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

ParameterDescription
[in] connHandleHandle of the connection to send the write response.
[in] p_respParamsPointer to Write Response parameters. See GATTS_SendWriteRespParams_T.

Return values

Return valueDescription
MBA_RES_SUCCESSSuccessfully starts to send the write response.
MBA_RES_FAILOperation 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_OOMInternal memory allocation failure.
MBA_RES_INVALID_PARAInvalid parameters. Connection handle is not valid.