diff --git a/examples/platforms/posix/openthread-core-posix-config.h b/examples/platforms/posix/openthread-core-posix-config.h index 7d3184813..242491f02 100644 --- a/examples/platforms/posix/openthread-core-posix-config.h +++ b/examples/platforms/posix/openthread-core-posix-config.h @@ -128,12 +128,12 @@ #define CLI_COAP_SECURE_USE_COAP_DEFAULT_HANDLER 1 /** - * @def OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE + * @def OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE * - * Define to 1 if you want to enable radio coexistence metrics implemented in platform. + * Define to 1 if you want to enable radio coexistence implemented in platform. * */ -#ifndef OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE -#define OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE 1 +#ifndef OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE +#define OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE 1 #endif #endif // OPENTHREAD_CORE_POSIX_CONFIG_H_ diff --git a/examples/platforms/posix/radio.c b/examples/platforms/posix/radio.c index b6b4d3f2d..fc2eee3d2 100644 --- a/examples/platforms/posix/radio.c +++ b/examples/platforms/posix/radio.c @@ -147,6 +147,10 @@ static uint16_t sShortAddressMatchTable[POSIX_MAX_SRC_MATCH_ENTRIES]; static otExtAddress sExtAddressMatchTable[POSIX_MAX_SRC_MATCH_ENTRIES]; static bool sSrcMatchEnabled = false; +#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE +static bool sRadioCoexEnabled = true; +#endif + static bool findShortAddress(uint16_t aShortAddress) { uint8_t i; @@ -1093,7 +1097,22 @@ int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) return POSIX_RECEIVE_SENSITIVITY; } -#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE +#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE +otError otPlatRadioSetCoexEnabled(otInstance *aInstance, bool aEnabled) +{ + assert(aInstance != NULL); + + sRadioCoexEnabled = aEnabled; + return OT_ERROR_NONE; +} + +bool otPlatRadioIsCoexEnabled(otInstance *aInstance) +{ + assert(aInstance != NULL); + + return sRadioCoexEnabled; +} + otError otPlatRadioGetCoexMetrics(otInstance *aInstance, otRadioCoexMetrics *aCoexMetrics) { otError error = OT_ERROR_NONE; diff --git a/include/openthread/platform/radio.h b/include/openthread/platform/radio.h index 0829a62fa..4acfc98a7 100644 --- a/include/openthread/platform/radio.h +++ b/include/openthread/platform/radio.h @@ -739,9 +739,37 @@ uint32_t otPlatRadioGetSupportedChannelMask(otInstance *aInstance); */ uint32_t otPlatRadioGetPreferredChannelMask(otInstance *aInstance); +/** + * Enable the radio coex. + * + * This function is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aEnabled TRUE to enable the radio coex, FALSE otherwise. + * + * @retval OT_ERROR_NONE Successfully enabled. + * @retval OT_ERROR_FAILED The radio coex could not be enabled. + * + */ +otError otPlatRadioSetCoexEnabled(otInstance *aInstance, bool aEnabled); + +/** + * Check whether radio coex is enabled or not. + * + * This function is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns TRUE if the radio coex is enabled, FALSE otherwise. + * + */ +bool otPlatRadioIsCoexEnabled(otInstance *aInstance); + /** * Get the radio coexistence metrics. * + * This function is used when feature OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE is enabled. + * * @param[in] aInstance The OpenThread instance structure. * @param[out] aCoexMetrics A pointer to the coexistence metrics structure. * diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 180a7f198..a1689203e 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -105,7 +105,7 @@ const struct Command Interpreter::sCommands[] = { #if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE {"coaps", &Interpreter::ProcessCoapSecure}, #endif -#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE +#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE {"coex", &Interpreter::ProcessCoexMetrics}, #endif #if OPENTHREAD_CONFIG_COMMISSIONER_ENABLE && OPENTHREAD_FTD @@ -786,43 +786,62 @@ void Interpreter::ProcessCoapSecure(int argc, char *argv[]) #endif // OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE -#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE +#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE void Interpreter::ProcessCoexMetrics(int argc, char *argv[]) { - OT_UNUSED_VARIABLE(argc); - OT_UNUSED_VARIABLE(argv); + otError error = OT_ERROR_NONE; - otRadioCoexMetrics metrics; - otError error = otPlatRadioGetCoexMetrics(mInstance, &metrics); + if (argc == 0) + { + mServer->OutputFormat("%s\r\n", otPlatRadioIsCoexEnabled(mInstance) ? "Enabled" : "Disabled"); + } + else if (strcmp(argv[0], "enable") == 0) + { + error = otPlatRadioSetCoexEnabled(mInstance, true); + } + else if (strcmp(argv[0], "disable") == 0) + { + error = otPlatRadioSetCoexEnabled(mInstance, false); + } + else if (strcmp(argv[0], "metrics") == 0) + { + otRadioCoexMetrics metrics; - SuccessOrExit(error); + SuccessOrExit(error = otPlatRadioGetCoexMetrics(mInstance, &metrics)); - mServer->OutputFormat("Stopped: %s\r\n", metrics.mStopped ? "true" : "false"); - mServer->OutputFormat("Grant Glitch: %u\r\n", metrics.mNumGrantGlitch); - mServer->OutputFormat("Transmit metrics\r\n"); - mServer->OutputFormat(" Request: %u\r\n", metrics.mNumTxRequest); - mServer->OutputFormat(" Grant Immediate: %u\r\n", metrics.mNumTxGrantImmediate); - mServer->OutputFormat(" Grant Wait: %u\r\n", metrics.mNumTxGrantWait); - mServer->OutputFormat(" Grant Wait Activated: %u\r\n", metrics.mNumTxGrantWaitActivated); - mServer->OutputFormat(" Grant Wait Timeout: %u\r\n", metrics.mNumTxGrantWaitTimeout); - mServer->OutputFormat(" Grant Deactivated During Request: %u\r\n", metrics.mNumTxGrantDeactivatedDuringRequest); - mServer->OutputFormat(" Delayed Grant: %u\r\n", metrics.mNumTxDelayedGrant); - mServer->OutputFormat(" Average Request To Grant Time: %u\r\n", metrics.mAvgTxRequestToGrantTime); - mServer->OutputFormat("Receive metrics\r\n"); - mServer->OutputFormat(" Request: %u\r\n", metrics.mNumRxRequest); - mServer->OutputFormat(" Grant Immediate: %u\r\n", metrics.mNumRxGrantImmediate); - mServer->OutputFormat(" Grant Wait: %u\r\n", metrics.mNumRxGrantWait); - mServer->OutputFormat(" Grant Wait Activated: %u\r\n", metrics.mNumRxGrantWaitActivated); - mServer->OutputFormat(" Grant Wait Timeout: %u\r\n", metrics.mNumRxGrantWaitTimeout); - mServer->OutputFormat(" Grant Deactivated During Request: %u\r\n", metrics.mNumRxGrantDeactivatedDuringRequest); - mServer->OutputFormat(" Delayed Grant: %u\r\n", metrics.mNumRxDelayedGrant); - mServer->OutputFormat(" Average Request To Grant Time: %u\r\n", metrics.mAvgRxRequestToGrantTime); - mServer->OutputFormat(" Grant None: %u\r\n", metrics.mNumRxGrantNone); + mServer->OutputFormat("Stopped: %s\r\n", metrics.mStopped ? "true" : "false"); + mServer->OutputFormat("Grant Glitch: %u\r\n", metrics.mNumGrantGlitch); + mServer->OutputFormat("Transmit metrics\r\n"); + mServer->OutputFormat(" Request: %u\r\n", metrics.mNumTxRequest); + mServer->OutputFormat(" Grant Immediate: %u\r\n", metrics.mNumTxGrantImmediate); + mServer->OutputFormat(" Grant Wait: %u\r\n", metrics.mNumTxGrantWait); + mServer->OutputFormat(" Grant Wait Activated: %u\r\n", metrics.mNumTxGrantWaitActivated); + mServer->OutputFormat(" Grant Wait Timeout: %u\r\n", metrics.mNumTxGrantWaitTimeout); + mServer->OutputFormat(" Grant Deactivated During Request: %u\r\n", + metrics.mNumTxGrantDeactivatedDuringRequest); + mServer->OutputFormat(" Delayed Grant: %u\r\n", metrics.mNumTxDelayedGrant); + mServer->OutputFormat(" Average Request To Grant Time: %u\r\n", metrics.mAvgTxRequestToGrantTime); + mServer->OutputFormat("Receive metrics\r\n"); + mServer->OutputFormat(" Request: %u\r\n", metrics.mNumRxRequest); + mServer->OutputFormat(" Grant Immediate: %u\r\n", metrics.mNumRxGrantImmediate); + mServer->OutputFormat(" Grant Wait: %u\r\n", metrics.mNumRxGrantWait); + mServer->OutputFormat(" Grant Wait Activated: %u\r\n", metrics.mNumRxGrantWaitActivated); + mServer->OutputFormat(" Grant Wait Timeout: %u\r\n", metrics.mNumRxGrantWaitTimeout); + mServer->OutputFormat(" Grant Deactivated During Request: %u\r\n", + metrics.mNumRxGrantDeactivatedDuringRequest); + mServer->OutputFormat(" Delayed Grant: %u\r\n", metrics.mNumRxDelayedGrant); + mServer->OutputFormat(" Average Request To Grant Time: %u\r\n", metrics.mAvgRxRequestToGrantTime); + mServer->OutputFormat(" Grant None: %u\r\n", metrics.mNumRxGrantNone); + } + else + { + ExitNow(error = OT_ERROR_INVALID_ARGS); + } exit: AppendResult(error); } -#endif // OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE +#endif // OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE #if OPENTHREAD_FTD void Interpreter::ProcessContextIdReuseDelay(int argc, char *argv[]) diff --git a/src/cli/cli.hpp b/src/cli/cli.hpp index e8318816a..062a40a49 100644 --- a/src/cli/cli.hpp +++ b/src/cli/cli.hpp @@ -208,7 +208,7 @@ private: #if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE void ProcessCoapSecure(int argc, char *argv[]); #endif // OPENTHREAD_CONFIG_COAP_API_ENABLE -#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE +#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE void ProcessCoexMetrics(int argc, char *argv[]); #endif #if OPENTHREAD_CONFIG_COMMISSIONER_ENABLE && OPENTHREAD_FTD diff --git a/src/core/config/openthread-core-config-check.h b/src/core/config/openthread-core-config-check.h index 5f2500386..a46d9b60b 100644 --- a/src/core/config/openthread-core-config-check.h +++ b/src/core/config/openthread-core-config-check.h @@ -436,4 +436,9 @@ "OPENTHREAD_CONFIG_INFORM_PREVIOUS_PARENT_ON_REATTACH was replaced by OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH." #endif +#ifdef OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE +#error \ + "OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE was replaced by OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE." +#endif + #endif // OPENTHREAD_CORE_CONFIG_CHECK_H_ diff --git a/src/core/config/platform.h b/src/core/config/platform.h index b45b166e7..35b820755 100644 --- a/src/core/config/platform.h +++ b/src/core/config/platform.h @@ -98,13 +98,13 @@ #endif /** - * @def OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE + * @def OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE * - * Define to 1 if you want to enable radio coexistence metrics implemented in platform. + * Define to 1 if you want to enable radio coexistence implemented in platform. * */ -#ifndef OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE -#define OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE 0 +#ifndef OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE +#define OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE 0 #endif #endif // CONFIG_PLATFORM_H_ diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index ca53bfd7d..af8e0e3da 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -1801,6 +1801,10 @@ template <> otError NcpBase::HandlePropertyGet(void) SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_SLAAC)); #endif +#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE + SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_RADIO_COEX)); +#endif + #if OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_PEEK_POKE)); #endif @@ -2193,7 +2197,24 @@ template <> otError NcpBase::HandlePropertyGet(v return EncodeChannelMask(otPlatRadioGetPreferredChannelMask(mInstance)); } -#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE +#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE +template <> otError NcpBase::HandlePropertySet(void) +{ + bool enabled; + otError error = OT_ERROR_NONE; + + SuccessOrExit(error = mDecoder.ReadBool(enabled)); + error = otPlatRadioSetCoexEnabled(mInstance, enabled); + +exit: + return error; +} + +template <> otError NcpBase::HandlePropertyGet(void) +{ + return mEncoder.WriteBool(otPlatRadioIsCoexEnabled(mInstance)); +} + template <> otError NcpBase::HandlePropertyGet(void) { otRadioCoexMetrics coexMetrics; @@ -2201,7 +2222,7 @@ template <> otError NcpBase::HandlePropertyGet(v if (error != OT_ERROR_NONE) { - error = mEncoder.OverwriteWithLastStatusError(SPINEL_STATUS_INVALID_COMMAND_FOR_PROP); + error = mEncoder.OverwriteWithLastStatusError(ThreadErrorToSpinelStatus(error)); ExitNow(); } diff --git a/src/ncp/ncp_base_dispatcher.cpp b/src/ncp/ncp_base_dispatcher.cpp index a6bb6f0c9..77689207d 100644 --- a/src/ncp/ncp_base_dispatcher.cpp +++ b/src/ncp/ncp_base_dispatcher.cpp @@ -140,10 +140,13 @@ NcpBase::PropertyHandler NcpBase::FindGetPropertyHandler(spinel_prop_key_t aKey) case SPINEL_PROP_PHY_CHAN_PREFERRED: handler = &NcpBase::HandlePropertyGet; break; -#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE +#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE case SPINEL_PROP_RADIO_COEX_METRICS: handler = &NcpBase::HandlePropertyGet; break; + case SPINEL_PROP_RADIO_COEX_ENABLE: + handler = &NcpBase::HandlePropertyGet; + break; #endif // -------------------------------------------------------------------------- @@ -717,6 +720,11 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey) case SPINEL_PROP_MAC_SCAN_PERIOD: handler = &NcpBase::HandlePropertySet; break; +#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE + case SPINEL_PROP_RADIO_COEX_ENABLE: + handler = &NcpBase::HandlePropertySet; + break; +#endif // -------------------------------------------------------------------------- // MTD (or FTD) Properties (Set Handler) diff --git a/src/ncp/spinel.c b/src/ncp/spinel.c index 1b0184dae..08cf5e8fa 100644 --- a/src/ncp/spinel.c +++ b/src/ncp/spinel.c @@ -1411,6 +1411,10 @@ const char *spinel_prop_key_to_cstr(spinel_prop_key_t prop_key) ret = "RADIO_COEX_METRICS"; break; + case SPINEL_PROP_RADIO_COEX_ENABLE: + ret = "RADIO_COEX_ENABLE"; + break; + case SPINEL_PROP_MAC_SCAN_STATE: ret = "MAC_SCAN_STATE"; break; @@ -2576,6 +2580,10 @@ const char *spinel_capability_to_cstr(unsigned int capability) ret = "SLAAC"; break; + case SPINEL_CAP_RADIO_COEX: + ret = "RADIO_COEX"; + break; + case SPINEL_CAP_ERROR_RATE_TRACKING: ret = "ERROR_RATE_TRACKING"; break; diff --git a/src/ncp/spinel.h b/src/ncp/spinel.h index 3deb0a6ae..6097cdc0a 100644 --- a/src/ncp/spinel.h +++ b/src/ncp/spinel.h @@ -1054,6 +1054,7 @@ enum SPINEL_CAP_CHILD_SUPERVISION = (SPINEL_CAP_OPENTHREAD__BEGIN + 8), SPINEL_CAP_POSIX_APP = (SPINEL_CAP_OPENTHREAD__BEGIN + 9), SPINEL_CAP_SLAAC = (SPINEL_CAP_OPENTHREAD__BEGIN + 10), + SPINEL_CAP_RADIO_COEX = (SPINEL_CAP_OPENTHREAD__BEGIN + 11), SPINEL_CAP_OPENTHREAD__END = 640, SPINEL_CAP_THREAD__BEGIN = 1024, @@ -1629,6 +1630,8 @@ typedef enum /// All coex metrics related counters. /** Format: t(LLLLLLLL)t(LLLLLLLLL)bL (Read-only) + * + * Required capability: SPINEL_CAP_RADIO_COEX * * The contents include two structures and two common variables, first structure corresponds to * all transmit related coex counters, second structure provides the receive related counters. @@ -1664,6 +1667,15 @@ typedef enum */ SPINEL_PROP_RADIO_COEX_METRICS = SPINEL_PROP_PHY_EXT__BEGIN + 12, + /// Radio Coex Enable + /** Format: `b` + * + * Required capability: SPINEL_CAP_RADIO_COEX + * + * Indicates if radio coex is enabled or disabled. Set to true to enable radio coex. + */ + SPINEL_PROP_RADIO_COEX_ENABLE = SPINEL_PROP_PHY_EXT__BEGIN + 13, + SPINEL_PROP_PHY_EXT__END = 0x1300, SPINEL_PROP_MAC__BEGIN = 0x30, diff --git a/src/posix/platform/openthread-core-posix-config.h b/src/posix/platform/openthread-core-posix-config.h index 908809a36..698c2e7f8 100644 --- a/src/posix/platform/openthread-core-posix-config.h +++ b/src/posix/platform/openthread-core-posix-config.h @@ -63,12 +63,12 @@ #define OPENTHREAD_CONFIG_NCP_UART_ENABLE 1 /** - * @def OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE + * @def OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE * - * Define to 1 if you want to enable radio coexistence metrics implemented in platform. + * Define to 1 if you want to enable radio coexistence implemented in platform. * */ -#ifndef OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE -#define OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE 1 +#ifndef OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE +#define OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE 1 #endif #endif // OPENTHREAD_CORE_POSIX_CONFIG_H_ diff --git a/src/posix/platform/radio_spinel.cpp b/src/posix/platform/radio_spinel.cpp index e024ebfea..abb0fb11f 100644 --- a/src/posix/platform/radio_spinel.cpp +++ b/src/posix/platform/radio_spinel.cpp @@ -892,7 +892,21 @@ int8_t RadioSpinel::GetRssi(void) return rssi; } -#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE +#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE +otError RadioSpinel::SetCoexEnabled(bool aEnabled) +{ + return Set(SPINEL_PROP_RADIO_COEX_ENABLE, SPINEL_DATATYPE_BOOL_S, aEnabled); +} + +bool RadioSpinel::IsCoexEnabled(void) +{ + bool enabled; + otError error = Get(SPINEL_PROP_RADIO_COEX_ENABLE, SPINEL_DATATYPE_BOOL_S, &enabled); + + LogIfFail("Get Coex State failed", error); + return enabled; +} + otError RadioSpinel::GetCoexMetrics(otRadioCoexMetrics &aCoexMetrics) { otError error; @@ -1670,7 +1684,19 @@ int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) return sRadioSpinel.GetReceiveSensitivity(); } -#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE +#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE +otError otPlatRadioSetCoexEnabled(otInstance *aInstance, bool aEnabled) +{ + OT_UNUSED_VARIABLE(aInstance); + return sRadioSpinel.SetCoexEnabled(aEnabled); +} + +bool otPlatRadioIsCoexEnabled(otInstance *aInstance) +{ + OT_UNUSED_VARIABLE(aInstance); + return sRadioSpinel.IsCoexEnabled(); +} + otError otPlatRadioGetCoexMetrics(otInstance *aInstance, otRadioCoexMetrics *aCoexMetrics) { OT_UNUSED_VARIABLE(aInstance); diff --git a/src/posix/platform/radio_spinel.hpp b/src/posix/platform/radio_spinel.hpp index 1a2917b0e..d327b6aba 100644 --- a/src/posix/platform/radio_spinel.hpp +++ b/src/posix/platform/radio_spinel.hpp @@ -197,7 +197,29 @@ public: */ int8_t GetReceiveSensitivity(void) const { return mRxSensitivity; } -#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_METRICS_ENABLE +#if OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE + /** + * Enable the radio coex. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aEnabled TRUE to enable the radio coex, FALSE otherwise. + * + * @retval OT_ERROR_NONE Successfully enabled. + * @retval OT_ERROR_FAILED The radio coex could not be enabled. + * + */ + otError SetCoexEnabled(bool aEnabled); + + /** + * Check whether radio coex is enabled or not. + * + * @param[in] aInstance The OpenThread instance structure. + * + * @returns TRUE if the radio coex is enabled, FALSE otherwise. + * + */ + bool IsCoexEnabled(void); + /** * This method retrieves the radio coexistence metrics. *