...
Message's Parameters
µC/HTTPMQTT-client provides the function MQTTc_MsgSetParam to configure parameters related to the HTTP RequestMQTT message. The function takes as argument the type of parameter and the pointer to the parameter. The below following parameter 's types are available :
Panel |
---|
title | Table - MQTTc Message Parameters |
---|
|
Parameter Type | Description |
---|
MQTTc_PARAM_TYPE_MSG_BUF_PTR | Sets the Message's buffer start. | MQTTc_PARAM_TYPE_MSG_BUF_LEN | Sets the Message's maximum buffer length. |
|
Example
Code Block |
---|
language | cpp |
---|
title | Listing - MQTTc Message Configuration Example |
---|
linenumbers | true |
---|
|
static MQTTc_MSG AppMQTTc_Msg;
static CPU_INT08U AppMQTTc_MsgBuf[APP_MQTTc_MSG_LEN_MAX];
CPU_BOOLEAN App_MQTTc_MsgPrepare (void)
{
MQTTc_ERR err;
/* ----------------- INIT NEW MESSAGE ----------------- */
MQTTc_MsgClr(&AppMQTTc_Msg, &err);
if (err != MQTTc_ERR_NONE) {
return (DEF_FAIL);
}
MQTTc_MsgSetParam(&AppMQTTc_Msg, MQTTc_PARAM_TYPE_MSG_BUF_PTR, (void *)&AppMQTTc_MsgBuf[0u], &err);
if (err != MQTTc_ERR_NONE) {
return (DEF_FAIL);
}
MQTTc_MsgSetParam(&AppMQTTc_Msg, MQTTc_PARAM_TYPE_MSG_BUF_LEN, (void *)APP_MQTTc_MSG_LEN_MAX, &err);
if (err != MQTTc_ERR_NONE) {
return (DEF_FAIL);
}
return (DEF_OK);
} |