On Transaction Complete
Called after an HTTP transaction was completed.
Like for every hook functions, it's only available when the µC/HTTP-client internal task is active (HTTPc_CFG_MODE_ASYNC_TASK_EN
). This hook is not mandatory when the API function HTTPc_ReqSend
is called in blocking mode. It can be set up with the API function HTTPc_ReqSetParam
and the parameter type HTTPc_PARAM_TYPE_TRANS_COMPLETE_CALLBACK
.
Prototype
void HTTPc_TransCompleteHook (HTTPc_CONN_OBJ *p_conn_obj, HTTPc_REQ_OBJ *p_req_obj, HTTPc_RESP_OBJ *p_resp_obj, CPU_BOOLEAN status);
Arguments
p_conn_obj
Pointer to the current HTTPc Connection Object.
p_req_obj
Pointer to the current HTTPc Request Object.
p_resp_obj
Pointer to the HTTPc Response Object fill with the data received in the HTTP response.
status
Status of the Transaction:
DEF_OK
, Transaction was completed successfully.
DEF_FAIL
, otherwise.
Return Values
None.
Required Configuration
The µC/HTTP-client Internal Task must be active. See section Task Configuration of the Compile-Time Configuration page.
Notes / Warnings
None.
Example Template
static void HTTPc_TransCompleteHook (HTTPc_CONN_OBJ *p_conn, HTTPc_REQ_OBJ *p_req, HTTPc_RESP_OBJ *p_resp, CPU_BOOLEAN status) { if (status == DEF_OK) { printf("%s\n\r", p_resp->ReasonPhrasePtr); } else { printf("Transaction failed\n\r"); } }