Add a command to call MQTT_Connect() for an MQTT connection. If a session is resumed with the broker, it will also resend the necessary QoS1/2 publishes.
MQTTStatus_t status;
MQTTConnectInfo_t connectInfo = { 0 };
MQTTPublishInfo_t willInfo = { 0 };
connectInfo.cleanSession = true;
connectInfo.pClientIdentifier = "someClientID";
connectInfo.clientIdentifierLength = strlen( connectInfo.pClientIdentifier );
connectInfo.keepAliveSeconds = 60;
connectInfo.pUserName = "someUserName";
connectInfo.userNameLength = strlen( connectInfo.pUserName );
connectInfo.pPassword = "somePassword";
connectInfo.passwordLength = strlen( connectInfo.pPassword );
willInfo.qos = MQTTQoS0;
willInfo.pTopicName = "/lwt/topic/name";
willInfo.topicNameLength = strlen( willInfo.pTopicName );
willInfo.pPayload = "LWT Message";
willInfo.payloadLength = strlen( "LWT Message" );
connectArgs.pConnectInfo = &connectInfo;
connectArgs.pWillInfo = &willInfo;
connectArgs.timeoutMs = 500;
if( status == MQTTSuccess )
{
}
MQTTStatus_t MQTTAgent_Connect(const MQTTAgentContext_t *pMqttAgentContext, MQTTAgentConnectArgs_t *pConnectArgs, const MQTTAgentCommandInfo_t *pCommandInfo)
Add a command to call MQTT_Connect() for an MQTT connection. If a session is resumed with the broker,...
Definition core_mqtt_agent.c:1266
struct MQTTAgentCommandContext MQTTAgentCommandContext_t
Struct containing context for a specific command.
Definition core_mqtt_agent.h:83
Struct holding arguments that are common to every command.
Definition core_mqtt_agent.h:214
MQTTAgentCommandCallback_t cmdCompleteCallback
Callback to invoke upon completion.
Definition core_mqtt_agent.h:215
uint32_t blockTimeMs
Maximum block time for enqueueing the command.
Definition core_mqtt_agent.h:217
Struct holding arguments for a CONNECT call.
Definition core_mqtt_agent.h:180
Information used by each MQTT agent. A context will be initialized by MQTTAgent_Init(),...
Definition core_mqtt_agent.h:153
Struct holding return codes and outputs from a command.
Definition core_mqtt_agent.h:71