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

Required buffer data on cccd_handle write for INDICATION

Hello,

I'm working with a nrf51822, SoftDevice S120 v2.0 and SDK v9.0 platform.

Specifically using it a Central role to connect to a Blood Pressure peripheral.

I connect to the peripheral, find the Service/Characteristic I need and register for an "Indication" like so:

uint32_t                 err_code;
ble_gattc_write_params_t write_params;
uint8_t                  buf[BLE_CCCD_VALUE_LEN];

buf[0] = BLE_GATT_HVX_INDICATION;
buf[1] = 0;

write_params.write_op = BLE_GATT_OP_WRITE_REQ;
write_params.handle   = p_client->srv_db.services[0].charateristics[p_client->my_char_index].cccd_handle;
write_params.offset   = 0;
write_params.len      = sizeof(buf);
write_params.p_value  = buf;

err_code = sd_ble_gattc_write(p_client->srv_db.conn_handle, &write_params);
APP_ERROR_CHECK(err_code);

Unfortunately this does not work for me.

i.e. I get a BLE_GATTC_EVT_WRITE_RSP back from the peripheral but BLE_GATTC_EVT_HVX never gets throw to indicate data has been received.

In this:

buf[0] = BLE_GATT_HVX_INDICATION;
buf[1] = 0

Can someone please tell me what buf[1] = 0 is supposed to be? I copied this from a NOTIFICATION example and I cant seem to find anywhere in the documentation what this buffer is supposed to contain. I suspect this may have something to do with the problem.

Thanks very much, Mark

Parents
  • Is the peripheral a commercial product? Or something that is running on a development kit? It could be that the CCCD requires the link to have a higher security level before it can be written. I'm assuming that you are using Just Works pairing (no Passkey Entry or OOB), then the link will only have security level 2.The CCCD may require the link to be in security level 3 (pairing with passkey entry or OOB) or even security level 4 (LESC).

Reply
  • Is the peripheral a commercial product? Or something that is running on a development kit? It could be that the CCCD requires the link to have a higher security level before it can be written. I'm assuming that you are using Just Works pairing (no Passkey Entry or OOB), then the link will only have security level 2.The CCCD may require the link to be in security level 3 (pairing with passkey entry or OOB) or even security level 4 (LESC).

Children
No Data
Related