Let us say we have a struct
typedef struct
{
uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection).*/
uint16_t service_handle; /**< Handle of Our Service (as provided by the BLE stack). */
// OUR_JOB: Step 2.D, Add handles for the characteristic attributes to our struct
ble_gatts_char_handles_t char_handles;
// Done with step 2.D
}ble_os_t;
Using this struct I have initialized a variable as
ble_os_t *p_our_service
Next I call the SoftDevice function to update a characteristic value (It has both notify and indicate turned on)
char_md.char_props.notify = 1;
char_md.char_props.indicate = 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 = 1;
hvx_params.p_len = &len;
hvx_params.p_data = (uint16_t*)sensor_value;
sd_ble_gatts_hvx(p_our_service->conn_handle, &hvx_params);
err_code = sd_ble_gattc_hv_confirm(p_our_service->conn_handle, p_our_service->char_handles.value_handle);
I get a response that NRF_ERROR_INVALID_STATE for sd_ble_gattc_hv_confirm.
Have I passed the parameters correctly or am I doing it wrong? Please help me out.