coreMQTT Agent v1.1.0
Thread safe MQTT 3.1.1 Client
MQTTAgent_CancelAll

Cancel all enqueued commands and those awaiting acknowledgment while the command loop is not running.

MQTTStatus_t MQTTAgent_CancelAll(MQTTAgentContext_t *pMqttAgentContext)
Cancel all enqueued commands and those awaiting acknowledgment while the command loop is not running.
Definition: core_mqtt_agent.c:1081
MQTTStatus_t
Information used by each MQTT agent. A context will be initialized by MQTTAgent_Init(),...
Definition: core_mqtt_agent.h:185

Canceled commands will be terminated with return code MQTTRecvFailed.

Parameters
[in]pMqttAgentContextThe MQTT agent to use.
Note
This function is NOT thread-safe and should only be called from the context of the task responsible for MQTTAgent_CommandLoop.
Returns
MQTTBadParameter if an invalid context is given, else MQTTSuccess.

Example

// Variables used in this example.
MQTTStatus_t status;
MQTTAgentContext_t mqttAgentContext;
status = MQTTAgent_CommandLoop( &mqttAgentContext );
//An error was returned, but reconnection is not desired. Cancel all commands
//that are in the queue or awaiting an acknowledgment.
if( status != MQTTSuccess )
{
//Cancel commands so any completion callbacks will be invoked.
status = MQTTAgent_CancelAll( &mqttAgentContext );
}
Platform_DisconnectNetwork( mqttAgentContext.mqttContext.transportInterface.pNetworkContext );
MQTTStatus_t MQTTAgent_CommandLoop(MQTTAgentContext_t *pMqttAgentContext)
Process commands from the command queue in a loop.
Definition: core_mqtt_agent.c:996
MQTTSuccess
MQTTContext_t mqttContext
Definition: core_mqtt_agent.h:186
TransportInterface_t transportInterface
NetworkContext_t * pNetworkContext