[notifier] Notifier class and new OT_CHANGED flags (#2403)

This commit contains the following changes: (a) It adds a new class
`Notifer` which can be used to register callbacks to be notified of
state or configuration changes within OpenThread. This is used both
internally (by other core OpenThread classes) or externally by
registering `otStateChangedCallback` handlers. (b) This commit also
adds a set of new `OT_CHANGED` flag definitions corresponding to
fields in the Thread Operational Dataset (e.g., the Thread network
channel changes map to `OT_CHANGED_THREAD_CHANNEL`). This ensures that
user is notified of changes to Active Operational Dataset. (c) Finally,
this commit adds support in `NcpBase` for the newly added `OT_CHANGED`
flags by emitting asynchronous spinel property updates corresponding
to the changed configuration properties.
This commit is contained in:
Abtin Keshavarzian
2017-12-13 21:50:30 -08:00
committed by Jonathan Hui
parent 78818c3f42
commit 5b25a57db7
34 changed files with 751 additions and 340 deletions
+4 -4
View File
@@ -81,18 +81,18 @@ void otInstanceFinalize(otInstance *aInstance)
otLogFuncExit();
}
otError otSetStateChangedCallback(otInstance *aInstance, otStateChangedCallback aCallback, void *aCallbackContext)
otError otSetStateChangedCallback(otInstance *aInstance, otStateChangedCallback aCallback, void *aContext)
{
Instance &instance = *static_cast<Instance *>(aInstance);
return instance.RegisterStateChangedCallback(aCallback, aCallbackContext);
return instance.GetNotifier().RegisterCallback(aCallback, aContext);
}
void otRemoveStateChangeCallback(otInstance *aInstance, otStateChangedCallback aCallback, void *aCallbackContext)
void otRemoveStateChangeCallback(otInstance *aInstance, otStateChangedCallback aCallback, void *aContext)
{
Instance &instance = *static_cast<Instance *>(aInstance);
instance.RemoveStateChangedCallback(aCallback, aCallbackContext);
instance.GetNotifier().RemoveCallback(aCallback, aContext);
}
void otInstanceReset(otInstance *aInstance)