aqhome: added some parsing for COM messages.
This commit is contained in:
@@ -110,11 +110,14 @@ void _packetReceived(AQH_SERIAL *sr, const uint8_t *ptr, uint8_t len)
|
||||
ti=GWEN_CurrentTime();
|
||||
GWEN_Time_toString(ti, "YYYY-MM-DD hh:mm:ss", dbuf);
|
||||
fprintf(stdout, "- %s: Received:\n", GWEN_Buffer_GetStart(dbuf));
|
||||
GWEN_Text_DumpString(ptr, len, 2);
|
||||
GWEN_Text_DumpString(ptr, len, 6);
|
||||
GWEN_Time_free(ti);
|
||||
GWEN_Buffer_free(dbuf);
|
||||
|
||||
if (ptr[2]==2) {
|
||||
if (ptr[2]==1) {
|
||||
fprintf(stdout, "-> PING\n");
|
||||
}
|
||||
else if (ptr[2]==2) {
|
||||
uint32_t secs;
|
||||
int packetsOut;
|
||||
int collisions;
|
||||
@@ -125,11 +128,18 @@ void _packetReceived(AQH_SERIAL *sr, const uint8_t *ptr, uint8_t len)
|
||||
packetsOut=(ptr[8])+(ptr[9]<<8);
|
||||
collisions=(ptr[10])+(ptr[11]<<8);
|
||||
aborted=(ptr[12])+(ptr[13]<<8);
|
||||
fprintf(stdout, " -> %08x packets sent=%d, collisions=%d, aborted=%d\n",
|
||||
fprintf(stdout, "-> SEND STATS: %08x packets sent=%d, collisions=%d, aborted=%d\n",
|
||||
(unsigned int) secs,
|
||||
packetsOut, collisions, aborted);
|
||||
}
|
||||
else if (ptr[2]==4) {
|
||||
int i2cAddr;
|
||||
int availability;
|
||||
|
||||
i2cAddr=ptr[4];
|
||||
availability=ptr[5];
|
||||
fprintf(stdout, "-> I2C DEVICE %02x: %s\n", i2cAddr, (availability==0)?"not available":"FOUND");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user