aqhome: fixed mqtt message handling
PUBLISH: the message itself is NOT preceeded by size
This commit is contained in:
@@ -474,6 +474,7 @@ int _calcAndSetPayloadSizeAndOffset(GWEN_MSG *msg)
|
||||
if (remainingBytesInBuffer>1) {
|
||||
const uint8_t *ptr;
|
||||
int idx;
|
||||
int shift=0;
|
||||
|
||||
ptr=GWEN_Msg_GetConstBuffer(msg);
|
||||
idx=1;
|
||||
@@ -482,8 +483,7 @@ int _calcAndSetPayloadSizeAndOffset(GWEN_MSG *msg)
|
||||
uint8_t len;
|
||||
|
||||
len=ptr[idx];
|
||||
mqttRemainingLength<<=8;
|
||||
mqttRemainingLength+=(len & 0x7f);
|
||||
mqttRemainingLength+=(len & 0x7f)<<shift;
|
||||
if (!(len & 0x80)) {
|
||||
/* last byte of size */
|
||||
GWEN_Msg_SetParsedPayloadSize(msg, mqttRemainingLength);
|
||||
@@ -491,6 +491,9 @@ int _calcAndSetPayloadSizeAndOffset(GWEN_MSG *msg)
|
||||
GWEN_Msg_AddFlags(msg, GWEN_MSG_FLAGS_PAYLOADINFO_SET);
|
||||
return 1; /* size successfully determined */
|
||||
}
|
||||
shift+=7;
|
||||
idx++;
|
||||
remainingBytesInBuffer--;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user