|
|
|
|
@ -117,7 +117,7 @@ char* MQTTFormat_toClientString(char* strbuf, int32_t strbuflen, uint8_t* buf, i
|
|
|
|
|
int32_t index = 0;
|
|
|
|
|
int32_t rem_length = 0;
|
|
|
|
|
MQTTHeader header = {0};
|
|
|
|
|
int32_t strindex = 0;
|
|
|
|
|
//int32_t strindex = 0;
|
|
|
|
|
|
|
|
|
|
header.byte = buf[index++];
|
|
|
|
|
index += MQTTPacket_decodeBuf(&buf[index], &rem_length);
|
|
|
|
|
@ -128,7 +128,7 @@ char* MQTTFormat_toClientString(char* strbuf, int32_t strbuflen, uint8_t* buf, i
|
|
|
|
|
{
|
|
|
|
|
uint8_t sessionPresent, connack_rc;
|
|
|
|
|
if (MQTTDeserialize_connack(&sessionPresent, &connack_rc, buf, buflen) == 1)
|
|
|
|
|
strindex = MQTTStringFormat_connack(strbuf, strbuflen, connack_rc, sessionPresent);
|
|
|
|
|
/*strindex = */MQTTStringFormat_connack(strbuf, strbuflen, connack_rc, sessionPresent);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case PUBLISH:
|
|
|
|
|
@ -141,7 +141,7 @@ char* MQTTFormat_toClientString(char* strbuf, int32_t strbuflen, uint8_t* buf, i
|
|
|
|
|
|
|
|
|
|
if (MQTTDeserialize_publish(&dup, &qos, &retained, &packetid, &topicName,
|
|
|
|
|
&payload, &payloadlen, buf, buflen) == 1)
|
|
|
|
|
strindex = MQTTStringFormat_publish(strbuf, strbuflen, dup, qos, retained,
|
|
|
|
|
/*strindex = */MQTTStringFormat_publish(strbuf, strbuflen, dup, qos, retained,
|
|
|
|
|
packetid, topicName, payload, payloadlen);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
@ -153,7 +153,7 @@ char* MQTTFormat_toClientString(char* strbuf, int32_t strbuflen, uint8_t* buf, i
|
|
|
|
|
uint8_t packettype, dup;
|
|
|
|
|
uint16_t packetid;
|
|
|
|
|
if (MQTTDeserialize_ack(&packettype, &dup, &packetid, buf, buflen) == 1)
|
|
|
|
|
strindex = MQTTStringFormat_ack(strbuf, strbuflen, packettype, dup, packetid);
|
|
|
|
|
/*strindex = */MQTTStringFormat_ack(strbuf, strbuflen, packettype, dup, packetid);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case SUBACK:
|
|
|
|
|
@ -162,20 +162,20 @@ char* MQTTFormat_toClientString(char* strbuf, int32_t strbuflen, uint8_t* buf, i
|
|
|
|
|
int32_t maxcount = 1, count = 0;
|
|
|
|
|
int32_t grantedQoSs[1];
|
|
|
|
|
if (MQTTDeserialize_suback(&packetid, maxcount, &count, grantedQoSs, buf, buflen) == 1)
|
|
|
|
|
strindex = MQTTStringFormat_suback(strbuf, strbuflen, packetid, count, grantedQoSs);
|
|
|
|
|
/*strindex = */MQTTStringFormat_suback(strbuf, strbuflen, packetid, count, grantedQoSs);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case UNSUBACK:
|
|
|
|
|
{
|
|
|
|
|
uint16_t packetid;
|
|
|
|
|
if (MQTTDeserialize_unsuback(&packetid, buf, buflen) == 1)
|
|
|
|
|
strindex = MQTTStringFormat_ack(strbuf, strbuflen, UNSUBACK, 0, packetid);
|
|
|
|
|
/*strindex = */MQTTStringFormat_ack(strbuf, strbuflen, UNSUBACK, 0, packetid);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case PINGREQ:
|
|
|
|
|
case PINGRESP:
|
|
|
|
|
case DISCONNECT:
|
|
|
|
|
strindex = snprintf(strbuf, strbuflen, "%s", MQTTPacket_names[header.bits.type]);
|
|
|
|
|
/*strindex = */snprintf(strbuf, strbuflen, "%s", MQTTPacket_names[header.bits.type]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -188,7 +188,7 @@ char* MQTTFormat_toServerString(char* strbuf, int32_t strbuflen, uint8_t* buf, i
|
|
|
|
|
int32_t index = 0;
|
|
|
|
|
int32_t rem_length = 0;
|
|
|
|
|
MQTTHeader header = {0};
|
|
|
|
|
int32_t strindex = 0;
|
|
|
|
|
//int32_t strindex = 0;
|
|
|
|
|
|
|
|
|
|
header.byte = buf[index++];
|
|
|
|
|
index += MQTTPacket_decodeBuf(&buf[index], &rem_length);
|
|
|
|
|
@ -201,7 +201,7 @@ char* MQTTFormat_toServerString(char* strbuf, int32_t strbuflen, uint8_t* buf, i
|
|
|
|
|
int32_t rc;
|
|
|
|
|
|
|
|
|
|
if ((rc = MQTTDeserialize_connect(&data, buf, buflen)) == 1)
|
|
|
|
|
strindex = MQTTStringFormat_connect(strbuf, strbuflen, &data);
|
|
|
|
|
/*strindex = */MQTTStringFormat_connect(strbuf, strbuflen, &data);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case PUBLISH:
|
|
|
|
|
@ -214,7 +214,7 @@ char* MQTTFormat_toServerString(char* strbuf, int32_t strbuflen, uint8_t* buf, i
|
|
|
|
|
|
|
|
|
|
if (MQTTDeserialize_publish(&dup, &qos, &retained, &packetid, &topicName,
|
|
|
|
|
&payload, &payloadlen, buf, buflen) == 1)
|
|
|
|
|
strindex = MQTTStringFormat_publish(strbuf, strbuflen, dup, qos, retained,
|
|
|
|
|
/*strindex = */MQTTStringFormat_publish(strbuf, strbuflen, dup, qos, retained,
|
|
|
|
|
packetid, topicName, payload, payloadlen);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
@ -227,7 +227,7 @@ char* MQTTFormat_toServerString(char* strbuf, int32_t strbuflen, uint8_t* buf, i
|
|
|
|
|
uint16_t packetid;
|
|
|
|
|
|
|
|
|
|
if (MQTTDeserialize_ack(&packettype, &dup, &packetid, buf, buflen) == 1)
|
|
|
|
|
strindex = MQTTStringFormat_ack(strbuf, strbuflen, packettype, dup, packetid);
|
|
|
|
|
/*strindex = */MQTTStringFormat_ack(strbuf, strbuflen, packettype, dup, packetid);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case SUBSCRIBE:
|
|
|
|
|
@ -240,7 +240,7 @@ char* MQTTFormat_toServerString(char* strbuf, int32_t strbuflen, uint8_t* buf, i
|
|
|
|
|
|
|
|
|
|
if (MQTTDeserialize_subscribe(&dup, &packetid, maxcount, &count,
|
|
|
|
|
topicFilters, requestedQoSs, buf, buflen) == 1)
|
|
|
|
|
strindex = MQTTStringFormat_subscribe(strbuf, strbuflen, dup, packetid, count, topicFilters, requestedQoSs);;
|
|
|
|
|
/*strindex = */MQTTStringFormat_subscribe(strbuf, strbuflen, dup, packetid, count, topicFilters, requestedQoSs);;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case UNSUBSCRIBE:
|
|
|
|
|
@ -250,13 +250,13 @@ char* MQTTFormat_toServerString(char* strbuf, int32_t strbuflen, uint8_t* buf, i
|
|
|
|
|
int32_t maxcount = 1, count = 0;
|
|
|
|
|
MQTTString topicFilters[1];
|
|
|
|
|
if (MQTTDeserialize_unsubscribe(&dup, &packetid, maxcount, &count, topicFilters, buf, buflen) == 1)
|
|
|
|
|
strindex = MQTTStringFormat_unsubscribe(strbuf, strbuflen, dup, packetid, count, topicFilters);
|
|
|
|
|
/*strindex = */MQTTStringFormat_unsubscribe(strbuf, strbuflen, dup, packetid, count, topicFilters);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case PINGREQ:
|
|
|
|
|
case PINGRESP:
|
|
|
|
|
case DISCONNECT:
|
|
|
|
|
strindex = snprintf(strbuf, strbuflen, "%s", MQTTPacket_names[header.bits.type]);
|
|
|
|
|
/*strindex = */snprintf(strbuf, strbuflen, "%s", MQTTPacket_names[header.bits.type]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|