Advertizing 20 custom parameters as perfipheral - NRF52832 BLE

Dears,

Is it possible to rework the heart rate example (BLE) for the client and peripheral, so instead of heart rate to advertise and receive by the client 20 custom parameters (all they are uint16_t)? What changes shall I do (general conception).

Best Regards,

Stanislav

Parents Reply Children
  • You must follow the definitions and flow for bt_data ad and bt_data sd to see how data is defined and added to the advertisement and scan response data structs. https://academy.nordicsemi.com/topic/blefund-lesson-2-exercise-1/ showcases how to do this with a minimal sample. Comparing this to the hr central sample you will see that there is defined multipled elements using BT_DATA_BYTES, where the last of them in the advertise data packet contains the custom Heart Rate Sensor value.

    Line 35 and 44 in main.c in central_and_peripheral_hr 

    Kind regards,
    Andreas

  • I looked at the ad[] structure and got the idea. Still, when looking at how those values are updated, I saw specific functions prepared and ending up with bt_gatt_notify. So I need to prepare functions per each parameter and link it to bt_gat_notify? My intention is just to set 20 parameters and advertise them, change them in the main loop, and that's all. The client should receive them. There were many parameters stated in uuid.h. Are there specific functions created for each of them, so I can use them to update the values?

    Exercise 2 from the nordic academy you pointed out looks promising. There, by pressing the button, you can change the advertised data. Can I do something similar but instead of a button, to wait for a character from the Serial interface and advertise the received character? Are there any restrictions (interrupts conflict, timers, etc that forbid using the advertising and the UART at the same time?

Related