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

sd_ble_gatts_value_set for setting directly CCCD value.

Hi Nordic Semiconductor's community,

I have a question about the function sd_ble_gatts_value_set(), more precisely about if it is possible to set the CCCD value of a characteristic directly in firmware (not by the client (i.e. Android application) ).

i use the sd_ble_gatts_value_set() like this :

    uint32_t err_code;
    uint8_t cccd_value = 0x0001;
	ble_gatts_value_t gatts_value;
	memset(&gatts_value, 0, sizeof(gatts_value));

     gatts_value.len = sizeof(uint8_t);
     gatts_value.offset  = 0;
     gatts_value.p_value = &cccd_value;  // 0x0001 (Notification).
	
	err_code = sd_ble_gatts_value_set(BLE_CONN_HANDLE_INVALID, m_lbs.battery_char_handles.cccd_handle, &gatts_value);
	APP_ERROR_CHECK(err_code);

Here, i set the value of the CCCD characteristic, but the nrf51 DK reset at APP_ERROR_CHECK(err_code).

I have the error code equal to 0x0000000F. So it is not possible (for me) to set programmatically (directly in the code) the CCCD value.

Thanks.

Related