ioLibrary for Cortex M series
|
Macros | |
#define | WATCH_SOCK_UDP_SEND 0x01 |
#define | WATCH_SOCK_TCP_SEND 0x02 |
#define | WATCH_SOCK_CONN_TRY 0x04 |
#define | WATCH_SOCK_CONN_EVT 0x10 |
#define | WATCH_SOCK_CLS_TRY 0x08 |
#define | WATCH_SOCK_CLS_EVT 0x20 |
#define | WATCH_SOCK_RECV 0x40 |
#define | WATCH_SOCK_MASK_LOW 0x0F |
#define | WATCH_SOCK_MASK_HIGH 0x70 |
#define | WATCH_SOCK_ALL_MASK 0x7F |
Typedefs | |
typedef void(* | watch_cbfunc )(uint8_t id, uint8_t item, int32_t ret) |
Functions | |
int8_t | sockwatch_open (uint8_t sock, watch_cbfunc cb) |
int8_t | sockwatch_close (uint8_t sock) |
int8_t | sockwatch_set (uint8_t sock, uint8_t item) |
int8_t | sockwatch_clr (uint8_t sock, uint8_t item) |
int8_t | sockwatch_chk (uint8_t sock, uint8_t item) |
void | sockwatch_run (void) |
#define WATCH_SOCK_UDP_SEND 0x01 |
Indicate that 'UDP SEND' completion of this socket has to be watched.
Definition at line 44 of file sockutil.h.
Referenced by sockwatch_run().
#define WATCH_SOCK_TCP_SEND 0x02 |
Indicate that 'TCP SEND' completion of this socket has to be watched.
Definition at line 45 of file sockutil.h.
Referenced by sockwatch_run().
#define WATCH_SOCK_CONN_TRY 0x04 |
Indicate that 'CONNECT' completion of this socket has to be watched.
Definition at line 46 of file sockutil.h.
Referenced by sockwatch_run().
#define WATCH_SOCK_CONN_EVT 0x10 |
Indicate that 'CONNECT' event of this socket has to be watched.
Definition at line 48 of file sockutil.h.
Referenced by sockwatch_run().
#define WATCH_SOCK_CLS_TRY 0x08 |
Indicate that 'CLOSE' completion of this socket has to be watched.
Definition at line 47 of file sockutil.h.
Referenced by sockwatch_run().
#define WATCH_SOCK_CLS_EVT 0x20 |
Indicate that 'CLOSE' event of this socket has to be watched.
Definition at line 49 of file sockutil.h.
Referenced by sockwatch_run().
#define WATCH_SOCK_RECV 0x40 |
Indicate that 'RECEIVE' event of this socket has to be watched.
Definition at line 50 of file sockutil.h.
Referenced by sockwatch_run().
#define WATCH_SOCK_MASK_LOW 0x0F |
Mask all Completions of the socket.
Definition at line 51 of file sockutil.h.
Referenced by sockwatch_run().
#define WATCH_SOCK_MASK_HIGH 0x70 |
Mask all Events of the socket.
Definition at line 52 of file sockutil.h.
#define WATCH_SOCK_ALL_MASK 0x7F |
Mask all Completions and Events.
Definition at line 53 of file sockutil.h.
Referenced by sockwatch_close().
watch_cbfunc |
Watch call back function form.
Definition at line 55 of file sockutil.h.
int8_t sockwatch_open | ( | uint8_t | sock, |
watch_cbfunc | cb | ||
) |
Assign a callback function to a socket. When sockwatch_run function detected a event,
this callback function will be called.
sock | The socket number which is corresponding to 'cb' param |
cb | The callback function to be called when the socket has any completion or event. |
Definition at line 121 of file sockutil.c.
References _WIZCHIP_SOCK_NUM_, DBGA, ERRA, RET_NOK, and RET_OK.
int8_t sockwatch_close | ( | uint8_t | sock) |
Remove callback function from a socket and Stop to watch all event.
sock | The socket number to close |
Definition at line 142 of file sockutil.c.
References _WIZCHIP_SOCK_NUM_, DBGA, ERRA, RET_NOK, RET_OK, sockwatch_clr(), and WATCH_SOCK_ALL_MASK.
int8_t sockwatch_set | ( | uint8_t | sock, |
uint8_t | item | ||
) |
Set a item of event to watch at sockwatch_run. Once opened a socket by sockwatch_open,
you have to register events for watching that using this function. It is possible to set plural item of event at the same time.
sock | The socket number to watch |
item | The item of event to watch |
Definition at line 168 of file sockutil.c.
References _WIZCHIP_SOCK_NUM_, BITSET, DBGA, ERRA, RET_NOK, and RET_OK.
int8_t sockwatch_clr | ( | uint8_t | sock, |
uint8_t | item | ||
) |
Clear a item of event which you don't care anymore. sockwatch_run stop to detect the item on the socket. It is possible to set plural item of event at the same time.
sock | The socket number to clear |
item | The item of event to clear |
Definition at line 192 of file sockutil.c.
References _WIZCHIP_SOCK_NUM_, BITCLR, DBGA, ERRA, RET_NOK, and RET_OK.
Referenced by sockwatch_close().
int8_t sockwatch_chk | ( | uint8_t | sock, |
uint8_t | item | ||
) |
Check a item of event has been set on the socket.
sock | The socket number to clear |
item | The item of event to clear |
Definition at line 214 of file sockutil.c.
References _WIZCHIP_SOCK_NUM_, RET_NOK, and RET_OK.
void sockwatch_run | ( | void | ) |
Sockwatch Module Handler If you use Sockwatch Module, this should run in the main loop
Definition at line 227 of file sockutil.c.
References _WIZCHIP_SOCK_NUM_, GetSocketRxRecvBufferSize(), RET_OK, SOCKERR_BUSY, TCPCloseCHK(), TCPClsRcvCHK(), TCPConnChk(), TCPSendCHK(), UDPSendCHK(), WATCH_SOCK_CLS_EVT, WATCH_SOCK_CLS_TRY, WATCH_SOCK_CONN_EVT, WATCH_SOCK_CONN_TRY, WATCH_SOCK_MASK_LOW, WATCH_SOCK_RECV, WATCH_SOCK_TCP_SEND, WATCH_SOCK_UDP_SEND, and WCF_HANDLE.