Convert enum value to string for more readable terminal output

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
CoCo_1816446
Level 4
Level 4
25 replies posted 10 replies posted 5 replies posted

  Currently, I use something like this: WPRINT_APP_INFO( ( "wiced_bt_ble_set_advertisement_data %d\n", result ) );

that would output the following to the terminal: "wiced_bt_ble_set_advertisement_data 0"

Then I have to figure out what the value 0 represents in the enum where it's declared.

Is there a function that could convert the numerical value back to the string its equal to?

I would like to see something like this: "wiced_bt_ble_set_advertisement_data WICED_SUCCESS"

0 Likes
1 Solution
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Hi,

wiced_bt_ble_set_advertisement_data will be returning the decimal or Hexadecimal value to indicate the results. See wiced_result.h.

It is not recommend to modify this header file, because it may break other applications.

I would suggest you to create another custom list for your application which will return the string instead of the value of the results.

Thanks,

-Dheeraj

View solution in original post

1 Reply
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Hi,

wiced_bt_ble_set_advertisement_data will be returning the decimal or Hexadecimal value to indicate the results. See wiced_result.h.

It is not recommend to modify this header file, because it may break other applications.

I would suggest you to create another custom list for your application which will return the string instead of the value of the results.

Thanks,

-Dheeraj