This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

characteristic value as a structure

Hello, I am working with S130 softdevice. I am using SDK v6. I want to send multiple data as a single characteristic value (possibly as a structure). But it is seen that p_value in ble_gatts_attr_t is uint8_t*. Can I modify it to a structure pointer?? Or is there any other way to solve the problem???

Anybody came across with a similar situation???

Thanks in advance

Parents
  • I had the opposite problem when receiving our proprietary commands on a characteristic. It was relatively simple to create a pointer to a structure of our command and then assign it the address of the uint8 * in the write event. It looks like:

        ble_gatts_evt_write_t	* p_evt_write = &p_ble_evt->evt.gatts_evt.params.write;
        onset_recv_command_t	* p_received_command = (onset_recv_command_t *)&p_evt_write->data[0];
    

    You could do the opposite and fill in your structure and then assign the address to your uint8_t pointer for your write command.

Reply
  • I had the opposite problem when receiving our proprietary commands on a characteristic. It was relatively simple to create a pointer to a structure of our command and then assign it the address of the uint8 * in the write event. It looks like:

        ble_gatts_evt_write_t	* p_evt_write = &p_ble_evt->evt.gatts_evt.params.write;
        onset_recv_command_t	* p_received_command = (onset_recv_command_t *)&p_evt_write->data[0];
    

    You could do the opposite and fill in your structure and then assign the address to your uint8_t pointer for your write command.

Children
No Data
Related