ioLibrary for Cortex M series
Macros | Typedefs | Functions
Sockwatch_module

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)
 

Detailed Description

Macro Definition Documentation

#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().

Typedef Documentation

watch_cbfunc

Watch call back function form.

Definition at line 55 of file sockutil.h.

Function Documentation

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.

Parameters
sockThe socket number which is corresponding to 'cb' param
cbThe callback function to be called when
the socket has any completion or event.
Returns
RET_OK: Success
RET_NOK: Error

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.

Parameters
sockThe socket number to close
Returns
RET_OK: Success
RET_NOK: Error

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.

Parameters
sockThe socket number to watch
itemThe item of event to watch
Returns
RET_OK: Success
RET_NOK: Error

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.

Parameters
sockThe socket number to clear
itemThe item of event to clear
Returns
RET_OK: Success
RET_NOK: Error

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.

Parameters
sockThe socket number to clear
itemThe item of event to clear
Returns
RET_OK: There is the item queried on the socket.
RET_NOK: There is not the item queried on the socket.

Definition at line 214 of file sockutil.c.

References _WIZCHIP_SOCK_NUM_, RET_NOK, and RET_OK.

void sockwatch_run ( void  )