Hi
I would like to use an ENUM and STUCT within my application to maintain device state (IDLE, RUNNING etc). This state needs to update a BLE Characteristic. I have the BLE Service and Characteristic running but am struggling to send the ENUM as a single byte (uint8_t).
The ENUM & STRUCT is as follows:
typedef enum
{
IDLE = 0x00, //0
RUNNING = 0x01, //1
FAULT = 0x09 //9
} m_srm_state_evt_type_t;
typedef struct
{
m_srm_state_evt_type_t evt_type;
} m_srm_state_type_t;
static m_srm_state_type_t m_srm_state;
And the BLE update char is as follows:
case BLE_SRVC_OPT_EVT_CONNECTED:
uint8_t value[1] = {m_srm_state.value};
err_code = ble_srvc_opt_custom_value_update(&m_cus, value);
APP_ERROR_CHECK(err_code);
break;
I know it's my lack of programming skills, but really stuck on this one. Thanks in advance.