mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Add immediate_notify and is_new to entry listener.
On the callback function, is_new indicates the value is newly added. On adding a callback function, immediate_notify indicates the callback should be called once (with is_new=true) for each matching entry that already exists.
This commit is contained in:
@@ -130,12 +130,15 @@ void NT_Flush(void) { nt::Flush(); }
|
||||
|
||||
unsigned int NT_AddEntryListener(const char *prefix, size_t prefix_len,
|
||||
void *data,
|
||||
NT_EntryListenerCallback callback) {
|
||||
NT_EntryListenerCallback callback,
|
||||
int immediate_notify) {
|
||||
return nt::AddEntryListener(
|
||||
StringRef(prefix, prefix_len),
|
||||
[=](unsigned int uid, StringRef name, std::shared_ptr<Value> value) {
|
||||
callback(uid, data, name.data(), name.size(), &value->value());
|
||||
});
|
||||
[=](unsigned int uid, StringRef name, std::shared_ptr<Value> value,
|
||||
bool is_new) {
|
||||
callback(uid, data, name.data(), name.size(), &value->value(), is_new);
|
||||
},
|
||||
immediate_notify != 0);
|
||||
}
|
||||
|
||||
void NT_RemoveEntryListener(unsigned int entry_listener_uid) {
|
||||
|
||||
Reference in New Issue
Block a user