1.2.2.1.2.4.22 GATTS_SendWriteResponse
C
uint16_t GATTS_SendWriteResponse(uint16_t connHandle, GATTS_SendWriteRespParams_T *p_respParams);
Description
GATT Server sends the write/prepare write/execute write response when this API is called. ResponseType in GATTS_SendWriteRespParams_T indicates if the response is for write request, prepare write request or execute write request.
Response to the GATT client is sent only if:
API initiates a Write response and a Write request was received by GATT server.
API initiates a Prepare Write response and a Prepare Write request was received by GATT server.
API initiates a Execute Write response and a Execution Write request was received by GATT server.
Note
If the attribute setting of the attribute is set as SETTING_MANUAL_WRITE_RSP, the event GATTS_EVT_WRITE with writeType is ATT_WRITE_REQ or ATT_PREPARE_WRITE_REQ or ATT_EXECUTE_WRITE_REQ will be sent to application when GATT server receives these requests performing on this attribute. In this case, application need to call this API to send write response or send error response if the request is not permitted.
This API should be called to send the response only when event GATTS_EVT_WRITE is received.
Parameters
Parameter | Description |
---|---|
[in] connHandle | Handle of the connection to send the write response. |
[in] p_respParams | Pointer to Write Response parameters. See GATTS_SendWriteRespParams_T. |
Return values
Return value | Description |
---|---|
MBA_RES_SUCCESS | Successfully starts to send the write response. |
MBA_RES_FAIL | Operation is not permitted as Write response/Prepare Write response/Execute Write response transmission was requested but write request/prepare write request/execute write request was not received. |
MBA_RES_OOM | Internal memory allocation failure. |
MBA_RES_INVALID_PARA | Invalid parameters. Connection handle is not valid. |