[spinel] add capability definitions for FTD, MTD, RADIO configuration (#3357)

This commit adds new spinel capability definitions to specify the
FTD, MTD or RADIO build configurations. Depending on the OpenThread
build configurations the corresponding capability is included in
`SPINEL_PROP_CAPS` list.
This commit is contained in:
Abtin Keshavarzian
2018-12-07 09:02:05 -08:00
committed by Jonathan Hui
parent c06179938c
commit f189cafcc7
3 changed files with 26 additions and 0 deletions
+8
View File
@@ -1724,6 +1724,14 @@ template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CAPS>(void)
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_MCU_POWER_STATE));
#endif
#if OPENTHREAD_FTD
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_CONFIG_FTD));
#elif OPENTHREAD_MTD
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_CONFIG_MTD));
#elif OPENTHREAD_RADIO
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_CONFIG_RADIO));
#endif
#if OPENTHREAD_RADIO || OPENTHREAD_ENABLE_RAW_LINK_API
SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_CAP_MAC_RAW));
#endif
+12
View File
@@ -2411,6 +2411,18 @@ const char *spinel_capability_to_cstr(unsigned int capability)
ret = "802_15_4_868MHZ_ASK";
break;
case SPINEL_CAP_CONFIG_FTD:
ret = "CONFIG_FTD";
break;
case SPINEL_CAP_CONFIG_MTD:
ret = "CONFIG_MTD";
break;
case SPINEL_CAP_CONFIG_RADIO:
ret = "CONFIG_RADIO";
break;
case SPINEL_CAP_ROLE_ROUTER:
ret = "ROLE_ROUTER";
break;
+6
View File
@@ -740,6 +740,12 @@ enum
SPINEL_CAP_802_15_4_868MHZ_ASK = (SPINEL_CAP_802_15_4__BEGIN + 14),
SPINEL_CAP_802_15_4__END = 32,
SPINEL_CAP_CONFIG__BEGIN = 32,
SPINEL_CAP_CONFIG_FTD = (SPINEL_CAP_CONFIG__BEGIN + 0),
SPINEL_CAP_CONFIG_MTD = (SPINEL_CAP_CONFIG__BEGIN + 1),
SPINEL_CAP_CONFIG_RADIO = (SPINEL_CAP_CONFIG__BEGIN + 2),
SPINEL_CAP_CONFIG__END = 40,
SPINEL_CAP_ROLE__BEGIN = 48,
SPINEL_CAP_ROLE_ROUTER = (SPINEL_CAP_ROLE__BEGIN + 0),
SPINEL_CAP_ROLE_SLEEPY = (SPINEL_CAP_ROLE__BEGIN + 1),