diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index 827ab0c94..65b3456dc 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -43,9 +43,6 @@ #include #include #include -#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE -#include -#endif #include "common/code_utils.hpp" #include "common/debug.hpp" @@ -2544,24 +2541,6 @@ exit: } #endif -#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE -template <> otError NcpBase::HandlePropertyGet(void) -{ - return mEncoder.WriteBool(mTrelTestModeEnable); -} - -template <> otError NcpBase::HandlePropertySet(void) -{ - otError error = OT_ERROR_NONE; - - SuccessOrExit(error = mDecoder.ReadBool(mTrelTestModeEnable)); - error = otPlatTrelUdp6SetTestMode(mInstance, mTrelTestModeEnable); - -exit: - return error; -} -#endif - } // namespace Ncp } // namespace ot diff --git a/src/ncp/ncp_base_dispatcher.cpp b/src/ncp/ncp_base_dispatcher.cpp index e778a4c23..51fbcecfc 100644 --- a/src/ncp/ncp_base_dispatcher.cpp +++ b/src/ncp/ncp_base_dispatcher.cpp @@ -373,7 +373,7 @@ NcpBase::PropertyHandler NcpBase::FindGetPropertyHandler(spinel_prop_key_t aKey) OT_NCP_GET_HANDLER_ENTRY(SPINEL_PROP_DEBUG_NCP_LOG_LEVEL), OT_NCP_GET_HANDLER_ENTRY(SPINEL_PROP_DEBUG_TEST_WATCHDOG), OT_NCP_GET_HANDLER_ENTRY(SPINEL_PROP_DEBUG_LOG_TIMESTAMP_BASE), -#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE +#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE && (OPENTHREAD_FTD || OPENTHREAD_MTD) OT_NCP_GET_HANDLER_ENTRY(SPINEL_PROP_DEBUG_TREL_TEST_MODE_ENABLE), #endif }; @@ -625,7 +625,7 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey) OT_NCP_SET_HANDLER_ENTRY(SPINEL_PROP_DEBUG_NCP_LOG_LEVEL), #endif OT_NCP_SET_HANDLER_ENTRY(SPINEL_PROP_DEBUG_LOG_TIMESTAMP_BASE), -#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE +#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE && (OPENTHREAD_FTD || OPENTHREAD_MTD) OT_NCP_SET_HANDLER_ENTRY(SPINEL_PROP_DEBUG_TREL_TEST_MODE_ENABLE), #endif }; diff --git a/src/ncp/ncp_base_mtd.cpp b/src/ncp/ncp_base_mtd.cpp index f75eab681..0ed209669 100644 --- a/src/ncp/ncp_base_mtd.cpp +++ b/src/ncp/ncp_base_mtd.cpp @@ -66,6 +66,9 @@ #if OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_ENABLE #include #endif +#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE +#include +#endif #include "common/code_utils.hpp" #include "common/debug.hpp" @@ -4072,6 +4075,24 @@ exit: #endif // OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE +#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE +template <> otError NcpBase::HandlePropertyGet(void) +{ + return mEncoder.WriteBool(mTrelTestModeEnable); +} + +template <> otError NcpBase::HandlePropertySet(void) +{ + otError error = OT_ERROR_NONE; + + SuccessOrExit(error = mDecoder.ReadBool(mTrelTestModeEnable)); + error = otPlatTrelUdp6SetTestMode(mInstance, mTrelTestModeEnable); + +exit: + return error; +} +#endif + #if OPENTHREAD_CONFIG_LEGACY_ENABLE void NcpBase::RegisterLegacyHandlers(const otNcpLegacyHandlers *aHandlers)