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

Send struct of data

Hi all,

If I want to send a table that contains a structure in each of his cases using sd_ble_gatts_hvx(), can I get it ?
Knowing that the second parametre of sd_ble_gatts_hvx() contains a ble_gatts_hvx_params_t variable, which has the uint8* p_data attribute.

Regards,

mohBOSS.

Parents
  • The short answer is yes, you can transfer anything you want.

    The BLE transport only knows it is transporting bytes from peripheral to central or vice versa. It doesn't know or care what those bytes represent, they can be anything you want them to be. There are limitations such as the need to fragment things over 20 bytes in size, the speed at which you can do the transfer, and things like that, but there is nothing to prevent you from transferring anything you want to.

  • Hi, I'm guessing you can't cast due to a coding standard? Not that it matters, another solution would be to change your rssi_mac struct into a union of your structure with a uint8_t array. Then you could assign the uint8_t portion of the union to p_data without a warning.

Reply Children
No Data
Related