[spinel] add string conversion support for MCU_POWER_STATE definitions (#2653)

This commit is contained in:
Abtin Keshavarzian
2018-04-10 13:10:26 -07:00
committed by Jonathan Hui
parent 9690339837
commit 648e8b292a
2 changed files with 32 additions and 0 deletions
+30
View File
@@ -1097,6 +1097,10 @@ spinel_prop_key_to_cstr(spinel_prop_key_t prop_key)
ret = "PROP_HOST_POWER_STATE";
break;
case SPINEL_PROP_MCU_POWER_STATE:
ret = "PROP_MCU_POWER_STATE";
break;
case SPINEL_PROP_GPIO_CONFIG:
ret = "PROP_GPIO_CONFIG";
break;
@@ -1873,6 +1877,28 @@ const char *spinel_net_role_to_cstr(uint8_t net_role)
return ret;
}
const char *spinel_mcu_power_state_to_cstr(spinel_mcu_power_state_t mcu_power_state)
{
const char *ret = "MCU_POWER_STATE_UNKNOWN";
switch (mcu_power_state)
{
case SPINEL_MCU_POWER_STATE_ON:
ret = "MCU_POWER_STATE_ON";
break;
case SPINEL_MCU_POWER_STATE_LOW_POWER:
ret = "MCU_POWER_STATE_LOW_POWER";
break;
case SPINEL_MCU_POWER_STATE_OFF:
ret = "MCU_POWER_STATE_OFF";
break;
}
return ret;
}
const char *spinel_status_to_cstr(spinel_status_t status)
{
const char *ret = "UNKNOWN";
@@ -2080,6 +2106,10 @@ const char *spinel_capability_to_cstr(unsigned int capability)
ret = "CAP_UNSOL_UPDATE_FILTER";
break;
case SPINEL_CAP_MCU_POWER_STATE:
ret = "CAP_MCU_POWER_STATE";
break;
case SPINEL_CAP_802_15_4_2003:
ret = "CAP_802_15_4_2003";
break;
+2
View File
@@ -2052,6 +2052,8 @@ SPINEL_API_EXTERN const char *spinel_prop_key_to_cstr(spinel_prop_key_t prop_key
SPINEL_API_EXTERN const char *spinel_net_role_to_cstr(uint8_t net_role);
SPINEL_API_EXTERN const char *spinel_mcu_power_state_to_cstr(spinel_mcu_power_state_t mcu_power_state);
SPINEL_API_EXTERN const char *spinel_status_to_cstr(spinel_status_t status);
SPINEL_API_EXTERN const char *spinel_capability_to_cstr(unsigned int capability);