Hi,
I use sd_ble_gattc_write function to write to my peripheral with my central device. I'm sure the settings should be right but i still can't see any change on peripheral. If i connect with my mobile app i can write normally.
Peripheral is write with no response only.
My code to write characteristic:
static uint32_t writeChar (uint16_t peripheral_id,uint8_t *zelVrednost)
{
uint32_t error_code = NRF_ERROR_NOT_FOUND;
ble_gattc_write_params_t write_params = {0};
LOG_INFO("CHAR HANDLE WRITE: 0x%04x",gs_peripheral[peripheral_id].value_handle);
write_params.write_op = BLE_GATT_OP_WRITE_REQ;
write_params.handle = gs_peripheral[peripheral_id].value_handle;
write_params.offset = 0x0000;
write_params.len = sizeof(zelVrednost);
write_params.p_value = zelVrednost;
LOG_DEBUG("vrednost: 0x%02x\r\n", *write_params.p_value);
if ((error_code = sd_ble_gattc_write(gs_peripheral[peripheral_id].conn_handle, &write_params)) != NRF_SUCCESS)
{
LOG_DEBUG("(Peripheral %i) Error: 0x%x", peripheral_id, error_code);
return error_code;
}
else
{
LOG_DEBUG("Success\r\n");
}
return error_code;
}
I set my handle when i discover service and characteristic, with this line:
gs_peripheral[peripheral_id].value_handle = gsp_ble_evt->evt.gattc_evt.params.char_disc_rsp.chars[i].handle_value;