Thread: [Firebug-cvs] fireboard/beta/tools/src/xlisten xpacket.c,1.5,1.6 xsensors.h,1.5,1.6
Brought to you by:
doolin
From: David M. D. <do...@us...> - 2005-08-01 15:23:55
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2485 Modified Files: xpacket.c xsensors.h Log Message: Added telos processing to xlisten. Index: xpacket.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xpacket.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** xpacket.c 30 Jul 2005 03:14:58 -0000 1.5 --- xpacket.c 1 Aug 2005 15:23:46 -0000 1.6 *************** *** 108,111 **** --- 108,112 ---- if (len < 2) return; + //printf("Mode is %d\n", mode); switch (mode) { case 0: *************** *** 160,163 **** --- 161,181 ---- break; + /* + case AMTYPE_FIREWORKS: + datastart = XPACKET_DATASTART_FIREWORKS; + //fprintf(stderr,"fireworks datastart: %d\n", datastart); + break; + + case XTYPE_TESTLINK: + datastart = XPACKET_DATASTART_FIREWORKS; + //fprintf(stderr,"fireworks datastart: %d\n", datastart); + break; + */ + + case AM_LINKMSG: + datastart = XPACKET_DATASTART_FIREWORKS; + //fprintf(stderr,"fireworks datastart: %d\n", datastart); + break; + default: return NULL; *************** *** 270,273 **** --- 288,292 ---- { int i = 256, entry; + while (--i >= 0) { entry = table + i; *************** *** 276,291 **** return g_packetTable[entry]; } return NULL; } ! XPacketHandler *xpacket_get_handler(char *tos_packet) ! { unsigned char am_type = tos_packet[XPACKET_TYPE]; switch (am_type) { case AMTYPE_XMULTIHOP: case AMTYPE_XUART: case AMTYPE_XDEBUG: - case AMTYPE_FIREWORKS: case AMTYPE_XSENSOR: { XbowSensorboardPacket *packet; --- 295,312 ---- return g_packetTable[entry]; } + return NULL; } ! XPacketHandler * ! xpacket_get_handler(char *tos_packet) { ! unsigned char am_type = tos_packet[XPACKET_TYPE]; + //fprintf("xpacket_get_handler am_type: %d\n", am_type); switch (am_type) { case AMTYPE_XMULTIHOP: case AMTYPE_XUART: case AMTYPE_XDEBUG: case AMTYPE_XSENSOR: { XbowSensorboardPacket *packet; *************** *** 293,297 **** if (xpacket_print_common(packet)) { fprintf(stderr, ! "error: no packet handler for board id 0x%02x\n", packet->board_id); return NULL; --- 314,318 ---- if (xpacket_print_common(packet)) { fprintf(stderr, ! "xpacket_get_handler error1: no packet handler for board id 0x%02x\n", packet->board_id); return NULL; *************** *** 299,303 **** return xsensor_get_handler(packet->board_id, XPACKET_BOARD_TABLE); } ! case AMTYPE_HEALTH: case AMTYPE_SURGE_MSG: --- 320,365 ---- return xsensor_get_handler(packet->board_id, XPACKET_BOARD_TABLE); } ! ! /* ! case AMTYPE_FIREWORKS: { ! XbowSensorboardPacket *packet; ! packet = xpacket_get_sensor_data(tos_packet); ! //fprintf(stderr, "xpacket_get_handler fireworks\n"); ! if (xpacket_print_common(packet)) { ! fprintf(stderr, ! "xpacket_get_handler error1: no packet handler for board id 0x%02x\n", ! packet->board_id); ! return NULL; ! } ! return xsensor_get_handler(am_type, XPACKET_BOARD_TABLE); ! } ! ! ! case XTYPE_TESTLINK: { ! XbowSensorboardPacket *packet; ! packet = xpacket_get_sensor_data(tos_packet); ! //fprintf(stderr, "xpacket_get_handler fireworks\n"); ! if (xpacket_print_common(packet)) { ! fprintf(stderr, ! "xpacket_get_handler error1: no packet handler for board id 0x%02x\n", ! packet->board_id); ! return NULL; ! } ! return xsensor_get_handler(am_type, XPACKET_BOARD_TABLE); ! } ! */ ! case AM_LINKMSG: { ! XbowSensorboardPacket *packet; ! packet = xpacket_get_sensor_data(tos_packet); ! //fprintf(stderr, "xpacket_get_handler fireworks\n"); ! if (xpacket_print_common(packet)) { ! fprintf(stderr, ! "xpacket_get_handler error1: no packet handler for board id 0x%02x\n", ! packet->board_id); ! return NULL; ! } ! return xsensor_get_handler(am_type, XPACKET_BOARD_TABLE); ! } ! case AMTYPE_HEALTH: case AMTYPE_SURGE_MSG: *************** *** 307,315 **** break; } ! fprintf(stderr, "error: no packet handler for tos type 0x%02x\n", am_type); return NULL; } /** * Display a parsed packet as raw ADC values for each sensor on the board. --- 369,379 ---- break; } ! fprintf(stderr, "xpacket_get_handler error2: no packet handler for tos type 0x%02x\n", ! am_type); return NULL; } + /** * Display a parsed packet as raw ADC values for each sensor on the board. *************** *** 329,333 **** return handler->print_parsed(packet); } else { ! fprintf(stderr, "error: no packet handler for board id 0x%02x\n", packet->board_id); return; --- 393,397 ---- return handler->print_parsed(packet); } else { ! fprintf(stderr, "xpacket_print_parsed error: no packet handler for board id 0x%02x\n", packet->board_id); return; *************** *** 352,356 **** return handler->print_cooked(packet); } else { ! fprintf(stderr, "error: no packet handler for board id 0x%02x\n", packet->board_id); return; --- 416,420 ---- return handler->print_cooked(packet); } else { ! fprintf(stderr, "xpacket_print_cooked error: no packet handler for board id 0x%02x\n", packet->board_id); return; *************** *** 375,379 **** return handler->export_cooked(packet); } else { ! fprintf(stderr, "error: no packet handler for board id 0x%02x\n", packet->board_id); return; --- 439,443 ---- return handler->export_cooked(packet); } else { ! fprintf(stderr, "xpacket_export_cooked error: no packet handler for board id 0x%02x\n", packet->board_id); return; *************** *** 398,402 **** return handler->log_cooked(packet); } else { ! fprintf(stderr, "error: no packet handler for board id 0x%02x\n", packet->board_id); return; --- 462,466 ---- return handler->log_cooked(packet); } else { ! fprintf(stderr, "xpacket_log_cooked error: no packet handler for board id 0x%02x\n", packet->board_id); return; Index: xsensors.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/xsensors.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** xsensors.h 30 Jul 2005 03:14:58 -0000 1.5 --- xsensors.h 1 Aug 2005 15:23:47 -0000 1.6 *************** *** 28,31 **** --- 28,33 ---- #include "xconvert.h" + #include "../../../fireworks/apps/TestLink/LinkMsg.h" + /** * A unique identifier for each Crossbow sensorboard. *************** *** 65,69 **** XTYPE_GGBACLTST, ! XTYPE_TESTLINK = 199, // mica2 integrated boards XTYPE_MSP410 = 0xA0, --- 67,71 ---- XTYPE_GGBACLTST, ! //XTYPE_TESTLINK = 0xfb, // mica2 integrated boards XTYPE_MSP410 = 0xA0, *************** *** 79,83 **** AMTYPE_XMULTIHOP = 0x33, AMTYPE_MHOP_MSG = 0xFA, ! AMTYPE_FIREWORKS = 0xFB } XbowAMType; --- 81,85 ---- AMTYPE_XMULTIHOP = 0x33, AMTYPE_MHOP_MSG = 0xFA, ! //AMTYPE_FIREWORKS = 0xC7 } XbowAMType; *************** *** 112,116 **** #define XPACKET_MIN_SIZE 4 //!< minimum valid packet size ! #define XPACKET_TYPE 2 //!< offset to type of TOS packet #define XPACKET_GROUP 3 //!< offset to group id of TOS packet #define XPACKET_LENGTH 4 //!< offset to length of TOS packet --- 114,121 ---- #define XPACKET_MIN_SIZE 4 //!< minimum valid packet size ! //#define XPACKET_TYPE 2 //!< offset to type of TOS packet ! // For telos ! #define XPACKET_TYPE 8 //!< offset to type of TOS packet ! #define XPACKET_GROUP 3 //!< offset to group id of TOS packet #define XPACKET_LENGTH 4 //!< offset to length of TOS packet *************** *** 119,122 **** --- 124,128 ---- #define XPACKET_DATASTART_MULTIHOP 12 //!< Multihop offset to data payload #define XPACKET_DATASTART 12 //!< Default offset to data payload + #define XPACKET_DATASTART_FIREWORKS 10 //!< Offset to Fireworks data #define XPACKET_BOARD_TABLE 0 //!< offset to XSensor board table |