WPILibC++
2019.1.1-beta-2-22-gc405188
|
Typedefs | |
typedef std::function< void(NT_ConnectionListener conn_listener, bool connected, const ConnectionInfo &conn)> | nt::ConnectionListenerCallback |
Connection listener callback function. More... | |
Functions | |
NT_ConnectionListener | nt::AddConnectionListener (ConnectionListenerCallback callback, bool immediate_notify) |
Add a connection listener. More... | |
NT_ConnectionListener | nt::AddConnectionListener (NT_Inst inst, std::function< void(const ConnectionNotification &event)> callback, 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, bool immediate_notify) |
Create a polled connection listener. More... | |
std::vector < ConnectionNotification > | nt::PollConnectionListener (NT_ConnectionListenerPoller poller) |
Get the next connection event. More... | |
std::vector < ConnectionNotification > | nt::PollConnectionListener (NT_ConnectionListenerPoller poller, double timeout, 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... | |
bool | nt::WaitForConnectionListenerQueue (NT_Inst inst, double timeout) |
Wait for the connection listener queue to be empty. More... | |
typedef std::function<void(NT_ConnectionListener conn_listener, bool connected, const ConnectionInfo& conn)> nt::ConnectionListenerCallback |
Connection listener callback function.
Called when a network connection is made or lost.
conn_listener | connection listener handle returned by callback creation function |
connected | true if event is due to connection being established |
conn | connection info |
NT_ConnectionListener nt::AddConnectionListener | ( | ConnectionListenerCallback | callback, |
bool | immediate_notify | ||
) |
Add a connection listener.
callback | listener to add |
immediate_notify | notify listener of all existing connections |
NT_ConnectionListener nt::AddConnectionListener | ( | NT_Inst | inst, |
std::function< void(const ConnectionNotification &event)> | callback, | ||
bool | immediate_notify | ||
) |
Add a connection listener.
callback | listener to add |
immediate_notify | notify listener of all existing connections |
inst | instance handle |
NT_ConnectionListener nt::AddPolledConnectionListener | ( | NT_ConnectionListenerPoller | poller, |
bool | immediate_notify | ||
) |
Create a polled connection listener.
The caller is responsible for calling 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 AddPolledConnectionListener()) will be stored in the queue and must be collected by calling PollConnectionListener(). The returned handle must be destroyed with 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 |
std::vector<ConnectionNotification> nt::PollConnectionListener | ( | NT_ConnectionListenerPoller | poller | ) |
Get the next connection event.
This blocks until the next connect or disconnect occurs. This is intended to be used with AddPolledConnectionListener(); connection listeners created using AddConnectionListener() will not be serviced through this function.
poller | poller handle |
std::vector<ConnectionNotification> nt::PollConnectionListener | ( | NT_ConnectionListenerPoller | poller, |
double | timeout, | ||
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 AddPolledConnectionListener(); connection listeners created using AddConnectionListener() will not be serviced through this function.
poller | poller handle |
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 |
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 |