aqhome: adapted to latest changes in node firmware.

This commit is contained in:
Martin Preuss
2024-09-06 22:51:32 +02:00
parent 2fa3e9d4ab
commit 9b724d5a5f
16 changed files with 602 additions and 230 deletions

View File

@@ -192,9 +192,7 @@ void _handleMsgDevice(AQHOMED *aqh, const GWEN_MSG *msg)
uid=AQH_DeviceMsg_GetUid(msg);
ni=_getOrCreateNodeAndUpdateUidAddr(aqh, msg, uid);
if (ni) {
AQH_NodeInfo_SetFirmwareType(ni, AQH_DeviceMsg_GetFirmwareType(msg));
AQH_NodeInfo_SetFirmwareVersion(ni, (AQH_DeviceMsg_GetFirmwareHigh(msg)<<8) | AQH_DeviceMsg_GetFirmwareLow(msg));
AQH_NodeInfo_SetModules(ni, AQH_DeviceMsg_GetModuleMask(msg));
// TODO
_updateTimestampLastChange(ni);
AQH_NodeDb_SetModified(aqh->nodeDb);
}
@@ -213,8 +211,14 @@ void _handleMsgFlashReady(AQHOMED *aqh, const GWEN_MSG *msg)
uid=AQH_FlashReadyMsg_GetUid(msg);
ni=_getOrCreateNodeAndUpdateUidAddr(aqh, msg, uid);
if (ni) {
AQH_NodeInfo_SetFirmwareType(ni, AQH_FlashReadyMsg_GetFirmwareType(msg));
AQH_NodeInfo_SetFirmwareVersion(ni, AQH_FlashReadyMsg_GetFirmwareVersion(msg));
AQH_NodeInfo_SetManufacturer(ni, AQH_FlashReadyMsg_GetManufacturer(msg));
AQH_NodeInfo_SetDeviceType(ni, AQH_FlashReadyMsg_GetDeviceType(msg));
AQH_NodeInfo_SetDeviceVersion(ni, (AQH_FlashReadyMsg_GetDeviceVersion(msg)<<8)+AQH_FlashReadyMsg_GetDeviceRevision(msg));
AQH_NodeInfo_SetFirmwareVersion(ni,
(AQH_FlashReadyMsg_GetFirmwareVariant(msg)<<24) |
(AQH_FlashReadyMsg_GetFirmwareVersionMajor(msg)<<16) |
(AQH_FlashReadyMsg_GetFirmwareVersionMinor(msg)<<8) |
AQH_FlashReadyMsg_GetFirmwareVersionPatchlevel(msg));
_updateTimestampLastChange(ni);
AQH_NodeDb_SetModified(aqh->nodeDb);
}

View File

@@ -19,6 +19,7 @@
#include "aqhome/msg/endpoint_tty.h"
#include "aqhome/msg/msg_node.h"
#include "aqhome/msg/msg_value2.h"
#include "aqhome/msg/msg_value3.h"
#include "aqhome/msg/msg_sendstats.h"
#include "aqhome/msg/msg_recvstats.h"
#include "aqhome/ipc/endpoint_ipc.h"
@@ -48,6 +49,7 @@
*/
static void _processValue2Message(AQHOMED *aqh, const GWEN_MSG *nodeMsg);
static void _processValue3Message(AQHOMED *aqh, const GWEN_MSG *nodeMsg);
static void _processSendStatsMessage(AQHOMED *aqh, const GWEN_MSG *nodeMsg);
static void _processRecvStatsMessage(AQHOMED *aqh, const GWEN_MSG *nodeMsg);
static void _publishInt(AQHOMED *aqh, uint32_t uid, int valueId, const char *valueUnits, const char *valuePath, int v);
@@ -70,6 +72,12 @@ void AqHomed_ForwardTtyMsgToBroker(AQHOMED *aqh, const GWEN_MSG *nodeMsg)
case AQH_MSG_TYPE_VALUE2:
_processValue2Message(aqh, nodeMsg);
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:
_processValue3Message(aqh, nodeMsg);
break;
case AQH_MSG_TYPE_COMSENDSTATS:
_processSendStatsMessage(aqh, nodeMsg);
break;
@@ -96,6 +104,18 @@ void _processValue2Message(AQHOMED *aqh, const GWEN_MSG *nodeMsg)
void _processValue3Message(AQHOMED *aqh, const GWEN_MSG *nodeMsg)
{
_publishDouble(aqh,
AQH_Value3Msg_GetUid(nodeMsg),
AQH_Value3Msg_GetValueId(nodeMsg),
AQH_Value3Msg_GetValueTypeUnits(nodeMsg),
AQH_Value3Msg_GetValueTypeName(nodeMsg),
AQH_Value3Msg_GetValue(nodeMsg));
}
void _processSendStatsMessage(AQHOMED *aqh, const GWEN_MSG *nodeMsg)
{
uint16_t packetsOutInt;