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

client to server data transfer with ble_app_hrs

I have the ble_app_hrs communicating with the ble_app_hrs_c, and everything works OK. However, I have to be able to send data in both directions. How do I modify, or what do I have to add to ble_app_hrs and ble_app_hrs_c in order to send data from the client (central) to the server (peripheral)?

  • Hi Jo-Jo,

    You would need to have a characteristic on the server (peripheral) that has write property. And on the client (central) you would need to do a write to that characteristic to send data.

    In ble_app_hrs_c example, we write to the CCCD characteristic on the server value "1" to enable notification. Please have a look at the BLE_BAS_C_EVT_DISCOVERY_COMPLETE event, and trace down to the cccd_configure() function in ble_hrs_c.c You can follow that to write your own write command.

  • I can't figure out where on the server this message is received and handled. What and where is the variable that is being written?

  • Even if I comment out the the cccd_configure() call, the values are still updated on the client, so I don't think this call is doing what you said it is doing unless it is redundant. can you provide an example of how to use sd_ble_gattc_write() to update a global variable on the server? Nordic doesn't provide an example, and I am beginning to think that this behavior is not support with the current soft devices, which would mean I cannot use Nordic devices in our project. Unfortunately, I have been unable to get any sort of response from Nordic's support department, which doesn't make me feel comfortable going forward with any Nordic devices.

Related