aqhome: added functions AQH_ConnAckMqttMsg_GetResultFlags() and AQH_ConnAckMqttMsg_GetResultCode()
This commit is contained in:
@@ -57,6 +57,54 @@ void AQH_ConnAckMqttMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, con
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int AQH_ConnAckMqttMsg_GetResultFlags(const GWEN_MSG *msg)
|
||||||
|
{
|
||||||
|
const uint8_t *msgPtr;
|
||||||
|
uint32_t msgLen;
|
||||||
|
|
||||||
|
msgPtr=GWEN_Msg_GetConstBuffer(msg);
|
||||||
|
msgLen=GWEN_Msg_GetBytesInBuffer(msg);
|
||||||
|
|
||||||
|
if (msgLen>1) {
|
||||||
|
uint32_t payloadLen;
|
||||||
|
const uint8_t *payloadPtr;
|
||||||
|
|
||||||
|
payloadLen=GWEN_Msg_GetParsedPayloadSize(msg);
|
||||||
|
payloadPtr=msgPtr+GWEN_Msg_GetParsedPayloadOffset(msg);
|
||||||
|
|
||||||
|
if (payloadLen)
|
||||||
|
return (int) (payloadPtr[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GWEN_ERROR_GENERIC;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int AQH_ConnAckMqttMsg_GetResultCode(const GWEN_MSG *msg)
|
||||||
|
{
|
||||||
|
const uint8_t *msgPtr;
|
||||||
|
uint32_t msgLen;
|
||||||
|
|
||||||
|
msgPtr=GWEN_Msg_GetConstBuffer(msg);
|
||||||
|
msgLen=GWEN_Msg_GetBytesInBuffer(msg);
|
||||||
|
|
||||||
|
if (msgLen>1) {
|
||||||
|
uint32_t payloadLen;
|
||||||
|
const uint8_t *payloadPtr;
|
||||||
|
|
||||||
|
payloadLen=GWEN_Msg_GetParsedPayloadSize(msg);
|
||||||
|
payloadPtr=msgPtr+GWEN_Msg_GetParsedPayloadOffset(msg);
|
||||||
|
|
||||||
|
if (payloadLen>1)
|
||||||
|
return (int) (payloadPtr[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GWEN_ERROR_GENERIC;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,9 @@
|
|||||||
|
|
||||||
AQHOME_API GWEN_MSG *GWEN_ConnAckMqttMsg_new(uint8_t flags, uint8_t result);
|
AQHOME_API GWEN_MSG *GWEN_ConnAckMqttMsg_new(uint8_t flags, uint8_t result);
|
||||||
|
|
||||||
|
AQHOME_API int AQH_ConnAckMqttMsg_GetResultFlags(const GWEN_MSG *msg);
|
||||||
|
AQHOME_API int AQH_ConnAckMqttMsg_GetResultCode(const GWEN_MSG *msg);
|
||||||
|
|
||||||
AQHOME_API void AQH_ConnAckMqttMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
AQHOME_API void AQH_ConnAckMqttMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user