Skip to content

Commit

Permalink
Fix for MQTT v5 property name typo.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarske committed Apr 27, 2020
1 parent 2094c31 commit 3c8d752
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/mqttclient/mqttclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ static int mqtt_property_cb(MqttClient *client, MqttProp *head, void *ctx)
PRINTF("Reason String: %s", prop->data_str.str);
break;

case MQTT_PROP_PLAYLOAD_FORMAT_IND:
case MQTT_PROP_PAYLOAD_FORMAT_IND:
case MQTT_PROP_MSG_EXPIRY_INTERVAL:
case MQTT_PROP_CONTENT_TYPE:
case MQTT_PROP_RESP_TOPIC:
Expand Down Expand Up @@ -428,7 +428,7 @@ int mqttclient_test(MQTTCtx *mqttCtx)
{
/* Payload Format Indicator */
MqttProp* prop = MqttClient_PropsAdd(&mqttCtx->publish.props);
prop->type = MQTT_PROP_PLAYLOAD_FORMAT_IND;
prop->type = MQTT_PROP_PAYLOAD_FORMAT_IND;
prop->data_int = 1;
}
{
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt_packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct MqttPropMatrix {
};
static const struct MqttPropMatrix gPropMatrix[] = {
{ MQTT_PROP_NONE, MQTT_DATA_TYPE_NONE, 0 },
{ MQTT_PROP_PLAYLOAD_FORMAT_IND, MQTT_DATA_TYPE_BYTE,
{ MQTT_PROP_PAYLOAD_FORMAT_IND, MQTT_DATA_TYPE_BYTE,
(1 << MQTT_PACKET_TYPE_PUBLISH) },
{ MQTT_PROP_MSG_EXPIRY_INTERVAL, MQTT_DATA_TYPE_INT,
(1 << MQTT_PACKET_TYPE_PUBLISH) },
Expand Down
5 changes: 4 additions & 1 deletion wolfmqtt/mqtt_packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ typedef enum MqttDataType {
/* PROPERTIES */
typedef enum MqttPropertyType {
MQTT_PROP_NONE = 0,
MQTT_PROP_PLAYLOAD_FORMAT_IND = 1,
MQTT_PROP_PAYLOAD_FORMAT_IND = 1,
MQTT_PROP_MSG_EXPIRY_INTERVAL = 2,
MQTT_PROP_CONTENT_TYPE = 3,
MQTT_PROP_RESP_TOPIC = 8,
Expand Down Expand Up @@ -92,6 +92,9 @@ typedef enum MqttPropertyType {
MQTT_PROP_TYPE_MAX = 0xFF
} MqttPropertyType;

/* backwards compatibility for anyone using the typo name */
#define MQTT_PROP_PLAYLOAD_FORMAT_IND MQTT_PROP_PAYLOAD_FORMAT_IND

struct _MqttProp_Str {
word16 len;
char *str;
Expand Down

0 comments on commit 3c8d752

Please sign in to comment.