aqhome-tool: more work on getdevices.
This commit is contained in:
@@ -174,13 +174,20 @@ int _doGetDevices(GWEN_DB_NODE *dbArgs)
|
||||
ts64=AQH_GetDevicesResponseIpcMsg_GetTimestamp(msg);
|
||||
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_GetUid(msg),
|
||||
AQH_GetDevicesResponseIpcMsg_GetFirmwareType(msg),
|
||||
(fwVersion>>8) & 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_Msg_free(msg);
|
||||
if (flags & AQH_MSGIPC_GETDEVICES_RSP_FLAGS_LAST) {
|
||||
|
||||
@@ -30,6 +30,12 @@
|
||||
#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_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)
|
||||
@@ -82,6 +88,30 @@ GWEN_MSG *AQH_GetDevicesResponseIpcMsg_new(uint16_t code, uint8_t flags, const A
|
||||
*(ptr++)=(u64>>48) & 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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSGIPC_GETDEVICES_RSP_MINSIZE) {
|
||||
|
||||
@@ -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 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);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user