WPILibC++
2019.1.1-2-g444b899
|
Typedefs | |
typedef void(* | NT_ConnectionListenerCallback )(void *data, const struct NT_ConnectionNotification *event) |
Connection listener callback function. More... | |
Functions | |
NT_ConnectionListener | NT_AddConnectionListener (NT_Inst inst, void *data, NT_ConnectionListenerCallback callback, NT_Bool immediate_notify) |
Add a connection listener. More... | |
NT_ConnectionListenerPoller | NT_CreateConnectionListenerPoller (NT_Inst inst) |
Create a connection listener poller. More... | |
void | NT_DestroyConnectionListenerPoller (NT_ConnectionListenerPoller poller) |
Destroy a connection listener poller. More... | |
NT_ConnectionListener | NT_AddPolledConnectionListener (NT_ConnectionListenerPoller poller, NT_Bool immediate_notify) |
Create a polled connection listener. More... | |
struct NT_ConnectionNotification * | NT_PollConnectionListener (NT_ConnectionListenerPoller poller, size_t *len) |
Get the next connection event. More... | |
struct NT_ConnectionNotification * | NT_PollConnectionListenerTimeout (NT_ConnectionListenerPoller poller, size_t *len, double timeout, NT_Bool *timed_out) |
Get the next connection event. More... | |
void | NT_CancelPollConnectionListener (NT_ConnectionListenerPoller poller) |
Cancel a PollConnectionListener call. More... | |
void | NT_RemoveConnectionListener (NT_ConnectionListener conn_listener) |
Remove a connection listener. More... | |
NT_Bool | NT_WaitForConnectionListenerQueue (NT_Inst inst, double timeout) |
Wait for the connection listener queue to be empty. More... | |
typedef void(* NT_ConnectionListenerCallback)(void *data, const struct NT_ConnectionNotification *event) |
Connection listener callback function.
Called when a network connection is made or lost.
data | data pointer provided to callback creation function |
event | event info |
NT_ConnectionListener NT_AddConnectionListener | ( | NT_Inst | inst, |
void * | data, | ||
NT_ConnectionListenerCallback | callback, | ||
NT_Bool | immediate_notify | ||
) |
Add a connection listener.
inst | instance handle |
data | data pointer to pass to callback |
callback | listener to add |
immediate_notify | notify listener of all existing connections |
NT_ConnectionListener NT_AddPolledConnectionListener | ( | NT_ConnectionListenerPoller | poller, |
NT_Bool | immediate_notify | ||
) |
Create a polled connection listener.
The caller is responsible for calling NT_PollConnectionListener() to poll.
poller | poller handle |
immediate_notify | notify listener of all existing connections |
void NT_CancelPollConnectionListener | ( | NT_ConnectionListenerPoller | poller | ) |
Cancel a PollConnectionListener call.
This wakes up a call to PollConnectionListener for this poller and causes it to immediately return an empty array.
poller | poller handle |
NT_ConnectionListenerPoller NT_CreateConnectionListenerPoller | ( | NT_Inst | inst | ) |
Create a connection listener poller.
A poller provides a single queue of poll events. Events linked to this poller (using NT_AddPolledConnectionListener()) will be stored in the queue and must be collected by calling NT_PollConnectionListener(). The returned handle must be destroyed with NT_DestroyConnectionListenerPoller().
inst | instance handle |
void NT_DestroyConnectionListenerPoller | ( | NT_ConnectionListenerPoller | poller | ) |
Destroy a connection listener poller.
This will abort any blocked polling call and prevent additional events from being generated for this poller.
poller | poller handle |
struct NT_ConnectionNotification* NT_PollConnectionListener | ( | NT_ConnectionListenerPoller | poller, |
size_t * | len | ||
) |
Get the next connection event.
This blocks until the next connect or disconnect occurs. This is intended to be used with NT_AddPolledConnectionListener(); connection listeners created using NT_AddConnectionListener() will not be serviced through this function.
poller | poller handle |
len | length of returned array (output) |
struct NT_ConnectionNotification* NT_PollConnectionListenerTimeout | ( | NT_ConnectionListenerPoller | poller, |
size_t * | len, | ||
double | timeout, | ||
NT_Bool * | timed_out | ||
) |
Get the next connection event.
This blocks until the next connect or disconnect occurs or it times out. This is intended to be used with NT_AddPolledConnectionListener(); connection listeners created using NT_AddConnectionListener() will not be serviced through this function.
poller | poller handle |
len | length of returned array (output) |
timeout | timeout, in seconds |
timed_out | true if the timeout period elapsed (output) |
void NT_RemoveConnectionListener | ( | NT_ConnectionListener | conn_listener | ) |
Remove a connection listener.
conn_listener | Listener handle to remove |
NT_Bool NT_WaitForConnectionListenerQueue | ( | NT_Inst | inst, |
double | timeout | ||
) |
Wait for the connection listener queue to be empty.
This is primarily useful for deterministic testing. This blocks until either the connection listener queue is empty (e.g. there are no more events that need to be passed along to callbacks or poll queues) or the timeout expires.
inst | instance handle |
timeout | timeout, in seconds. Set to 0 for non-blocking behavior, or a negative value to block indefinitely |