aqhome: added more parsers.

This commit is contained in:
Martin Preuss
2023-02-05 23:43:43 +01:00
parent 0b1e0ea4d5
commit 9f45b70e36
11 changed files with 442 additions and 2 deletions

View File

@@ -7,7 +7,11 @@
#include "aqhome/msg_value.h"
#include "aqhome/msg_sendstats.h"
#include "aqhome/msg_ping.h"
#include "aqhome/msg_pong.h"
#include "aqhome/msg_needaddr.h"
#include "aqhome/msg_claimaddr.h"
#include "aqhome/msg_haveaddr.h"
#include "aqhome/msg_denyaddr.h"
#include <gwenhywfar/debug.h>
#include <gwenhywfar/text.h>
@@ -129,6 +133,10 @@ void _packetReceived(AQH_SERIAL *sr, AQH_MSG *msg)
AQH_MsgPing_DumpToBuffer(msg, dbuf, "received");
fprintf(stdout, "%s", GWEN_Buffer_GetStart(dbuf));
}
else if (msgType==AQH_MSG_TYPE_PONG) {
AQH_MsgPong_DumpToBuffer(msg, dbuf, "received");
fprintf(stdout, "%s", GWEN_Buffer_GetStart(dbuf));
}
else if (msgType==AQH_MSG_TYPE_COMSENDSTATS) { /* CPRO_CMD_COMSENDSTATS */
AQH_MsgSendStats_DumpToBuffer(msg, dbuf, "received");
fprintf(stdout, "%s", GWEN_Buffer_GetStart(dbuf));
@@ -157,6 +165,18 @@ void _packetReceived(AQH_SERIAL *sr, AQH_MSG *msg)
AQH_MsgNeedAddr_DumpToBuffer(msg, dbuf, "received");
fprintf(stdout, "%s", GWEN_Buffer_GetStart(dbuf));
}
else if (msgType==AQH_MSG_TYPE_CLAIM_ADDRESS) {
AQH_MsgClaimAddr_DumpToBuffer(msg, dbuf, "received");
fprintf(stdout, "%s", GWEN_Buffer_GetStart(dbuf));
}
else if (msgType==AQH_MSG_TYPE_HAVE_ADDRESS) {
AQH_MsgHaveAddr_DumpToBuffer(msg, dbuf, "received");
fprintf(stdout, "%s", GWEN_Buffer_GetStart(dbuf));
}
else if (msgType==AQH_MSG_TYPE_DENY_ADDRESS) {
AQH_MsgDenyAddr_DumpToBuffer(msg, dbuf, "received");
fprintf(stdout, "%s", GWEN_Buffer_GetStart(dbuf));
}
else {
fprintf(stdout, " %s: Received (%d):\n", GWEN_Buffer_GetStart(dbuf), msgType);
GWEN_Text_DumpString(ptr, len, 6);
@@ -186,7 +206,7 @@ AQH_MSG *createPingMsg(AQH_SERIAL *sr, uint8_t destAddr)
AQH_Msg_free(msg);
return NULL;
}
rv=AQH_Msg_AddByte(msg, 10); /* ping */
rv=AQH_Msg_AddByte(msg, AQH_MSG_TYPE_PING); /* ping */
if (rv<0) {
fprintf(stderr, "ERROR3: %d\n", rv);
AQH_Msg_free(msg);
@@ -267,7 +287,7 @@ int testLoop()
break;
}
t=time(NULL);
if (difftime(t, tLast)>10) {
if (difftime(t, tLast)>61) {
AQH_MSG *msg;
msg=createPingMsg(sr, 1);