mirror of
https://github.com/espressif/openthread.git
synced 2026-08-22 02:19:52 +00:00
[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:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user