diff --git a/src/ncp/ncp_host.cpp b/src/ncp/ncp_host.cpp index e98dd5e1cd2..a34d6d12d27 100644 --- a/src/ncp/ncp_host.cpp +++ b/src/ncp/ncp_host.cpp @@ -203,6 +203,12 @@ void NcpHost::SetChannelMaxPowers(const std::vector &aChannelMa mTaskRunner.Post([aReceiver](void) { aReceiver(OT_ERROR_NOT_IMPLEMENTED, "Not implemented!"); }); } +void NcpHost::AddThreadStateChangedCallback(ThreadStateChangedCallback aCallback) +{ + // TODO: Implement AddThreadStateChangedCallback under NCP mode. + OT_UNUSED_VARIABLE(aCallback); +} + void NcpHost::Process(const MainloopContext &aMainloop) { mSpinelDriver.Process(&aMainloop); diff --git a/src/ncp/ncp_host.hpp b/src/ncp/ncp_host.hpp index 9a218c88f4b..ae033173400 100644 --- a/src/ncp/ncp_host.hpp +++ b/src/ncp/ncp_host.hpp @@ -96,6 +96,7 @@ class NcpHost : public MainloopProcessor, public ThreadHost, public NcpNetworkPr void GetChannelMasks(const ChannelMasksReceiver &aReceiver, const AsyncResultReceiver &aErrReceiver) override; void SetChannelMaxPowers(const std::vector &aChannelMaxPowers, const AsyncResultReceiver &aReceiver) override; + void AddThreadStateChangedCallback(ThreadStateChangedCallback aCallback) override; CoprocessorType GetCoprocessorType(void) override { return OT_COPROCESSOR_NCP; } const char *GetCoprocessorVersion(void) override; const char *GetInterfaceName(void) const override { return mConfig.mInterfaceName; } diff --git a/src/ncp/rcp_host.hpp b/src/ncp/rcp_host.hpp index c896ee6601b..35b602ad0b7 100644 --- a/src/ncp/rcp_host.hpp +++ b/src/ncp/rcp_host.hpp @@ -88,8 +88,6 @@ class OtNetworkProperties : virtual public NetworkProperties class RcpHost : public MainloopProcessor, public ThreadHost, public OtNetworkProperties { public: - using ThreadStateChangedCallback = std::function; - /** * This constructor initializes this object. * @@ -152,13 +150,6 @@ class RcpHost : public MainloopProcessor, public ThreadHost, public OtNetworkPro */ void RegisterResetHandler(std::function aHandler); - /** - * This method adds a event listener for Thread state changes. - * - * @param[in] aCallback The callback to receive Thread state changed events. - */ - void AddThreadStateChangedCallback(ThreadStateChangedCallback aCallback); - /** * This method resets the OpenThread instance. */ @@ -213,6 +204,7 @@ class RcpHost : public MainloopProcessor, public ThreadHost, public OtNetworkPro void GetChannelMasks(const ChannelMasksReceiver &aReceiver, const AsyncResultReceiver &aErrReceiver) override; void SetChannelMaxPowers(const std::vector &aChannelMaxPowers, const AsyncResultReceiver &aReceiver) override; + void AddThreadStateChangedCallback(ThreadStateChangedCallback aCallback) override; CoprocessorType GetCoprocessorType(void) override { diff --git a/src/ncp/thread_host.hpp b/src/ncp/thread_host.hpp index c4f3f55d913..f436cd25818 100644 --- a/src/ncp/thread_host.hpp +++ b/src/ncp/thread_host.hpp @@ -88,7 +88,8 @@ class ThreadHost : virtual public NetworkProperties using AsyncResultReceiver = std::function; using ChannelMasksReceiver = std::function; - using DeviceRoleHandler = std::function; + using DeviceRoleHandler = std::function; + using ThreadStateChangedCallback = std::function; struct ChannelMaxPower { @@ -201,6 +202,13 @@ class ThreadHost : virtual public NetworkProperties virtual void SetChannelMaxPowers(const std::vector &aChannelMaxPowers, const AsyncResultReceiver &aReceiver) = 0; + /** + * This method adds a event listener for Thread state changes. + * + * @param[in] aCallback The callback to receive Thread state changed events. + */ + virtual void AddThreadStateChangedCallback(ThreadStateChangedCallback aCallback) = 0; + /** * Returns the co-processor type. */