nrf-softdevice-s122

Crates

git

Versions

default

Flavors

pub unsafe fn sd_ble_gattc_write(
conn_handle: u16,
p_write_params: *const ble_gattc_write_params_t
) -> u32
Expand description

@brief Perform a Write (Characteristic Value or Descriptor, with or without response, signed or not, long or reliable) procedure.

@details This function can perform all write procedures described in GATT.

@note Only one write with response procedure can be ongoing per connection at a time. If the application tries to write with response while another write with response procedure is ongoing, the function call will return @ref NRF_ERROR_BUSY. A @ref BLE_GATTC_EVT_WRITE_RSP event will be issued as soon as the write response arrives from the peer.

@note The minimum guaranteed number of Write without Response that can be queued is configured by @ref ble_gattc_conn_cfg_t::write_cmd_tx_queue_size When the queue is full, the function call will return @ref NRF_ERROR_RESOURCES. A @ref BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE event will be issued as soon as the transmission of the write without response is complete.

@note The application can keep track of the available queue element count for writes without responses by following the procedure below: - Store initial queue element count in a variable. - Decrement the variable, which stores the currently available queue element count, by one when a call to this function returns @ref NRF_SUCCESS. - Increment the variable, which stores the current available queue element count, by the count variable in @ref BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE event.

@events @event{@ref BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE, Write without response transmission complete.} @event{@ref BLE_GATTC_EVT_WRITE_RSP, Write response received from the peer.} @endevents

@mscs @mmsc{@ref BLE_GATTC_VALUE_WRITE_WITHOUT_RESP_MSC} @mmsc{@ref BLE_GATTC_VALUE_WRITE_MSC} @mmsc{@ref BLE_GATTC_VALUE_LONG_WRITE_MSC} @mmsc{@ref BLE_GATTC_VALUE_RELIABLE_WRITE_MSC} @endmscs

@param[in] conn_handle The connection handle identifying the connection to perform this procedure on. @param[in] p_write_params A pointer to a write parameters structure.

@retval ::NRF_SUCCESS Successfully started the Write procedure. @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. @retval ::NRF_ERROR_BUSY For write with response, procedure already in progress. Wait for a @ref BLE_GATTC_EVT_WRITE_RSP event and retry. @retval ::NRF_ERROR_RESOURCES Too many writes without responses queued. Wait for a @ref BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE event and retry. @retval ::NRF_ERROR_TIMEOUT There has been a GATT procedure timeout. No new GATT procedure can be performed without reestablishing the connection.