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

Custom service with multiple peripheral links - notify all connections instead of last connected only

nRF52862, SDK 14.2, SD 5.1.0,, Arm GCC (Eclipse)

I have a custom service that is working well when 1 device (phone) is connected. All notifications are sent properly to the phone.

I used the multi peripheral example in  SDK 14.2 to allow multiple links (connections). I set NRF_SDH_BLE_PERIPHERAL_LINK_COUNT to 3 in sdk_config.h.

When I connect a second device (phone), it connects fine and works well but any notifications are only sent to the second device and not the first connected device. I am only getting notifications on one device at a time.

I assume that has something to do with my service only sending one update out for the one conn_handle.

See code below that shows my temperature characteristic update:

void our_temperature_characteristic_update(ble_os_t *p_our_service, uint8_t *temperature_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_a_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);
    }
}

What I would like it to do is send out that notification to every conn_handle that is connected.


Hopefully I explained this clearly enough.

Thanks in advance

Parents Reply Children
No Data
Related