Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions MQTTv5Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ status = MQTTPropertyBuilder_Init(&propBuilder, propBuffer, sizeof(propBuffer));
// Add session expiry
uint32_t sessionExpiry = 3600; // 1 hour
status = MQTTPropAdd_SessionExpiry(&propBuilder, sessionExpiry,
&(uint8_t){MQTT_PACKET_TYPE_CONNECT});
MQTT_PROP_VALIDATE_CONNECT);

// Add user property
MQTTUserProperty_t userProp = {
Expand All @@ -320,7 +320,7 @@ MQTTUserProperty_t userProp = {
.valueLength = strlen("sensor-001")
};
status = MQTTPropAdd_UserProp(&propBuilder, &userProp,
&(uint8_t){MQTT_PACKET_TYPE_CONNECT});
MQTT_PROP_VALIDATE_CONNECT);
```

3. **Pass the property builder to API functions:**
Expand Down Expand Up @@ -532,7 +532,7 @@ MQTTPropertyBuilder_Init(&pubProps, pubPropsBuf, sizeof(pubPropsBuf));

uint16_t topicAlias = 1;
MQTTPropAdd_TopicAlias(&pubProps, topicAlias,
&(uint8_t){MQTT_PACKET_TYPE_PUBLISH});
MQTT_PROP_VALIDATE_PUBLISH);

MQTTPublishInfo_t publishInfo = {
.qos = MQTTQoS1,
Expand Down Expand Up @@ -560,10 +560,10 @@ MQTTPropertyBuilder_Init(&pubProps, pubPropsBuf, sizeof(pubPropsBuf));

MQTTPropAdd_ResponseTopic(&pubProps, "response/topic",
strlen("response/topic"),
&(uint8_t){MQTT_PACKET_TYPE_PUBLISH});
MQTT_PROP_VALIDATE_PUBLISH);

MQTTPropAdd_CorrelationData(&pubProps, "req-123", strlen("req-123"),
&(uint8_t){MQTT_PACKET_TYPE_PUBLISH});
MQTT_PROP_VALIDATE_PUBLISH);

MQTT_Publish(&context, &publishInfo, packetId, &pubProps);

Expand Down Expand Up @@ -618,7 +618,7 @@ MQTTPropertyBuilder_Init(&connectProps, connectPropsBuf, sizeof(connectPropsBuf)
// Set session expiry to 1 hour
uint32_t sessionExpiry = 3600;
MQTTPropAdd_SessionExpiry(&connectProps, sessionExpiry,
&(uint8_t){MQTT_PACKET_TYPE_CONNECT});
MQTT_PROP_VALIDATE_CONNECT);

// Connect with session expiry
MQTT_Connect(&context, &connectInfo, NULL, 1000, &sessionPresent,
Expand All @@ -640,7 +640,7 @@ MQTTUserProperty_t deviceId = {
.valueLength = strlen("sensor-001")
};
MQTTPropAdd_UserProp(&pubProps, &deviceId,
&(uint8_t){MQTT_PACKET_TYPE_PUBLISH});
MQTT_PROP_VALIDATE_PUBLISH);

MQTTUserProperty_t timestamp = {
.pKey = "timestamp",
Expand All @@ -649,7 +649,7 @@ MQTTUserProperty_t timestamp = {
.valueLength = strlen("2024-01-23T10:30:00Z")
};
MQTTPropAdd_UserProp(&pubProps, &timestamp,
&(uint8_t){MQTT_PACKET_TYPE_PUBLISH});
MQTT_PROP_VALIDATE_PUBLISH);

MQTT_Publish(&context, &publishInfo, packetId, &pubProps);
```
Expand All @@ -664,7 +664,7 @@ MQTTPropertyBuilder_Init(&disconnectProps, disconnectPropsBuf,

MQTTPropAdd_ReasonString(&disconnectProps, "Shutting down for maintenance",
strlen("Shutting down for maintenance"),
&(uint8_t){MQTT_PACKET_TYPE_DISCONNECT});
MQTT_PROP_VALIDATE_DISCONNECT);

MQTTSuccessFailReasonCode_t reason = MQTT_REASON_DISCONNECT_NORMAL_DISCONNECTION;
MQTT_Disconnect(&context, &disconnectProps, &reason);
Expand Down
52 changes: 26 additions & 26 deletions MigrationGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ static bool eventCallback(
/* PUBREC is not a terminating packet — the library will send PUBREL next.
* pReasonCode and pSendPropsBuffer are valid here. */
*pReasonCode = MQTT_REASON_PUBREL_SUCCESS;
MQTTPropAdd_ReasonString( pSendPropsBuffer, "Success", 7, &(uint8_t){ MQTT_PACKET_TYPE_PUBREL } );
MQTTPropAdd_ReasonString( pSendPropsBuffer, "Success", 7, MQTT_PROP_NO_VALIDATE );
}
else
{
Expand Down Expand Up @@ -613,7 +613,7 @@ size bufLength = sizeof(buf);
MQTTPropertyBuilder_Init(&connectionProperties, buf, bufLength) ;

uint32_t sessionExpiryInterval = 100 ; // 100ms
MQTTPropAdd_SessionExpiry(&connectionProperties, sessionExpiryInterval, &(uint8_t){ MQTT_PACKET_TYPE_CONNECT } );
MQTTPropAdd_SessionExpiry(&connectionProperties, sessionExpiryInterval, MQTT_PROP_VALIDATE_CONNECT );

// Can also use the will properties in a similar way.

Expand Down Expand Up @@ -713,7 +713,7 @@ MQTTPropertyBuilder_Init(&propertyBuilder,
sizeof(propertyBuffer));

// Add subscription identifier property
MQTTPropAdd_SubscriptionId(&propertyBuilder, 1, &(uint8_t){ MQTT_PACKET_TYPE_SUBSCRIBE } );
MQTTPropAdd_SubscriptionId(&propertyBuilder, 1, MQTT_PROP_VALIDATE_SUBSCRIBE );

status = MQTT_Subscribe(&mqttContext,
subscriptionList,
Expand Down Expand Up @@ -810,8 +810,8 @@ MQTTPropertyBuilder_Init(&propertyBuilder,
sizeof(propertyBuffer));

// Add publish properties
MQTTPropAdd_PayloadFormat(&propertyBuilder, 1, &(uint8_t){ MQTT_PACKET_TYPE_PUBLISH } );
MQTTPropAdd_TopicAlias(&propertyBuilder, 1, &(uint8_t){ MQTT_PACKET_TYPE_PUBLISH } );
MQTTPropAdd_PayloadFormat(&propertyBuilder, 1, MQTT_PROP_VALIDATE_PUBLISH );
MQTTPropAdd_TopicAlias(&propertyBuilder, 1, MQTT_PROP_VALIDATE_PUBLISH );

status = MQTT_Publish(&mqttContext,
&publishInfo,
Expand Down Expand Up @@ -913,7 +913,7 @@ MQTTUserProperty_t userProperty = {
.pValue = "value",
.valueLength = strlen("value")
};
MQTTPropAdd_UserProp(&propertyBuilder, &userProperty, &(uint8_t){ MQTT_PACKET_TYPE_UNSUBSCRIBE } );
MQTTPropAdd_UserProp(&propertyBuilder, &userProperty, MQTT_PROP_VALIDATE_UNSUBSCRIBE );

status = MQTT_Unsubscribe(&mqttContext,
unsubscribeList,
Expand Down Expand Up @@ -983,7 +983,7 @@ MQTTPropertyBuilder_Init(&propertyBuilder,
MQTTPropAdd_ReasonString(&propertyBuilder,
"Normal shutdown",
strlen("Normal shutdown"),
&(uint8_t){ MQTT_PACKET_TYPE_DISCONNECT });
MQTT_PROP_VALIDATE_DISCONNECT);

MQTTSuccessFailReasonCode_t reason = MQTT_REASON_DISCONNECT_NORMAL_DISCONNECTION;
status = MQTT_Disconnect(&mqttContext,
Expand Down Expand Up @@ -1083,7 +1083,7 @@ MQTTPropertyBuilder_Init(&willProperties,
sizeof(willPropBuffer));

// Add properties as needed
MQTTPropAdd_SessionExpiry(&connectionProperties, 3600, &(uint8_t){ MQTT_PACKET_TYPE_CONNECT } );
MQTTPropAdd_SessionExpiry(&connectionProperties, 3600, MQTT_PROP_VALIDATE_CONNECT );
MQTTPropAdd_WillDelayInterval(&willProperties, 60, NULL );

status = MQTT_GetConnectPacketSize(&connectInfo,
Expand Down Expand Up @@ -1179,8 +1179,8 @@ MQTTPropertyBuilder_Init(&publishProperties,
sizeof(propBuffer));

// Add publish properties
MQTTPropAdd_TopicAlias(&publishProperties, 1, &(uint8_t){ MQTT_PACKET_TYPE_PUBLISH } );
MQTTPropAdd_PayloadFormat(&publishProperties, 1, &(uint8_t){ MQTT_PACKET_TYPE_PUBLISH } );
MQTTPropAdd_TopicAlias(&publishProperties, 1, MQTT_PROP_VALIDATE_PUBLISH );
MQTTPropAdd_PayloadFormat(&publishProperties, 1, MQTT_PROP_VALIDATE_PUBLISH );

// Get max packet size from CONNACK properties
uint32_t serverMaxPacketSize = pContext->connectionProperties.serverMaxPacketSize; // Value from server
Expand Down Expand Up @@ -1274,7 +1274,7 @@ MQTTPropertyBuilder_Init(&subscribeProperties,
sizeof(propBuffer));

// Add subscription identifier
MQTTPropAdd_SubscriptionId(&subscribeProperties, 1, &(uint8_t){ MQTT_PACKET_TYPE_SUBSCRIBE } );
MQTTPropAdd_SubscriptionId(&subscribeProperties, 1, MQTT_PROP_VALIDATE_SUBSCRIBE );

// Get max packet size from CONNACK properties
uint32_t serverMaxPacketSize = pContext->connectionProperties.serverMaxPacketSize; // value from server
Expand Down Expand Up @@ -1377,7 +1377,7 @@ MQTTUserProperty_t userProperty = {
.pValue = "value",
.valueLength = strlen("value")
};
MQTTPropAdd_UserProp(&unsubscribeProperties, &userProperty, &(uint8_t){ MQTT_PACKET_TYPE_UNSUBSCRIBE } );
MQTTPropAdd_UserProp(&unsubscribeProperties, &userProperty, MQTT_PROP_VALIDATE_UNSUBSCRIBE );

// Get max packet size from CONNACK properties
uint32_t serverMaxPacketSize = pContext->connectionProperties.serverMaxPacketSize; // Value from server
Expand Down Expand Up @@ -1455,11 +1455,11 @@ MQTTPropertyBuilder_Init(&disconnectProperties,
sizeof(propBuffer));

// Add disconnect properties
MQTTPropAdd_SessionExpiry(&disconnectProperties, 0, &(uint8_t){ MQTT_PACKET_TYPE_DISCONNECT } );
MQTTPropAdd_SessionExpiry(&disconnectProperties, 0, MQTT_PROP_VALIDATE_DISCONNECT );
MQTTPropAdd_ReasonString(&disconnectProperties,
"Normal shutdown",
strlen("Normal shutdown"),
&(uint8_t){ MQTT_PACKET_TYPE_DISCONNECT } );
MQTT_PROP_VALIDATE_DISCONNECT );

MQTTSuccessFailReasonCode_t reason = MQTT_REASON_DISCONNECT_NORMAL_DISCONNECTION;
status = MQTT_GetDisconnectPacketSize(&disconnectProperties,
Expand Down Expand Up @@ -1587,8 +1587,8 @@ MQTTPropertyBuilder_Init(&willProperties,
sizeof(willPropBuffer));

// Add connect properties
MQTTPropAdd_SessionExpiry(&connectionProperties, 3600, &(uint8_t){ MQTT_PACKET_TYPE_CONNECT } );
MQTTPropAdd_MaxPacketSize(&connectionProperties, 1024, &(uint8_t){ MQTT_PACKET_TYPE_CONNECT } );
MQTTPropAdd_SessionExpiry(&connectionProperties, 3600, MQTT_PROP_VALIDATE_CONNECT );
MQTTPropAdd_MaxPacketSize(&connectionProperties, 1024, MQTT_PROP_VALIDATE_CONNECT );

// Add will properties if using will message
MQTTPropAdd_WillDelayInterval(&willProperties, 60, NULL );
Expand Down Expand Up @@ -1723,9 +1723,9 @@ MQTTPropertyBuilder_Init(&publishProperties,
sizeof(propBuffer));

// Add publish properties
MQTTPropAdd_PayloadFormat(&publishProperties, 1, &(uint8_t){ MQTT_PACKET_TYPE_PUBLISH } );
MQTTPropAdd_TopicAlias(&publishProperties, 1, &(uint8_t){ MQTT_PACKET_TYPE_PUBLISH } );
MQTTPropAdd_MessageExpiry(&publishProperties, 3600, &(uint8_t){ MQTT_PACKET_TYPE_PUBLISH } );
MQTTPropAdd_PayloadFormat(&publishProperties, 1, MQTT_PROP_VALIDATE_PUBLISH );
MQTTPropAdd_TopicAlias(&publishProperties, 1, MQTT_PROP_VALIDATE_PUBLISH );
MQTTPropAdd_MessageExpiry(&publishProperties, 3600, MQTT_PROP_VALIDATE_PUBLISH );

// Get remaining length first
status = MQTT_GetPublishPacketSize(&publishInfo,
Expand Down Expand Up @@ -1863,9 +1863,9 @@ MQTTPropertyBuilder_Init(&publishProperties,
sizeof(propBuffer));

// Add publish properties
MQTTPropAdd_PayloadFormat(&publishProperties, 1, &(uint8_t){ MQTT_PACKET_TYPE_PUBLISH } );
MQTTPropAdd_TopicAlias(&publishProperties, 1, &(uint8_t){ MQTT_PACKET_TYPE_PUBLISH } );
MQTTPropAdd_MessageExpiry(&publishProperties, 3600, &(uint8_t){ MQTT_PACKET_TYPE_PUBLISH } );
MQTTPropAdd_PayloadFormat(&publishProperties, 1, MQTT_PROP_VALIDATE_PUBLISH );
MQTTPropAdd_TopicAlias(&publishProperties, 1, MQTT_PROP_VALIDATE_PUBLISH );
MQTTPropAdd_MessageExpiry(&publishProperties, 3600, MQTT_PROP_VALIDATE_PUBLISH );

// Get remaining length first
status = MQTT_GetPublishPacketSize(&publishInfo,
Expand Down Expand Up @@ -2003,7 +2003,7 @@ MQTTPropertyBuilder_Init(&subscribeProperties,
sizeof(propBuffer));

// Add subscription identifier
MQTTPropAdd_SubscriptionId(&subscribeProperties, 1, &(uint8_t){ MQTT_PACKET_TYPE_SUBSCRIBE } );
MQTTPropAdd_SubscriptionId(&subscribeProperties, 1, MQTT_PROP_VALIDATE_SUBSCRIBE );

// Get remaining length first
status = MQTT_GetSubscribePacketSize(subscriptionList,
Expand Down Expand Up @@ -2141,7 +2141,7 @@ MQTTUserProperty_t userProperty = {
.pValue = "value",
.valueLength = strlen("value")
};
MQTTPropAdd_UserProp(&unsubscribeProperties, &userProperty, &(uint8_t){ MQTT_PACKET_TYPE_UNSUBSCRIBE } );
MQTTPropAdd_UserProp(&unsubscribeProperties, &userProperty, MQTT_PROP_VALIDATE_UNSUBSCRIBE );

// Get remaining length first
status = MQTT_GetUnsubscribePacketSize(subscriptionList,
Expand Down Expand Up @@ -2242,11 +2242,11 @@ MQTTPropertyBuilder_Init(&disconnectProperties,
sizeof(propBuffer));

// Add disconnect properties
MQTTPropAdd_SessionExpiry(&disconnectProperties, 0, &(uint8_t){ MQTT_PACKET_TYPE_DISCONNECT } );
MQTTPropAdd_SessionExpiry(&disconnectProperties, 0, MQTT_PROP_VALIDATE_DISCONNECT );
MQTTPropAdd_ReasonString(&disconnectProperties,
"Normal shutdown",
strlen("Normal shutdown"),
&(uint8_t){ MQTT_PACKET_TYPE_DISCONNECT } );
MQTT_PROP_VALIDATE_DISCONNECT );

// Get remaining length first
MQTTSuccessFailReasonCode_t reason = MQTT_REASON_DISCONNECT_NORMAL_DISCONNECTION;
Expand Down
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,61 @@ connectInfo.userNameLength = USERNAME_STRING_LENGTH;
mqttStatus = MQTT_Connect( pMqttContext, &connectInfo, NULL, CONNACK_RECV_TIMEOUT_MS, pSessionPresent, NULL, NULL );
```

## Thread Safety

coreMQTT is a single-threaded protocol engine: a given `MQTTContext_t` is
**not** safe to use concurrently from multiple threads. The `MQTT_ProcessLoop`,
`MQTT_ReceiveLoop`, and publish/subscribe APIs all read and mutate fields in
the context (timestamps, state records, in-flight packet IDs, etc.) without
internal locking.

If your application calls coreMQTT APIs from more than one thread — for
example, an MQTT receive loop in one task and application-originated
`MQTT_Publish` calls from another — you must serialize access to the context
yourself. The library provides two extension points for that purpose:

- `MQTT_PRE_STATE_UPDATE_HOOK( pContext )` — invoked immediately before the
library reads or writes shared context state.
- `MQTT_POST_STATE_UPDATE_HOOK( pContext )` — invoked immediately after the
corresponding read or write completes.

Both macros expand to nothing by default. Define them in your
`core_mqtt_config.h` (or via the compiler command line) to acquire and release
a mutex that protects the context. Sketch for FreeRTOS:

```c
/* In core_mqtt_config.h */
#include "FreeRTOS.h"
#include "semphr.h"

/* Application provides one mutex per MQTT context and stores a pointer to it
* reachable from the context — for example, inside the NetworkContext or a
* parallel lookup table keyed by pContext. */
extern SemaphoreHandle_t getMutexForContext( const MQTTContext_t * pContext );

#define MQTT_PRE_STATE_UPDATE_HOOK( pContext ) \
( void ) xSemaphoreTake( getMutexForContext( pContext ), portMAX_DELAY )

#define MQTT_POST_STATE_UPDATE_HOOK( pContext ) \
( void ) xSemaphoreGive( getMutexForContext( pContext ) )
```

Notes:

- The library calls the hooks in matched pre/post pairs around individual
state accesses; it does not re-enter a hook-protected region from inside
another one, so a non-recursive mutex is sufficient. A recursive mutex
also works if you prefer one for defense in depth.
- The hooks surround individual state accesses, not whole API calls. If you
also need atomicity across a full `MQTT_Publish` invocation from the
application's point of view, take a second application-level lock around
the API call.
- On a single-threaded system (for example, cooperative scheduling with one
task owning the MQTT stack), leave the hooks undefined.
- The transport `send` / `recv` callbacks are not called from inside the
hooks, so your transport implementation does not need to be reentrant with
respect to the mutex.

## Upgrading to v5.0.0

coreMQTT v5.0.0 adds MQTT v5.0 protocol support with breaking API changes.
Expand Down
19 changes: 8 additions & 11 deletions source/include/core_mqtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ MQTTStatus_t MQTT_Init( MQTTContext_t * pContext,
* @param[in] incomingPublishCount Maximum number of records which can be kept in the memory
* pointed to by @p pIncomingPublishRecords.
* @param[in] pAckPropsBuf Pointer to memory which will be used to store properties of outgoing publish-ACKS.
* @param[in] ackPropsBufLength Length of the buffer pointed to by @p pBuffer.
* @param[in] ackPropsBufLength Length of the buffer pointed to by @p pAckPropsBuf.
* @return #MQTTBadParameter if invalid parameters are passed;<br>
* #MQTTSuccess otherwise.<br>
*
Expand Down Expand Up @@ -637,8 +637,6 @@ MQTTStatus_t MQTT_InitStatefulQoS( MQTTContext_t * pContext,
* // User defined callback used to clear a particular copied publish packet
* bool publishClearCallback(struct MQTTContext* pContext,
* uint16_t packetId);
* // User defined callback used to clear all copied publish packets
* bool publishClearAllCallback(struct MQTTContext* pContext);
*
* MQTTContext_t mqttContext;
* TransportInterface_t transport;
Expand Down Expand Up @@ -678,8 +676,7 @@ MQTTStatus_t MQTT_InitStatefulQoS( MQTTContext_t * pContext,
* {
* status = MQTT_InitRetransmits( &mqttContext, publishStoreCallback,
* publishRetrieveCallback,
* publishClearCallback,
* publishClearAllCallback );
* publishClearCallback );
*
* // Now unacked Publishes can be resent on an unclean session resumption.
* }
Expand All @@ -700,7 +697,7 @@ MQTTStatus_t MQTT_InitRetransmits( MQTTContext_t * pContext,
*
* @return #MQTTBadParameter if invalid parameters are passed;
* #MQTTStatusConnected if the MQTT connection is established with the broker.
* #MQTTStatusNotConnected if the MQTT connection is broker.
* #MQTTStatusNotConnected if the MQTT connection is not established with the broker.
* #MQTTStatusDisconnectPending if Transport Interface has failed and MQTT connection needs to be closed.
*
* <b>Example</b>
Expand Down Expand Up @@ -840,7 +837,7 @@ MQTTStatus_t MQTT_CheckConnectStatus( const MQTTContext_t * pContext );
*
* // Set a property in the connectPropsBuilder
* uint32_t maxPacketSize = 100 ;
* status = MQTTPropAdd_MaxPacketSize(&connectPropsBuilder, maxPacketSize, &(uint8_t){ MQTT_PACKET_TYPE_CONNECT });
* status = MQTTPropAdd_MaxPacketSize(&connectPropsBuilder, maxPacketSize, MQTT_PROP_VALIDATE_CONNECT);
*
* // The last will and testament is optional, it will be published by the broker
* // should this client disconnect without sending a DISCONNECT packet.
Expand Down Expand Up @@ -930,7 +927,7 @@ MQTTStatus_t MQTT_Connect( MQTTContext_t * pContext,
* size_t propertyBufferLength = sizeof( propertyBuffer );
* status = MQTTPropertyBuilder_Init( &propertyBuilder, propertyBuffer, propertyBufferLength );
*
* status = MQTTPropAdd_SubscriptionId(&propertyBuilder, 1, &(uint8_t){ MQTT_PACKET_TYPE_SUBSCRIBE });
* status = MQTTPropAdd_SubscriptionId(&propertyBuilder, 1, MQTT_PROP_VALIDATE_SUBSCRIBE);
*
* // Obtain a new packet id for the subscription.
* packetId = MQTT_GetPacketId( pContext );
Expand Down Expand Up @@ -1011,7 +1008,7 @@ MQTTStatus_t MQTT_Subscribe( MQTTContext_t * pContext,
* status = MQTTPropertyBuilder_Init( &propertyBuilder, propertyBuffer, propertyBufferLength );
*
* // Set a property in the propertyBuilder
* status = MQTTPropAdd_PayloadFormat( &propertyBuilder, 1, &(uint8_t){ MQTT_PACKET_TYPE_PUBLISH });
* status = MQTTPropAdd_PayloadFormat( &propertyBuilder, 1, MQTT_PROP_VALIDATE_PUBLISH);
*
* // Packet ID is needed for QoS > 0.
* packetId = MQTT_GetPacketId( pContext );
Expand Down Expand Up @@ -1130,7 +1127,7 @@ MQTTStatus_t MQTT_Ping( MQTTContext_t * pContext );
* userProperty.pValue = "value";
* userProperty.valueLength = strlen( userProperty.pValue );
*
* status = MQTTPropAdd_UserProp( &propertyBuilder, &userProperty, &(uint8_t){ MQTT_PACKET_TYPE_UNSUBSCRIBE });
* status = MQTTPropAdd_UserProp( &propertyBuilder, &userProperty, MQTT_PROP_VALIDATE_UNSUBSCRIBE);
*
* status = MQTT_Unsubscribe( pContext, &unsubscribeList[ 0 ], NUMBER_OF_SUBSCRIPTIONS, packetId, &propertyBuilder );
*
Expand Down Expand Up @@ -1184,7 +1181,7 @@ MQTTStatus_t MQTT_Unsubscribe( MQTTContext_t * pContext,
* status = MQTTPropertyBuilder_Init( &propertyBuilder, propertyBuffer, propertyBufferLength );
*
* // Set a property in the propertyBuilder
* status = MQTTPropAdd_ReasonString( &propertyBuilder, "Disconnecting", 13, &(uint8_t){ MQTT_PACKET_TYPE_DISCONNECT });
* status = MQTTPropAdd_ReasonString( &propertyBuilder, "Disconnecting", 13, MQTT_PROP_VALIDATE_DISCONNECT);
*
* MQTTSuccessFailReasonCode_t reason = MQTT_REASON_DISCONNECT_NORMAL_DISCONNECTION;
* status = MQTT_Disconnect( pContext, &propertyBuilder, &reason );
Expand Down
Loading
Loading