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 believe the two most common ways to solve this issue is:

    a) As John says you could always cast your struct pointer to a uint8_t pointer, and assign it to p_value.

    b) Declare your struct as a union between a uint8_t array and a sub-struct containing all your fields. Then you can refer to the uint8_t array when passing the data to the BLE stack, and refer to the sub-struct when assigning your data fields.

Reply
  • I believe the two most common ways to solve this issue is:

    a) As John says you could always cast your struct pointer to a uint8_t pointer, and assign it to p_value.

    b) Declare your struct as a union between a uint8_t array and a sub-struct containing all your fields. Then you can refer to the uint8_t array when passing the data to the BLE stack, and refer to the sub-struct when assigning your data fields.

Children
Related