nrf52DK - SDK12.2
This is probably a simple thing I am missing but I can't seem to find the answer.
I have been following the tutorial for BLE Characteristics (here)
I was able to follow through the whole thing and make changes needed - it was very well written and informative.
I am now at the point where I want to add another characteristic to the service for a photocell reading (already sending the SD temp on the other characteristic). I am using the same timer to send the photocell reading. I added a new characteristic uuid - no problem. I can see the new characteristic in nrfConnect app (android). The notification values it sends out are always on only one of the characteristics. I am pretty sure it has something to do with this quote from the tutorial:
handle: The SoftDevice needs to know what characteristic value we are working on. In applications with two or more characteristics naturally we will need to reference the handle of the specific characteristic value we want to use. Our example only has one characteristic and we will use the handle stored in p_our_service->char_handles.value_handle.
Below is my code to update the sd temp characteristic value (I made it an uint8_t to show the temp in degrees C) :
// OUR_JOB: Step 3.E, Update characteristic value
if (p_our_service->conn_handle != BLE_CONN_HANDLE_INVALID)
{
uint16_t len = 1;
ble_gatts_hvx_params_t hvx_params;
memset(&hvx_params, 0, sizeof(hvx_params));
hvx_params.handle = p_our_service->char_handles.value_handle;
hvx_params.type = BLE_GATT_HVX_NOTIFICATION;
hvx_params.offset = 0;
hvx_params.p_len = &len;
hvx_params.p_data = (uint8_t*)temperature_value;
sd_ble_gatts_hvx(p_our_service->conn_handle, &hvx_params);
}
And my code for updating my photocell reading characteristic value:
{
if (p_our_service->conn_handle != BLE_CONN_HANDLE_INVALID)
{
uint16_t len = 2;
ble_gatts_hvx_params_t hvx_params;
memset(&hvx_params, 0, sizeof(hvx_params));
hvx_params.handle = p_our_service->char_handles.value_handle;
hvx_params.type = BLE_GATT_HVX_NOTIFICATION;
hvx_params.offset = 0;
hvx_params.p_len = &len;
hvx_params.p_data = (uint8_t*)photoReading_value;
sd_ble_gatts_hvx(p_our_service->conn_handle, &hvx_params);
}
Can someone explain how I can reference the handle of each specific characteristic?
Thanks,
Bryan