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)
{
if (!cw_dbg_is_level(DBG_CW_MSGELEM))
return;
/*
char buf[250];
sprintf(buf,"Reading %s msgelem, type=%d (%d), len=%d",
cw_msgtostr(msg),
msgelem,
cw_msgelemtostr(msg));
*/
const char * elemname;
char vendorname[256];
if (msgelem==CWMSGELEM_VENDOR_SPECIFIC_PAYLOAD){
int vendor = ntohl(*((uint32_t*)msgbuf));
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))
cw_dbg(DBG_CW_MSGELEM,"Reading %s msgelem, type=%d (%s), len=%d",
cw_msgtostr(msg),
msgelem,
cw_msgelemtostr(msgelem),
elemname,
len);
else
cw_dbg_dmp(DBG_CW_MSGELEM,msgbuf,len,"Reading %s msgelem, type=%d (%s), len=%d\n\t Dump ...",
cw_msgtostr(msg),
msgelem,
cw_msgelemtostr(msgelem),
elemname,
len);