cw_dbg_msgelem decodes vendor specific msg types now.

FossilOrigin-Name: 070165095f0483a1f00e2c417a3bfaeebbb28c16b3512a622c0ac66cfa1631f2
This commit is contained in:
7u83@mail.ru 2014-08-24 13:06:35 +00:00
parent 4d84e7bee0
commit b702ba6c89
1 changed files with 22 additions and 9 deletions

View File

@ -238,30 +238,43 @@ void (*cw_log_debug_cbs[])(const char * fromat, ...) = {
/**
* print debug info
*/
void cw_dbg_msgelem_(int msg, int msgelem, const uint8_t *msgbuf,int len) void cw_dbg_msgelem_(int msg, int msgelem, const uint8_t *msgbuf,int len)
{ {
if (!cw_dbg_is_level(DBG_CW_MSGELEM)) if (!cw_dbg_is_level(DBG_CW_MSGELEM))
return; return;
/*
char buf[250]; const char * elemname;
sprintf(buf,"Reading %s msgelem, type=%d (%d), len=%d", char vendorname[256];
cw_msgtostr(msg), if (msgelem==CWMSGELEM_VENDOR_SPECIFIC_PAYLOAD){
msgelem, int vendor = ntohl(*((uint32_t*)msgbuf));
cw_msgelemtostr(msg)); int type = ntohs( * ((uint16_t*)(msgbuf+4)) );
*/ sprintf(vendorname,"%s/%s/%d",
(char*)cw_msgelemtostr(msgelem),
(char*)cw_ianavendoridtostr(vendor),
type);
elemname=vendorname;
}
else{
elemname=cw_msgelemtostr(msgelem);
}
if (!cw_dbg_is_level(DBG_CW_MSGELEM_DMP)) if (!cw_dbg_is_level(DBG_CW_MSGELEM_DMP))
cw_dbg(DBG_CW_MSGELEM,"Reading %s msgelem, type=%d (%s), len=%d", cw_dbg(DBG_CW_MSGELEM,"Reading %s msgelem, type=%d (%s), len=%d",
cw_msgtostr(msg), cw_msgtostr(msg),
msgelem, msgelem,
cw_msgelemtostr(msgelem), elemname,
len); len);
else else
cw_dbg_dmp(DBG_CW_MSGELEM,msgbuf,len,"Reading %s msgelem, type=%d (%s), len=%d\n\t Dump ...", cw_dbg_dmp(DBG_CW_MSGELEM,msgbuf,len,"Reading %s msgelem, type=%d (%s), len=%d\n\t Dump ...",
cw_msgtostr(msg), cw_msgtostr(msg),
msgelem, msgelem,
cw_msgelemtostr(msgelem), elemname,
len); len);