[extension] add method to receive and handle notifier events (#5420)

This commit adds `ExtensionBase` (base class of vendor `Extension`)
as one of the event receivers from `Notifier` class.
This commit is contained in:
Abtin Keshavarzian
2020-08-18 19:43:14 -07:00
committed by GitHub
parent 07cfc9a7d1
commit d493c671f2
3 changed files with 19 additions and 0 deletions
+9
View File
@@ -38,6 +38,7 @@
#include "common/locator.hpp"
#include "common/non_copyable.hpp"
#include "common/notifier.hpp"
#if OPENTHREAD_ENABLE_VENDOR_EXTENSION
@@ -96,6 +97,14 @@ public:
*/
void SignalNcpInit(Ncp::NcpBase &aNcpInstance);
/**
* This method notifies the extension object of events from OpenThread `Notifier`.
*
* @param[in] aEvents The list of events emitted by `Notifier`.
*
*/
void HandleNotifierEvents(Events aEvents);
protected:
/**
* This constructor initializes the object.
+7
View File
@@ -92,5 +92,12 @@ void ExtensionBase::SignalNcpInit(Ncp::NcpBase &aNcpBase)
OT_UNUSED_VARIABLE(aNcpBase);
}
void ExtensionBase::HandleNotifierEvents(Events aEvents)
{
// TODO: Implement vendor extension code here to handle notifier events.
OT_UNUSED_VARIABLE(aEvents);
}
} // namespace Extension
} // namespace ot
+3
View File
@@ -178,6 +178,9 @@ void Notifier::EmitEvents(void)
#if OPENTHREAD_CONFIG_OTNS_ENABLE
Get<Utils::Otns>().HandleNotifierEvents(events);
#endif
#if OPENTHREAD_ENABLE_VENDOR_EXTENSION
Get<Extension::ExtensionBase>().HandleNotifierEvents(events);
#endif
for (ExternalCallback &callback : mExternalCallbacks)
{