aqhome-tool: Decreased verbosity, fixed flash handling.
This commit is contained in:
@@ -397,7 +397,7 @@ int _exchangeConnectMsgs(AQH_TOOL_CLIENT *xo, uint32_t flags)
|
|||||||
userId=GWEN_DB_GetCharValue(xo->dbLocalArgs, "userId", 0, NULL);
|
userId=GWEN_DB_GetCharValue(xo->dbLocalArgs, "userId", 0, NULL);
|
||||||
passw=GWEN_DB_GetCharValue(xo->dbLocalArgs, "password", 0, NULL);
|
passw=GWEN_DB_GetCharValue(xo->dbLocalArgs, "password", 0, NULL);
|
||||||
|
|
||||||
DBG_ERROR(NULL, "Sending connect message for proto=%d.%d", xo->protoId, xo->protoVer);
|
DBG_INFO(NULL, "Sending connect message for proto=%d.%d", xo->protoId, xo->protoVer);
|
||||||
msgId=AQH_Endpoint_GetNextMessageId(xo->ipcEndpoint);
|
msgId=AQH_Endpoint_GetNextMessageId(xo->ipcEndpoint);
|
||||||
msgOut=AQH_IpcMessageConnect_new(xo->protoId, xo->protoVer,
|
msgOut=AQH_IpcMessageConnect_new(xo->protoId, xo->protoVer,
|
||||||
AQH_MSGTYPE_IPC_CONNECT_REQ,
|
AQH_MSGTYPE_IPC_CONNECT_REQ,
|
||||||
@@ -577,7 +577,7 @@ int _waitAndHandle(AQH_OBJECT *o, AQH_TOOL_CLIENT *xo, uint32_t msgId)
|
|||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
else if (rv==1) {
|
else if (rv==1) {
|
||||||
DBG_ERROR(NULL, "Done.");
|
DBG_INFO(NULL, "Done.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,10 @@
|
|||||||
#define A_CHAR GWEN_ArgsType_Char
|
#define A_CHAR GWEN_ArgsType_Char
|
||||||
#define A_INT GWEN_ArgsType_Int
|
#define A_INT GWEN_ArgsType_Int
|
||||||
|
|
||||||
#define FLASH_TOOL_MAX_REPEAT 16
|
|
||||||
#define FLASH_TOOL_DEFAULT_TIMEOUTINSECS 5
|
#define FLASH_TOOL_MAX_REPEAT 16
|
||||||
|
#define FLASH_TOOL_DEFAULT_TIMEOUTINSECS 5
|
||||||
|
#define FLASH_TOOL_WAITFORFLASHREADY_INSECS 30
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -68,6 +70,9 @@ static int _flashRecord(AQH_OBJECT *o,
|
|||||||
int timeoutInSeconds);
|
int timeoutInSeconds);
|
||||||
static int _flashData(AQH_OBJECT *o, uint32_t address, const uint8_t *ptr, uint32_t len, int timeoutInSeconds);
|
static int _flashData(AQH_OBJECT *o, uint32_t address, const uint8_t *ptr, uint32_t len, int timeoutInSeconds);
|
||||||
static int _flashEnd(AQH_OBJECT *o, int reason, int timeoutInSeconds);
|
static int _flashEnd(AQH_OBJECT *o, int reason, int timeoutInSeconds);
|
||||||
|
|
||||||
|
/** frees msg! */
|
||||||
|
static int _trySendMsgAndWaitForFlasgResponse(AQH_OBJECT *o, AQH_MESSAGE *msg, const char *msgInfo, int timeoutInSeconds);
|
||||||
static int _waitForFlashResponse(AQH_OBJECT *o, int timeoutInSeconds);
|
static int _waitForFlashResponse(AQH_OBJECT *o, int timeoutInSeconds);
|
||||||
static AQH_FLASHRECORD_LIST *_readHexfileIntoFlashRecordList(const char *hexFilename);
|
static AQH_FLASHRECORD_LIST *_readHexfileIntoFlashRecordList(const char *hexFilename);
|
||||||
|
|
||||||
@@ -90,7 +95,7 @@ int AQH_Tool_Flash(GWEN_DB_NODE *dbGlobalArgs, int argc, char **argv)
|
|||||||
{ A_ARG, A_INT, "timeout", 0, 1, "T", NULL, I18S("Specify timeout in seconds for response"), NULL},
|
{ A_ARG, A_INT, "timeout", 0, 1, "T", NULL, I18S("Specify timeout in seconds for response"), NULL},
|
||||||
{ A_ARG, A_CHAR, "userId", 0, 1, "u", "userid", I18S("Specify user id"), NULL},
|
{ A_ARG, A_CHAR, "userId", 0, 1, "u", "userid", I18S("Specify user id"), NULL},
|
||||||
{ A_ARG, A_CHAR, "password", 0, 1, "p", "password", I18S("Specify service password"), NULL},
|
{ A_ARG, A_CHAR, "password", 0, 1, "p", "password", I18S("Specify service password"), NULL},
|
||||||
{ A_ARG, A_CHAR, "uid", 1, 1, "u", "uid", I18S("Specify UID of the node to flash"),NULL},
|
{ A_ARG, A_CHAR, "uid", 1, 1, "U", "uid", I18S("Specify UID of the node to flash"),NULL},
|
||||||
{ A_ARG, A_CHAR, "hexFilename", 1, 1, "H", NULL, I18S("Specify hexfile to flash"), NULL},
|
{ A_ARG, A_CHAR, "hexFilename", 1, 1, "H", NULL, I18S("Specify hexfile to flash"), NULL},
|
||||||
{ 0, A_INT, "reboot", 0, 1, "R", NULL, I18S("Request node reboot before trying to flash"), NULL},
|
{ 0, A_INT, "reboot", 0, 1, "R", NULL, I18S("Request node reboot before trying to flash"), NULL},
|
||||||
{ A_END, A_INT, "help", 0, 0, "h", "help", I18S("Show this help screen"), NULL}
|
{ A_END, A_INT, "help", 0, 0, "h", "help", I18S("Show this help screen"), NULL}
|
||||||
@@ -164,6 +169,7 @@ int doFlash(AQH_OBJECT *o)
|
|||||||
rv=_rebootNode(o, uid, timeoutInSeconds);
|
rv=_rebootNode(o, uid, timeoutInSeconds);
|
||||||
if (rv<0) {
|
if (rv<0) {
|
||||||
DBG_INFO(NULL, "here (%d)", rv);
|
DBG_INFO(NULL, "here (%d)", rv);
|
||||||
|
fprintf(stderr, "No REBOOT response received.\n");
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
fprintf(stdout, "Reboot in progress\n");
|
fprintf(stdout, "Reboot in progress\n");
|
||||||
@@ -171,9 +177,10 @@ int doFlash(AQH_OBJECT *o)
|
|||||||
|
|
||||||
/* wait for FLASH_READY message */
|
/* wait for FLASH_READY message */
|
||||||
fprintf(stdout, "Waiting for node to become ready for flashing\n");
|
fprintf(stdout, "Waiting for node to become ready for flashing\n");
|
||||||
msg=AQH_ToolClient_WaitForNodeMsg(o, 0, AQH_MSG_TYPE_FLASH_READY, timeoutInSeconds);
|
msg=AQH_ToolClient_WaitForNodeMsg(o, 0, AQH_MSG_TYPE_FLASH_READY, FLASH_TOOL_WAITFORFLASHREADY_INSECS);
|
||||||
if (msg==NULL) {
|
if (msg==NULL) {
|
||||||
DBG_INFO(NULL, "No FLASH_READY message received.");
|
DBG_INFO(NULL, "No FLASH_READY message received.");
|
||||||
|
fprintf(stderr, "No FLASH_READY received.\n");
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
DBG_INFO(NULL, "FLASH_READY message received");
|
DBG_INFO(NULL, "FLASH_READY message received");
|
||||||
@@ -263,31 +270,14 @@ int _performFlashProcedure(AQH_OBJECT *o,
|
|||||||
|
|
||||||
int _flashStart(AQH_OBJECT *o, unsigned int uid, int timeoutInSeconds)
|
int _flashStart(AQH_OBJECT *o, unsigned int uid, int timeoutInSeconds)
|
||||||
{
|
{
|
||||||
int i;
|
AQH_MESSAGE *nodeMsg;
|
||||||
|
|
||||||
for (i=0; i<FLASH_TOOL_MAX_REPEAT; i++) {
|
nodeMsg=AQH_FlashStartMessage_new(0, 0xc1, AQH_MSG_TYPE_FLASH_START, uid);
|
||||||
AQH_MESSAGE *nodeMsg;
|
if (nodeMsg==NULL) {
|
||||||
int rv;
|
DBG_ERROR(NULL, "Error creating message");
|
||||||
|
return GWEN_ERROR_GENERIC;
|
||||||
if (i)
|
|
||||||
fprintf(stdout, "- sending FLASH_START (retry %d)\n", i);
|
|
||||||
else
|
|
||||||
fprintf(stdout, "- sending FLASH_START\n");
|
|
||||||
/* send FLASH_START message */
|
|
||||||
DBG_INFO(NULL, "Sending FLASH START message (%d)", i);
|
|
||||||
nodeMsg=AQH_FlashStartMessage_new(0, 0xc1, AQH_MSG_TYPE_FLASH_START, uid);
|
|
||||||
if (nodeMsg==NULL) {
|
|
||||||
DBG_ERROR(NULL, "Error creating message");
|
|
||||||
return GWEN_ERROR_GENERIC;
|
|
||||||
}
|
|
||||||
AQH_ToolClient_SendNodeMsg(o, nodeMsg);
|
|
||||||
rv=_waitForFlashResponse(o, timeoutInSeconds);
|
|
||||||
if (rv==0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
DBG_INFO(NULL, "No FLASH_RESPONSE message received");
|
return _trySendMsgAndWaitForFlasgResponse(o, nodeMsg, "FLASH_START", timeoutInSeconds);
|
||||||
return GWEN_ERROR_GENERIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -328,40 +318,41 @@ int _flashRecord(AQH_OBJECT *o,
|
|||||||
|
|
||||||
int _flashData(AQH_OBJECT *o, uint32_t address, const uint8_t *ptr, uint32_t len, int timeoutInSeconds)
|
int _flashData(AQH_OBJECT *o, uint32_t address, const uint8_t *ptr, uint32_t len, int timeoutInSeconds)
|
||||||
{
|
{
|
||||||
int i;
|
AQH_MESSAGE *nodeMsg;
|
||||||
|
int rv;
|
||||||
|
GWEN_BUFFER *dbuf;
|
||||||
|
|
||||||
for (i=0;i<FLASH_TOOL_MAX_REPEAT;i++) {
|
dbuf=GWEN_Buffer_new(0, 256, 0, 1);
|
||||||
AQH_MESSAGE *nodeMsg;
|
GWEN_Buffer_AppendString(dbuf, "FLASH_DATA (");
|
||||||
int rv;
|
GWEN_Buffer_AppendArgs(dbuf, "addr=%04x, data len=%d)", address, len);
|
||||||
|
|
||||||
#ifdef DEBUG_FLASH
|
nodeMsg=AQH_FlashDataMessage_new(0, 0xc1, AQH_MSG_TYPE_FLASH_DATA, address, ptr, len);
|
||||||
DBG_ERROR(NULL, " Sending message: addr=%04x, data len=%d, pagesize=%d", address, len, pageSize);
|
if (nodeMsg==NULL) {
|
||||||
GWEN_Text_LogString((const char*) ptr, len, NULL, GWEN_LoggerLevel_Error);
|
DBG_ERROR(NULL, "Error creating message");
|
||||||
#endif
|
return GWEN_ERROR_GENERIC;
|
||||||
|
}
|
||||||
if (i)
|
rv=_trySendMsgAndWaitForFlasgResponse(o, nodeMsg, GWEN_Buffer_GetStart(dbuf), timeoutInSeconds);
|
||||||
fprintf(stdout, "- send data: dest addr=%04x, len=%d bytes (retry %d)\n", address, len, i);
|
GWEN_Buffer_free(dbuf);
|
||||||
else
|
return rv;
|
||||||
fprintf(stdout, "- send data: dest addr=%04x, len=%d bytes\n", address, len);
|
|
||||||
|
|
||||||
nodeMsg=AQH_FlashDataMessage_new(0, 0xc1, AQH_MSG_TYPE_FLASH_DATA, address, ptr, len);
|
|
||||||
if (nodeMsg==NULL) {
|
|
||||||
DBG_ERROR(NULL, "Error creating message");
|
|
||||||
return GWEN_ERROR_GENERIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
AQH_ToolClient_SendNodeMsg(o, nodeMsg);
|
|
||||||
rv=_waitForFlashResponse(o, timeoutInSeconds);
|
|
||||||
if (rv==0)
|
|
||||||
return 0;
|
|
||||||
} /* for */
|
|
||||||
DBG_INFO(NULL, "No FLASH_RESPONSE message received");
|
|
||||||
return GWEN_ERROR_GENERIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int _flashEnd(AQH_OBJECT *o, int reason, int timeoutInSeconds)
|
int _flashEnd(AQH_OBJECT *o, int reason, int timeoutInSeconds)
|
||||||
|
{
|
||||||
|
AQH_MESSAGE *nodeMsg;
|
||||||
|
|
||||||
|
nodeMsg=AQH_FlashEndMessage_new(0, 0xc1, AQH_MSG_TYPE_FLASH_END, reason);
|
||||||
|
if (nodeMsg==NULL) {
|
||||||
|
DBG_ERROR(NULL, "Error creating message");
|
||||||
|
return GWEN_ERROR_GENERIC;
|
||||||
|
}
|
||||||
|
return _trySendMsgAndWaitForFlasgResponse(o, nodeMsg, "FLASH_END", timeoutInSeconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int _trySendMsgAndWaitForFlasgResponse(AQH_OBJECT *o, AQH_MESSAGE *msg, const char *msgInfo, int timeoutInSeconds)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -370,22 +361,21 @@ int _flashEnd(AQH_OBJECT *o, int reason, int timeoutInSeconds)
|
|||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
if (i)
|
if (i)
|
||||||
fprintf(stdout, "- sending FLASH_END (retry %d)\n", i);
|
fprintf(stdout, " - retry sending %s (retry %d)\n", msgInfo, i);
|
||||||
else
|
|
||||||
fprintf(stdout, "- sending FLASH_END\n");
|
|
||||||
/* send FLASH_START message */
|
/* send FLASH_START message */
|
||||||
DBG_INFO(NULL, "Sending FLASH END message (%d)", i);
|
nodeMsg=AQH_Message_dup(msg);
|
||||||
nodeMsg=AQH_FlashEndMessage_new(0, 0xc1, AQH_MSG_TYPE_FLASH_END, reason);
|
DBG_INFO(NULL, "Sending %s message (%d)", msgInfo, i);
|
||||||
if (nodeMsg==NULL) {
|
|
||||||
DBG_ERROR(NULL, "Error creating message");
|
|
||||||
return GWEN_ERROR_GENERIC;
|
|
||||||
}
|
|
||||||
AQH_ToolClient_SendNodeMsg(o, nodeMsg);
|
AQH_ToolClient_SendNodeMsg(o, nodeMsg);
|
||||||
rv=_waitForFlashResponse(o, timeoutInSeconds);
|
rv=_waitForFlashResponse(o, timeoutInSeconds);
|
||||||
if (rv==0)
|
if (rv==0) {
|
||||||
|
AQH_Message_free(msg);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DBG_INFO(NULL, "No FLASH_RESPONSE message received");
|
DBG_INFO(NULL, "No FLASH_RESPONSE message received");
|
||||||
|
fprintf(stderr, "No FLASH_RESPONSE received.\n");
|
||||||
|
AQH_Message_free(msg);
|
||||||
return GWEN_ERROR_GENERIC;
|
return GWEN_ERROR_GENERIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#include <gwenhywfar/i18n.h>
|
#include <gwenhywfar/i18n.h>
|
||||||
#include <gwenhywfar/debug.h>
|
#include <gwenhywfar/debug.h>
|
||||||
#include <gwenhywfar/text.h>
|
#include <gwenhywfar/text.h>
|
||||||
|
#include <gwenhywfar/timestamp.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
@@ -44,6 +45,8 @@
|
|||||||
#define A_CHAR GWEN_ArgsType_Char
|
#define A_CHAR GWEN_ArgsType_Char
|
||||||
#define A_INT GWEN_ArgsType_Int
|
#define A_INT GWEN_ArgsType_Int
|
||||||
|
|
||||||
|
#define LAST1H (60*60)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
@@ -53,7 +56,7 @@
|
|||||||
|
|
||||||
static AQH_MESSAGE *_createRequestMessage(AQH_OBJECT *o, uint32_t msgId);
|
static AQH_MESSAGE *_createRequestMessage(AQH_OBJECT *o, uint32_t msgId);
|
||||||
static int _handleResponseMessage(AQH_OBJECT *o, const AQH_MESSAGE *msg, const GWEN_TAG16_LIST *tagList, int first);
|
static int _handleResponseMessage(AQH_OBJECT *o, const AQH_MESSAGE *msg, const GWEN_TAG16_LIST *tagList, int first);
|
||||||
static void _printNode(const AQH_NODE_INFO *ni);
|
static void _printNode(const AQH_NODE_INFO *ni, int printAll);
|
||||||
static void _printUintAsTextOrHex(uint32_t u, int bits);
|
static void _printUintAsTextOrHex(uint32_t u, int bits);
|
||||||
|
|
||||||
|
|
||||||
@@ -74,6 +77,7 @@ int AQH_Tool_GetNodes(GWEN_DB_NODE *dbGlobalArgs, int argc, char **argv)
|
|||||||
{ A_ARG, A_INT, "tcpPort", 0, 1, "P", "tcpport", I18S("TCP port to connect to"), NULL},
|
{ A_ARG, A_INT, "tcpPort", 0, 1, "P", "tcpport", I18S("TCP port to connect to"), NULL},
|
||||||
{ A_ARG, A_INT, "timeout", 0, 1, "T", NULL, I18S("Specify timeout in seconds for response"), NULL},
|
{ A_ARG, A_INT, "timeout", 0, 1, "T", NULL, I18S("Specify timeout in seconds for response"), NULL},
|
||||||
{ 0, A_INT, "printHeader", 0, 1, "H", "printheader", I18S("Print header if given"), NULL},
|
{ 0, A_INT, "printHeader", 0, 1, "H", "printheader", I18S("Print header if given"), NULL},
|
||||||
|
{ 0, A_INT, "printAll", 0, 1, "a", "printall", I18S("Print all devices (not only last seen)"), NULL},
|
||||||
{ A_END, A_INT, "help", 0, 0, "h", "help", I18S("Show this help screen"), NULL}
|
{ A_END, A_INT, "help", 0, 0, "h", "help", I18S("Show this help screen"), NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -104,11 +108,13 @@ AQH_MESSAGE *_createRequestMessage(GWEN_UNUSED AQH_OBJECT *o, uint32_t msgId)
|
|||||||
int _handleResponseMessage(GWEN_UNUSED AQH_OBJECT *o, const AQH_MESSAGE *msg, const GWEN_TAG16_LIST *tagList, int first)
|
int _handleResponseMessage(GWEN_UNUSED AQH_OBJECT *o, const AQH_MESSAGE *msg, const GWEN_TAG16_LIST *tagList, int first)
|
||||||
{
|
{
|
||||||
uint16_t code;
|
uint16_t code;
|
||||||
//GWEN_DB_NODE *dbArgs;
|
GWEN_DB_NODE *dbArgs;
|
||||||
//int printHeader;
|
//int printHeader;
|
||||||
|
int printAll;
|
||||||
|
|
||||||
//dbArgs=AQH_ToolClient_GetDbLocalArgs(o);
|
dbArgs=AQH_ToolClient_GetDbLocalArgs(o);
|
||||||
//printHeader=first?GWEN_DB_GetIntValue(dbArgs, "printHeader", 0, 0):0;
|
//printHeader=first?GWEN_DB_GetIntValue(dbArgs, "printHeader", 0, 0):0;
|
||||||
|
printAll=GWEN_DB_GetIntValue(dbArgs, "printAll", 0, 0);
|
||||||
|
|
||||||
code=AQH_IpcMessage_GetCode(msg);
|
code=AQH_IpcMessage_GetCode(msg);
|
||||||
if (code==AQH_MSGTYPE_IPC_NODES_GETDEVICES_RSP) {
|
if (code==AQH_MSGTYPE_IPC_NODES_GETDEVICES_RSP) {
|
||||||
@@ -116,7 +122,7 @@ int _handleResponseMessage(GWEN_UNUSED AQH_OBJECT *o, const AQH_MESSAGE *msg, co
|
|||||||
|
|
||||||
ni=AQH_IpcnMessageGetDevicesRsp_ReadNodeInfo(tagList);
|
ni=AQH_IpcnMessageGetDevicesRsp_ReadNodeInfo(tagList);
|
||||||
if (ni)
|
if (ni)
|
||||||
_printNode(ni);
|
_printNode(ni, printAll);
|
||||||
|
|
||||||
if (AQH_IpcnMessageGetDevicesRsp_GetFlags(tagList) & AQH_MSGNODE_GETDEVICES_RSP_FLAGS_LASTMSG) {
|
if (AQH_IpcnMessageGetDevicesRsp_GetFlags(tagList) & AQH_MSGNODE_GETDEVICES_RSP_FLAGS_LASTMSG) {
|
||||||
DBG_INFO(NULL, "Last message received");
|
DBG_INFO(NULL, "Last message received");
|
||||||
@@ -135,35 +141,44 @@ int _handleResponseMessage(GWEN_UNUSED AQH_OBJECT *o, const AQH_MESSAGE *msg, co
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void _printNode(const AQH_NODE_INFO *ni)
|
void _printNode(const AQH_NODE_INFO *ni, int printAll)
|
||||||
{
|
{
|
||||||
uint32_t u;
|
|
||||||
const GWEN_TIMESTAMP *ts;
|
const GWEN_TIMESTAMP *ts;
|
||||||
|
time_t now;
|
||||||
|
time_t tLastSeen=0;
|
||||||
|
int timeSinceLastSeen;
|
||||||
|
|
||||||
fprintf(stdout, "- node: addr=%3d, uid=0x%08x, device=",
|
now=time(NULL);
|
||||||
AQH_NodeInfo_GetBusAddress(ni),
|
|
||||||
(unsigned int) AQH_NodeInfo_GetUid(ni));
|
|
||||||
ts=AQH_NodeInfo_GetTimestampLastChange(ni);
|
ts=AQH_NodeInfo_GetTimestampLastChange(ni);
|
||||||
|
tLastSeen=ts?GWEN_Timestamp_toTimeT(ts):now;
|
||||||
|
timeSinceLastSeen=(int) (now-tLastSeen);
|
||||||
|
if (printAll || timeSinceLastSeen<LAST1H) {
|
||||||
|
uint32_t u;
|
||||||
|
|
||||||
u=AQH_NodeInfo_GetManufacturer(ni);
|
fprintf(stdout, "- node: addr=%3d, uid=0x%08x, device=",
|
||||||
_printUintAsTextOrHex(u, 32);
|
AQH_NodeInfo_GetBusAddress(ni),
|
||||||
fprintf(stdout, ":");
|
(unsigned int) AQH_NodeInfo_GetUid(ni));
|
||||||
u=AQH_NodeInfo_GetDeviceType(ni);
|
|
||||||
_printUintAsTextOrHex(u, 16);
|
u=AQH_NodeInfo_GetManufacturer(ni);
|
||||||
u=AQH_NodeInfo_GetDeviceVersion(ni);
|
_printUintAsTextOrHex(u, 32);
|
||||||
fprintf(stdout, " v%d.%d", (u>>8) & 0xff, u & 0xff);
|
fprintf(stdout, ":");
|
||||||
u=AQH_NodeInfo_GetFirmwareVersion(ni);
|
u=AQH_NodeInfo_GetDeviceType(ni);
|
||||||
fprintf(stdout, ", firmware=%d.%d.%d (%d), ",
|
_printUintAsTextOrHex(u, 16);
|
||||||
(u>>16) & 0xff, (u>>8) & 0xff, u & 0xff, (u>>24) & 0xff);
|
u=AQH_NodeInfo_GetDeviceVersion(ni);
|
||||||
if (ts)
|
fprintf(stdout, " v%d.%d", (u>>8) & 0xff, u & 0xff);
|
||||||
fprintf(stdout, "last seen %s, ", GWEN_Timestamp_GetString(ts));
|
u=AQH_NodeInfo_GetFirmwareVersion(ni);
|
||||||
fprintf(stdout, "pkg out: %d, pkg in: %d, collisions: %d, busy: %d, crc: %d, io: %d\n",
|
fprintf(stdout, ", firmware=%d.%d.%d (%d), ",
|
||||||
AQH_NodeInfo_GetStatsPacketsOut(ni),
|
(u>>16) & 0xff, (u>>8) & 0xff, u & 0xff, (u>>24) & 0xff);
|
||||||
AQH_NodeInfo_GetStatsPacketsIn(ni),
|
if (ts)
|
||||||
AQH_NodeInfo_GetStatsCollisions(ni),
|
fprintf(stdout, "last seen %s, ", GWEN_Timestamp_GetString(ts));
|
||||||
AQH_NodeInfo_GetStatsBusy(ni),
|
fprintf(stdout, "pkg out: %d, pkg in: %d, collisions: %d, busy: %d, crc: %d, io: %d\n",
|
||||||
AQH_NodeInfo_GetStatsCrcErrors(ni),
|
AQH_NodeInfo_GetStatsPacketsOut(ni),
|
||||||
AQH_NodeInfo_GetStatsIoErrors(ni));
|
AQH_NodeInfo_GetStatsPacketsIn(ni),
|
||||||
|
AQH_NodeInfo_GetStatsCollisions(ni),
|
||||||
|
AQH_NodeInfo_GetStatsBusy(ni),
|
||||||
|
AQH_NodeInfo_GetStatsCrcErrors(ni),
|
||||||
|
AQH_NodeInfo_GetStatsIoErrors(ni));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user