mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
Provide more extensive listener features.
This enables listeners to be notified of not only value updates, but also flag changes and deletions by using a bitmask to specify what notifications are desired. The old API (which only provided a new/not new) flag is still supported. This also subsumes the feature to listen to local changes (that's one of the bitmask options).
This commit is contained in:
@@ -169,15 +169,14 @@ void NT_Flush(void) { nt::Flush(); }
|
||||
unsigned int NT_AddEntryListener(const char *prefix, size_t prefix_len,
|
||||
void *data,
|
||||
NT_EntryListenerCallback callback,
|
||||
int immediate_notify, int local_notify) {
|
||||
unsigned int flags) {
|
||||
return nt::AddEntryListener(
|
||||
StringRef(prefix, prefix_len),
|
||||
[=](unsigned int uid, StringRef name, std::shared_ptr<Value> value,
|
||||
bool is_new) {
|
||||
callback(uid, data, name.data(), name.size(), &value->value(), is_new);
|
||||
unsigned int flags_) {
|
||||
callback(uid, data, name.data(), name.size(), &value->value(), flags_);
|
||||
},
|
||||
immediate_notify != 0,
|
||||
local_notify != 0);
|
||||
flags);
|
||||
}
|
||||
|
||||
void NT_RemoveEntryListener(unsigned int entry_listener_uid) {
|
||||
|
||||
Reference in New Issue
Block a user