WPILibC++ 2024.3.2
|
#include <networktables/NetworkTableListener.h>
Public Member Functions | |
NetworkTableListener ()=default | |
NetworkTableListener (const NetworkTableListener &)=delete | |
NetworkTableListener & | operator= (const NetworkTableListener &)=delete |
NetworkTableListener (NetworkTableListener &&rhs) | |
NetworkTableListener & | operator= (NetworkTableListener &&rhs) |
~NetworkTableListener () | |
operator bool () const | |
NT_Listener | GetHandle () const |
Gets the native handle. More... | |
bool | WaitForQueue (double timeout) |
Wait for the listener queue to be empty. More... | |
Static Public Member Functions | |
static NetworkTableListener | CreateListener (NetworkTableInstance inst, std::span< const std::string_view > prefixes, unsigned int mask, ListenerCallback listener) |
Create a listener for changes to topics with names that start with any of the given prefixes. More... | |
static NetworkTableListener | CreateListener (Topic topic, unsigned int mask, ListenerCallback listener) |
Create a listener for changes on a particular topic. More... | |
static NetworkTableListener | CreateListener (Subscriber &subscriber, unsigned int mask, ListenerCallback listener) |
Create a listener for topic changes on a subscriber. More... | |
static NetworkTableListener | CreateListener (MultiSubscriber &subscriber, unsigned int mask, ListenerCallback listener) |
Create a listener for topic changes on a subscriber. More... | |
static NetworkTableListener | CreateListener (NetworkTableEntry &entry, unsigned int mask, ListenerCallback listener) |
Create a listener for topic changes on an entry. More... | |
static NetworkTableListener | CreateConnectionListener (NetworkTableInstance inst, bool immediate_notify, ListenerCallback listener) |
Create a connection listener. More... | |
static NetworkTableListener | CreateTimeSyncListener (NetworkTableInstance inst, bool immediate_notify, ListenerCallback listener) |
Create a time synchronization listener. More... | |
static NetworkTableListener | CreateLogger (NetworkTableInstance inst, unsigned int minLevel, unsigned int maxLevel, ListenerCallback listener) |
Create a listener for log messages. More... | |
Event listener.
This calls back to a callback function when an event matching the specified mask occurs. The callback function is called asynchronously on a separate thread, so it's important to use synchronization or atomics when accessing any shared state from the callback function.
|
default |
|
delete |
|
inline |
|
inline |
|
inlinestatic |
Create a connection listener.
inst | instance |
immediate_notify | notify listener of all existing connections |
listener | listener function |
|
inlinestatic |
Create a listener for topic changes on a subscriber.
This does NOT keep the subscriber active.
subscriber | Subscriber |
mask | Bitmask of EventFlags values |
listener | Listener function |
|
inlinestatic |
Create a listener for topic changes on an entry.
entry | Entry |
mask | Bitmask of EventFlags values |
listener | Listener function |
|
inlinestatic |
Create a listener for changes to topics with names that start with any of the given prefixes.
This creates a corresponding internal subscriber with the lifetime of the listener.
inst | Instance |
prefixes | Topic name string prefixes |
mask | Bitmask of EventFlags values |
listener | Listener function |
|
inlinestatic |
Create a listener for topic changes on a subscriber.
This does NOT keep the subscriber active.
subscriber | Subscriber |
mask | Bitmask of EventFlags values |
listener | Listener function |
|
inlinestatic |
Create a listener for changes on a particular topic.
This creates a corresponding internal subscriber with the lifetime of the listener.
topic | Topic |
mask | Bitmask of EventFlags values |
listener | Listener function |
|
inlinestatic |
Create a listener for log messages.
By default, log messages are sent to stderr; this function sends log messages with the specified levels to the provided callback function instead. The callback function will only be called for log messages with level greater than or equal to minLevel and less than or equal to maxLevel; messages outside this range will be silently ignored.
inst | instance |
minLevel | minimum log level |
maxLevel | maximum log level |
listener | listener function |
|
inlinestatic |
Create a time synchronization listener.
inst | instance |
immediate_notify | notify listener of current time synchronization value |
listener | listener function |
|
inline |
Gets the native handle.
|
inlineexplicit |
|
delete |
|
inline |
|
inline |
Wait for the listener queue to be empty.
This is primarily useful for deterministic testing. This blocks until either the 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.
timeout | timeout, in seconds. Set to 0 for non-blocking behavior, or a negative value to block indefinitely |