Hello,
We are trying to develop a gateway (central) to interface with off the shelf BLE devices. One of the functions of the device is to send logged data to the client. To do this it uses notifications after CCCD bit (0x2902) is written to 01 for characteristic 0xFF0E . However I'm not sure how to use the sd_ble_gattc_write function to write to the CCCD descriptor. If I understand correctly the ble_gattc_write_params_t.handle is only for the charachteristic handle, not the descriptor. Where do I set the descriptor? Additionally other than using case BLE_GATTC_EVT_HVX: in the ble_evt_handler is there anything else that needs to be enabled to receive notifications?
Thanks.
ret_code_t err_code = NRF_SUCCESS; NRF_LOG_INFO("SENDING LOG Request") ble_gattc_write_params_t keycode; ret_code_t val; /**@brief Write Parameters. */ uint8_t cccd_value =0x01; keycode.write_op=BLE_GATT_OP_WRITE_CMD; /**< Write Operation to be performed, see @ref BLE_GATT_WRITE_OPS. */ keycode.flags= 0; /**< Flags, see @ref BLE_GATT_EXEC_WRITE_FLAGS. */ keycode.handle=0x2902; /**< Handle to the attribute to be written. */ keycode.offset=0; /**< Offset in bytes. @note For WRITE_CMD and WRITE_REQ, offset must be 0. */ keycode.len= 1; /**< Length of data in bytes. */ keycode.p_value= &cccd_value; /**< Pointer to the value data. */ NRF_LOG_INFO("trying to write"); //nrf_delay_ms(5); //sd_ble_gatts_hvx() val=sd_ble_gattc_write(0x0000,&keycode); // while (val==17){ // nrf_delay_ms(10); NRF_LOG_INFO("error code %d", val); // } //NRF_LOG_INFO("%d", val); return err_code;