aqhome-tool: more work on getdevices.

This commit is contained in:
Martin Preuss
2023-04-24 20:36:13 +02:00
parent 5f7e192e27
commit 8847d051c1
3 changed files with 96 additions and 9 deletions

View File

@@ -174,13 +174,20 @@ int _doGetDevices(GWEN_DB_NODE *dbArgs)
ts64=AQH_GetDevicesResponseIpcMsg_GetTimestamp(msg); ts64=AQH_GetDevicesResponseIpcMsg_GetTimestamp(msg);
ts=GWEN_Timestamp_fromInt64(ts64); /* TODO: fix timestamp */ ts=GWEN_Timestamp_fromInt64(ts64); /* TODO: fix timestamp */
fprintf(stdout, "- node: %02x (uid=%04x, firmware type=%02x, firmware version=%d.%d, timeStamp: %016lx)\n", fprintf(stdout, "- node: %02x (uid=%04x, fw type=%02x, fw version=%d.%d, timeStamp: %016lx"
", pkg out: %d, pkg in: %d, collisions: %d, busy: %d, crc: %d, io: %d)\n",
AQH_GetDevicesResponseIpcMsg_GetBusAddress(msg), AQH_GetDevicesResponseIpcMsg_GetBusAddress(msg),
AQH_GetDevicesResponseIpcMsg_GetUid(msg), AQH_GetDevicesResponseIpcMsg_GetUid(msg),
AQH_GetDevicesResponseIpcMsg_GetFirmwareType(msg), AQH_GetDevicesResponseIpcMsg_GetFirmwareType(msg),
(fwVersion>>8) & 0xff, (fwVersion>>8) & 0xff,
fwVersion & 0xff, fwVersion & 0xff,
(unsigned long int)ts64); (unsigned long int)ts64,
AQH_GetDevicesResponseIpcMsg_GetPkgOut(msg),
AQH_GetDevicesResponseIpcMsg_GetPkgIn(msg),
AQH_GetDevicesResponseIpcMsg_GetCollisions(msg),
AQH_GetDevicesResponseIpcMsg_GetBusy(msg),
AQH_GetDevicesResponseIpcMsg_GetCrcErrors(msg),
AQH_GetDevicesResponseIpcMsg_GetIoErrors(msg));
GWEN_Timestamp_free(ts); GWEN_Timestamp_free(ts);
GWEN_Msg_free(msg); GWEN_Msg_free(msg);
if (flags & AQH_MSGIPC_GETDEVICES_RSP_FLAGS_LAST) { if (flags & AQH_MSGIPC_GETDEVICES_RSP_FLAGS_LAST) {

View File

@@ -23,13 +23,19 @@
#include <gwenhywfar/msg_ipc.h> #include <gwenhywfar/msg_ipc.h>
#define AQH_MSGIPC_GETDEVICES_RSP_OFFS_FLAGS 0 /* 1 bytes */ #define AQH_MSGIPC_GETDEVICES_RSP_OFFS_FLAGS 0 /* 1 bytes */
#define AQH_MSGIPC_GETDEVICES_RSP_OFFS_BUSADDR 1 /* 1 bytes */ #define AQH_MSGIPC_GETDEVICES_RSP_OFFS_BUSADDR 1 /* 1 bytes */
#define AQH_MSGIPC_GETDEVICES_RSP_OFFS_UID 2 /* 4 bytes */ #define AQH_MSGIPC_GETDEVICES_RSP_OFFS_UID 2 /* 4 bytes */
#define AQH_MSGIPC_GETDEVICES_RSP_OFFS_FWTYPE 6 /* 2 bytes */ #define AQH_MSGIPC_GETDEVICES_RSP_OFFS_FWTYPE 6 /* 2 bytes */
#define AQH_MSGIPC_GETDEVICES_RSP_OFFS_FWVER 8 /* 2 bytes */ #define AQH_MSGIPC_GETDEVICES_RSP_OFFS_FWVER 8 /* 2 bytes */
#define AQH_MSGIPC_GETDEVICES_RSP_OFFS_MODULES 10 /* 2 bytes */ #define AQH_MSGIPC_GETDEVICES_RSP_OFFS_MODULES 10 /* 2 bytes */
#define AQH_MSGIPC_GETDEVICES_RSP_OFFS_LASTCHG 12 /* 8 bytes */ #define AQH_MSGIPC_GETDEVICES_RSP_OFFS_LASTCHG 12 /* 8 bytes */
#define AQH_MSGIPC_GETDEVICES_RSP_OFFS_PKGOUT 20 /* 2 bytes */
#define AQH_MSGIPC_GETDEVICES_RSP_OFFS_PKGIN 22 /* 2 bytes */
#define AQH_MSGIPC_GETDEVICES_RSP_OFFS_COLLISIONS 24 /* 2 bytes */
#define AQH_MSGIPC_GETDEVICES_RSP_OFFS_BUSY 26 /* 2 bytes */
#define AQH_MSGIPC_GETDEVICES_RSP_OFFS_CRC 28 /* 2 bytes */
#define AQH_MSGIPC_GETDEVICES_RSP_OFFS_IO 30 /* 2 bytes */
#define AQH_MSGIPC_GETDEVICES_RSP_MINSIZE (GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_GETDEVICES_RSP_OFFS_LASTCHG+8) #define AQH_MSGIPC_GETDEVICES_RSP_MINSIZE (GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_GETDEVICES_RSP_OFFS_LASTCHG+8)
@@ -82,6 +88,30 @@ GWEN_MSG *AQH_GetDevicesResponseIpcMsg_new(uint16_t code, uint8_t flags, const A
*(ptr++)=(u64>>48) & 0xff; *(ptr++)=(u64>>48) & 0xff;
*(ptr++)=(u64>>56) & 0xff; *(ptr++)=(u64>>56) & 0xff;
u32=AQH_NodeInfo_GetStatsPacketsOut(ni);
*(ptr++)=u32 & 0xff;
*(ptr++)=(u32>>8) & 0xff;
u32=AQH_NodeInfo_GetStatsPacketsIn(ni);
*(ptr++)=u32 & 0xff;
*(ptr++)=(u32>>8) & 0xff;
u32=AQH_NodeInfo_GetStatsCollisions(ni);
*(ptr++)=u32 & 0xff;
*(ptr++)=(u32>>8) & 0xff;
u32=AQH_NodeInfo_GetStatsBusy(ni);
*(ptr++)=u32 & 0xff;
*(ptr++)=(u32>>8) & 0xff;
u32=AQH_NodeInfo_GetStatsCrcErrors(ni);
*(ptr++)=u32 & 0xff;
*(ptr++)=(u32>>8) & 0xff;
u32=AQH_NodeInfo_GetStatsIoErrors(ni);
*(ptr++)=u32 & 0xff;
*(ptr++)=(u32>>8) & 0xff;
return msg; return msg;
} }
@@ -140,6 +170,48 @@ int64_t AQH_GetDevicesResponseIpcMsg_GetTimestamp(const GWEN_MSG *msg)
uint16_t AQH_GetDevicesResponseIpcMsg_GetPkgOut(const GWEN_MSG *msg)
{
return GWEN_Msg_GetUint16At(msg, GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_GETDEVICES_RSP_OFFS_PKGOUT, 0);
}
uint16_t AQH_GetDevicesResponseIpcMsg_GetPkgIn(const GWEN_MSG *msg)
{
return GWEN_Msg_GetUint16At(msg, GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_GETDEVICES_RSP_OFFS_PKGIN, 0);
}
uint16_t AQH_GetDevicesResponseIpcMsg_GetCollisions(const GWEN_MSG *msg)
{
return GWEN_Msg_GetUint16At(msg, GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_GETDEVICES_RSP_OFFS_COLLISIONS, 0);
}
uint16_t AQH_GetDevicesResponseIpcMsg_GetBusy(const GWEN_MSG *msg)
{
return GWEN_Msg_GetUint16At(msg, GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_GETDEVICES_RSP_OFFS_BUSY, 0);
}
uint16_t AQH_GetDevicesResponseIpcMsg_GetCrcErrors(const GWEN_MSG *msg)
{
return GWEN_Msg_GetUint16At(msg, GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_GETDEVICES_RSP_OFFS_CRC, 0);
}
uint16_t AQH_GetDevicesResponseIpcMsg_GetIoErrors(const GWEN_MSG *msg)
{
return GWEN_Msg_GetUint16At(msg, GWEN_MSGIPC_OFFS_PAYLOAD+AQH_MSGIPC_GETDEVICES_RSP_OFFS_IO, 0);
}
void AQH_GetDevicesResponseIpcMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText) void AQH_GetDevicesResponseIpcMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText)
{ {
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSGIPC_GETDEVICES_RSP_MINSIZE) { if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSGIPC_GETDEVICES_RSP_MINSIZE) {

View File

@@ -32,6 +32,14 @@ AQHOME_API uint16_t AQH_GetDevicesResponseIpcMsg_GetFirmwareVersion(const GWEN_M
AQHOME_API uint16_t AQH_GetDevicesResponseIpcMsg_GetModules(const GWEN_MSG *msg); AQHOME_API uint16_t AQH_GetDevicesResponseIpcMsg_GetModules(const GWEN_MSG *msg);
AQHOME_API int64_t AQH_GetDevicesResponseIpcMsg_GetTimestamp(const GWEN_MSG *msg); AQHOME_API int64_t AQH_GetDevicesResponseIpcMsg_GetTimestamp(const GWEN_MSG *msg);
AQHOME_API uint16_t AQH_GetDevicesResponseIpcMsg_GetPkgOut(const GWEN_MSG *msg);
AQHOME_API uint16_t AQH_GetDevicesResponseIpcMsg_GetPkgIn(const GWEN_MSG *msg);
AQHOME_API uint16_t AQH_GetDevicesResponseIpcMsg_GetCollisions(const GWEN_MSG *msg);
AQHOME_API uint16_t AQH_GetDevicesResponseIpcMsg_GetBusy(const GWEN_MSG *msg);
AQHOME_API uint16_t AQH_GetDevicesResponseIpcMsg_GetCrcErrors(const GWEN_MSG *msg);
AQHOME_API uint16_t AQH_GetDevicesResponseIpcMsg_GetIoErrors(const GWEN_MSG *msg);
AQHOME_API void AQH_GetDevicesResponseIpcMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText); AQHOME_API void AQH_GetDevicesResponseIpcMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);