mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Support immediate notify of connection listener.
Also only perform immediate notification to the callback actually requesting the notification, not all existing callbacks. Offset returned uids by 1 so uid=0 can be used to indicate immediate notification.
This commit is contained in:
@@ -180,14 +180,16 @@ void NT_RemoveEntryListener(unsigned int entry_listener_uid) {
|
||||
}
|
||||
|
||||
unsigned int NT_AddConnectionListener(void *data,
|
||||
NT_ConnectionListenerCallback callback) {
|
||||
NT_ConnectionListenerCallback callback,
|
||||
int immediate_notify) {
|
||||
return nt::AddConnectionListener(
|
||||
[=](unsigned int uid, bool connected, const ConnectionInfo &conn) {
|
||||
NT_ConnectionInfo conn_c;
|
||||
ConvertToC(conn, &conn_c);
|
||||
callback(uid, data, connected ? 1 : 0, &conn_c);
|
||||
DisposeConnectionInfo(&conn_c);
|
||||
});
|
||||
},
|
||||
immediate_notify != 0);
|
||||
}
|
||||
|
||||
void NT_RemoveConnectionListener(unsigned int conn_listener_uid) {
|
||||
|
||||
Reference in New Issue
Block a user