Sends a HTTP Request to a remote HTTP Send a 'Connect' message to MQTT server.
Files
httpmqtt-c.h/httpmqtt-c.c
Prototype
Arguments
p_conn_obj
Pointer to the HTTPc Connection object on which to send HTTP request.
p_req_obj
Pointer to the HTTP Request object to send.
p_resp_obj
Pointer to the HTTPc Response object that will be filled with the HTTP response received from the server.
method
HTTP method's type of the request:
HTTP_METHOD_GET
HTTP_METHOD_POST
HTTP_METHOD_HEAD
HTTP_METHOD_PUT
HTTP_METHOD_DELETE
HTTP_METHOD_TRACE
HTTP_METHOD_CONNECT
HTTP_METHOD_OPTIONS
p_resource_path
Pointer to complete URI (or only resource path) string of the request.
resource_path_len
URI (or Resource path) string length.
flags
Configuration flags:
HTTPc_FLAG_REQ_NO_BLOCK
Code Block |
---|
void MQTTc_Connect (MQTTc_CONN *p_conn,
MQTTc_MSG *p_msg,
MQTTc_ERR *p_err); |
Arguments
p_conn
Pointer to MQTTc Connection to use.
p_msg
Pointer to MQTTc Message object to use.
p_err
Pointer to variable that will receive the return error code from this function:HTTPc
MQTTc_ERR_NONE
...
MQTTc_ERR_
...
NOT_INIT
...
...
MQTTc_ERR_
...
NULL_
...
PTR
...
MQTTc_ERR_
...
INVALID_
...
ARG
...
MQTTc_ERR
...
_INVALID
...
_
...
BUF_SIZE
MQTTc_ERR_
...
FAIL
Returned Values
None.
Required Configuration
None.
Notes / Warnings
- This function MUST be called after the µC/HTTPMQTT-client Suite Initialization initialization has been completed.If the µC/HTTP-client Asynchronous Task is enabled (
HTTPc_CFG_MODE_ASYNC_TASK_EN
macro in http-c_cfg.h), the HTTPc Request Object will be added to the request's queue.
If theHTTPc_FLAG_REQ_NO_BLOCK
flag is set, the function will be in non-blocking mode. Therefore, the function could return before the HTTP transaction is finished. For the application to be notified when the HTTP transaction completes, the callback function must have been setup before with the parameter typeHTTPc_PARAM_TYPE_TRANS_COMPLETE_CALLBACK
. - Both the
MQTTc_CONN
object and theMQTTc_MSG
object used MUST stay valid until the message has completed (callback has been called).