GATTC_Write

C

uint16_t GATTC_Write(uint16_t connHandle, GATTC_WriteParams_T *p_writeParams);

Description

Initiates a write operation from the GATT Client to the GATT Server.

Note

Use this API to write a Characteristic Value or a Characteristic Descriptor. See ATT opcodes for write types (ATT_WRITE_REQ, ATT_WRITE_CMD, ATT_PREPARE_WRITE_REQ, ATT_EXECUTE_WRITE_REQ). - For non-long attributes, set valueOffset to 0 and choose Write Request/Write Command. - For long attributes, write the first (ATT_MTU-3) bytes with valueOffset set to 0 and writeType as ATT_PREPARE_WRITE_REQ. Subsequent prepare write requests should be made with the correct valueOffset and data upon receiving GATTC_EVT_WRITE_RESP. Continue until all bytes are queued on the server. After the last prepare write response, call this API with writeType as ATT_EXECUTE_WRITE_REQ and flags as Execute write flags.

Parameters

ParameterDescription
[in] connHandleHandle of the connection to send write operation.
[in] p_writeParamsPointer to the write parameters structure (see GATTC_WriteParams_T).

Return values

Return valueDescription
MBA_RES_SUCCESSSuccessfully starts the write operation.
MBA_RES_FAILOperation not permitted.
MBA_RES_OOMMemory allocation failure occurred internally.
MBA_RES_INVALID_PARAInvalid parameters (invalid connection handle or write parameters).
MBA_RES_NO_RESOURCENo resources available to perform the write.
MBA_RES_BUSYGATT Client is busy with another ongoing request.