coreMQTT
v1.1.1
MQTT 3.1.1 Client Library
|
|
Get the packet ID of next pending publish to be resent.
This function will need to be called to get the packet for which a publish need to be sent when a session is reestablished. Calling this function repeatedly until packet id is 0 will give all the packets for which a publish need to be resent in the correct order.
- Parameters
-
[in] | pMqttContext | Initialized MQTT context. |
[in,out] | pCursor | Index at which to start searching. |
Example
bool sessionPresent;
uint16_t packetID;
status =
MQTT_Connect( pContext, &connectInfo, NULL, 100, &sessionPresent );
{
if( sessionPresent )
{
{
pResendPublish = getPublish( packetID );
pResendPublish->
dup =
true;
status =
MQTT_Publish( pContext, pResendPublish, packetID );
{
}
}
}
else
{
}
}
#define MQTT_STATE_CURSOR_INITIALIZER
Initializer value for an MQTTStateCursor_t, indicating a search should start at the beginning of a st...
Definition: core_mqtt_state.h:37
MQTT CONNECT packet parameters.
Definition: core_mqtt_serializer.h:134
uint16_t MQTT_PublishToResend(const MQTTContext_t *pMqttContext, MQTTStateCursor_t *pCursor)
Get the packet ID of next pending publish to be resent.
Definition: core_mqtt_state.c:1025
size_t MQTTStateCursor_t
Cursor for iterating through state records.
Definition: core_mqtt_state.h:43
MQTTStatus_t MQTT_Connect(MQTTContext_t *pContext, const MQTTConnectInfo_t *pConnectInfo, const MQTTPublishInfo_t *pWillInfo, uint32_t timeoutMs, bool *pSessionPresent)
Establish an MQTT session.
Definition: core_mqtt.c:1750
const char * pClientIdentifier
MQTT client identifier. Must be unique per client.
Definition: core_mqtt_serializer.h:148
MQTTStatus_t
Return codes from MQTT functions.
Definition: core_mqtt_serializer.h:91
uint16_t keepAliveSeconds
MQTT keep alive period.
Definition: core_mqtt_serializer.h:143
MQTTStatus_t MQTT_Publish(MQTTContext_t *pContext, const MQTTPublishInfo_t *pPublishInfo, uint16_t packetId)
Publishes a message to the given topic name.
Definition: core_mqtt.c:1907
A struct representing an MQTT connection.
Definition: core_mqtt.h:163
bool cleanSession
Whether to establish a new, clean session or resume a previous session.
Definition: core_mqtt_serializer.h:138
uint16_t clientIdentifierLength
Length of the client identifier.
Definition: core_mqtt_serializer.h:153
@ MQTTSuccess
Definition: core_mqtt_serializer.h:92
MQTT PUBLISH packet parameters.
Definition: core_mqtt_serializer.h:203
bool dup
Whether this is a duplicate publish message.
Definition: core_mqtt_serializer.h:217