mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +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:
@@ -66,11 +66,12 @@ void Flush() {
|
||||
*/
|
||||
|
||||
unsigned int AddEntryListener(StringRef prefix, EntryListenerCallback callback,
|
||||
bool immediate_notify, bool local_notify) {
|
||||
unsigned int flags) {
|
||||
Notifier& notifier = Notifier::GetInstance();
|
||||
unsigned int uid = notifier.AddEntryListener(prefix, callback, local_notify);
|
||||
unsigned int uid = notifier.AddEntryListener(prefix, callback, flags);
|
||||
notifier.Start();
|
||||
if (immediate_notify) Storage::GetInstance().NotifyEntries(prefix, callback);
|
||||
if ((flags & NT_NOTIFY_IMMEDIATE) != 0)
|
||||
Storage::GetInstance().NotifyEntries(prefix, callback);
|
||||
return uid;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user