diff --git a/etc/cmake/options.cmake b/etc/cmake/options.cmake index 4b6c0bb7c97..c495d0ce9e2 100644 --- a/etc/cmake/options.cmake +++ b/etc/cmake/options.cmake @@ -164,3 +164,10 @@ if (OTBR_LINK_METRICS_TELEMETRY) else() target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_LINK_METRICS_TELEMETRY=0) endif() + +option(OTBR_POWER_CALIBRATION "Enable Power Calibration" ON) +if (OTBR_POWER_CALIBRATION) + target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_POWER_CALIBRATION=1) +else() + target_compile_definitions(otbr-config INTERFACE OTBR_ENABLE_POWER_CALIBRATION=0) +endif() diff --git a/src/ncp/ncp_host.cpp b/src/ncp/ncp_host.cpp index a34d6d12d27..56728f962a4 100644 --- a/src/ncp/ncp_host.cpp +++ b/src/ncp/ncp_host.cpp @@ -194,6 +194,7 @@ void NcpHost::GetChannelMasks(const ChannelMasksReceiver &aReceiver, const Async mTaskRunner.Post([aErrReceiver](void) { aErrReceiver(OT_ERROR_NOT_IMPLEMENTED, "Not implemented!"); }); } +#if OTBR_ENABLE_POWER_CALIBRATION void NcpHost::SetChannelMaxPowers(const std::vector &aChannelMaxPowers, const AsyncResultReceiver &aReceiver) { @@ -202,6 +203,7 @@ void NcpHost::SetChannelMaxPowers(const std::vector &aChannelMa // TODO: Implement SetChannelMaxPowers under NCP mode. mTaskRunner.Post([aReceiver](void) { aReceiver(OT_ERROR_NOT_IMPLEMENTED, "Not implemented!"); }); } +#endif void NcpHost::AddThreadStateChangedCallback(ThreadStateChangedCallback aCallback) { diff --git a/src/ncp/ncp_host.hpp b/src/ncp/ncp_host.hpp index ae033173400..a81d077e1a8 100644 --- a/src/ncp/ncp_host.hpp +++ b/src/ncp/ncp_host.hpp @@ -94,14 +94,22 @@ class NcpHost : public MainloopProcessor, public ThreadHost, public NcpNetworkPr void SetThreadEnabled(bool aEnabled, const AsyncResultReceiver aReceiver) override; void SetCountryCode(const std::string &aCountryCode, const AsyncResultReceiver &aReceiver) override; void GetChannelMasks(const ChannelMasksReceiver &aReceiver, const AsyncResultReceiver &aErrReceiver) override; +#if OTBR_ENABLE_POWER_CALIBRATION 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; } - void Init(void) override; - void Deinit(void) override; +#endif + 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; + } + void Init(void) override; + void Deinit(void) override; // MainloopProcessor methods void Update(MainloopContext &aMainloop) override; diff --git a/src/ncp/rcp_host.cpp b/src/ncp/rcp_host.cpp index 691c68535f5..7d5bd608829 100644 --- a/src/ncp/rcp_host.cpp +++ b/src/ncp/rcp_host.cpp @@ -522,6 +522,7 @@ void RcpHost::GetChannelMasks(const ChannelMasksReceiver &aReceiver, const Async } } +#if OTBR_ENABLE_POWER_CALIBRATION void RcpHost::SetChannelMaxPowers(const std::vector &aChannelMaxPowers, const AsyncResultReceiver &aReceiver) { @@ -549,6 +550,7 @@ void RcpHost::SetChannelMaxPowers(const std::vector &aChannelMa exit: mTaskRunner.Post([aReceiver, error, errorMsg](void) { aReceiver(error, errorMsg); }); } +#endif // OTBR_ENABLE_POWER_CALIBRATION void RcpHost::DisableThreadAfterDetach(void *aContext) { diff --git a/src/ncp/rcp_host.hpp b/src/ncp/rcp_host.hpp index 35b602ad0b7..07e837d7d28 100644 --- a/src/ncp/rcp_host.hpp +++ b/src/ncp/rcp_host.hpp @@ -202,8 +202,10 @@ class RcpHost : public MainloopProcessor, public ThreadHost, public OtNetworkPro void SetThreadEnabled(bool aEnabled, const AsyncResultReceiver aReceiver) override; void SetCountryCode(const std::string &aCountryCode, const AsyncResultReceiver &aReceiver) override; void GetChannelMasks(const ChannelMasksReceiver &aReceiver, const AsyncResultReceiver &aErrReceiver) override; +#if OTBR_ENABLE_POWER_CALIBRATION void SetChannelMaxPowers(const std::vector &aChannelMaxPowers, const AsyncResultReceiver &aReceiver) override; +#endif void AddThreadStateChangedCallback(ThreadStateChangedCallback aCallback) override; CoprocessorType GetCoprocessorType(void) override diff --git a/src/ncp/thread_host.hpp b/src/ncp/thread_host.hpp index f436cd25818..0488c03e44d 100644 --- a/src/ncp/thread_host.hpp +++ b/src/ncp/thread_host.hpp @@ -189,6 +189,7 @@ class ThreadHost : virtual public NetworkProperties */ virtual void GetChannelMasks(const ChannelMasksReceiver &aReceiver, const AsyncResultReceiver &aErrReceiver) = 0; +#if OTBR_ENABLE_POWER_CALIBRATION /** * Sets the max power of each channel. * @@ -201,6 +202,7 @@ class ThreadHost : virtual public NetworkProperties */ virtual void SetChannelMaxPowers(const std::vector &aChannelMaxPowers, const AsyncResultReceiver &aReceiver) = 0; +#endif /** * This method adds a event listener for Thread state changes.