aqhome: adapted to latest changes.
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "aqhome/msg/msg_value.h"
|
#include "aqhome/msg/msg_value.h"
|
||||||
#include "aqhome/msg/msg_value2.h"
|
#include "aqhome/msg/msg_value2.h"
|
||||||
|
#include "aqhome/msg/msg_value3.h"
|
||||||
#include "aqhome/msg/msg_sendstats.h"
|
#include "aqhome/msg/msg_sendstats.h"
|
||||||
#include "aqhome/msg/msg_recvstats.h"
|
#include "aqhome/msg/msg_recvstats.h"
|
||||||
#include "aqhome/msg/msg_memstats.h"
|
#include "aqhome/msg/msg_memstats.h"
|
||||||
@@ -77,29 +78,33 @@ void AqHomed_LogTtyMsg(AQHOMED *aqh, const GWEN_MSG *msg)
|
|||||||
|
|
||||||
if (msgIsValid) {
|
if (msgIsValid) {
|
||||||
switch(msgType) {
|
switch(msgType) {
|
||||||
case AQH_MSG_TYPE_PING: AQH_PingMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_PING: AQH_PingMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_PONG: AQH_PongMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_PONG: AQH_PongMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_COMSENDSTATS: AQH_SendStatsMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_COMSENDSTATS: AQH_SendStatsMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_COMRECVSTATS: AQH_RecvStatsMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_COMRECVSTATS: AQH_RecvStatsMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_TWIBUSMEMBER: AQH_NodeMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_TWIBUSMEMBER: AQH_NodeMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_DEBUG: AQH_NodeMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_DEBUG: AQH_NodeMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_VALUE: AQH_ValueMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_VALUE: AQH_ValueMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_VALUE2: AQH_Value2Msg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_VALUE2: AQH_Value2Msg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_NEED_ADDRESS: AQH_NeedAddrMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_NEED_ADDRESS: AQH_NeedAddrMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_CLAIM_ADDRESS: AQH_ClaimAddrMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_CLAIM_ADDRESS: AQH_ClaimAddrMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_HAVE_ADDRESS: AQH_HaveAddrMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_HAVE_ADDRESS: AQH_HaveAddrMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_DENY_ADDRESS: AQH_DenyAddrMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_DENY_ADDRESS: AQH_DenyAddrMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_DEVICE: AQH_DeviceMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_DEVICE: AQH_DeviceMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_MEMSTATS: AQH_MemStatsMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_MEMSTATS: AQH_MemStatsMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_SYSSTATS: AQH_SysStatsMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_SYSSTATS: AQH_SysStatsMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_FLASH_READY: AQH_FlashReadyMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_FLASH_READY: AQH_FlashReadyMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_FLASH_START: AQH_FlashStartMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_FLASH_START: AQH_FlashStartMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_FLASH_RSP: AQH_FlashResponseMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_FLASH_RSP: AQH_FlashResponseMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_FLASH_END: AQH_FlashEndMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_FLASH_END: AQH_FlashEndMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_FLASH_DATA: AQH_FlashDataMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_FLASH_DATA: AQH_FlashDataMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_REBOOT_REQ: AQH_RebootRequestMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_REBOOT_REQ: AQH_RebootRequestMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
case AQH_MSG_TYPE_REBOOT_RSP: AQH_RebootResponseMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_REBOOT_RSP: AQH_RebootResponseMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
default: AQH_NodeMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
case AQH_MSG_TYPE_VALUE_REPORT:
|
||||||
|
case AQH_MSG_TYPE_VALUE_SET:
|
||||||
|
case AQH_MSG_TYPE_VALUE_SET_ACK:
|
||||||
|
case AQH_MSG_TYPE_VALUE_SET_NACK: AQH_Value3Msg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
|
default: AQH_NodeMsg_DumpToBuffer(msg, dbuf, "received"); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ int _sendFlashStart(GWEN_MSG_ENDPOINT *epTcp, unsigned int uid)
|
|||||||
GWEN_MSG *msgNode;
|
GWEN_MSG *msgNode;
|
||||||
GWEN_MSG *msgOut;
|
GWEN_MSG *msgOut;
|
||||||
|
|
||||||
msgNode=AQH_FlashStartMsg_new(0, 0xc1, AQH_MSG_TYPE_FLASH_START, uid, 0, 0);
|
msgNode=AQH_FlashStartMsg_new(0, 0xc1, AQH_MSG_TYPE_FLASH_START, uid);
|
||||||
if (msgNode==NULL) {
|
if (msgNode==NULL) {
|
||||||
DBG_ERROR(NULL, "Error creating message");
|
DBG_ERROR(NULL, "Error creating message");
|
||||||
return GWEN_ERROR_GENERIC;
|
return GWEN_ERROR_GENERIC;
|
||||||
|
|||||||
@@ -19,15 +19,12 @@
|
|||||||
|
|
||||||
|
|
||||||
#define AQH_MSG_OFFS_FLASHSTART_UID 0 /* 4 bytes */
|
#define AQH_MSG_OFFS_FLASHSTART_UID 0 /* 4 bytes */
|
||||||
#define AQH_MSG_OFFS_FLASHSTART_FWTYPE 4 /* 2 bytes */
|
|
||||||
#define AQH_MSG_OFFS_FLASHSTART_FWVER 6 /* 2 bytes */
|
|
||||||
|
|
||||||
#define AQH_MSG_FLASHSTART_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_FLASHSTART_FWVER+2)
|
#define AQH_MSG_FLASHSTART_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_FLASHSTART_UID+4)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GWEN_MSG *AQH_FlashStartMsg_new(uint8_t srcAddr, uint8_t destAddr, uint8_t code,
|
GWEN_MSG *AQH_FlashStartMsg_new(uint8_t srcAddr, uint8_t destAddr, uint8_t code, uint32_t uid)
|
||||||
uint32_t uid, uint16_t firmwareType, uint16_t firmwareVersion)
|
|
||||||
{
|
{
|
||||||
GWEN_MSG *msg;
|
GWEN_MSG *msg;
|
||||||
uint8_t *ptr;
|
uint8_t *ptr;
|
||||||
@@ -41,12 +38,6 @@ GWEN_MSG *AQH_FlashStartMsg_new(uint8_t srcAddr, uint8_t destAddr, uint8_t code,
|
|||||||
*(ptr++)=(uid>>16) & 0xff;
|
*(ptr++)=(uid>>16) & 0xff;
|
||||||
*(ptr++)=(uid>>24) & 0xff;
|
*(ptr++)=(uid>>24) & 0xff;
|
||||||
|
|
||||||
*(ptr++)=firmwareType & 0xff; /* fw type */
|
|
||||||
*(ptr++)=(firmwareType>>8) & 0xff;
|
|
||||||
|
|
||||||
*(ptr++)=firmwareVersion & 0xff; /* fw ver */
|
|
||||||
*(ptr++)=(firmwareVersion>>8) & 0xff;
|
|
||||||
|
|
||||||
rv=AQH_NodeMsg_AddChecksum(msg);
|
rv=AQH_NodeMsg_AddChecksum(msg);
|
||||||
if (rv<0) {
|
if (rv<0) {
|
||||||
DBG_INFO(AQH_LOGDOMAIN, "here (%d)", rv);
|
DBG_INFO(AQH_LOGDOMAIN, "here (%d)", rv);
|
||||||
@@ -67,35 +58,14 @@ uint32_t AQH_FlashStartMsg_GetUid(const GWEN_MSG *msg)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint16_t AQH_FlashStartMsg_GetFirmwareType(const GWEN_MSG *msg)
|
|
||||||
{
|
|
||||||
return GWEN_Msg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_FLASHSTART_FWTYPE, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint16_t AQH_FlashStartMsg_GetFirmwareVersion(const GWEN_MSG *msg)
|
|
||||||
{
|
|
||||||
return GWEN_Msg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_FLASHSTART_FWVER, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void AQH_FlashStartMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText)
|
void AQH_FlashStartMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText)
|
||||||
{
|
{
|
||||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_FLASHSTART_MINSIZE) {
|
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_FLASHSTART_MINSIZE) {
|
||||||
uint16_t fwVersion;
|
GWEN_Buffer_AppendArgs(dbuf, "0x%02x->0x%02x: FLASHSTART %s (uid=0x%08x)\n",
|
||||||
|
|
||||||
fwVersion=AQH_FlashStartMsg_GetFirmwareVersion(msg);
|
|
||||||
GWEN_Buffer_AppendArgs(dbuf, "0x%02x->0x%02x: FLASHSTART %s (uid=0x%08x, fw type=%d, fw ver=%d.%d)\n",
|
|
||||||
AQH_NodeMsg_GetSourceAddress(msg),
|
AQH_NodeMsg_GetSourceAddress(msg),
|
||||||
AQH_NodeMsg_GetDestAddress(msg),
|
AQH_NodeMsg_GetDestAddress(msg),
|
||||||
sText,
|
sText,
|
||||||
(unsigned int) AQH_FlashStartMsg_GetUid(msg),
|
(unsigned int) AQH_FlashStartMsg_GetUid(msg));
|
||||||
AQH_FlashStartMsg_GetFirmwareType(msg),
|
|
||||||
(fwVersion>>8) & 0xff,
|
|
||||||
fwVersion & 0xff);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,9 @@
|
|||||||
#include <gwenhywfar/msg.h>
|
#include <gwenhywfar/msg.h>
|
||||||
#include <gwenhywfar/buffer.h>
|
#include <gwenhywfar/buffer.h>
|
||||||
|
|
||||||
AQHOME_API GWEN_MSG *AQH_FlashStartMsg_new(uint8_t srcAddr, uint8_t destAddr, uint8_t code,
|
AQHOME_API GWEN_MSG *AQH_FlashStartMsg_new(uint8_t srcAddr, uint8_t destAddr, uint8_t code, uint32_t uid);
|
||||||
uint32_t uid, uint16_t firmwareType, uint16_t firmwareVersion);
|
|
||||||
|
|
||||||
AQHOME_API uint32_t AQH_FlashStartMsg_GetUid(const GWEN_MSG *msg);
|
AQHOME_API uint32_t AQH_FlashStartMsg_GetUid(const GWEN_MSG *msg);
|
||||||
AQHOME_API uint16_t AQH_FlashStartMsg_GetFirmwareType(const GWEN_MSG *msg);
|
|
||||||
AQHOME_API uint16_t AQH_FlashStartMsg_GetFirmwareVersion(const GWEN_MSG *msg);
|
|
||||||
|
|
||||||
AQHOME_API void AQH_FlashStartMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
AQHOME_API void AQH_FlashStartMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
||||||
|
|
||||||
|
|||||||
@@ -142,10 +142,21 @@ double AQH_Value3Msg_GetValue(const GWEN_MSG *msg)
|
|||||||
void AQH_Value3Msg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText)
|
void AQH_Value3Msg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText)
|
||||||
{
|
{
|
||||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_VALUE3_MINSIZE) {
|
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_VALUE3_MINSIZE) {
|
||||||
if (AQH_Value3Msg_GetValueType(msg)==AQH_MSG_VALUE3_TYPE_DOOR)
|
const char *sCmd;
|
||||||
GWEN_Buffer_AppendArgs(dbuf, "0x%02x->0x%02x: VALUE3 %s (uid=0x%08x, msgId=%u, value_id=0x%02x type=%s value=%s)\n",
|
|
||||||
|
switch(AQH_NodeMsg_GetMsgType(msg)) {
|
||||||
|
case AQH_MSG_TYPE_VALUE_REPORT: sCmd="report"; break;
|
||||||
|
case AQH_MSG_TYPE_VALUE_SET: sCmd="set"; break;
|
||||||
|
case AQH_MSG_TYPE_VALUE_SET_ACK: sCmd="ack"; break;
|
||||||
|
case AQH_MSG_TYPE_VALUE_SET_NACK: sCmd="nack"; break;
|
||||||
|
default: sCmd="unknown"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AQH_Value3Msg_GetValueType(msg)==AQH_MSG_VALUE3_TYPE_DOOR)
|
||||||
|
GWEN_Buffer_AppendArgs(dbuf, "0x%02x->0x%02x: VALUE3(%s) %s (uid=0x%08x, msgId=%u, value_id=0x%02x type=%s value=%s)\n",
|
||||||
AQH_NodeMsg_GetSourceAddress(msg),
|
AQH_NodeMsg_GetSourceAddress(msg),
|
||||||
AQH_NodeMsg_GetDestAddress(msg),
|
AQH_NodeMsg_GetDestAddress(msg),
|
||||||
|
sCmd,
|
||||||
sText,
|
sText,
|
||||||
(unsigned int) AQH_Value3Msg_GetUid(msg),
|
(unsigned int) AQH_Value3Msg_GetUid(msg),
|
||||||
(unsigned int)AQH_Value3Msg_GetMsgId(msg),
|
(unsigned int)AQH_Value3Msg_GetMsgId(msg),
|
||||||
@@ -153,9 +164,10 @@ void AQH_Value3Msg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const ch
|
|||||||
AQH_Value3Msg_GetValueTypeName(msg),
|
AQH_Value3Msg_GetValueTypeName(msg),
|
||||||
AQH_Value3Msg_GetValueAsWindowStateString(msg));
|
AQH_Value3Msg_GetValueAsWindowStateString(msg));
|
||||||
else
|
else
|
||||||
GWEN_Buffer_AppendArgs(dbuf, "0x%02x->0x%02x: VALUE3 %s (uid=0x%08x, msgId=%u, value_id=0x%02x type=%s value=%f)\n",
|
GWEN_Buffer_AppendArgs(dbuf, "0x%02x->0x%02x: VALUE3(%s) %s (uid=0x%08x, msgId=%u, value_id=0x%02x type=%s value=%f)\n",
|
||||||
AQH_NodeMsg_GetSourceAddress(msg),
|
AQH_NodeMsg_GetSourceAddress(msg),
|
||||||
AQH_NodeMsg_GetDestAddress(msg),
|
AQH_NodeMsg_GetDestAddress(msg),
|
||||||
|
sCmd,
|
||||||
sText,
|
sText,
|
||||||
(unsigned int) AQH_Value3Msg_GetUid(msg),
|
(unsigned int) AQH_Value3Msg_GetUid(msg),
|
||||||
(unsigned int)AQH_Value3Msg_GetMsgId(msg),
|
(unsigned int)AQH_Value3Msg_GetMsgId(msg),
|
||||||
|
|||||||
Reference in New Issue
Block a user