diff --git a/src/core/common/extension.hpp b/src/core/common/extension.hpp index 01fde91c3..8ed87f2bd 100644 --- a/src/core/common/extension.hpp +++ b/src/core/common/extension.hpp @@ -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. diff --git a/src/core/common/extension_example.cpp b/src/core/common/extension_example.cpp index 290914dcd..ee9553f06 100644 --- a/src/core/common/extension_example.cpp +++ b/src/core/common/extension_example.cpp @@ -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 diff --git a/src/core/common/notifier.cpp b/src/core/common/notifier.cpp index 384eca9d4..cab1d1073 100644 --- a/src/core/common/notifier.cpp +++ b/src/core/common/notifier.cpp @@ -178,6 +178,9 @@ void Notifier::EmitEvents(void) #if OPENTHREAD_CONFIG_OTNS_ENABLE Get().HandleNotifierEvents(events); #endif +#if OPENTHREAD_ENABLE_VENDOR_EXTENSION + Get().HandleNotifierEvents(events); +#endif for (ExternalCallback &callback : mExternalCallbacks) {