firebug-cvs Mailing List for FireBug: wireless wildfire monitoring (Page 4)
Brought to you by:
doolin
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(36) |
Jun
(45) |
Jul
(108) |
Aug
(31) |
Sep
(2) |
Oct
(4) |
Nov
(113) |
Dec
(20) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(63) |
Feb
(37) |
Mar
(24) |
Apr
(6) |
May
(5) |
Jun
(5) |
Jul
(71) |
Aug
(42) |
Sep
(7) |
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
(64) |
Jun
(71) |
Jul
(51) |
Aug
(89) |
Sep
(24) |
Oct
(1) |
Nov
(1) |
Dec
(2) |
2006 |
Jan
|
Feb
|
Mar
(3) |
Apr
(2) |
May
|
Jun
|
Jul
(21) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: David M. D. <do...@us...> - 2005-08-19 00:33:45
|
Update of /cvsroot/firebug/fireboard/beta/tools/gps/SiRF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5700/tools/gps/SiRF Modified Files: sirftest.c sirftest.h sirftest2.c Log Message: More work on sirf message parsing. Index: sirftest.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/gps/SiRF/sirftest.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sirftest.h 17 Aug 2005 21:48:41 -0000 1.1 --- sirftest.h 18 Aug 2005 00:38:46 -0000 1.2 *************** *** 1,25 **** ! ! // Header used in packets that make up a long message. ! // ! typedef struct fragmentHeader { ! uint8_t mote_id; ! uint8_t sequenceNumber; ! uint8_t blockNumber; ! uint8_t blockCount; ! } FragmentHeader_t; ! ! #ifndef TOSH_DATA_LENGTH ! #define TOSH_DATA_LENGTH 29 ! #endif ! ! #define FRAGMENT_PAYLOAD_LENGTH (TOSH_DATA_LENGTH - sizeof(FragmentHeader_t)) ! ! // Packet to transport variable length (and long) messages in a fixed ! // length radio message. ! typedef struct messageFragment { ! FragmentHeader_t h; ! uint8_t data[FRAGMENT_PAYLOAD_LENGTH]; ! } MessageFragment_t; --- 1,5 ---- ! #ifndef FB_SIRFTEST_H ! #define FB_SIRFTEST_H *************** *** 39,40 **** --- 19,21 ---- typedef struct msg_packer msg_packer_t; + #endif /* FB_SIRFTEST_H */ Index: sirftest2.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/gps/SiRF/sirftest2.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sirftest2.c 17 Aug 2005 21:47:39 -0000 1.1 --- sirftest2.c 18 Aug 2005 00:38:46 -0000 1.2 *************** *** 18,22 **** #include "sirftest_util.h" - #include "sirf.h" --- 18,21 ---- *************** *** 363,388 **** - // Header used in packets that make up a long message. - // - typedef struct fragmentHeader { - uint8_t mote_id; - uint8_t sequenceNumber; - uint8_t blockNumber; - uint8_t blockCount; - } FragmentHeader_t; - - #ifndef TOSH_DATA_LENGTH - #define TOSH_DATA_LENGTH 29 - #endif - - #define FRAGMENT_PAYLOAD_LENGTH (TOSH_DATA_LENGTH - sizeof(FragmentHeader_t)) - - // Packet to transport variable length (and long) messages in a fixed - // length radio message. - typedef struct messageFragment { - FragmentHeader_t h; - uint8_t data[FRAGMENT_PAYLOAD_LENGTH]; - } MessageFragment_t; - // Struct pointer for msg parsing code. --- 362,365 ---- Index: sirftest.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/gps/SiRF/sirftest.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sirftest.c 17 Aug 2005 21:46:00 -0000 1.7 --- sirftest.c 18 Aug 2005 00:38:46 -0000 1.8 *************** *** 604,607 **** --- 604,608 ---- + #if 0 // Header used in packets that make up a long message. // *************** *** 629,632 **** --- 630,635 ---- // Struct pointer for msg parsing code. typedef void * (*message_parser)(uint8_t * raw_msg); + #endif + struct msg_packer { *************** *** 642,645 **** --- 645,649 ---- typedef struct msg_packer msg_packer_t; + #define NUMBER_OF_MOTES 30 msg_packer_t * mp_array[NUMBER_OF_MOTES]; |
From: David M. D. <do...@us...> - 2005-08-19 00:31:24
|
Update of /cvsroot/firebug/fireboard/beta/tos/lib/SiRF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14310/tos/lib/SiRF Modified Files: sirf.h Log Message: sirf id 28 messages can now be handled. Index: sirf.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tos/lib/SiRF/sirf.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sirf.h 17 Aug 2005 01:56:47 -0000 1.2 --- sirf.h 17 Aug 2005 21:46:00 -0000 1.3 *************** *** 187,189 **** --- 187,230 ---- + + typedef struct SiRF_ID28 { + + fb_header header; + + uint8_t channel; + uint32_t time_tag; + uint8_t sat_id; + uint64_t gps_sw_time; + + uint64_t pseudo_range; + uint32_t carrier_freq; + uint64_t carrier_phase; + uint16_t time_in_track; + + uint8_t sync_flags; + + uint8_t cno1; + uint8_t cno2; + uint8_t cno3; + uint8_t cno4; + uint8_t cno5; + uint8_t cno6; + uint8_t cno7; + uint8_t cno8; + uint8_t cno9; + uint8_t cno10; + + uint16_t delta_range_interval; + uint16_t mean_delta_range_time; + uint16_t extrapolation_time; + uint8_t phase_error_count; + uint8_t low_power_count; + + } SiRF_ID28_t; + + enum { + AM_SIRF_ID28 = 156 + }; + + #endif /* FB_SIRF_H */ |
From: David M. D. <do...@us...> - 2005-08-19 00:24:47
|
Update of /cvsroot/firebug/fireboard/beta/tools/gps/SiRF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14310/tools/gps/SiRF Modified Files: Makefile sirf_id2.c sirf_id28.c sirf_id28_1.c sirf_id28_2.c sirf_id28_3.c sirf_id2_1.c sirf_id2_2.c sirftest.c Added Files: sirftest_util.c sirftest_util.h Log Message: sirf id 28 messages can now be handled. Index: sirftest.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/gps/SiRF/sirftest.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** sirftest.c 17 Aug 2005 01:56:47 -0000 1.6 --- sirftest.c 17 Aug 2005 21:46:00 -0000 1.7 *************** *** 559,563 **** //print_message_sizes(); print_struct_sizes(); ! //test_sirf_id2_parsing(); --- 559,563 ---- //print_message_sizes(); print_struct_sizes(); ! *************** *** 573,584 **** sid2 = (SiRF_ID2_t*)calloc(1,sizeof(SiRF_ID2_t)); sid2->xpos = convert_4_bytes_to_int(&msg[1]); sid2->ypos = convert_4_bytes_to_int(&msg[5]); sid2->zpos = convert_4_bytes_to_int(&msg[9]); ! sid2->xvel = convert_2_bytes_to_float(&msg[13]); ! sid2->yvel = convert_2_bytes_to_float(&msg[15])/8.0; ! sid2->zvel = convert_2_bytes_to_float(&msg[17])/8.0; sid2->mode1 = msg[19]; ! sid2->dop = (float)msg[20]/5.0; sid2->mode2 = msg[21]; sid2->gps_week = convert_2_bytes_to_uint16(&msg[22]); --- 573,586 ---- sid2 = (SiRF_ID2_t*)calloc(1,sizeof(SiRF_ID2_t)); + printf("zpos: %i\n",convert_4_bytes_to_int(&msg[9])); + sid2->xpos = convert_4_bytes_to_int(&msg[1]); sid2->ypos = convert_4_bytes_to_int(&msg[5]); sid2->zpos = convert_4_bytes_to_int(&msg[9]); ! sid2->xvel = convert_2_bytes_to_uint16(&msg[13]); ! sid2->yvel = convert_2_bytes_to_uint16(&msg[15]); ! sid2->zvel = convert_2_bytes_to_uint16(&msg[17]); sid2->mode1 = msg[19]; ! sid2->dop = msg[20]; sid2->mode2 = msg[21]; sid2->gps_week = convert_2_bytes_to_uint16(&msg[22]); *************** *** 660,665 **** uint8_t mid = get_message_id(sirfmsg); - printf("sirf id: %d\n",sirfmsg[2]); - switch (mid) { case 2: --- 662,665 ---- *************** *** 681,690 **** pack_struct(msg_packer_t * mp, uint8_t * raw_msg) { ! printf("Block Number:%d\n",mp->blocknumber); ! printf("msg[0]: %d\n",raw_msg[0]); ! ! strncpy(&mp->msg[mp->blocknumber*FRAGMENT_PAYLOAD_LENGTH],raw_msg,FRAGMENT_PAYLOAD_LENGTH); ! printf("ID: %d\n",mp->msg[0]); } --- 681,691 ---- pack_struct(msg_packer_t * mp, uint8_t * raw_msg) { ! int offset; ! offset = mp->blocknumber*FRAGMENT_PAYLOAD_LENGTH; ! //printf("offset: %d\n",offset); ! //printf("zpos: %i\n",convert_4_bytes_to_int(&raw_msg[9])); ! memcpy(&mp->msg[offset],raw_msg,FRAGMENT_PAYLOAD_LENGTH); ! //printf("zpos: %i\n",convert_4_bytes_to_int(&mp->msg[9])); } *************** *** 713,720 **** msg_packer_t * mp; ! printf("mf->blockcount: %d\n", mf->h.blockCount); ! printf("mf->mote_id: %d\n", mf->h.mote_id); ! printf("mf->seqno: %d\n", mf->h.sequenceNumber); printf("mf->blocknumber: %d\n", mf->h.blockNumber); mp = mp_array[mote_id]; --- 714,723 ---- msg_packer_t * mp; ! ! //printf("mf->blockcount: %d\n", mf->h.blockCount); ! //printf("mf->mote_id: %d\n", mf->h.mote_id); ! //printf("mf->seqno: %d\n", mf->h.sequenceNumber); printf("mf->blocknumber: %d\n", mf->h.blockNumber); + mp = mp_array[mote_id]; *************** *** 739,747 **** } ! printf("IDID: %d\n",mp->msg[0]); mp->blocks_received_flags |= 1 << blocknumber; ! printf("Blocks received: %d\n",mp->blocks_received_flags); if ((number_of_blocks == 1 && mp->blocks_received_flags == 1) || --- 742,750 ---- } ! //printf("IDID: %d\n",mp->msg[0]); mp->blocks_received_flags |= 1 << blocknumber; ! //printf("Blocks received: %d\n",mp->blocks_received_flags); if ((number_of_blocks == 1 && mp->blocks_received_flags == 1) || *************** *** 750,754 **** (number_of_blocks == 4 && mp->blocks_received_flags == 15)) { parse_msg(mp->msg); ! memset(mp, 0x0, sizeof(msg_packer_t)); } --- 753,757 ---- (number_of_blocks == 4 && mp->blocks_received_flags == 15)) { parse_msg(mp->msg); ! //memset(mp, 0x0, sizeof(msg_packer_t)); } *************** *** 784,792 **** //printf("%d\n",sirf_id2[0]); ! memcpy(mf1->data,(uint8_t*)sirf_id2,FRAGMENT_PAYLOAD_LENGTH); ! memcpy(&mf2->data[FRAGMENT_PAYLOAD_LENGTH],sirf_id2,FRAGMENT_PAYLOAD_LENGTH); - unpack_message((void*)mf1); unpack_message((void*)mf2); } --- 787,802 ---- //printf("%d\n",sirf_id2[0]); ! printf("zvel: %d:\n",convert_2_bytes_to_uint16(&sirf_id2[17])); ! ! ! memcpy(mf1->data,sirf_id2,FRAGMENT_PAYLOAD_LENGTH); ! memcpy(mf2->data,sirf_id2+FRAGMENT_PAYLOAD_LENGTH,FRAGMENT_PAYLOAD_LENGTH); ! ! ! printf("yvel: %d:\n",convert_2_bytes_to_uint16(&mf1->data[15])); ! unpack_message((void*)mf2); + unpack_message((void*)mf1); } *************** *** 805,810 **** //printf("Foo: %f\n", foo); - test_packer(); return 0; } --- 815,822 ---- //printf("Foo: %f\n", foo); + test_sirf_id2_parsing(); + test_packer(); + print_sirf2_message(); return 0; } Index: sirf_id28.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/gps/SiRF/sirf_id28.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sirf_id28.c 11 Jul 2005 22:33:01 -0000 1.1 --- sirf_id28.c 17 Aug 2005 21:46:00 -0000 1.2 *************** *** 1,3 **** ! #include "sirf.h" --- 1,805 ---- + /** + * This class is automatically generated by mig. DO NOT EDIT THIS FILE. + * This code implements C interface to the 'SiRF_ID28P' + * message type. + */ + #include <stdio.h> + #include <stdlib.h> + #include <memory.h> ! ! ! ! /** Private header is programmer specified for handling ! * conversion functions, etc. ! */ ! //#include "SiRF_ID28P_private.h" ! /** Not the best way to handle xbow dependencies. */ ! #ifdef TELOS_MOTE ! #include "../xdb.h" ! #include "../xsensors.h" ! #endif ! ! ! ! ! /** These need to be moved to a header file. */ ! typedef struct _SiRF_ID28P SiRF_ID28P; ! #ifndef TELOS_MOTE ! typedef struct _XbowSensorboardPacket XbowSensorboardPacket; ! #endif ! /** The Active Message type associated with this message. */ ! //static const int AM_TYPE = 156; ! ! //#define AM_TYPE 156 ! ! ! ! // This struct is defined to keep gcc happy while the module ! // is under development. At some point in the near future, a ! // a convention for passing arguments into the functions will ! // have to be defined. ! struct _XbowSensorboardPacket { ! unsigned char data[29]; ! }; ! ! ! ! ! ! ! ! ! struct _SiRF_ID28P { ! uint8_t header_mote_id; ! uint8_t header_seqno; ! uint8_t header_am_type; ! uint8_t header_blockcount; ! uint8_t channel; ! uint32_t time_tag; ! uint8_t sat_id; ! uint64_t gps_sw_time; ! uint64_t pseudo_range; ! uint32_t carrier_freq; ! uint64_t carrier_phase; ! uint16_t time_in_track; ! uint8_t sync_flags; ! uint8_t cno1; ! uint8_t cno2; ! uint8_t cno3; ! uint8_t cno4; ! uint8_t cno5; ! uint8_t cno6; ! uint8_t cno7; ! uint8_t cno8; ! uint8_t cno9; ! uint8_t cno10; ! uint16_t delta_range_interval; ! uint16_t mean_delta_range_time; ! uint16_t extrapolation_time; ! uint8_t phase_error_count; ! uint8_t low_power_count; ! }; ! ! ! ! void ! SiRF_ID28P_set_header_mote_id(SiRF_ID28P * userdata, uint8_t header_mote_id) { ! userdata->header_mote_id = header_mote_id; ! } ! ! uint8_t ! SiRF_ID28P_get_header_mote_id(SiRF_ID28P * userdata) { ! return userdata->header_mote_id; ! } ! ! void ! SiRF_ID28P_set_header_seqno(SiRF_ID28P * userdata, uint8_t header_seqno) { ! userdata->header_seqno = header_seqno; ! } ! ! uint8_t ! SiRF_ID28P_get_header_seqno(SiRF_ID28P * userdata) { ! return userdata->header_seqno; ! } ! ! void ! SiRF_ID28P_set_header_am_type(SiRF_ID28P * userdata, uint8_t header_am_type) { ! userdata->header_am_type = header_am_type; ! } ! ! uint8_t ! SiRF_ID28P_get_header_am_type(SiRF_ID28P * userdata) { ! return userdata->header_am_type; ! } ! ! void ! SiRF_ID28P_set_header_blockcount(SiRF_ID28P * userdata, uint8_t header_blockcount) { ! userdata->header_blockcount = header_blockcount; ! } ! ! uint8_t ! SiRF_ID28P_get_header_blockcount(SiRF_ID28P * userdata) { ! return userdata->header_blockcount; ! } ! ! void ! SiRF_ID28P_set_channel(SiRF_ID28P * userdata, uint8_t channel) { ! userdata->channel = channel; ! } ! ! uint8_t ! SiRF_ID28P_get_channel(SiRF_ID28P * userdata) { ! return userdata->channel; ! } ! ! void ! SiRF_ID28P_set_time_tag(SiRF_ID28P * userdata, uint32_t time_tag) { ! userdata->time_tag = time_tag; ! } ! ! uint32_t ! SiRF_ID28P_get_time_tag(SiRF_ID28P * userdata) { ! return userdata->time_tag; ! } ! ! void ! SiRF_ID28P_set_sat_id(SiRF_ID28P * userdata, uint8_t sat_id) { ! userdata->sat_id = sat_id; ! } ! ! uint8_t ! SiRF_ID28P_get_sat_id(SiRF_ID28P * userdata) { ! return userdata->sat_id; ! } ! ! void ! SiRF_ID28P_set_gps_sw_time(SiRF_ID28P * userdata, uint64_t gps_sw_time) { ! userdata->gps_sw_time = gps_sw_time; ! } ! ! uint64_t ! SiRF_ID28P_get_gps_sw_time(SiRF_ID28P * userdata) { ! return userdata->gps_sw_time; ! } ! ! void ! SiRF_ID28P_set_pseudo_range(SiRF_ID28P * userdata, uint64_t pseudo_range) { ! userdata->pseudo_range = pseudo_range; ! } ! ! uint64_t ! SiRF_ID28P_get_pseudo_range(SiRF_ID28P * userdata) { ! return userdata->pseudo_range; ! } ! ! void ! SiRF_ID28P_set_carrier_freq(SiRF_ID28P * userdata, uint32_t carrier_freq) { ! userdata->carrier_freq = carrier_freq; ! } ! ! uint32_t ! SiRF_ID28P_get_carrier_freq(SiRF_ID28P * userdata) { ! return userdata->carrier_freq; ! } ! ! void ! SiRF_ID28P_set_carrier_phase(SiRF_ID28P * userdata, uint64_t carrier_phase) { ! userdata->carrier_phase = carrier_phase; ! } ! ! uint64_t ! SiRF_ID28P_get_carrier_phase(SiRF_ID28P * userdata) { ! return userdata->carrier_phase; ! } ! ! void ! SiRF_ID28P_set_time_in_track(SiRF_ID28P * userdata, uint16_t time_in_track) { ! userdata->time_in_track = time_in_track; ! } ! ! uint16_t ! SiRF_ID28P_get_time_in_track(SiRF_ID28P * userdata) { ! return userdata->time_in_track; ! } ! ! void ! SiRF_ID28P_set_sync_flags(SiRF_ID28P * userdata, uint8_t sync_flags) { ! userdata->sync_flags = sync_flags; ! } ! ! uint8_t ! SiRF_ID28P_get_sync_flags(SiRF_ID28P * userdata) { ! return userdata->sync_flags; ! } ! ! void ! SiRF_ID28P_set_cno1(SiRF_ID28P * userdata, uint8_t cno1) { ! userdata->cno1 = cno1; ! } ! ! uint8_t ! SiRF_ID28P_get_cno1(SiRF_ID28P * userdata) { ! return userdata->cno1; ! } ! ! void ! SiRF_ID28P_set_cno2(SiRF_ID28P * userdata, uint8_t cno2) { ! userdata->cno2 = cno2; ! } ! ! uint8_t ! SiRF_ID28P_get_cno2(SiRF_ID28P * userdata) { ! return userdata->cno2; ! } ! ! void ! SiRF_ID28P_set_cno3(SiRF_ID28P * userdata, uint8_t cno3) { ! userdata->cno3 = cno3; ! } ! ! uint8_t ! SiRF_ID28P_get_cno3(SiRF_ID28P * userdata) { ! return userdata->cno3; ! } ! ! void ! SiRF_ID28P_set_cno4(SiRF_ID28P * userdata, uint8_t cno4) { ! userdata->cno4 = cno4; ! } ! ! uint8_t ! SiRF_ID28P_get_cno4(SiRF_ID28P * userdata) { ! return userdata->cno4; ! } ! ! void ! SiRF_ID28P_set_cno5(SiRF_ID28P * userdata, uint8_t cno5) { ! userdata->cno5 = cno5; ! } ! ! uint8_t ! SiRF_ID28P_get_cno5(SiRF_ID28P * userdata) { ! return userdata->cno5; ! } ! ! void ! SiRF_ID28P_set_cno6(SiRF_ID28P * userdata, uint8_t cno6) { ! userdata->cno6 = cno6; ! } ! ! uint8_t ! SiRF_ID28P_get_cno6(SiRF_ID28P * userdata) { ! return userdata->cno6; ! } ! ! void ! SiRF_ID28P_set_cno7(SiRF_ID28P * userdata, uint8_t cno7) { ! userdata->cno7 = cno7; ! } ! ! uint8_t ! SiRF_ID28P_get_cno7(SiRF_ID28P * userdata) { ! return userdata->cno7; ! } ! ! void ! SiRF_ID28P_set_cno8(SiRF_ID28P * userdata, uint8_t cno8) { ! userdata->cno8 = cno8; ! } ! ! uint8_t ! SiRF_ID28P_get_cno8(SiRF_ID28P * userdata) { ! return userdata->cno8; ! } ! ! void ! SiRF_ID28P_set_cno9(SiRF_ID28P * userdata, uint8_t cno9) { ! userdata->cno9 = cno9; ! } ! ! uint8_t ! SiRF_ID28P_get_cno9(SiRF_ID28P * userdata) { ! return userdata->cno9; ! } ! ! void ! SiRF_ID28P_set_cno10(SiRF_ID28P * userdata, uint8_t cno10) { ! userdata->cno10 = cno10; ! } ! ! uint8_t ! SiRF_ID28P_get_cno10(SiRF_ID28P * userdata) { ! return userdata->cno10; ! } ! ! void ! SiRF_ID28P_set_delta_range_interval(SiRF_ID28P * userdata, uint16_t delta_range_interval) { ! userdata->delta_range_interval = delta_range_interval; ! } ! ! uint16_t ! SiRF_ID28P_get_delta_range_interval(SiRF_ID28P * userdata) { ! return userdata->delta_range_interval; ! } ! ! void ! SiRF_ID28P_set_mean_delta_range_time(SiRF_ID28P * userdata, uint16_t mean_delta_range_time) { ! userdata->mean_delta_range_time = mean_delta_range_time; ! } ! ! uint16_t ! SiRF_ID28P_get_mean_delta_range_time(SiRF_ID28P * userdata) { ! return userdata->mean_delta_range_time; ! } ! ! void ! SiRF_ID28P_set_extrapolation_time(SiRF_ID28P * userdata, uint16_t extrapolation_time) { ! userdata->extrapolation_time = extrapolation_time; ! } ! ! uint16_t ! SiRF_ID28P_get_extrapolation_time(SiRF_ID28P * userdata) { ! return userdata->extrapolation_time; ! } ! ! void ! SiRF_ID28P_set_phase_error_count(SiRF_ID28P * userdata, uint8_t phase_error_count) { ! userdata->phase_error_count = phase_error_count; ! } ! ! uint8_t ! SiRF_ID28P_get_phase_error_count(SiRF_ID28P * userdata) { ! return userdata->phase_error_count; ! } ! ! void ! SiRF_ID28P_set_low_power_count(SiRF_ID28P * userdata, uint8_t low_power_count) { ! userdata->low_power_count = low_power_count; ! } ! ! uint8_t ! SiRF_ID28P_get_low_power_count(SiRF_ID28P * userdata) { ! return userdata->low_power_count; ! } ! ! ! ! ! ! //Format string generated automatically, ! //static char formatstring[] = "%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i"; ! ! ! //static char formatstring[] = "%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i"; ! ! ! static char insert_stmt[] = "INSERT into SiRF_ID28P (" ! "result_time," ! "header_mote_id," ! "header_seqno," ! "header_am_type," ! "header_blockcount," ! "channel," ! "time_tag," ! "sat_id," ! "gps_sw_time," ! "pseudo_range," ! "carrier_freq," ! "carrier_phase," ! "time_in_track," ! "sync_flags," ! "cno1," ! "cno2," ! "cno3," ! "cno4," ! "cno5," ! "cno6," ! "cno7," ! "cno8," ! "cno9," ! "cno10," ! "delta_range_interval," ! "mean_delta_range_time," ! "extrapolation_time," ! "phase_error_count," ! "low_power_count) values (now(), %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"; ! ! ! void ! SiRF_ID28P_pg_log(XbowSensorboardPacket * userdata) { ! char pg_command[255]; ! SiRF_ID28P * data = (SiRF_ID28P*)userdata; ! sprintf(pg_command,insert_stmt, ! data->header_mote_id, ! data->header_seqno, ! data->header_am_type, ! data->header_blockcount, ! data->channel, ! data->time_tag, ! data->sat_id, ! data->gps_sw_time, ! data->pseudo_range, ! data->carrier_freq, ! data->carrier_phase, ! data->time_in_track, ! data->sync_flags, ! data->cno1, ! data->cno2, ! data->cno3, ! data->cno4, ! data->cno5, ! data->cno6, ! data->cno7, ! data->cno8, ! data->cno9, ! data->cno10, ! data->delta_range_interval, ! data->mean_delta_range_time, ! data->extrapolation_time, ! data->phase_error_count, ! data->low_power_count); ! #ifdef TELOS_MOTE ! xdb_execute(pg_command); ! #endif ! } ! ! ! ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! header_mote_id_convert(uint8_t header_mote_id) { ! return header_mote_id; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! header_seqno_convert(uint8_t header_seqno) { ! return header_seqno; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! header_am_type_convert(uint8_t header_am_type) { ! return header_am_type; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! header_blockcount_convert(uint8_t header_blockcount) { ! return header_blockcount; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! channel_convert(uint8_t channel) { ! return channel; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint32_t ! time_tag_convert(uint32_t time_tag) { ! return time_tag; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! sat_id_convert(uint8_t sat_id) { ! return sat_id; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint64_t ! gps_sw_time_convert(uint64_t gps_sw_time) { ! return gps_sw_time; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint64_t ! pseudo_range_convert(uint64_t pseudo_range) { ! return pseudo_range; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint32_t ! carrier_freq_convert(uint32_t carrier_freq) { ! return carrier_freq; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint64_t ! carrier_phase_convert(uint64_t carrier_phase) { ! return carrier_phase; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint16_t ! time_in_track_convert(uint16_t time_in_track) { ! return time_in_track; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! sync_flags_convert(uint8_t sync_flags) { ! return sync_flags; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! cno1_convert(uint8_t cno1) { ! return cno1; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! cno2_convert(uint8_t cno2) { ! return cno2; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! cno3_convert(uint8_t cno3) { ! return cno3; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! cno4_convert(uint8_t cno4) { ! return cno4; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! cno5_convert(uint8_t cno5) { ! return cno5; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! cno6_convert(uint8_t cno6) { ! return cno6; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! cno7_convert(uint8_t cno7) { ! return cno7; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! cno8_convert(uint8_t cno8) { ! return cno8; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! cno9_convert(uint8_t cno9) { ! return cno9; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! cno10_convert(uint8_t cno10) { ! return cno10; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint16_t ! delta_range_interval_convert(uint16_t delta_range_interval) { ! return delta_range_interval; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint16_t ! mean_delta_range_time_convert(uint16_t mean_delta_range_time) { ! return mean_delta_range_time; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint16_t ! extrapolation_time_convert(uint16_t extrapolation_time) { ! return extrapolation_time; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! phase_error_count_convert(uint8_t phase_error_count) { ! return phase_error_count; ! } ! ! /** @brief Default behavior is to return the input as output. ! * User is responsible for "cooking" the data. ! */ ! static uint8_t ! low_power_count_convert(uint8_t low_power_count) { ! return low_power_count; ! } ! ! void ! SiRF_ID28P_cook_packet(SiRF_ID28P * userdata) { ! userdata->header_mote_id = header_mote_id_convert(userdata->header_mote_id); ! userdata->header_seqno = header_seqno_convert(userdata->header_seqno); ! userdata->header_am_type = header_am_type_convert(userdata->header_am_type); ! userdata->header_blockcount = header_blockcount_convert(userdata->header_blockcount); ! userdata->channel = channel_convert(userdata->channel); ! userdata->time_tag = time_tag_convert(userdata->time_tag); ! userdata->sat_id = sat_id_convert(userdata->sat_id); ! userdata->gps_sw_time = gps_sw_time_convert(userdata->gps_sw_time); ! userdata->pseudo_range = pseudo_range_convert(userdata->pseudo_range); ! userdata->carrier_freq = carrier_freq_convert(userdata->carrier_freq); ! userdata->carrier_phase = carrier_phase_convert(userdata->carrier_phase); ! userdata->time_in_track = time_in_track_convert(userdata->time_in_track); ! userdata->sync_flags = sync_flags_convert(userdata->sync_flags); ! userdata->cno1 = cno1_convert(userdata->cno1); ! userdata->cno2 = cno2_convert(userdata->cno2); ! userdata->cno3 = cno3_convert(userdata->cno3); ! userdata->cno4 = cno4_convert(userdata->cno4); ! userdata->cno5 = cno5_convert(userdata->cno5); ! userdata->cno6 = cno6_convert(userdata->cno6); ! userdata->cno7 = cno7_convert(userdata->cno7); ! userdata->cno8 = cno8_convert(userdata->cno8); ! userdata->cno9 = cno9_convert(userdata->cno9); ! userdata->cno10 = cno10_convert(userdata->cno10); ! userdata->delta_range_interval = delta_range_interval_convert(userdata->delta_range_interval); ! userdata->mean_delta_range_time = mean_delta_range_time_convert(userdata->mean_delta_range_time); ! userdata->extrapolation_time = extrapolation_time_convert(userdata->extrapolation_time); ! userdata->phase_error_count = phase_error_count_convert(userdata->phase_error_count); ! userdata->low_power_count = low_power_count_convert(userdata->low_power_count); ! } ! ! ! ! ! ! /** User has to fill in any conversion code ! * necessary for processing. ! */ ! SiRF_ID28P * ! SiRF_ID28P_convert(char * data) { ! // Just to keep gcc happy. ! return (SiRF_ID28P*)data; ! } ! ! ! ! ! /** Print the bytes of the packet. */ ! void ! SiRF_ID28P_print_raw (XbowSensorboardPacket *packet) { ! ! printf("SiRF_ID28P print raw.\n"); ! } ! ! /** Print cooked output. */ ! void ! SiRF_ID28P_print_cooked (XbowSensorboardPacket * userdata) { ! ! SiRF_ID28P * data = (SiRF_ID28P*)userdata; ! printf("SiRF_ID28P print cooked:\n"); ! printf(" header_mote_id: %i,\n",data->header_mote_id); ! printf(" header_seqno: %i,\n",data->header_seqno); ! printf(" header_am_type: %i,\n",data->header_am_type); ! printf(" header_blockcount: %i,\n",data->header_blockcount); ! printf(" channel: %i,\n",data->channel); ! printf(" time_tag: %i,\n",data->time_tag); ! printf(" sat_id: %i,\n",data->sat_id); ! printf(" gps_sw_time: %i,\n",data->gps_sw_time); ! printf(" pseudo_range: %i,\n",data->pseudo_range); ! printf(" carrier_freq: %i,\n",data->carrier_freq); ! printf(" carrier_phase: %i,\n",data->carrier_phase); ! printf(" time_in_track: %i,\n",data->time_in_track); ! printf(" sync_flags: %i,\n",data->sync_flags); ! printf(" cno1: %i,\n",data->cno1); ! printf(" cno2: %i,\n",data->cno2); ! printf(" cno3: %i,\n",data->cno3); ! printf(" cno4: %i,\n",data->cno4); ! printf(" cno5: %i,\n",data->cno5); ! printf(" cno6: %i,\n",data->cno6); ! printf(" cno7: %i,\n",data->cno7); ! printf(" cno8: %i,\n",data->cno8); ! printf(" cno9: %i,\n",data->cno9); ! printf(" cno10: %i,\n",data->cno10); ! printf(" delta_range_interval: %i,\n",data->delta_range_interval); ! printf(" mean_delta_range_time: %i,\n",data->mean_delta_range_time); ! printf(" extrapolation_time: %i,\n",data->extrapolation_time); ! printf(" phase_error_count: %i,\n",data->phase_error_count); ! printf(" low_power_count: %i,\n",data->low_power_count); ! } ! ! #ifdef TELOS_MOTE ! XPacketHandler SiRF_ID28P_packet_handler = { ! // This should be replaced with the AM_TYPE ! 156, ! "$Id$", ! SiRF_ID28P_print_raw, ! SiRF_ID28P_print_cooked, ! SiRF_ID28P_print_raw, ! SiRF_ID28P_print_cooked, ! SiRF_ID28P_pg_log, ! {0} ! }; ! ! ! void ! SiRF_ID28P_initialize() { ! xpacket_add_type(&SiRF_ID28P_packet_handler); ! } ! #endif ! /** The default size of this message type in bytes. */ ! //static int DEFAULT_MESSAGE_SIZE = 59; ! ! /** If incomplete types are used, we need to provide a way ! * to manage memory. ! */ ! SiRF_ID28P * ! SiRF_ID28P_new() { ! SiRF_ID28P * userdata = (SiRF_ID28P*)malloc(sizeof(SiRF_ID28P)); ! memset((void*)userdata,0xda,sizeof(SiRF_ID28P)); ! return userdata; ! } ! ! ! ! ! void ! SiRF_ID28P_delete(SiRF_ID28P * userdata) { ! memset((void*)userdata,0xdd,sizeof(SiRF_ID28P)); ! free(userdata); ! } Index: Makefile =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/gps/SiRF/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile 17 Aug 2005 01:56:47 -0000 1.5 --- Makefile 17 Aug 2005 21:46:00 -0000 1.6 *************** *** 1,8 **** SRC = sirf_id2_1.c sirf_id2_2.c sirf_id28_1.c sirf_id28_2.c sirf_id28_3.c ! SRC += sirf_id2.c INCLUDES = ../../../tos/lib/SiRF # uint32_t -> int format produces annoying warning messages, # disable it for now. --- 1,11 ---- SRC = sirf_id2_1.c sirf_id2_2.c sirf_id28_1.c sirf_id28_2.c sirf_id28_3.c ! SRC += sirf_id2.c sirf_id28.c ! SRC += sirftest_util.c INCLUDES = ../../../tos/lib/SiRF + all: test sirftest2 sirftest28 + # uint32_t -> int format produces annoying warning messages, # disable it for now. *************** *** 10,13 **** --- 13,22 ---- gcc -Wall -Wno-format -o sirftest -I$(INCLUDES) sirftest.c $(SRC) + sirftest2: + gcc -Wall -Wno-format -o sirftest2 -I$(INCLUDES) sirftest2.c $(SRC) + + sirftest28: + gcc -Wall -Wno-format -o sirftest28 -I$(INCLUDES) sirftest28.c $(SRC) -lm + clean: --- NEW FILE: sirftest_util.c --- #include <stdio.h> #include <string.h> #include <stdlib.h> // TODO: Make a macro for this. int convert_4_bytes_to_int(char * bytes) { int val = 0; val |= bytes[0] & 0xFF; val <<= 8; val |= bytes[1] & 0xFF; val <<= 8; val |= bytes[2] & 0xFF; val <<= 8; val |= bytes[3] & 0xFF; return val; } /* static int convert_4_bytes_to_uint32(char * bytes) { int val = 0; val |= bytes[0] & 0xFF; val <<= 8; val |= bytes[1] & 0xFF; val <<= 8; val |= bytes[2] & 0xFF; val <<= 8; val |= bytes[3] & 0xFF; return val; } */ // TODO: Make a macro for this. float convert_2_bytes_to_float(char * bytes) { int16_t val = 0; val |= bytes[0] & 0xFF; val <<= 8; val |= bytes[1] & 0xFF; return (float)val; } // TODO: Make a macro for this. float convert_4_bytes_to_float(char * bytes) { int32_t val = 0; val |= bytes[0] & 0xFF; val <<= 8; val |= bytes[1] & 0xFF; val <<= 8; val |= bytes[2] & 0xFF; val <<= 8; val |= bytes[3] & 0xFF; return (float)val; } // FIXME: Get rid of locally defined variable // so that this can be turned into a macro. double convert_8_bytes_to_double(char * bytes) { int64_t val = 0; val |= bytes[0] & 0xFF; val <<= 8; val |= bytes[1] & 0xFF; val <<= 8; val |= bytes[2] & 0xFF; val <<= 8; val |= bytes[3] & 0xFF; val <<= 8; val |= bytes[4] & 0xFF; val <<= 8; val |= bytes[5] & 0xFF; val <<= 8; val |= bytes[6] & 0xFF; val <<= 8; val |= bytes[7] & 0xFF; return (double)val; } // TODO: Make a macro for this. uint16_t convert_2_bytes_to_uint16(char * bytes) { uint16_t val = 0; val |= bytes[0] & 0xFF; val <<= 8; val |= bytes[1] & 0xFF; return val; } --- NEW FILE: sirftest_util.h --- int convert_4_bytes_to_int (char * bytes); /* int convert_4_bytes_to_uint32 (char * bytes); */ // TODO: Make a macro for this. float convert_2_bytes_to_float (char * bytes); // TODO: Make a macro for this. float convert_4_bytes_to_float (char * bytes); // FIXME: Get rid of locally defined variable // so that this can be turned into a macro. double convert_8_bytes_to_double (char * bytes); // TODO: Make a macro for this. uint16_t convert_2_bytes_to_uint16 (char * bytes); |
From: David M. D. <do...@us...> - 2005-08-19 00:19:55
|
Update of /cvsroot/firebug/fireboard/beta/tools/gps/SiRF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15083/tools/gps/SiRF Added Files: sirftest.h sirftest28.c Log Message: sirf id 28 messages can now be handled. --- NEW FILE: sirftest.h --- // Header used in packets that make up a long message. // typedef struct fragmentHeader { uint8_t mote_id; uint8_t sequenceNumber; uint8_t blockNumber; uint8_t blockCount; } FragmentHeader_t; #ifndef TOSH_DATA_LENGTH #define TOSH_DATA_LENGTH 29 #endif #define FRAGMENT_PAYLOAD_LENGTH (TOSH_DATA_LENGTH - sizeof(FragmentHeader_t)) // Packet to transport variable length (and long) messages in a fixed // length radio message. typedef struct messageFragment { FragmentHeader_t h; uint8_t data[FRAGMENT_PAYLOAD_LENGTH]; } MessageFragment_t; // Struct pointer for msg parsing code. typedef void * (*message_parser)(uint8_t * raw_msg); struct msg_packer { uint8_t number_of_blocks; uint8_t mote_id; uint8_t blocknumber; uint8_t seqno; uint8_t blocks_received_flags; uint8_t msg[255]; }; typedef struct msg_packer msg_packer_t; --- NEW FILE: sirftest28.c --- /** * Test code for LeadTek GPS unit sirf message 28. */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE !FALSE #endif #include "sirftest.h" #include "sirftest_util.h" #include "sirf.h" static FILE * outstream; // See page 67 of the LeadTek Protocol manual for // example sirf id 2 string. static char sirf_id28[] = { 0x1c, // message id 0x00, // channel 0x00, 0x06, 0x60, 0xd0, // time tag 0x14, // satellite id 0xf1, 0x43, 0xf6, 0x2c, // GPS Software time, 1st 4 bytes 0x41, 0x13, 0xf4, 0x2f, // GPS Software time, 2d 4 bytes 0x41, 0x7b, 0x23, 0x5c, // Pseudo-range, 1st 4 bytes 0xf3, 0xfb, 0xe9, 0x5e, // Pseudo-range, 2d 4 bytes 0x46, 0x8c, 0x69, 0x64, // Carrier freq. 0xb8, 0xfb, 0xc5, 0x82, // Carrier phase, 1st 4 bytes 0x41, 0x5c, 0xf1, 0x5e, // Carrier phase, 2d 4 bytes 0x75, 0x30, // Time in track 0x17, // Sync flags 0x34, // C/No 1 0x34, // C/No 2 0x34, // C/No 3 0x34, // C/No 4 0x34, // C/No 5 0x34, // C/No 6 0x34, // C/No 7 0x34, // C/No 8 0x34, // C/No 9 0x34, // C/No 10 0x03, 0xe8, // Delta Range interval 0x01, 0xf4, // Mean Delta Range Time 0x00, 0x00, // Extrapolation time 0x00, // Phase error count 0x00 // Low Power Count }; void print_message_sizes(void) { printf("Size of sirf id 28 string: %d\n", sizeof(sirf_id28)); } uint8_t get_message_id(char * msg) { return msg[0]; } unsigned char leadtek_crc(char * message, int size) { unsigned char cs = 0; int index = 1; while (message[index] != '*') { cs ^= message[index++]; } return cs; } unsigned char sirf_crc(char * msg, uint8_t size) { unsigned char cs = 0; uint8_t i; for (i=0; i<size; i++) { cs = cs ^ msg[i]; } return cs; } int fb_sirfid28_test() { int passed = FALSE; uint8_t msgid = 0; uint8_t channel; int time_tag; uint8_t sat_id; double gps_software_time; double pseudo_range; float carrier_freq; double carrier_phase; uint16_t time_in_track; uint8_t sync_flags; uint8_t cno1, cno2, cno3, cno4, cno5, cno6, cno7, cno8, cno9, cno10; uint16_t delta_range_interval; uint16_t mean_delta_range_time; uint16_t extrapolation_time; uint8_t phase_error_count, low_power_count; msgid = get_message_id(sirf_id28); passed = (msgid == 28); channel = sirf_id28[1]; passed &= (channel == 0); time_tag = convert_4_bytes_to_int(&sirf_id28[2]); passed &= (time_tag == 418000); //fprintf(outstream,"Time tag: %d\n",0x000660D0); sat_id = sirf_id28[6]; passed &= (sat_id == 20); //fprintf(outstream,"Sat id: %d\n",sat_id); /* Failing first here. */ gps_software_time = convert_8_bytes_to_double(&sirf_id28[7]); passed &= (gps_software_time == 2.4921113696e5); pseudo_range = convert_8_bytes_to_double(&sirf_id28[15]); //passed &= (pseudo_range == 2.1016756638e7); // Check offset carrier_freq = convert_4_bytes_to_float(&sirf_id28[23]); //passed &= (carrier_freq == 1.6756767578e4); carrier_phase = convert_8_bytes_to_double(&sirf_id28[27]); //passed &= (carrier_phase == 4.4345542262e4); time_in_track = convert_2_bytes_to_uint16(&sirf_id28[35]); passed &= (time_in_track == 30000); sync_flags = sirf_id28[37]; passed &= (sync_flags == 23); cno1 = sirf_id28[38]; passed &= (cno1 == 52); cno2 = sirf_id28[39]; passed &= (cno2 == 52); cno3 = sirf_id28[40]; passed &= (cno3 == 52); cno4 = sirf_id28[41]; passed &= (cno4 == 52); cno5 = sirf_id28[42]; passed &= (cno5 == 52); cno6 = sirf_id28[43]; passed &= (cno6 == 52); cno7 = sirf_id28[44]; passed &= (cno7 == 52); cno8 = sirf_id28[45]; passed &= (cno8 == 52); cno9 = sirf_id28[46]; passed &= (cno9 == 52); cno10 = sirf_id28[47]; passed &= (cno10 == 52); delta_range_interval = convert_2_bytes_to_uint16(&sirf_id28[48]); passed &= (delta_range_interval == 1000); mean_delta_range_time = convert_2_bytes_to_uint16(&sirf_id28[50]); passed &= (mean_delta_range_time == 500); extrapolation_time = convert_2_bytes_to_uint16(&sirf_id28[52]); passed &= (extrapolation_time == 0); phase_error_count = sirf_id28[54]; passed &= (phase_error_count == 0); low_power_count = sirf_id28[55]; passed &= (low_power_count == 0); return passed; } int fb_sirf_test(void) { if (fb_sirfid28_test()) { fprintf(outstream, "SiRF ID 28 parsing passed.\n"); } else { fprintf(outstream, "SiRF ID 28 parsing failed.\n"); } return FALSE; } #define NUMBER_OF_MOTES 30 static msg_packer_t * mp_array[NUMBER_OF_MOTES]; static void init_mp_array() { int i; for (i=0; i< NUMBER_OF_MOTES; i++) { mp_array[i] = calloc(1,sizeof(msg_packer_t)); } } SiRF_ID28_t * parse_sirfid28(uint8_t * sirfmsg) { SiRF_ID28_t * sid28; sid28 = (SiRF_ID28_t*)calloc(1,sizeof(SiRF_ID28_t)); //sid28->msgid = get_message_id(sirf_id28); sid28->channel = sirf_id28[1]; sid28->time_tag = convert_4_bytes_to_int(&sirf_id28[2]); sid28->sat_id = sirf_id28[6]; sid28->gps_sw_time = (uint64_t)convert_8_bytes_to_double(&sirf_id28[7]); sid28->pseudo_range = (uint64_t)convert_8_bytes_to_double(&sirf_id28[15]); sid28->carrier_freq = convert_4_bytes_to_int(&sirf_id28[23]); sid28->carrier_phase = (uint64_t)convert_8_bytes_to_double(&sirf_id28[27]); sid28->time_in_track = convert_2_bytes_to_uint16(&sirf_id28[35]); sid28->sync_flags = sirf_id28[37]; sid28->cno1 = sirf_id28[38]; sid28->cno2 = sirf_id28[39]; sid28->cno3 = sirf_id28[40]; sid28->cno4 = sirf_id28[41]; sid28->cno5 = sirf_id28[42]; sid28->cno6 = sirf_id28[43]; sid28->cno7 = sirf_id28[44]; sid28->cno8 = sirf_id28[45]; sid28->cno9 = sirf_id28[46]; sid28->cno10 = sirf_id28[47]; sid28->delta_range_interval = convert_2_bytes_to_uint16(&sirf_id28[48]); sid28->mean_delta_range_time = convert_2_bytes_to_uint16(&sirf_id28[50]); sid28->extrapolation_time = convert_2_bytes_to_uint16(&sirf_id28[52]); sid28->phase_error_count = sirf_id28[54]; sid28->low_power_count = sirf_id28[55]; return sid28; } void parse_msg(uint8_t * sirfmsg) { SiRF_ID28_t * sid28; uint8_t mid = get_message_id(sirfmsg); switch (mid) { case 2: break; case 28: printf("Parsing sirf id 28 msg...\n"); sid28 = parse_sirfid28(sirfmsg); SiRF_ID28P_print_cooked(sid28); break; default: ; } } void pack_struct(msg_packer_t * mp, uint8_t * raw_msg) { int offset; offset = mp->blocknumber*FRAGMENT_PAYLOAD_LENGTH; //printf("offset: %d\n",offset); //printf("zpos: %i\n",convert_4_bytes_to_int(&raw_msg[9])); memcpy(&mp->msg[offset],raw_msg,FRAGMENT_PAYLOAD_LENGTH); //printf("zpos: %i\n",convert_4_bytes_to_int(&mp->msg[9])); } /** This is really quick and dirty code, * should work ok, but will probably * start to drop a lot of packets as * the number of motes increases and * as the number of hops from mote to * base station increases. * * The idea is that when packets come in, * we have to keep track of what we have * versus what we need to have a complete * message. */ void unpack_message(void * raw_msg) { MessageFragment_t * mf = (MessageFragment_t*)raw_msg; uint8_t number_of_blocks = mf->h.blockCount; uint8_t mote_id = mf->h.mote_id; uint8_t blocknumber = mf->h.blockNumber; uint8_t seqno = mf->h.sequenceNumber; msg_packer_t * mp; //printf("mf->blockcount: %d\n", mf->h.blockCount); //printf("mf->mote_id: %d\n", mf->h.mote_id); //printf("mf->seqno: %d\n", mf->h.sequenceNumber); printf("mf->blocknumber: %d\n", mf->h.blockNumber); mp = mp_array[mote_id]; mp->blocknumber = blocknumber; //printf("mp->seqno: %d\n",mp->seqno); // Out of sequence messages are discarded. if (mp->seqno > seqno) { printf("older\n"); return; } else if (mp->seqno == seqno) { printf("same\n"); //stuff the msg frag into the struct. pack_struct(mp,mf->data); } else { // // Current struct is stale, refill. printf("newer\n"); memset(mp, 0x0, sizeof(msg_packer_t)); //stuff the msg frag into the struct. pack_struct(mp,mf->data); } //printf("IDID: %d\n",mp->msg[0]); mp->blocks_received_flags |= 1 << blocknumber; printf("Blocks received: %d\n",mp->blocks_received_flags); if ((number_of_blocks == 1 && mp->blocks_received_flags == 1) || (number_of_blocks == 2 && mp->blocks_received_flags == 3) || (number_of_blocks == 3 && mp->blocks_received_flags == 7) || (number_of_blocks == 4 && mp->blocks_received_flags == 15)) { parse_msg(mp->msg); //memset(mp, 0x0, sizeof(msg_packer_t)); } } static void test_packer() { int offset; MessageFragment_t * mf1; MessageFragment_t * mf2; MessageFragment_t * mf3; mf1 = (MessageFragment_t *)calloc(1,sizeof(MessageFragment_t)); mf2 = (MessageFragment_t *)calloc(1,sizeof(MessageFragment_t)); mf3 = (MessageFragment_t *)calloc(1,sizeof(MessageFragment_t)); init_mp_array(); mf1->h.sequenceNumber = 0; mf2->h.sequenceNumber = 0; mf3->h.sequenceNumber = 0; mf1->h.blockCount = 3; mf2->h.blockCount = 3; mf3->h.blockCount = 3; mf1->h.blockNumber = 0; mf2->h.blockNumber = 1; mf3->h.blockNumber = 2; mf1->h.mote_id = 13; mf2->h.mote_id = 13; mf3->h.mote_id = 13; offset = 0*FRAGMENT_PAYLOAD_LENGTH; memcpy(mf1->data,sirf_id28+offset,FRAGMENT_PAYLOAD_LENGTH); offset = 1*FRAGMENT_PAYLOAD_LENGTH; memcpy(mf2->data,sirf_id28+offset,FRAGMENT_PAYLOAD_LENGTH); offset = 2*FRAGMENT_PAYLOAD_LENGTH; memcpy(mf3->data,sirf_id28+offset,FRAGMENT_PAYLOAD_LENGTH); unpack_message((void*)mf2); unpack_message((void*)mf1); unpack_message((void*)mf3); } int main(int argc, char ** argv) { outstream = stdout; int structsize; structsize = sizeof(SiRF_ID28_t); fprintf(outstream,"Sizeof ID 28 struct: %d\n",structsize); // ceil takes a double, returns a double (!??!!!???!!) fprintf(outstream,"Number of fragments: %d\n",(int)ceil((double)structsize/FRAGMENT_PAYLOAD_LENGTH)); test_packer(); //print_sirf28_message(); return 0; } |
From: David M. D. <do...@us...> - 2005-08-19 00:18:04
|
Update of /cvsroot/firebug/fireboard/beta/tos/lib/SiRF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4249 Modified Files: SiRFM.nc sirf.h Log Message: Filled in parsing code. Index: SiRFM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tos/lib/SiRF/SiRFM.nc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SiRFM.nc 17 Aug 2005 01:56:47 -0000 1.3 --- SiRFM.nc 17 Aug 2005 22:51:56 -0000 1.4 *************** *** 13,16 **** --- 13,20 ---- */ + + /** TODO: These came from the GGA code, and + * need to be rearranged/renamed for sirf data. + */ #define extract_num_sats_m(data) (10*(data[0]-'0') + (data[1]-'0')) #define extract_hours_m(data) (10*(data[0]-'0') + (data[1]-'0')) *************** *** 34,38 **** module SiRFM { ! provides interface SiRF; } --- 38,51 ---- module SiRFM { ! provides { ! ! interface SiRF; ! /** These will all be turned into macros later. */ ! command int convert_4_bytes_to_int(char * bytes); ! command float convert_2_bytes_to_float(char * bytes); ! command float convert_4_bytes_to_float(char * bytes); ! command double convert_8_bytes_to_double(char * bytes); ! command uint16_t convert_2_bytes_to_uint16(char * bytes); ! } } *************** *** 50,67 **** command uint8_t SiRF.get_type (const char * sirfstring) { ! return 0; } ! command result_t SiRF.id2_parse(const char * sirf_string) { ! return FAIL; } ! command result_t SiRF.id28_parse(const char * sirf_string) { ! return FAIL; } } --- 63,222 ---- command uint8_t SiRF.get_type (const char * sirfstring) { ! return sirfstring[0]; } ! command result_t SiRF.id2_parse(SiRF_ID2_t * sid2, char * sirf_string) { ! sid2->xpos = call convert_4_bytes_to_int(&sirf_string[1]); ! sid2->ypos = call convert_4_bytes_to_int(&sirf_string[5]); ! sid2->zpos = call convert_4_bytes_to_int(&sirf_string[9]); ! sid2->xvel = call convert_2_bytes_to_uint16(&sirf_string[13]); ! sid2->yvel = call convert_2_bytes_to_uint16(&sirf_string[15]); ! sid2->zvel = call convert_2_bytes_to_uint16(&sirf_string[17]); ! sid2->mode1 = sirf_string[19]; ! sid2->dop = sirf_string[20]; ! sid2->mode2 = sirf_string[21]; ! sid2->gps_week = call convert_2_bytes_to_uint16(&sirf_string[22]); ! sid2->gps_tow = call convert_4_bytes_to_int(&sirf_string[24]); ! sid2->sv_in_fix = sirf_string[28]; ! sid2->ch1 = sirf_string[29]; ! sid2->ch2 = sirf_string[30]; ! sid2->ch3 = sirf_string[31]; ! sid2->ch4 = sirf_string[32]; ! sid2->ch5 = sirf_string[33]; ! sid2->ch6 = sirf_string[34]; ! sid2->ch7 = sirf_string[35]; ! sid2->ch8 = sirf_string[36]; ! sid2->ch9 = sirf_string[37]; ! sid2->ch10 = sirf_string[38]; ! sid2->ch11 = sirf_string[39]; ! sid2->ch12 = sirf_string[40]; ! ! return SUCCESS; } ! command result_t SiRF.id28_parse(SiRF_ID28_t * sid28, char * sirf_string) { ! sid28->channel = sirf_string[1]; ! sid28->time_tag = call convert_4_bytes_to_int(&sirf_string[2]); ! sid28->sat_id = sirf_string[6]; ! sid28->gps_sw_time = (uint64_t)call convert_8_bytes_to_double(&sirf_string[7]); ! sid28->pseudo_range = (uint64_t)call convert_8_bytes_to_double(&sirf_string[15]); ! sid28->carrier_freq = call convert_4_bytes_to_int(&sirf_string[23]); ! sid28->carrier_phase = (uint64_t)call convert_8_bytes_to_double(&sirf_string[27]); ! sid28->time_in_track = call convert_2_bytes_to_uint16(&sirf_string[35]); ! sid28->sync_flags = sirf_string[37]; ! sid28->cno1 = sirf_string[38]; ! sid28->cno2 = sirf_string[39]; ! sid28->cno3 = sirf_string[40]; ! sid28->cno4 = sirf_string[41]; ! sid28->cno5 = sirf_string[42]; ! sid28->cno6 = sirf_string[43]; ! sid28->cno7 = sirf_string[44]; ! sid28->cno8 = sirf_string[45]; ! sid28->cno9 = sirf_string[46]; ! sid28->cno10 = sirf_string[47]; ! sid28->delta_range_interval = call convert_2_bytes_to_uint16(&sirf_string[48]); ! sid28->mean_delta_range_time = call convert_2_bytes_to_uint16(&sirf_string[50]); ! sid28->extrapolation_time = call convert_2_bytes_to_uint16(&sirf_string[52]); ! sid28->phase_error_count = sirf_string[54]; ! sid28->low_power_count = sirf_string[55]; ! ! return SUCCESS; } + + + // TODO: Make a macro for this. + command int convert_4_bytes_to_int(char * bytes) { + + int val = 0; + val |= bytes[0] & 0xFF; + val <<= 8; + val |= bytes[1] & 0xFF; + val <<= 8; + val |= bytes[2] & 0xFF; + val <<= 8; + val |= bytes[3] & 0xFF; + return val; + } + + /* + command static int + convert_4_bytes_to_uint32(char * bytes) { + + int val = 0; + val |= bytes[0] & 0xFF; + val <<= 8; + val |= bytes[1] & 0xFF; + val <<= 8; + val |= bytes[2] & 0xFF; + val <<= 8; + val |= bytes[3] & 0xFF; + return val; + } + */ + + + // TODO: Make a macro for this. + command float convert_2_bytes_to_float(char * bytes) { + + int16_t val = 0; + val |= bytes[0] & 0xFF; + val <<= 8; + val |= bytes[1] & 0xFF; + return (float)val; + } + + + // TODO: Make a macro for this. + command float convert_4_bytes_to_float(char * bytes) { + + int32_t val = 0; + val |= bytes[0] & 0xFF; + val <<= 8; + val |= bytes[1] & 0xFF; + val <<= 8; + val |= bytes[2] & 0xFF; + val <<= 8; + val |= bytes[3] & 0xFF; + return (float)val; + } + + + // FIXME: Get rid of locally defined variable + // so that this can be turned into a macro. + command double convert_8_bytes_to_double(char * bytes) { + + int64_t val = 0; + val |= bytes[0] & 0xFF; + val <<= 8; + val |= bytes[1] & 0xFF; + val <<= 8; + val |= bytes[2] & 0xFF; + val <<= 8; + val |= bytes[3] & 0xFF; + val <<= 8; + val |= bytes[4] & 0xFF; + val <<= 8; + val |= bytes[5] & 0xFF; + val <<= 8; + val |= bytes[6] & 0xFF; + val <<= 8; + val |= bytes[7] & 0xFF; + return (double)val; + } + + // TODO: Make a macro for this. + command uint16_t convert_2_bytes_to_uint16(char * bytes) { + + uint16_t val = 0; + val |= bytes[0] & 0xFF; + val <<= 8; + val |= bytes[1] & 0xFF; + return val; + } + } Index: sirf.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tos/lib/SiRF/sirf.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sirf.h 17 Aug 2005 21:46:00 -0000 1.3 --- sirf.h 17 Aug 2005 22:51:56 -0000 1.4 *************** *** 8,12 **** #define FB_SIRF_H ! //#include <sys/types.h> /** Enums for dispatching sirf messages. */ --- 8,34 ---- #define FB_SIRF_H ! ! ! // Header used in packets that make up a long message. ! typedef struct fragmentHeader { ! uint8_t mote_id; ! uint8_t sequenceNumber; ! uint8_t blockNumber; ! uint8_t blockCount; ! } FragmentHeader_t; ! ! #ifndef TOSH_DATA_LENGTH ! #define TOSH_DATA_LENGTH 29 ! #endif ! ! #define FRAGMENT_PAYLOAD_LENGTH (TOSH_DATA_LENGTH - sizeof(FragmentHeader_t)) ! ! // Packet to transport variable length (and long) messages in a fixed ! // length radio message. ! typedef struct messageFragment { ! FragmentHeader_t h; ! uint8_t data[FRAGMENT_PAYLOAD_LENGTH]; ! } MessageFragment_t; ! /** Enums for dispatching sirf messages. */ *************** *** 31,36 **** - - typedef struct SiRF_ID2_1 { --- 53,56 ---- |
From: David M. D. <do...@us...> - 2005-08-19 00:10:37
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14310/tools/src/xlisten/boards Modified Files: linkmsg.c sirf_id28_1.c sirf_id28_2.c sirf_id28_3.c sirf_id2_1.c sirf_id2_2.c Log Message: sirf id 28 messages can now be handled. |
From: David M. D. <do...@us...> - 2005-08-18 23:31:34
|
Update of /cvsroot/firebug/fireboard/beta/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14636 Added Files: sirf_id2.pgsql sirf_id28.pgsql Log Message: sirf id 28 messages can now be handled. --- NEW FILE: sirf_id28.pgsql --- /** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This code provides postgres table to the 'SiRF_ID28P' * message type. */ CREATE TABLE SiRF_ID28P ( result_time timestamp without time zone, header_mote_id integer, header_seqno integer, header_am_type integer, header_blockcount integer, channel integer, time_tag integer, sat_id integer, gps_sw_time integer, pseudo_range integer, carrier_freq integer, carrier_phase integer, time_in_track integer, sync_flags integer, cno1 integer, cno2 integer, cno3 integer, cno4 integer, cno5 integer, cno6 integer, cno7 integer, cno8 integer, cno9 integer, cno10 integer, delta_range_interval integer, mean_delta_range_time integer, extrapolation_time integer, phase_error_count integer, low_power_count integer); --- NEW FILE: sirf_id2.pgsql --- /** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This code provides postgres table to the 'SiRF_ID2P' * message type. */ CREATE TABLE SiRF_ID2P ( result_time timestamp without time zone, header_mote_id integer, header_seqno integer, header_am_type integer, header_blockcount integer, xpos integer, ypos integer, zpos integer, xvel integer, yvel integer, zvel integer, mode1 integer, dop integer, mode2 integer, gps_week integer, gps_tow integer, sv_in_fix integer, ch1 integer, ch2 integer, ch3 integer, ch4 integer, ch5 integer, ch6 integer, ch7 integer, ch8 integer, ch9 integer, ch10 integer, ch11 integer, ch12 integer); |
From: Michael N. <mne...@us...> - 2005-08-18 23:12:00
|
Update of /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23069/apps/XSensorMTS400 Modified Files: TestMTS400M.nc Log Message: Comments on power control Index: TestMTS400M.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/TestMTS400M.nc,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** TestMTS400M.nc 17 Aug 2005 22:42:42 -0000 1.17 --- TestMTS400M.nc 17 Aug 2005 23:50:14 -0000 1.18 *************** *** 690,697 **** --- 690,702 ---- if (is_gga_string_m(leadtek_string)) { call nmea.gga_parse(gga_data_ptr, leadtek_string); + #if 0 + // Power control should be handled internal to the GPS + // module. The GPS module should be told to turn off + // and all switch control should be handled there. if (!gpsIsPowered) { // The GPS is off, we can release the switches too. call GpsCmd.TxRxSwitch(0); }; + #endif atomic readStep = GPS_DONE; |
From: Michael N. <mne...@us...> - 2005-08-18 22:36:38
|
Update of /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4956 Added Files: sodebug.h Log Message: added debug macro --- NEW FILE: sodebug.h --- // printf style output for debugging // // Copyright (c) 2004 by Sensicast, Inc. // All rights including that of resale granted to Crossbow, Inc. // // Permission to use, copy, modify, and distribute this software and its // documentation for any purpose, without fee, and without written // agreement is hereby granted, provided that the above copyright // notice, the (updated) modification history and the author appear in // all copies of this source code. // // Permission is also granted to distribute this software under the // standard BSD license as contained in the TinyOS distribution. // // @Author: Michael Newman // #ifndef SOdebugEdit #define SOdebugEdit 1 // // Modification History: // 25Jan04 MJNewman 1: Created. #include <stdarg.h> //turn off debug output by default #ifndef SO_DEBUG #define SO_DEBUG 0 #endif // Assume we are not a dot by default #ifndef SO_DEBUG_DOT #define SODEBUG_DOT 0 #endif // Most of this module is off unless enabled #if (SO_DEBUG) //#include <stdio.h> // This varaiable is shared by many possible users of SOdebug. // The rest of the code is duplicated!. static const char hex[] = "0123456789ABCDEF"; #if (!SO_DEBUG_DOT) //init comm port (57.6K baud, mica2 only, use 19K baud for mica2dot, mica....) for debug // TinyOS is using 57.6K and seems to reset the baud rate periodically. // Use only 57.6K baud unless TinyOS is sorted out. static void init_debug(){ atomic { outp(0,UBRR0H); #if 1 // 56K with 0% error clock is 7.3728Mhz outp(15, UBRR0L); //set baud rate outp((1<<U2X),UCSR0A); // Set UART double speed #else // 19.K with 0% error clock is 7.3728Mhz outp(47, UBRR0L); //set baud rate outp((1<<U2X),UCSR0A); // Set UART double speed #endif outp(((1 << UCSZ1) | (1 << UCSZ0)) , UCSR0C); // Set frame format: 8 data-bits, 1 stop-bit inp(UDR0); outp((1 << TXEN) ,UCSR0B); // Enable uart reciever and transmitter } } #else //init comm port (19K baud) for mica2dot for debug static void init_debug(){ atomic { outp(0,UBRR0H); // Set baudrate to 19.2 KBps outp(12, UBRR0L); outp(0,UCSR0A); // Disable U2X and MPCM outp(((1 << UCSZ1) | (1 << UCSZ0)) , UCSR0C); inp(UDR0); outp((1 << TXEN) ,UCSR0B); } } #endif // output a char to the uart void UARTPutChar(char c) { if (c == '\n') { loop_until_bit_is_set(UCSR0A, UDRE); outb(UDR0,'\r'); loop_until_bit_is_set(UCSR0A, TXC); }; loop_until_bit_is_set(UCSR0A, UDRE); outb(UDR0,c); loop_until_bit_is_set(UCSR0A, TXC); return; } // Simplified printf int printf(const uint8_t *format, ...) { static bool debugStarted; uint8_t format_flag; uint32_t u_val=0; uint32_t div_val; uint8_t base; uint8_t *ptr; bool longNumber = FALSE; bool temp; va_list ap; va_start (ap, format); atomic temp = debugStarted; if (!temp) { init_debug(); atomic debugStarted = 1; }; if (format == NULL) format = "NULL\n"; for (;;) /* Until full format string read */ { if (!longNumber) { // Assume char after %l is d or xX while ((format_flag = *format++) != '%') /* Until '%' or '\0' */ { if (!format_flag) { return 0; // not bothering with count of chars output }; UARTPutChar(format_flag); }; }; switch (format_flag = *format++) { case 'c': format_flag = va_arg(ap, int); default: UARTPutChar(format_flag); continue; case 'S': case 's': ptr = va_arg(ap,char *); while ((format_flag = *ptr++)) { UARTPutChar(format_flag); }; continue; #if 0 case 't': { #define SECONDS_IN_ONE_DAY 86400 base = 10; if (currentSeconds/86400) {//print days div_val = 10000; u_val = currentSeconds/SECONDS_IN_ONE_DAY; do { UARTPutChar(hex[u_val / div_val]); u_val %= div_val; div_val /= base; } while (div_val); UARTPutChar(' '); UARTPutChar('d'); UARTPutChar('a'); UARTPutChar('y'); UARTPutChar('s'); UARTPutChar(' '); } // //hours div_val = 10; u_val = (currentSeconds % 86400)/3600; do { UARTPutChar(hex[u_val / div_val]); u_val %= div_val; div_val /= base; } while (div_val); UARTPutChar(':'); // //minutes div_val = 10; u_val = (INT16)((currentSeconds % 86400)%3600)/60; do { UARTPutChar(hex[u_val / div_val]); u_val %= div_val; div_val /= base; } while (div_val); UARTPutChar(':'); // //seconds div_val = 10; u_val = (INT16)(currentSeconds%60); do { UARTPutChar(hex[u_val / div_val]); u_val %= div_val; div_val /= base; } while (div_val); } continue; #endif // 't' time output case 'l': longNumber = TRUE; continue; case 'o': base = 8; if (!longNumber) div_val = 0x8000; else div_val = 0x40000000; goto CONVERSION_LOOP; case 'u': case 'i': case 'd': base = 10; if (!longNumber) div_val = 10000; else div_val = 1000000000; goto CONVERSION_LOOP; case 'x': base = 16; if (!longNumber) div_val = 0x1000; else div_val = 0x10000000; CONVERSION_LOOP: { if (!longNumber) u_val = va_arg(ap,int); else u_val = va_arg(ap,long); if ((format_flag == 'd') || (format_flag == 'i')) { bool isNegative; if (!longNumber) isNegative = (((int)u_val) < 0); else isNegative = (((long)u_val) < 0); if (isNegative) { u_val = - u_val; UARTPutChar('-'); }; while (div_val > 1 && div_val > u_val) { div_val /= 10; }; } // truncate signed values to a 16 bits for hex output if ((format_flag == 'x') && (!longNumber)) u_val &= 0xffff; do { UARTPutChar(hex[u_val / div_val]); u_val %= div_val; div_val /= base; } while (div_val); longNumber = FALSE; }; break; }; }; } #endif // SO_DEBUG #define SO_NO_DEBUG 0 #if (SO_DEBUG) #define SODbg(__x,__args...) { \ char bStatus; \ if(__x != SO_NO_DEBUG){ \ bStatus=bit_is_set(SREG,7); \ cli(); \ printf(__args); \ if (bStatus) sei(); \ }; \ } #else #define SODbg(__x,__args...) #endif #endif //SOdebugEdit |
From: Michael N. <mne...@us...> - 2005-08-18 22:22:03
|
Update of /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1823 Modified Files: Makefile TestMTS400.nc TestMTS400M.nc appFeatures.h Log Message: Control GPS to SIRF modes Index: TestMTS400M.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/TestMTS400M.nc,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** TestMTS400M.nc 17 Aug 2005 01:56:47 -0000 1.16 --- TestMTS400M.nc 17 Aug 2005 22:42:42 -0000 1.17 *************** *** 61,65 **** /* History: created 1/25/2001 * ! * @author ..., Hu Siquan * * $Id$ --- 61,65 ---- /* History: created 1/25/2001 * ! * @author ..., Hu Siquan, Michael Newman * [...1651 lines suppressed...] + } else { + atomic { + WaitingForSend = FALSE; // both uart and radio sent, done for current msg + sending_packet = FALSE; + }; + }; + IsUART = !IsUART; // change to other type of send + return SUCCESS; + } + + /**************************************************************************** + * Uart msg rcvd. + * This app doesn't respond to any incoming uart msg + * Just return + ****************************************************************************/ + event TOS_MsgPtr Receive.receive(TOS_MsgPtr data) { + return data; + } + + } Index: TestMTS400.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/TestMTS400.nc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TestMTS400.nc 19 Jun 2005 19:09:27 -0000 1.5 --- TestMTS400.nc 17 Aug 2005 22:42:42 -0000 1.6 *************** *** 85,89 **** NMEAC, LedsC, ! DelugeC, Accel, TaosPhoto, --- 85,89 ---- NMEAC, LedsC, ! // DelugeC, Accel, TaosPhoto, *************** *** 97,101 **** Main.StdControl -> TestMTS400M; Main.StdControl -> TimerC; ! Main.StdControl -> DelugeC; XEE_PARAMS_WIRING() --- 97,101 ---- Main.StdControl -> TestMTS400M; Main.StdControl -> TimerC; ! // Main.StdControl -> DelugeC; XEE_PARAMS_WIRING() *************** *** 108,112 **** #ifdef MTS420 TestMTS400M.GpsControl -> UARTGpsPacket; ! //TestMTS400M.GpsSend -> UARTGpsPacket; TestMTS400M.GpsReceive -> UARTGpsPacket; TestMTS400M.GpsCmd -> UARTGpsPacket.GpsCmd; //UARTGpsPacket.GpsCmd; --- 108,112 ---- #ifdef MTS420 TestMTS400M.GpsControl -> UARTGpsPacket; ! TestMTS400M.GpsSend -> UARTGpsPacket.SendVar; TestMTS400M.GpsReceive -> UARTGpsPacket; TestMTS400M.GpsCmd -> UARTGpsPacket.GpsCmd; //UARTGpsPacket.GpsCmd; Index: appFeatures.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/appFeatures.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** appFeatures.h 19 Jun 2005 19:09:27 -0000 1.5 --- appFeatures.h 17 Aug 2005 22:42:42 -0000 1.6 *************** *** 22,27 **** #endif - //#define FEATURE_GPS_ONLY 0 - #ifndef FEATURE_GPS_ONLY #define FEATURE_GPS_ONLY 0 --- 22,25 ---- Index: Makefile =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/Makefile,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Makefile 19 Jun 2005 19:09:26 -0000 1.9 --- Makefile 17 Aug 2005 22:42:42 -0000 1.10 *************** *** 19,22 **** --- 19,26 ---- PFLAGS += -I$(FIREBOARDROOT)/interfaces + + # control debugging printfs 1 is on 0 is off + PFLAGS += -DSO_DEBUG=1 + PFLAGS += -DFEATURE_GPS_ONLY=1 #include ../MakeXbowlocal #include ${TOSROOT}/tools/make/Makerules |
From: David M. D. <do...@us...> - 2005-08-18 21:50:04
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/MultihopLinkEstimator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15303 Added Files: SurgeMsg.pgsql mkmsg.sh Log Message: sirf id 28 messages can now be handled. --- NEW FILE: SurgeMsg.pgsql --- /** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This code provides postgres table to the 'SurgeMsgP' * message type. */ CREATE TABLE SurgeMsgP ( result_time timestamp without time zone, type integer, reading integer, parentaddr integer, seq_no integer); --- NEW FILE: mkmsg.sh --- #!/usr/bin/sh export LINKESTPATH=$HOME/sf.net/firebug/fireboard/beta/fireworks/apps/MultihopLinkEstimator export XLISTENPATH=$HOME/sf.net/firebug/fireboard/beta/tools/src/xlisten mig c -java-classname=org.firebug.LinkEstimatorMsg $LINKESTPATH/MultihopLinkEstimator.h LinkEstimatorMsg > $XLISTENPATH/boards/LinkEstimatorMsg.c mig pgsql -java-classname=org.firebug.LinkEstimatorMsg $LINKESTPATH/MultihopLinkEstimator.h LinkEstimatorMsg > LinkEstimatorMsg.pgsql mig c -java-classname=org.firebug.SurgeMsg $LINKESTPATH/MultihopLinkEstimator.h SurgeMsg > $XLISTENPATH/boards/SurgeMsg.c mig pgsql -java-classname=org.firebug.SurgeMsg $LINKESTPATH/MultihopLinkEstimator.h SurgeMsg > SurgeMsg.pgsql |
From: David M. D. <do...@us...> - 2005-08-18 21:34:52
|
Update of /cvsroot/firebug/fireboard/beta/tos/interfaces In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5700/tos/interfaces Modified Files: SiRF.nc Log Message: More work on sirf message parsing. Index: SiRF.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tos/interfaces/SiRF.nc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SiRF.nc 16 Aug 2005 00:57:34 -0000 1.3 --- SiRF.nc 18 Aug 2005 00:38:47 -0000 1.4 *************** *** 19,24 **** command uint8_t get_type (const char * sirfstring); ! command result_t id2_parse (const char * sirf_string); ! command result_t id28_parse (const char * sirf_string); } --- 19,24 ---- command uint8_t get_type (const char * sirfstring); ! command result_t id2_parse (SiRF_ID2_t * sid2, char * sirf_string); ! command result_t id28_parse (SiRF_ID28_t * sid28, char * sirf_string); } |
From: Michael N. <mne...@us...> - 2005-08-18 21:16:55
|
Update of /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4156 Added Files: SODebug.h Log Message: added debug macro --- NEW FILE: SODebug.h --- // printf style output for debugging // // Copyright (c) 2004 by Sensicast, Inc. // All rights including that of resale granted to Crossbow, Inc. // // Permission to use, copy, modify, and distribute this software and its // documentation for any purpose, without fee, and without written // agreement is hereby granted, provided that the above copyright // notice, the (updated) modification history and the author appear in // all copies of this source code. // // Permission is also granted to distribute this software under the // standard BSD license as contained in the TinyOS distribution. // // @Author: Michael Newman // #ifndef SOdebugEdit #define SOdebugEdit 1 // // Modification History: // 25Jan04 MJNewman 1: Created. #include <stdarg.h> //turn off debug output by default #ifndef SO_DEBUG #define SO_DEBUG 0 #endif // Assume we are not a dot by default #ifndef SO_DEBUG_DOT #define SODEBUG_DOT 0 #endif // Most of this module is off unless enabled #if (SO_DEBUG) //#include <stdio.h> // This varaiable is shared by many possible users of SOdebug. // The rest of the code is duplicated!. static const char hex[] = "0123456789ABCDEF"; #if (!SO_DEBUG_DOT) //init comm port (57.6K baud, mica2 only, use 19K baud for mica2dot, mica....) for debug // TinyOS is using 57.6K and seems to reset the baud rate periodically. // Use only 57.6K baud unless TinyOS is sorted out. static void init_debug(){ atomic { outp(0,UBRR0H); #if 1 // 56K with 0% error clock is 7.3728Mhz outp(15, UBRR0L); //set baud rate outp((1<<U2X),UCSR0A); // Set UART double speed #else // 19.K with 0% error clock is 7.3728Mhz outp(47, UBRR0L); //set baud rate outp((1<<U2X),UCSR0A); // Set UART double speed #endif outp(((1 << UCSZ1) | (1 << UCSZ0)) , UCSR0C); // Set frame format: 8 data-bits, 1 stop-bit inp(UDR0); outp((1 << TXEN) ,UCSR0B); // Enable uart reciever and transmitter } } #else //init comm port (19K baud) for mica2dot for debug static void init_debug(){ atomic { outp(0,UBRR0H); // Set baudrate to 19.2 KBps outp(12, UBRR0L); outp(0,UCSR0A); // Disable U2X and MPCM outp(((1 << UCSZ1) | (1 << UCSZ0)) , UCSR0C); inp(UDR0); outp((1 << TXEN) ,UCSR0B); } } #endif // output a char to the uart void UARTPutChar(char c) { if (c == '\n') { loop_until_bit_is_set(UCSR0A, UDRE); outb(UDR0,'\r'); loop_until_bit_is_set(UCSR0A, TXC); }; loop_until_bit_is_set(UCSR0A, UDRE); outb(UDR0,c); loop_until_bit_is_set(UCSR0A, TXC); return; } // Simplified printf int printf(const uint8_t *format, ...) { static bool debugStarted; uint8_t format_flag; uint32_t u_val=0; uint32_t div_val; uint8_t base; uint8_t *ptr; bool longNumber = FALSE; bool temp; va_list ap; va_start (ap, format); atomic temp = debugStarted; if (!temp) { init_debug(); atomic debugStarted = 1; }; if (format == NULL) format = "NULL\n"; for (;;) /* Until full format string read */ { if (!longNumber) { // Assume char after %l is d or xX while ((format_flag = *format++) != '%') /* Until '%' or '\0' */ { if (!format_flag) { return 0; // not bothering with count of chars output }; UARTPutChar(format_flag); }; }; switch (format_flag = *format++) { case 'c': format_flag = va_arg(ap, int); default: UARTPutChar(format_flag); continue; case 'S': case 's': ptr = va_arg(ap,char *); while ((format_flag = *ptr++)) { UARTPutChar(format_flag); }; continue; #if 0 case 't': { #define SECONDS_IN_ONE_DAY 86400 base = 10; if (currentSeconds/86400) {//print days div_val = 10000; u_val = currentSeconds/SECONDS_IN_ONE_DAY; do { UARTPutChar(hex[u_val / div_val]); u_val %= div_val; div_val /= base; } while (div_val); UARTPutChar(' '); UARTPutChar('d'); UARTPutChar('a'); UARTPutChar('y'); UARTPutChar('s'); UARTPutChar(' '); } // //hours div_val = 10; u_val = (currentSeconds % 86400)/3600; do { UARTPutChar(hex[u_val / div_val]); u_val %= div_val; div_val /= base; } while (div_val); UARTPutChar(':'); // //minutes div_val = 10; u_val = (INT16)((currentSeconds % 86400)%3600)/60; do { UARTPutChar(hex[u_val / div_val]); u_val %= div_val; div_val /= base; } while (div_val); UARTPutChar(':'); // //seconds div_val = 10; u_val = (INT16)(currentSeconds%60); do { UARTPutChar(hex[u_val / div_val]); u_val %= div_val; div_val /= base; } while (div_val); } continue; #endif // 't' time output case 'l': longNumber = TRUE; continue; case 'o': base = 8; if (!longNumber) div_val = 0x8000; else div_val = 0x40000000; goto CONVERSION_LOOP; case 'u': case 'i': case 'd': base = 10; if (!longNumber) div_val = 10000; else div_val = 1000000000; goto CONVERSION_LOOP; case 'x': base = 16; if (!longNumber) div_val = 0x1000; else div_val = 0x10000000; CONVERSION_LOOP: { if (!longNumber) u_val = va_arg(ap,int); else u_val = va_arg(ap,long); if ((format_flag == 'd') || (format_flag == 'i')) { bool isNegative; if (!longNumber) isNegative = (((int)u_val) < 0); else isNegative = (((long)u_val) < 0); if (isNegative) { u_val = - u_val; UARTPutChar('-'); }; while (div_val > 1 && div_val > u_val) { div_val /= 10; }; } // truncate signed values to a 16 bits for hex output if ((format_flag == 'x') && (!longNumber)) u_val &= 0xffff; do { UARTPutChar(hex[u_val / div_val]); u_val %= div_val; div_val /= base; } while (div_val); longNumber = FALSE; }; break; }; }; } #endif // SO_DEBUG #define SO_NO_DEBUG 0 #if (SO_DEBUG) #define SODbg(__x,__args...) { \ char bStatus; \ if(__x != SO_NO_DEBUG){ \ bStatus=bit_is_set(SREG,7); \ cli(); \ printf(__args); \ if (bStatus) sei(); \ }; \ } #else #define SODbg(__x,__args...) #endif #endif //SOdebugEdit |
From: David M. D. <do...@us...> - 2005-08-18 21:14:38
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15020 Added Files: sirf_id2.c sirf_id28.c Log Message: sirf id 28 messages can now be handled. --- NEW FILE: sirf_id2.c --- /** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This code implements C interface to the 'SiRF_ID2P' * message type. */ #include <stdio.h> #include <stdlib.h> #include <memory.h> /** Private header is programmer specified for handling * conversion functions, etc. */ //#include "SiRF_ID2P_private.h" /** Not the best way to handle xbow dependencies. */ #ifdef TELOS_MOTE #include "../xdb.h" #include "../xsensors.h" #endif /** These need to be moved to a header file. */ typedef struct _SiRF_ID2P SiRF_ID2P; #ifndef TELOS_MOTE typedef struct _XbowSensorboardPacket XbowSensorboardPacket; #endif /** The Active Message type associated with this message. */ //static const int AM_TYPE = 155; //#define AM_TYPE 155 // This struct is defined to keep gcc happy while the module // is under development. At some point in the near future, a // a convention for passing arguments into the functions will // have to be defined. struct _XbowSensorboardPacket { unsigned char data[29]; }; struct _SiRF_ID2P { uint8_t header_mote_id; uint8_t header_seqno; uint8_t header_am_type; uint8_t header_blockcount; int xpos; int ypos; int zpos; uint16_t xvel; uint16_t yvel; uint16_t zvel; uint8_t mode1; uint8_t dop; uint8_t mode2; uint16_t gps_week; uint32_t gps_tow; uint8_t sv_in_fix; uint8_t ch1; uint8_t ch2; uint8_t ch3; uint8_t ch4; uint8_t ch5; uint8_t ch6; uint8_t ch7; uint8_t ch8; uint8_t ch9; uint8_t ch10; uint8_t ch11; uint8_t ch12; }; void SiRF_ID2P_set_header_mote_id(SiRF_ID2P * userdata, uint8_t header_mote_id) { userdata->header_mote_id = header_mote_id; } uint8_t SiRF_ID2P_get_header_mote_id(SiRF_ID2P * userdata) { return userdata->header_mote_id; } void SiRF_ID2P_set_header_seqno(SiRF_ID2P * userdata, uint8_t header_seqno) { userdata->header_seqno = header_seqno; } uint8_t SiRF_ID2P_get_header_seqno(SiRF_ID2P * userdata) { return userdata->header_seqno; } void SiRF_ID2P_set_header_am_type(SiRF_ID2P * userdata, uint8_t header_am_type) { userdata->header_am_type = header_am_type; } uint8_t SiRF_ID2P_get_header_am_type(SiRF_ID2P * userdata) { return userdata->header_am_type; } void SiRF_ID2P_set_header_blockcount(SiRF_ID2P * userdata, uint8_t header_blockcount) { userdata->header_blockcount = header_blockcount; } uint8_t SiRF_ID2P_get_header_blockcount(SiRF_ID2P * userdata) { return userdata->header_blockcount; } void SiRF_ID2P_set_xpos(SiRF_ID2P * userdata, int xpos) { userdata->xpos = xpos; } int SiRF_ID2P_get_xpos(SiRF_ID2P * userdata) { return userdata->xpos; } void SiRF_ID2P_set_ypos(SiRF_ID2P * userdata, int ypos) { userdata->ypos = ypos; } int SiRF_ID2P_get_ypos(SiRF_ID2P * userdata) { return userdata->ypos; } void SiRF_ID2P_set_zpos(SiRF_ID2P * userdata, int zpos) { userdata->zpos = zpos; } int SiRF_ID2P_get_zpos(SiRF_ID2P * userdata) { return userdata->zpos; } void SiRF_ID2P_set_xvel(SiRF_ID2P * userdata, uint16_t xvel) { userdata->xvel = xvel; } uint16_t SiRF_ID2P_get_xvel(SiRF_ID2P * userdata) { return userdata->xvel; } void SiRF_ID2P_set_yvel(SiRF_ID2P * userdata, uint16_t yvel) { userdata->yvel = yvel; } uint16_t SiRF_ID2P_get_yvel(SiRF_ID2P * userdata) { return userdata->yvel; } void SiRF_ID2P_set_zvel(SiRF_ID2P * userdata, uint16_t zvel) { userdata->zvel = zvel; } uint16_t SiRF_ID2P_get_zvel(SiRF_ID2P * userdata) { return userdata->zvel; } void SiRF_ID2P_set_mode1(SiRF_ID2P * userdata, uint8_t mode1) { userdata->mode1 = mode1; } uint8_t SiRF_ID2P_get_mode1(SiRF_ID2P * userdata) { return userdata->mode1; } void SiRF_ID2P_set_dop(SiRF_ID2P * userdata, uint8_t dop) { userdata->dop = dop; } uint8_t SiRF_ID2P_get_dop(SiRF_ID2P * userdata) { return userdata->dop; } void SiRF_ID2P_set_mode2(SiRF_ID2P * userdata, uint8_t mode2) { userdata->mode2 = mode2; } uint8_t SiRF_ID2P_get_mode2(SiRF_ID2P * userdata) { return userdata->mode2; } void SiRF_ID2P_set_gps_week(SiRF_ID2P * userdata, uint16_t gps_week) { userdata->gps_week = gps_week; } uint16_t SiRF_ID2P_get_gps_week(SiRF_ID2P * userdata) { return userdata->gps_week; } void SiRF_ID2P_set_gps_tow(SiRF_ID2P * userdata, uint32_t gps_tow) { userdata->gps_tow = gps_tow; } uint32_t SiRF_ID2P_get_gps_tow(SiRF_ID2P * userdata) { return userdata->gps_tow; } void SiRF_ID2P_set_sv_in_fix(SiRF_ID2P * userdata, uint8_t sv_in_fix) { userdata->sv_in_fix = sv_in_fix; } uint8_t SiRF_ID2P_get_sv_in_fix(SiRF_ID2P * userdata) { return userdata->sv_in_fix; } void SiRF_ID2P_set_ch1(SiRF_ID2P * userdata, uint8_t ch1) { userdata->ch1 = ch1; } uint8_t SiRF_ID2P_get_ch1(SiRF_ID2P * userdata) { return userdata->ch1; } void SiRF_ID2P_set_ch2(SiRF_ID2P * userdata, uint8_t ch2) { userdata->ch2 = ch2; } uint8_t SiRF_ID2P_get_ch2(SiRF_ID2P * userdata) { return userdata->ch2; } void SiRF_ID2P_set_ch3(SiRF_ID2P * userdata, uint8_t ch3) { userdata->ch3 = ch3; } uint8_t SiRF_ID2P_get_ch3(SiRF_ID2P * userdata) { return userdata->ch3; } void SiRF_ID2P_set_ch4(SiRF_ID2P * userdata, uint8_t ch4) { userdata->ch4 = ch4; } uint8_t SiRF_ID2P_get_ch4(SiRF_ID2P * userdata) { return userdata->ch4; } void SiRF_ID2P_set_ch5(SiRF_ID2P * userdata, uint8_t ch5) { userdata->ch5 = ch5; } uint8_t SiRF_ID2P_get_ch5(SiRF_ID2P * userdata) { return userdata->ch5; } void SiRF_ID2P_set_ch6(SiRF_ID2P * userdata, uint8_t ch6) { userdata->ch6 = ch6; } uint8_t SiRF_ID2P_get_ch6(SiRF_ID2P * userdata) { return userdata->ch6; } void SiRF_ID2P_set_ch7(SiRF_ID2P * userdata, uint8_t ch7) { userdata->ch7 = ch7; } uint8_t SiRF_ID2P_get_ch7(SiRF_ID2P * userdata) { return userdata->ch7; } void SiRF_ID2P_set_ch8(SiRF_ID2P * userdata, uint8_t ch8) { userdata->ch8 = ch8; } uint8_t SiRF_ID2P_get_ch8(SiRF_ID2P * userdata) { return userdata->ch8; } void SiRF_ID2P_set_ch9(SiRF_ID2P * userdata, uint8_t ch9) { userdata->ch9 = ch9; } uint8_t SiRF_ID2P_get_ch9(SiRF_ID2P * userdata) { return userdata->ch9; } void SiRF_ID2P_set_ch10(SiRF_ID2P * userdata, uint8_t ch10) { userdata->ch10 = ch10; } uint8_t SiRF_ID2P_get_ch10(SiRF_ID2P * userdata) { return userdata->ch10; } void SiRF_ID2P_set_ch11(SiRF_ID2P * userdata, uint8_t ch11) { userdata->ch11 = ch11; } uint8_t SiRF_ID2P_get_ch11(SiRF_ID2P * userdata) { return userdata->ch11; } void SiRF_ID2P_set_ch12(SiRF_ID2P * userdata, uint8_t ch12) { userdata->ch12 = ch12; } uint8_t SiRF_ID2P_get_ch12(SiRF_ID2P * userdata) { return userdata->ch12; } //Format string generated automatically, //static char formatstring[] = "%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i"; //static char formatstring[] = "%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i"; static char insert_stmt[] = "INSERT into SiRF_ID2P (" "result_time," "header_mote_id," "header_seqno," "header_am_type," "header_blockcount," "xpos," "ypos," "zpos," "xvel," "yvel," "zvel," "mode1," "dop," "mode2," "gps_week," "gps_tow," "sv_in_fix," "ch1," "ch2," "ch3," "ch4," "ch5," "ch6," "ch7," "ch8," "ch9," "ch10," "ch11," "ch12) values (now(), %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"; void SiRF_ID2P_pg_log(XbowSensorboardPacket * userdata) { char pg_command[255]; SiRF_ID2P * data = (SiRF_ID2P*)userdata; sprintf(pg_command,insert_stmt, data->header_mote_id, data->header_seqno, data->header_am_type, data->header_blockcount, data->xpos, data->ypos, data->zpos, data->xvel, data->yvel, data->zvel, data->mode1, data->dop, data->mode2, data->gps_week, data->gps_tow, data->sv_in_fix, data->ch1, data->ch2, data->ch3, data->ch4, data->ch5, data->ch6, data->ch7, data->ch8, data->ch9, data->ch10, data->ch11, data->ch12); #ifdef TELOS_MOTE xdb_execute(pg_command); #endif } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t header_mote_id_convert(uint8_t header_mote_id) { return header_mote_id; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t header_seqno_convert(uint8_t header_seqno) { return header_seqno; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t header_am_type_convert(uint8_t header_am_type) { return header_am_type; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t header_blockcount_convert(uint8_t header_blockcount) { return header_blockcount; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static int xpos_convert(int xpos) { return xpos; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static int ypos_convert(int ypos) { return ypos; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static int zpos_convert(int zpos) { return zpos; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint16_t xvel_convert(uint16_t xvel) { return xvel; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint16_t yvel_convert(uint16_t yvel) { return yvel; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint16_t zvel_convert(uint16_t zvel) { return zvel; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t mode1_convert(uint8_t mode1) { return mode1; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t dop_convert(uint8_t dop) { return dop; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t mode2_convert(uint8_t mode2) { return mode2; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint16_t gps_week_convert(uint16_t gps_week) { return gps_week; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint32_t gps_tow_convert(uint32_t gps_tow) { return gps_tow; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t sv_in_fix_convert(uint8_t sv_in_fix) { return sv_in_fix; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t ch1_convert(uint8_t ch1) { return ch1; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t ch2_convert(uint8_t ch2) { return ch2; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t ch3_convert(uint8_t ch3) { return ch3; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t ch4_convert(uint8_t ch4) { return ch4; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t ch5_convert(uint8_t ch5) { return ch5; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t ch6_convert(uint8_t ch6) { return ch6; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t ch7_convert(uint8_t ch7) { return ch7; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t ch8_convert(uint8_t ch8) { return ch8; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t ch9_convert(uint8_t ch9) { return ch9; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t ch10_convert(uint8_t ch10) { return ch10; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t ch11_convert(uint8_t ch11) { return ch11; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t ch12_convert(uint8_t ch12) { return ch12; } void SiRF_ID2P_cook_packet(SiRF_ID2P * userdata) { userdata->header_mote_id = header_mote_id_convert(userdata->header_mote_id); userdata->header_seqno = header_seqno_convert(userdata->header_seqno); userdata->header_am_type = header_am_type_convert(userdata->header_am_type); userdata->header_blockcount = header_blockcount_convert(userdata->header_blockcount); userdata->xpos = xpos_convert(userdata->xpos); userdata->ypos = ypos_convert(userdata->ypos); userdata->zpos = zpos_convert(userdata->zpos); userdata->xvel = xvel_convert(userdata->xvel); userdata->yvel = yvel_convert(userdata->yvel); userdata->zvel = zvel_convert(userdata->zvel); userdata->mode1 = mode1_convert(userdata->mode1); userdata->dop = dop_convert(userdata->dop); userdata->mode2 = mode2_convert(userdata->mode2); userdata->gps_week = gps_week_convert(userdata->gps_week); userdata->gps_tow = gps_tow_convert(userdata->gps_tow); userdata->sv_in_fix = sv_in_fix_convert(userdata->sv_in_fix); userdata->ch1 = ch1_convert(userdata->ch1); userdata->ch2 = ch2_convert(userdata->ch2); userdata->ch3 = ch3_convert(userdata->ch3); userdata->ch4 = ch4_convert(userdata->ch4); userdata->ch5 = ch5_convert(userdata->ch5); userdata->ch6 = ch6_convert(userdata->ch6); userdata->ch7 = ch7_convert(userdata->ch7); userdata->ch8 = ch8_convert(userdata->ch8); userdata->ch9 = ch9_convert(userdata->ch9); userdata->ch10 = ch10_convert(userdata->ch10); userdata->ch11 = ch11_convert(userdata->ch11); userdata->ch12 = ch12_convert(userdata->ch12); } /** User has to fill in any conversion code * necessary for processing. */ SiRF_ID2P * SiRF_ID2P_convert(char * data) { // Just to keep gcc happy. return (SiRF_ID2P*)data; } /** Print the bytes of the packet. */ void SiRF_ID2P_print_raw (XbowSensorboardPacket *packet) { printf("SiRF_ID2P print raw.\n"); } /** Print cooked output. */ void SiRF_ID2P_print_cooked (XbowSensorboardPacket * userdata) { SiRF_ID2P * data = (SiRF_ID2P*)userdata; printf("SiRF_ID2P print cooked:\n"); printf(" header_mote_id: %i,\n",data->header_mote_id); printf(" header_seqno: %i,\n",data->header_seqno); printf(" header_am_type: %i,\n",data->header_am_type); printf(" header_blockcount: %i,\n",data->header_blockcount); printf(" xpos: %i,\n",data->xpos); printf(" ypos: %i,\n",data->ypos); printf(" zpos: %i,\n",data->zpos); printf(" xvel: %i,\n",data->xvel); printf(" yvel: %i,\n",data->yvel); printf(" zvel: %i,\n",data->zvel); printf(" mode1: %i,\n",data->mode1); printf(" dop: %i,\n",data->dop); printf(" mode2: %i,\n",data->mode2); printf(" gps_week: %i,\n",data->gps_week); printf(" gps_tow: %i,\n",data->gps_tow); printf(" sv_in_fix: %i,\n",data->sv_in_fix); printf(" ch1: %i,\n",data->ch1); printf(" ch2: %i,\n",data->ch2); printf(" ch3: %i,\n",data->ch3); printf(" ch4: %i,\n",data->ch4); printf(" ch5: %i,\n",data->ch5); printf(" ch6: %i,\n",data->ch6); printf(" ch7: %i,\n",data->ch7); printf(" ch8: %i,\n",data->ch8); printf(" ch9: %i,\n",data->ch9); printf(" ch10: %i,\n",data->ch10); printf(" ch11: %i,\n",data->ch11); printf(" ch12: %i,\n",data->ch12); } #ifdef TELOS_MOTE XPacketHandler SiRF_ID2P_packet_handler = { // This should be replaced with the AM_TYPE 155, "$Id: sirf_id2.c,v 1.1 2005/08/17 21:48:29 doolin Exp $", SiRF_ID2P_print_raw, SiRF_ID2P_print_cooked, SiRF_ID2P_print_raw, SiRF_ID2P_print_cooked, SiRF_ID2P_pg_log, {0} }; void SiRF_ID2P_initialize() { xpacket_add_type(&SiRF_ID2P_packet_handler); } #endif /** The default size of this message type in bytes. */ //static int DEFAULT_MESSAGE_SIZE = 44; /** If incomplete types are used, we need to provide a way * to manage memory. */ SiRF_ID2P * SiRF_ID2P_new() { SiRF_ID2P * userdata = (SiRF_ID2P*)malloc(sizeof(SiRF_ID2P)); memset((void*)userdata,0xda,sizeof(SiRF_ID2P)); return userdata; } void SiRF_ID2P_delete(SiRF_ID2P * userdata) { memset((void*)userdata,0xdd,sizeof(SiRF_ID2P)); free(userdata); } --- NEW FILE: sirf_id28.c --- /** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This code implements C interface to the 'SiRF_ID28P' * message type. */ #include <stdio.h> #include <stdlib.h> #include <memory.h> /** Private header is programmer specified for handling * conversion functions, etc. */ //#include "SiRF_ID28P_private.h" /** Not the best way to handle xbow dependencies. */ #ifdef TELOS_MOTE #include "../xdb.h" #include "../xsensors.h" #endif /** These need to be moved to a header file. */ typedef struct _SiRF_ID28P SiRF_ID28P; #ifndef TELOS_MOTE typedef struct _XbowSensorboardPacket XbowSensorboardPacket; #endif /** The Active Message type associated with this message. */ //static const int AM_TYPE = 156; //#define AM_TYPE 156 // This struct is defined to keep gcc happy while the module // is under development. At some point in the near future, a // a convention for passing arguments into the functions will // have to be defined. struct _XbowSensorboardPacket { unsigned char data[29]; }; struct _SiRF_ID28P { uint8_t header_mote_id; uint8_t header_seqno; uint8_t header_am_type; uint8_t header_blockcount; uint8_t channel; uint32_t time_tag; uint8_t sat_id; uint64_t gps_sw_time; uint64_t pseudo_range; uint32_t carrier_freq; uint64_t carrier_phase; uint16_t time_in_track; uint8_t sync_flags; uint8_t cno1; uint8_t cno2; uint8_t cno3; uint8_t cno4; uint8_t cno5; uint8_t cno6; uint8_t cno7; uint8_t cno8; uint8_t cno9; uint8_t cno10; uint16_t delta_range_interval; uint16_t mean_delta_range_time; uint16_t extrapolation_time; uint8_t phase_error_count; uint8_t low_power_count; }; void SiRF_ID28P_set_header_mote_id(SiRF_ID28P * userdata, uint8_t header_mote_id) { userdata->header_mote_id = header_mote_id; } uint8_t SiRF_ID28P_get_header_mote_id(SiRF_ID28P * userdata) { return userdata->header_mote_id; } void SiRF_ID28P_set_header_seqno(SiRF_ID28P * userdata, uint8_t header_seqno) { userdata->header_seqno = header_seqno; } uint8_t SiRF_ID28P_get_header_seqno(SiRF_ID28P * userdata) { return userdata->header_seqno; } void SiRF_ID28P_set_header_am_type(SiRF_ID28P * userdata, uint8_t header_am_type) { userdata->header_am_type = header_am_type; } uint8_t SiRF_ID28P_get_header_am_type(SiRF_ID28P * userdata) { return userdata->header_am_type; } void SiRF_ID28P_set_header_blockcount(SiRF_ID28P * userdata, uint8_t header_blockcount) { userdata->header_blockcount = header_blockcount; } uint8_t SiRF_ID28P_get_header_blockcount(SiRF_ID28P * userdata) { return userdata->header_blockcount; } void SiRF_ID28P_set_channel(SiRF_ID28P * userdata, uint8_t channel) { userdata->channel = channel; } uint8_t SiRF_ID28P_get_channel(SiRF_ID28P * userdata) { return userdata->channel; } void SiRF_ID28P_set_time_tag(SiRF_ID28P * userdata, uint32_t time_tag) { userdata->time_tag = time_tag; } uint32_t SiRF_ID28P_get_time_tag(SiRF_ID28P * userdata) { return userdata->time_tag; } void SiRF_ID28P_set_sat_id(SiRF_ID28P * userdata, uint8_t sat_id) { userdata->sat_id = sat_id; } uint8_t SiRF_ID28P_get_sat_id(SiRF_ID28P * userdata) { return userdata->sat_id; } void SiRF_ID28P_set_gps_sw_time(SiRF_ID28P * userdata, uint64_t gps_sw_time) { userdata->gps_sw_time = gps_sw_time; } uint64_t SiRF_ID28P_get_gps_sw_time(SiRF_ID28P * userdata) { return userdata->gps_sw_time; } void SiRF_ID28P_set_pseudo_range(SiRF_ID28P * userdata, uint64_t pseudo_range) { userdata->pseudo_range = pseudo_range; } uint64_t SiRF_ID28P_get_pseudo_range(SiRF_ID28P * userdata) { return userdata->pseudo_range; } void SiRF_ID28P_set_carrier_freq(SiRF_ID28P * userdata, uint32_t carrier_freq) { userdata->carrier_freq = carrier_freq; } uint32_t SiRF_ID28P_get_carrier_freq(SiRF_ID28P * userdata) { return userdata->carrier_freq; } void SiRF_ID28P_set_carrier_phase(SiRF_ID28P * userdata, uint64_t carrier_phase) { userdata->carrier_phase = carrier_phase; } uint64_t SiRF_ID28P_get_carrier_phase(SiRF_ID28P * userdata) { return userdata->carrier_phase; } void SiRF_ID28P_set_time_in_track(SiRF_ID28P * userdata, uint16_t time_in_track) { userdata->time_in_track = time_in_track; } uint16_t SiRF_ID28P_get_time_in_track(SiRF_ID28P * userdata) { return userdata->time_in_track; } void SiRF_ID28P_set_sync_flags(SiRF_ID28P * userdata, uint8_t sync_flags) { userdata->sync_flags = sync_flags; } uint8_t SiRF_ID28P_get_sync_flags(SiRF_ID28P * userdata) { return userdata->sync_flags; } void SiRF_ID28P_set_cno1(SiRF_ID28P * userdata, uint8_t cno1) { userdata->cno1 = cno1; } uint8_t SiRF_ID28P_get_cno1(SiRF_ID28P * userdata) { return userdata->cno1; } void SiRF_ID28P_set_cno2(SiRF_ID28P * userdata, uint8_t cno2) { userdata->cno2 = cno2; } uint8_t SiRF_ID28P_get_cno2(SiRF_ID28P * userdata) { return userdata->cno2; } void SiRF_ID28P_set_cno3(SiRF_ID28P * userdata, uint8_t cno3) { userdata->cno3 = cno3; } uint8_t SiRF_ID28P_get_cno3(SiRF_ID28P * userdata) { return userdata->cno3; } void SiRF_ID28P_set_cno4(SiRF_ID28P * userdata, uint8_t cno4) { userdata->cno4 = cno4; } uint8_t SiRF_ID28P_get_cno4(SiRF_ID28P * userdata) { return userdata->cno4; } void SiRF_ID28P_set_cno5(SiRF_ID28P * userdata, uint8_t cno5) { userdata->cno5 = cno5; } uint8_t SiRF_ID28P_get_cno5(SiRF_ID28P * userdata) { return userdata->cno5; } void SiRF_ID28P_set_cno6(SiRF_ID28P * userdata, uint8_t cno6) { userdata->cno6 = cno6; } uint8_t SiRF_ID28P_get_cno6(SiRF_ID28P * userdata) { return userdata->cno6; } void SiRF_ID28P_set_cno7(SiRF_ID28P * userdata, uint8_t cno7) { userdata->cno7 = cno7; } uint8_t SiRF_ID28P_get_cno7(SiRF_ID28P * userdata) { return userdata->cno7; } void SiRF_ID28P_set_cno8(SiRF_ID28P * userdata, uint8_t cno8) { userdata->cno8 = cno8; } uint8_t SiRF_ID28P_get_cno8(SiRF_ID28P * userdata) { return userdata->cno8; } void SiRF_ID28P_set_cno9(SiRF_ID28P * userdata, uint8_t cno9) { userdata->cno9 = cno9; } uint8_t SiRF_ID28P_get_cno9(SiRF_ID28P * userdata) { return userdata->cno9; } void SiRF_ID28P_set_cno10(SiRF_ID28P * userdata, uint8_t cno10) { userdata->cno10 = cno10; } uint8_t SiRF_ID28P_get_cno10(SiRF_ID28P * userdata) { return userdata->cno10; } void SiRF_ID28P_set_delta_range_interval(SiRF_ID28P * userdata, uint16_t delta_range_interval) { userdata->delta_range_interval = delta_range_interval; } uint16_t SiRF_ID28P_get_delta_range_interval(SiRF_ID28P * userdata) { return userdata->delta_range_interval; } void SiRF_ID28P_set_mean_delta_range_time(SiRF_ID28P * userdata, uint16_t mean_delta_range_time) { userdata->mean_delta_range_time = mean_delta_range_time; } uint16_t SiRF_ID28P_get_mean_delta_range_time(SiRF_ID28P * userdata) { return userdata->mean_delta_range_time; } void SiRF_ID28P_set_extrapolation_time(SiRF_ID28P * userdata, uint16_t extrapolation_time) { userdata->extrapolation_time = extrapolation_time; } uint16_t SiRF_ID28P_get_extrapolation_time(SiRF_ID28P * userdata) { return userdata->extrapolation_time; } void SiRF_ID28P_set_phase_error_count(SiRF_ID28P * userdata, uint8_t phase_error_count) { userdata->phase_error_count = phase_error_count; } uint8_t SiRF_ID28P_get_phase_error_count(SiRF_ID28P * userdata) { return userdata->phase_error_count; } void SiRF_ID28P_set_low_power_count(SiRF_ID28P * userdata, uint8_t low_power_count) { userdata->low_power_count = low_power_count; } uint8_t SiRF_ID28P_get_low_power_count(SiRF_ID28P * userdata) { return userdata->low_power_count; } //Format string generated automatically, //static char formatstring[] = "%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i"; //static char formatstring[] = "%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i"; static char insert_stmt[] = "INSERT into SiRF_ID28P (" "result_time," "header_mote_id," "header_seqno," "header_am_type," "header_blockcount," "channel," "time_tag," "sat_id," "gps_sw_time," "pseudo_range," "carrier_freq," "carrier_phase," "time_in_track," "sync_flags," "cno1," "cno2," "cno3," "cno4," "cno5," "cno6," "cno7," "cno8," "cno9," "cno10," "delta_range_interval," "mean_delta_range_time," "extrapolation_time," "phase_error_count," "low_power_count) values (now(), %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"; void SiRF_ID28P_pg_log(XbowSensorboardPacket * userdata) { char pg_command[255]; SiRF_ID28P * data = (SiRF_ID28P*)userdata; sprintf(pg_command,insert_stmt, data->header_mote_id, data->header_seqno, data->header_am_type, data->header_blockcount, data->channel, data->time_tag, data->sat_id, data->gps_sw_time, data->pseudo_range, data->carrier_freq, data->carrier_phase, data->time_in_track, data->sync_flags, data->cno1, data->cno2, data->cno3, data->cno4, data->cno5, data->cno6, data->cno7, data->cno8, data->cno9, data->cno10, data->delta_range_interval, data->mean_delta_range_time, data->extrapolation_time, data->phase_error_count, data->low_power_count); #ifdef TELOS_MOTE xdb_execute(pg_command); #endif } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t header_mote_id_convert(uint8_t header_mote_id) { return header_mote_id; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t header_seqno_convert(uint8_t header_seqno) { return header_seqno; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t header_am_type_convert(uint8_t header_am_type) { return header_am_type; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t header_blockcount_convert(uint8_t header_blockcount) { return header_blockcount; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t channel_convert(uint8_t channel) { return channel; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint32_t time_tag_convert(uint32_t time_tag) { return time_tag; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t sat_id_convert(uint8_t sat_id) { return sat_id; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint64_t gps_sw_time_convert(uint64_t gps_sw_time) { return gps_sw_time; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint64_t pseudo_range_convert(uint64_t pseudo_range) { return pseudo_range; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint32_t carrier_freq_convert(uint32_t carrier_freq) { return carrier_freq; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint64_t carrier_phase_convert(uint64_t carrier_phase) { return carrier_phase; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint16_t time_in_track_convert(uint16_t time_in_track) { return time_in_track; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t sync_flags_convert(uint8_t sync_flags) { return sync_flags; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t cno1_convert(uint8_t cno1) { return cno1; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t cno2_convert(uint8_t cno2) { return cno2; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t cno3_convert(uint8_t cno3) { return cno3; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t cno4_convert(uint8_t cno4) { return cno4; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t cno5_convert(uint8_t cno5) { return cno5; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t cno6_convert(uint8_t cno6) { return cno6; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t cno7_convert(uint8_t cno7) { return cno7; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t cno8_convert(uint8_t cno8) { return cno8; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t cno9_convert(uint8_t cno9) { return cno9; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t cno10_convert(uint8_t cno10) { return cno10; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint16_t delta_range_interval_convert(uint16_t delta_range_interval) { return delta_range_interval; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint16_t mean_delta_range_time_convert(uint16_t mean_delta_range_time) { return mean_delta_range_time; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint16_t extrapolation_time_convert(uint16_t extrapolation_time) { return extrapolation_time; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t phase_error_count_convert(uint8_t phase_error_count) { return phase_error_count; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t low_power_count_convert(uint8_t low_power_count) { return low_power_count; } void SiRF_ID28P_cook_packet(SiRF_ID28P * userdata) { userdata->header_mote_id = header_mote_id_convert(userdata->header_mote_id); userdata->header_seqno = header_seqno_convert(userdata->header_seqno); userdata->header_am_type = header_am_type_convert(userdata->header_am_type); userdata->header_blockcount = header_blockcount_convert(userdata->header_blockcount); userdata->channel = channel_convert(userdata->channel); userdata->time_tag = time_tag_convert(userdata->time_tag); userdata->sat_id = sat_id_convert(userdata->sat_id); userdata->gps_sw_time = gps_sw_time_convert(userdata->gps_sw_time); userdata->pseudo_range = pseudo_range_convert(userdata->pseudo_range); userdata->carrier_freq = carrier_freq_convert(userdata->carrier_freq); userdata->carrier_phase = carrier_phase_convert(userdata->carrier_phase); userdata->time_in_track = time_in_track_convert(userdata->time_in_track); userdata->sync_flags = sync_flags_convert(userdata->sync_flags); userdata->cno1 = cno1_convert(userdata->cno1); userdata->cno2 = cno2_convert(userdata->cno2); userdata->cno3 = cno3_convert(userdata->cno3); userdata->cno4 = cno4_convert(userdata->cno4); userdata->cno5 = cno5_convert(userdata->cno5); userdata->cno6 = cno6_convert(userdata->cno6); userdata->cno7 = cno7_convert(userdata->cno7); userdata->cno8 = cno8_convert(userdata->cno8); userdata->cno9 = cno9_convert(userdata->cno9); userdata->cno10 = cno10_convert(userdata->cno10); userdata->delta_range_interval = delta_range_interval_convert(userdata->delta_range_interval); userdata->mean_delta_range_time = mean_delta_range_time_convert(userdata->mean_delta_range_time); userdata->extrapolation_time = extrapolation_time_convert(userdata->extrapolation_time); userdata->phase_error_count = phase_error_count_convert(userdata->phase_error_count); userdata->low_power_count = low_power_count_convert(userdata->low_power_count); } /** User has to fill in any conversion code * necessary for processing. */ SiRF_ID28P * SiRF_ID28P_convert(char * data) { // Just to keep gcc happy. return (SiRF_ID28P*)data; } /** Print the bytes of the packet. */ void SiRF_ID28P_print_raw (XbowSensorboardPacket *packet) { printf("SiRF_ID28P print raw.\n"); } /** Print cooked output. */ void SiRF_ID28P_print_cooked (XbowSensorboardPacket * userdata) { SiRF_ID28P * data = (SiRF_ID28P*)userdata; printf("SiRF_ID28P print cooked:\n"); printf(" header_mote_id: %i,\n",data->header_mote_id); printf(" header_seqno: %i,\n",data->header_seqno); printf(" header_am_type: %i,\n",data->header_am_type); printf(" header_blockcount: %i,\n",data->header_blockcount); printf(" channel: %i,\n",data->channel); printf(" time_tag: %i,\n",data->time_tag); printf(" sat_id: %i,\n",data->sat_id); printf(" gps_sw_time: %i,\n",data->gps_sw_time); printf(" pseudo_range: %i,\n",data->pseudo_range); printf(" carrier_freq: %i,\n",data->carrier_freq); printf(" carrier_phase: %i,\n",data->carrier_phase); printf(" time_in_track: %i,\n",data->time_in_track); printf(" sync_flags: %i,\n",data->sync_flags); printf(" cno1: %i,\n",data->cno1); printf(" cno2: %i,\n",data->cno2); printf(" cno3: %i,\n",data->cno3); printf(" cno4: %i,\n",data->cno4); printf(" cno5: %i,\n",data->cno5); printf(" cno6: %i,\n",data->cno6); printf(" cno7: %i,\n",data->cno7); printf(" cno8: %i,\n",data->cno8); printf(" cno9: %i,\n",data->cno9); printf(" cno10: %i,\n",data->cno10); printf(" delta_range_interval: %i,\n",data->delta_range_interval); printf(" mean_delta_range_time: %i,\n",data->mean_delta_range_time); printf(" extrapolation_time: %i,\n",data->extrapolation_time); printf(" phase_error_count: %i,\n",data->phase_error_count); printf(" low_power_count: %i,\n",data->low_power_count); } #ifdef TELOS_MOTE XPacketHandler SiRF_ID28P_packet_handler = { // This should be replaced with the AM_TYPE 156, "$Id: sirf_id28.c,v 1.1 2005/08/17 21:48:29 doolin Exp $", SiRF_ID28P_print_raw, SiRF_ID28P_print_cooked, SiRF_ID28P_print_raw, SiRF_ID28P_print_cooked, SiRF_ID28P_pg_log, {0} }; void SiRF_ID28P_initialize() { xpacket_add_type(&SiRF_ID28P_packet_handler); } #endif /** The default size of this message type in bytes. */ //static int DEFAULT_MESSAGE_SIZE = 59; /** If incomplete types are used, we need to provide a way * to manage memory. */ SiRF_ID28P * SiRF_ID28P_new() { SiRF_ID28P * userdata = (SiRF_ID28P*)malloc(sizeof(SiRF_ID28P)); memset((void*)userdata,0xda,sizeof(SiRF_ID28P)); return userdata; } void SiRF_ID28P_delete(SiRF_ID28P * userdata) { memset((void*)userdata,0xdd,sizeof(SiRF_ID28P)); free(userdata); } |
From: David M. D. <do...@us...> - 2005-08-18 21:14:07
|
Update of /cvsroot/firebug/fireboard/beta/tools/gps/SiRF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14796 Added Files: sirftest2.c Log Message: sirf id 28 messages can now be handled. --- NEW FILE: sirftest2.c --- /** * Test code for LeadTek GPS unit sirf message 2. */ #include <stdio.h> #include <string.h> #include <stdlib.h> #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE !FALSE #endif #include "sirftest_util.h" #include "sirf.h" static FILE * outstream; // See page 40 of the LeadTek Protocol manual for // example sirf id 2 string. static char sirf_id2[] = { 0x02, // message id 0xff, 0xd6, 0xf7, 0x8c, // x position 0xff, 0xbe, 0x53, 0x6e, // y position 0x00, 0x3a, 0xc0, 0x04, // z position 0x00, 0x00, // x velocity 0x00, 0x03, // y velocity 0x00, 0x01, // z velocity 0x04, // mode 1 0x0a, // (H)DOP 0x00, // mode 2 0x03, 0x6b, // GPS Week 0x03, 0x97, 0x80, 0xe3, // GPS TOW 0x06, // Sats in fix 0x12, // ch 1 0x19, // ch 2 0x0e, // ch 3 0x16, // ch 4 0x0f, // ch 5 0x04, // ch 6 0x00, // ch 7 0x00, // ch 8 0x00, // ch 9 0x00, // ch 10 0x00, // ch 11 0x00 // ch 12 }; int test_sirf_id2_parsing(void) { SiRF_ID2_1 sid2_1 = {{0}}; sid2_1.header.seqno = 13; sid2_1.header.am_type = 150; sid2_1.xpos = convert_4_bytes_to_int(&sirf_id2[1]); sid2_1.ypos = convert_4_bytes_to_int(&sirf_id2[4]); sid2_1.zpos = convert_4_bytes_to_int(&sirf_id2[9]); sid2_1.xvel = convert_2_bytes_to_float(&sirf_id2[13]); sid2_1.yvel = convert_2_bytes_to_float(&sirf_id2[15]); sid2_1.zvel = convert_2_bytes_to_float(&sirf_id2[17]); sid2_1.mode1 = sirf_id2[19]; sid2_1.dop = sirf_id2[20]; sid2_1.mode2 = sirf_id2[21]; // memcpy(&sid2_1 + 4,&sirf_id2[1],23); //SiRF_ID2_1_print_cooked (&sid2_1); return 0; } void print_struct_sizes(void) { printf("sirf id 2,1: %d\n",sizeof(SiRF_ID2_1)); printf("sirf id 2,2: %d\n",sizeof(SiRF_ID2_2)); printf("sirf id 28,1: %d\n",sizeof(SiRF_ID28_1)); printf("sirf id 28,2: %d\n",sizeof(SiRF_ID28_2)); printf("sirf id 28,3: %d\n",sizeof(SiRF_ID28_3)); } void print_message_sizes(void) { printf("Size of sirf id 2 string: %d\n", sizeof(sirf_id2)); } uint8_t get_message_id(char * msg) { return msg[0]; } void print_sirf2_message(void) { uint8_t msgid = 0; int32_t xpos = 0; int32_t ypos = 0; int32_t zpos = 0; float xvel = 0; float yvel = 0; float zvel = 0; msgid = get_message_id(sirf_id2); xpos = convert_4_bytes_to_int(&sirf_id2[1]); ypos = convert_4_bytes_to_int(&sirf_id2[5]); zpos = convert_4_bytes_to_int(&sirf_id2[9]); printf("Message ID: %d:\n",msgid); printf("X Pos: %ld\n", xpos); printf("Y Pos: %ld\n", ypos); printf("Z Pos: %ld\n", zpos); xvel = convert_2_bytes_to_float(&sirf_id2[13]); yvel = convert_2_bytes_to_float(&sirf_id2[15]); zvel = convert_2_bytes_to_float(&sirf_id2[17]); printf("X Vel: %f\n", xvel/8.0); printf("Y Vel: %f\n", yvel/8.0); printf("Z Vel: %f\n", zvel/8.0); printf("Mode 1: %d\n",sirf_id2[19]); printf("(H)DOP: %f\n",(float)sirf_id2[20]/5.0); printf("Mode 2: %d\n",sirf_id2[21]); printf("GPS Week: %d\n",convert_2_bytes_to_uint16(&sirf_id2[22])); //printf("GPS TOW: %f\n",(float)convert_4_bytes_to_int(&sirf_id2[24])/100.0); } unsigned char leadtek_crc(char * message, int size) { unsigned char cs = 0; int index = 1; while (message[index] != '*') { cs ^= message[index++]; } return cs; } unsigned char sirf_crc(char * msg, uint8_t size) { unsigned char cs = 0; uint8_t i; for (i=0; i<size; i++) { cs = cs ^ msg[i]; } return cs; } /** * This function tests for correct extraction of data * from the raw sirf message. */ int fb_sirfid2_test() { int passed = FALSE; uint8_t msgid = 0; int32_t xpos = 0; int32_t ypos = 0; int32_t zpos = 0; float xvel = 0; float yvel = 0; float zvel = 0; uint8_t mode1, mode2; float dop; uint16_t gps_week; uint32_t gps_tow; uint8_t sats_in_fix; uint8_t ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8, ch9, ch10, ch11, ch12; msgid = get_message_id(sirf_id2); passed = (msgid == 2); xpos = convert_4_bytes_to_int(&sirf_id2[1]); passed &= (xpos == -2689140); ypos = convert_4_bytes_to_int(&sirf_id2[5]); passed &= (ypos == -4304018); zpos = convert_4_bytes_to_int(&sirf_id2[9]); passed &= (zpos == 3850244); xvel = convert_2_bytes_to_float(&sirf_id2[13]); passed &= (xvel == 0.0); yvel = convert_2_bytes_to_float(&sirf_id2[15])/8.0; passed &= (yvel == 0.375); zvel = convert_2_bytes_to_float(&sirf_id2[17])/8.0; passed &= (zvel == 0.125); mode1 = sirf_id2[19]; passed &= (mode1 == 4); dop = (float)sirf_id2[20]/5.0; passed &= (dop == 2.0); mode2 = sirf_id2[21]; passed &= (mode2 == 0); gps_week = convert_2_bytes_to_uint16(&sirf_id2[22]); passed &= (gps_week == 875); gps_tow = convert_4_bytes_to_int(&sirf_id2[24]); passed &= (gps_tow == 60260579); sats_in_fix = sirf_id2[28]; passed &= (sats_in_fix == 6); ch1 = sirf_id2[29]; passed &= (ch1 == 18); ch2 = sirf_id2[30]; passed &= (ch2 == 25); ch3 = sirf_id2[31]; passed &= (ch3 == 14); ch4 = sirf_id2[32]; passed &= (ch4 == 22); ch5 = sirf_id2[33]; passed &= (ch5 == 15); ch6 = sirf_id2[34]; passed &= (ch6 == 4); ch7 = sirf_id2[35]; passed &= (ch7 == 0); ch8 = sirf_id2[36]; passed &= (ch8 == 0); ch9 = sirf_id2[37]; passed &= (ch9 == 0); ch10 = sirf_id2[38]; passed &= (ch10 == 0); ch11 = sirf_id2[39]; passed &= (ch11 == 0); ch12 = sirf_id2[40]; passed &= (ch12 == 0); /* fprintf(outstream,"GPS Week: %d\n",gps_week); fprintf(outstream,"GPS TOW: %d\n", gps_tow); fprintf(outstream,"SVs in fix: %d\n", sats_in_fix); fprintf(outstream, "Channels 1-6: %d %d %d %d %d %d\n" "Channels 7-12: %d %d %d %d %d %d\n", ch1, ch2, ch3, ch4, ch5, ch6, ch7, ch8, ch9, ch10, ch11, ch12); */ return passed; } int fb_sirf_test(void) { if (fb_sirfid2_test()) { fprintf(outstream, "SiRF ID 2 parsing passed.\n"); } else { fprintf(outstream, "SiRF ID 2 parsing failed.\n"); } return FALSE; } void temporary(void) { print_message_sizes(); print_struct_sizes(); } // Change to msg * later SiRF_ID2_t * parse_sirfid2 (uint8_t * msg) { SiRF_ID2_t * sid2; sid2 = (SiRF_ID2_t*)calloc(1,sizeof(SiRF_ID2_t)); printf("zpos: %i\n",convert_4_bytes_to_int(&msg[9])); sid2->xpos = convert_4_bytes_to_int(&msg[1]); sid2->ypos = convert_4_bytes_to_int(&msg[5]); sid2->zpos = convert_4_bytes_to_int(&msg[9]); sid2->xvel = convert_2_bytes_to_uint16(&msg[13]); sid2->yvel = convert_2_bytes_to_uint16(&msg[15]); sid2->zvel = convert_2_bytes_to_uint16(&msg[17]); sid2->mode1 = msg[19]; sid2->dop = msg[20]; sid2->mode2 = msg[21]; sid2->gps_week = convert_2_bytes_to_uint16(&msg[22]); sid2->gps_tow = convert_4_bytes_to_int(&msg[24]); sid2->sv_in_fix = msg[28]; sid2->ch1 = msg[29]; sid2->ch2 = msg[30]; sid2->ch3 = msg[31]; sid2->ch4 = msg[32]; sid2->ch5 = msg[33]; sid2->ch6 = msg[34]; sid2->ch7 = msg[35]; sid2->ch8 = msg[36]; sid2->ch9 = msg[37]; sid2->ch10 = msg[38]; sid2->ch11 = msg[39]; sid2->ch12 = msg[40]; return sid2; } // Header used in packets that make up a long message. // typedef struct fragmentHeader { uint8_t mote_id; uint8_t sequenceNumber; uint8_t blockNumber; uint8_t blockCount; } FragmentHeader_t; #ifndef TOSH_DATA_LENGTH #define TOSH_DATA_LENGTH 29 #endif #define FRAGMENT_PAYLOAD_LENGTH (TOSH_DATA_LENGTH - sizeof(FragmentHeader_t)) // Packet to transport variable length (and long) messages in a fixed // length radio message. typedef struct messageFragment { FragmentHeader_t h; uint8_t data[FRAGMENT_PAYLOAD_LENGTH]; } MessageFragment_t; // Struct pointer for msg parsing code. typedef void * (*message_parser)(uint8_t * raw_msg); struct msg_packer { uint8_t number_of_blocks; uint8_t mote_id; uint8_t blocknumber; uint8_t seqno; uint8_t blocks_received_flags; uint8_t msg[255]; }; typedef struct msg_packer msg_packer_t; #define NUMBER_OF_MOTES 30 msg_packer_t * mp_array[NUMBER_OF_MOTES]; void init_mp_array() { int i; for (i=0; i< NUMBER_OF_MOTES; i++) { mp_array[i] = calloc(1,sizeof(msg_packer_t)); } } void parse_msg(uint8_t * sirfmsg) { SiRF_ID2_t * sid2; uint8_t mid = get_message_id(sirfmsg); switch (mid) { case 2: printf("Parsing sirf id 2 msg...\n"); sid2 = parse_sirfid2(sirfmsg); SiRF_ID2P_print_cooked(sid2); break; case 28: //parse_sirfid28(msg); break; default: ; } } void pack_struct(msg_packer_t * mp, uint8_t * raw_msg) { int offset; offset = mp->blocknumber*FRAGMENT_PAYLOAD_LENGTH; //printf("offset: %d\n",offset); //printf("zpos: %i\n",convert_4_bytes_to_int(&raw_msg[9])); memcpy(&mp->msg[offset],raw_msg,FRAGMENT_PAYLOAD_LENGTH); //printf("zpos: %i\n",convert_4_bytes_to_int(&mp->msg[9])); } /** This is really quick and dirty code, * should work ok, but will probably * start to drop a lot of packets as * the number of motes increases and * as the number of hops from mote to * base station increases. * * The idea is that when packets come in, * we have to keep track of what we have * versus what we need to have a complete * message. */ void unpack_message(void * raw_msg) { MessageFragment_t * mf = (MessageFragment_t*)raw_msg; uint8_t number_of_blocks = mf->h.blockCount; uint8_t mote_id = mf->h.mote_id; uint8_t blocknumber = mf->h.blockNumber; uint8_t seqno = mf->h.sequenceNumber; msg_packer_t * mp; //printf("mf->blockcount: %d\n", mf->h.blockCount); //printf("mf->mote_id: %d\n", mf->h.mote_id); //printf("mf->seqno: %d\n", mf->h.sequenceNumber); printf("mf->blocknumber: %d\n", mf->h.blockNumber); mp = mp_array[mote_id]; mp->blocknumber = blocknumber; //printf("mp->seqno: %d\n",mp->seqno); // Out of sequence messages are discarded. if (mp->seqno > seqno) { printf("older\n"); return; } else if (mp->seqno == seqno) { printf("same\n"); //stuff the msg frag into the struct. pack_struct(mp,mf->data); } else { // // Current struct is stale, refill. printf("newer\n"); memset(mp, 0x0, sizeof(msg_packer_t)); //stuff the msg frag into the struct. pack_struct(mp,mf->data); } //printf("IDID: %d\n",mp->msg[0]); mp->blocks_received_flags |= 1 << blocknumber; //printf("Blocks received: %d\n",mp->blocks_received_flags); if ((number_of_blocks == 1 && mp->blocks_received_flags == 1) || (number_of_blocks == 2 && mp->blocks_received_flags == 3) || (number_of_blocks == 3 && mp->blocks_received_flags == 7) || (number_of_blocks == 4 && mp->blocks_received_flags == 15)) { parse_msg(mp->msg); //memset(mp, 0x0, sizeof(msg_packer_t)); } } void test_packer() { MessageFragment_t * mf1; MessageFragment_t * mf2; mf1 = (MessageFragment_t *)calloc(1,sizeof(MessageFragment_t)); mf2 = (MessageFragment_t *)calloc(1,sizeof(MessageFragment_t)); init_mp_array(); mf1->h.sequenceNumber = 0; mf2->h.sequenceNumber = 0; mf1->h.blockCount = 2; mf2->h.blockCount = 2; mf1->h.blockNumber = 0; mf2->h.blockNumber = 1; mf1->h.mote_id = 13; mf2->h.mote_id = 13; //printf("sirf msg: %s\n",sirf_id2); //printf("%d\n",sirf_id2[0]); printf("zvel: %d:\n",convert_2_bytes_to_uint16(&sirf_id2[17])); memcpy(mf1->data,sirf_id2,FRAGMENT_PAYLOAD_LENGTH); memcpy(mf2->data,sirf_id2+FRAGMENT_PAYLOAD_LENGTH,FRAGMENT_PAYLOAD_LENGTH); printf("yvel: %d:\n",convert_2_bytes_to_uint16(&mf1->data[15])); unpack_message((void*)mf2); unpack_message((void*)mf1); } int main(int argc, char ** argv) { //uint64_t foo = 0xf143f62c4113f42f; outstream = stdout; //fb_sirf_test(); //print_sirf2_message(); //temporary(); //printf("Foo: %f\n", foo); test_sirf_id2_parsing(); test_packer(); print_sirf2_message(); return 0; } |
From: David M. D. <do...@us...> - 2005-08-18 20:53:30
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14310/tools/src/xlisten Modified Files: genc.pm Log Message: sirf id 28 messages can now be handled. Index: genc.pm =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/genc.pm,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** genc.pm 17 Aug 2005 01:56:47 -0000 1.7 --- genc.pm 17 Aug 2005 21:46:00 -0000 1.8 *************** *** 515,520 **** } elsif ($bitlength < 32) { $jtype = "uint16_t"; ! } else { $jtype = "uint32_t"; } } elsif ($basetype eq "I") { --- 515,522 ---- } elsif ($bitlength < 32) { $jtype = "uint16_t"; ! } elsif ($bitlength < 64) { $jtype = "uint32_t"; + } else { + $jtype = "uint64_t"; } } elsif ($basetype eq "I") { |
From: Michael N. <mne...@us...> - 2005-08-18 20:10:24
|
Update of /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3474 Modified Files: GpsPacket.nc IntersemaPressureM.nc UARTGpsPacket.nc Log Message: Control GPS to SIRF modes Index: GpsPacket.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400/GpsPacket.nc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GpsPacket.nc 30 Jul 2005 03:15:38 -0000 1.4 --- GpsPacket.nc 17 Aug 2005 22:48:55 -0000 1.5 *************** *** 21,68 **** * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." * ! */ ! /* tab:4 ! * IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. By ! * downloading, copying, installing or using the software you agree to ! * this license. If you do not agree to this license, do not download, ! * install, copy or use the software. ! * ! * Intel Open Source License [...997 lines suppressed...] ! signal GpsCmd.TxRxSet(gpsPowerStatus); ! } ! ! return SUCCESS; } ! event result_t SwitchI2W.setAllDone(bool local_result) { ! return SUCCESS; ! } ! event result_t Switch1.setAllDone(bool local_result) { ! return SUCCESS; ! } ! event result_t SwitchI2W.getDone(char value) { ! return SUCCESS; ! } Index: IntersemaPressureM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400/IntersemaPressureM.nc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IntersemaPressureM.nc 4 Jul 2005 02:55:43 -0000 1.3 --- IntersemaPressureM.nc 17 Aug 2005 22:48:55 -0000 1.4 *************** *** 126,129 **** --- 126,130 ---- if (l_state == BUSY) { atomic state = SWITCH_IO1; + SODbg(DBG_USR2, "Setting SCLK %s\n",(l_iostate) ? "ON" : "OFF"); call IOSwitch.set(MICAWB_PRESSURE_SCLK, l_iostate); } *************** *** 131,134 **** --- 132,136 ---- // SODbg(DBG_USR2, "IntesemaPressure.IoBus.SCLK switch set \n"); atomic state = SWITCH_IO2; + SODbg(DBG_USR2, "Setting DIN %s\n",(l_iostate) ? "ON" : "OFF"); call IOSwitch.set(MICAWB_PRESSURE_DIN, l_iostate); } *************** *** 136,139 **** --- 138,142 ---- // SODbg(DBG_USR2, "IntesemaPressure.IoBus.Din switch set \n"); atomic state = SWITCH_IO3; + SODbg(DBG_USR2, "Setting DOUT %s\n",(l_iostate) ? "ON" : "OFF"); call IOSwitch.set(MICAWB_PRESSURE_DOUT, l_iostate); } *************** *** 175,179 **** command result_t SplitControl.start() { ! // SODbg(DBG_USR2, "IntesemaPressure.start: turning on power \n"); atomic state = MAIN_SWITCH_ON; call SwitchControl.start(); --- 178,182 ---- command result_t SplitControl.start() { ! SODbg(DBG_USR2, "IntesemaPressure.start: turning on power \n"); atomic state = MAIN_SWITCH_ON; call SwitchControl.start(); Index: UARTGpsPacket.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400/UARTGpsPacket.nc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UARTGpsPacket.nc 19 May 2005 17:31:54 -0000 1.1 --- UARTGpsPacket.nc 17 Aug 2005 22:48:55 -0000 1.2 *************** *** 71,74 **** --- 71,75 ---- interface StdControl as Control; interface BareSendMsg as Send; + interface SendVarLenPacket as SendVar; interface ReceiveMsg as Receive; // interface I2CSwitchCmds as GpsCmd; *************** *** 79,91 **** implementation { ! components GpsPacket as Packet, UART1 as UART,MicaWbSwitch; GpsCmd = Packet.GpsCmd; Control = Packet.Control; ! Send = Packet.Send; ! Receive = Packet.Receive; ! Packet.ByteControl -> UART; ! Packet.ByteComm -> UART; Packet.SwitchControl -> MicaWbSwitch.StdControl; --- 80,94 ---- implementation { ! components GpsPacket as Packet, UART1, MicaWbSwitch; GpsCmd = Packet.GpsCmd; Control = Packet.Control; ! Send = Packet.BareSendMsg; ! SendVar = Packet.SendVarLenPacket; ! ! Receive = Packet.ReceiveMsg; ! Packet.ByteControl -> UART1; ! Packet.ByteComm -> UART1; Packet.SwitchControl -> MicaWbSwitch.StdControl; |
From: Michael N. <mne...@us...> - 2005-08-18 17:46:08
|
Update of /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400/GPS In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3474/GPS Modified Files: HPLUART1M.nc gps.h Log Message: Control GPS to SIRF modes Index: HPLUART1M.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400/GPS/HPLUART1M.nc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HPLUART1M.nc 19 May 2005 17:31:54 -0000 1.1 --- HPLUART1M.nc 17 Aug 2005 22:48:56 -0000 1.2 *************** *** 120,123 **** --- 120,124 ---- default async event result_t UART.putDone() { return SUCCESS; } + TOSH_INTERRUPT(SIG_UART1_TRANS) { signal UART.putDone(); Index: gps.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tos/sensorboards/mts400/GPS/gps.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gps.h 23 May 2005 21:34:38 -0000 1.2 --- gps.h 17 Aug 2005 22:48:56 -0000 1.3 *************** *** 68,72 **** #define XBOW_GPS_H ! #define GPS_DATA_LENGTH 128 #define GPS_PACKET_START 0x24 //start of gps packet #define GPS_PACKET_END1 0x0D //end if gps packet --- 68,72 ---- #define XBOW_GPS_H ! #define GPS_DATA_LENGTH 254 #define GPS_PACKET_START 0x24 //start of gps packet #define GPS_PACKET_END1 0x0D //end if gps packet |
From: David M. D. <do...@us...> - 2005-08-18 17:27:11
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/MultihopLinkEstimator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15370 Added Files: LinkEstimatorMsg.pgsql Log Message: sirf id 28 messages can now be handled. --- NEW FILE: LinkEstimatorMsg.pgsql --- /** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This code provides postgres table to the 'LinkEstimatorMsgP' * message type. */ CREATE TABLE LinkEstimatorMsgP ( result_time timestamp without time zone, seqno integer, source integer, dest integer, RSSI integer, LQI integer, source_seqno integer); |
From: David M. D. <do...@us...> - 2005-08-17 01:56:57
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28568/tools/src/xlisten/boards Modified Files: linkmsg.c sirf_id28_1.c sirf_id28_2.c sirf_id28_3.c sirf_id2_1.c sirf_id2_2.c Log Message: Added code for parsing blocked sirf messages. Index: sirf_id2_2.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards/sirf_id2_2.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sirf_id2_2.c 9 Aug 2005 00:39:08 -0000 1.5 --- sirf_id2_2.c 17 Aug 2005 01:56:47 -0000 1.6 *************** *** 53,60 **** struct _SiRF_ID2_2P { uint8_t header_seqno; uint8_t header_am_type; ! uint8_t header_rsrvd1; ! uint8_t header_rsrvd2; uint32_t gps_tow; uint8_t sv_in_fix; --- 53,60 ---- struct _SiRF_ID2_2P { + uint8_t header_mote_id; uint8_t header_seqno; uint8_t header_am_type; ! uint8_t header_blockcount; uint32_t gps_tow; uint8_t sv_in_fix; *************** *** 76,79 **** --- 76,89 ---- void + SiRF_ID2_2P_set_header_mote_id(SiRF_ID2_2P * userdata, uint8_t header_mote_id) { + userdata->header_mote_id = header_mote_id; + } + + uint8_t + SiRF_ID2_2P_get_header_mote_id(SiRF_ID2_2P * userdata) { + return userdata->header_mote_id; + } + + void SiRF_ID2_2P_set_header_seqno(SiRF_ID2_2P * userdata, uint8_t header_seqno) { userdata->header_seqno = header_seqno; *************** *** 96,116 **** void ! SiRF_ID2_2P_set_header_rsrvd1(SiRF_ID2_2P * userdata, uint8_t header_rsrvd1) { ! userdata->header_rsrvd1 = header_rsrvd1; ! } ! ! uint8_t ! SiRF_ID2_2P_get_header_rsrvd1(SiRF_ID2_2P * userdata) { ! return userdata->header_rsrvd1; ! } ! ! void ! SiRF_ID2_2P_set_header_rsrvd2(SiRF_ID2_2P * userdata, uint8_t header_rsrvd2) { ! userdata->header_rsrvd2 = header_rsrvd2; } uint8_t ! SiRF_ID2_2P_get_header_rsrvd2(SiRF_ID2_2P * userdata) { ! return userdata->header_rsrvd2; } --- 106,116 ---- void ! SiRF_ID2_2P_set_header_blockcount(SiRF_ID2_2P * userdata, uint8_t header_blockcount) { ! userdata->header_blockcount = header_blockcount; } uint8_t ! SiRF_ID2_2P_get_header_blockcount(SiRF_ID2_2P * userdata) { ! return userdata->header_blockcount; } *************** *** 268,275 **** static char insert_stmt[] = "INSERT into SiRF_ID2_2P (" "result_time," "header_seqno," "header_am_type," ! "header_rsrvd1," ! "header_rsrvd2," "gps_tow," "sv_in_fix," --- 268,275 ---- static char insert_stmt[] = "INSERT into SiRF_ID2_2P (" "result_time," + "header_mote_id," "header_seqno," "header_am_type," ! "header_blockcount," "gps_tow," "sv_in_fix," *************** *** 293,300 **** SiRF_ID2_2P * data = (SiRF_ID2_2P*)userdata; sprintf(pg_command,insert_stmt, data->header_seqno, data->header_am_type, ! data->header_rsrvd1, ! data->header_rsrvd2, data->gps_tow, data->sv_in_fix, --- 293,300 ---- SiRF_ID2_2P * data = (SiRF_ID2_2P*)userdata; sprintf(pg_command,insert_stmt, + data->header_mote_id, data->header_seqno, data->header_am_type, ! data->header_blockcount, data->gps_tow, data->sv_in_fix, *************** *** 323,328 **** */ static uint8_t ! header_seqno_convert(uint8_t header_seqno) { ! return header_seqno; } --- 323,328 ---- */ static uint8_t ! header_mote_id_convert(uint8_t header_mote_id) { ! return header_mote_id; } *************** *** 331,336 **** */ static uint8_t ! header_am_type_convert(uint8_t header_am_type) { ! return header_am_type; } --- 331,336 ---- */ static uint8_t ! header_seqno_convert(uint8_t header_seqno) { ! return header_seqno; } *************** *** 339,344 **** */ static uint8_t ! header_rsrvd1_convert(uint8_t header_rsrvd1) { ! return header_rsrvd1; } --- 339,344 ---- */ static uint8_t ! header_am_type_convert(uint8_t header_am_type) { ! return header_am_type; } *************** *** 347,352 **** */ static uint8_t ! header_rsrvd2_convert(uint8_t header_rsrvd2) { ! return header_rsrvd2; } --- 347,352 ---- */ static uint8_t ! header_blockcount_convert(uint8_t header_blockcount) { ! return header_blockcount; } *************** *** 465,472 **** void SiRF_ID2_2P_cook_packet(SiRF_ID2_2P * userdata) { userdata->header_seqno = header_seqno_convert(userdata->header_seqno); userdata->header_am_type = header_am_type_convert(userdata->header_am_type); ! userdata->header_rsrvd1 = header_rsrvd1_convert(userdata->header_rsrvd1); ! userdata->header_rsrvd2 = header_rsrvd2_convert(userdata->header_rsrvd2); userdata->gps_tow = gps_tow_convert(userdata->gps_tow); userdata->sv_in_fix = sv_in_fix_convert(userdata->sv_in_fix); --- 465,472 ---- void SiRF_ID2_2P_cook_packet(SiRF_ID2_2P * userdata) { + userdata->header_mote_id = header_mote_id_convert(userdata->header_mote_id); userdata->header_seqno = header_seqno_convert(userdata->header_seqno); userdata->header_am_type = header_am_type_convert(userdata->header_am_type); ! userdata->header_blockcount = header_blockcount_convert(userdata->header_blockcount); userdata->gps_tow = gps_tow_convert(userdata->gps_tow); userdata->sv_in_fix = sv_in_fix_convert(userdata->sv_in_fix); *************** *** 514,521 **** SiRF_ID2_2P * data = (SiRF_ID2_2P*)userdata; printf("SiRF_ID2_2P print cooked:\n"); printf(" header_seqno: %i,\n",data->header_seqno); printf(" header_am_type: %i,\n",data->header_am_type); ! printf(" header_rsrvd1: %i,\n",data->header_rsrvd1); ! printf(" header_rsrvd2: %i,\n",data->header_rsrvd2); printf(" gps_tow: %i,\n",data->gps_tow); printf(" sv_in_fix: %i,\n",data->sv_in_fix); --- 514,521 ---- SiRF_ID2_2P * data = (SiRF_ID2_2P*)userdata; printf("SiRF_ID2_2P print cooked:\n"); + printf(" header_mote_id: %i,\n",data->header_mote_id); printf(" header_seqno: %i,\n",data->header_seqno); printf(" header_am_type: %i,\n",data->header_am_type); ! printf(" header_blockcount: %i,\n",data->header_blockcount); printf(" gps_tow: %i,\n",data->gps_tow); printf(" sv_in_fix: %i,\n",data->sv_in_fix); Index: sirf_id28_2.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards/sirf_id28_2.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sirf_id28_2.c 9 Aug 2005 00:39:08 -0000 1.5 --- sirf_id28_2.c 17 Aug 2005 01:56:47 -0000 1.6 *************** *** 53,60 **** struct _SiRF_ID28_2P { uint8_t header_seqno; uint8_t header_am_type; ! uint8_t header_rsrvd1; ! uint8_t header_rsrvd2; uint32_t pseudo_range; uint32_t carrier_freq; --- 53,60 ---- struct _SiRF_ID28_2P { + uint8_t header_mote_id; uint8_t header_seqno; uint8_t header_am_type; ! uint8_t header_blockcount; uint32_t pseudo_range; uint32_t carrier_freq; *************** *** 66,69 **** --- 66,79 ---- void + SiRF_ID28_2P_set_header_mote_id(SiRF_ID28_2P * userdata, uint8_t header_mote_id) { + userdata->header_mote_id = header_mote_id; + } + + uint8_t + SiRF_ID28_2P_get_header_mote_id(SiRF_ID28_2P * userdata) { + return userdata->header_mote_id; + } + + void SiRF_ID28_2P_set_header_seqno(SiRF_ID28_2P * userdata, uint8_t header_seqno) { userdata->header_seqno = header_seqno; *************** *** 86,106 **** void ! SiRF_ID28_2P_set_header_rsrvd1(SiRF_ID28_2P * userdata, uint8_t header_rsrvd1) { ! userdata->header_rsrvd1 = header_rsrvd1; ! } ! ! uint8_t ! SiRF_ID28_2P_get_header_rsrvd1(SiRF_ID28_2P * userdata) { ! return userdata->header_rsrvd1; ! } ! ! void ! SiRF_ID28_2P_set_header_rsrvd2(SiRF_ID28_2P * userdata, uint8_t header_rsrvd2) { ! userdata->header_rsrvd2 = header_rsrvd2; } uint8_t ! SiRF_ID28_2P_get_header_rsrvd2(SiRF_ID28_2P * userdata) { ! return userdata->header_rsrvd2; } --- 96,106 ---- void ! SiRF_ID28_2P_set_header_blockcount(SiRF_ID28_2P * userdata, uint8_t header_blockcount) { ! userdata->header_blockcount = header_blockcount; } uint8_t ! SiRF_ID28_2P_get_header_blockcount(SiRF_ID28_2P * userdata) { ! return userdata->header_blockcount; } *************** *** 158,165 **** static char insert_stmt[] = "INSERT into SiRF_ID28_2P (" "result_time," "header_seqno," "header_am_type," ! "header_rsrvd1," ! "header_rsrvd2," "pseudo_range," "carrier_freq," --- 158,165 ---- static char insert_stmt[] = "INSERT into SiRF_ID28_2P (" "result_time," + "header_mote_id," "header_seqno," "header_am_type," ! "header_blockcount," "pseudo_range," "carrier_freq," *************** *** 173,180 **** SiRF_ID28_2P * data = (SiRF_ID28_2P*)userdata; sprintf(pg_command,insert_stmt, data->header_seqno, data->header_am_type, ! data->header_rsrvd1, ! data->header_rsrvd2, data->pseudo_range, data->carrier_freq, --- 173,180 ---- SiRF_ID28_2P * data = (SiRF_ID28_2P*)userdata; sprintf(pg_command,insert_stmt, + data->header_mote_id, data->header_seqno, data->header_am_type, ! data->header_blockcount, data->pseudo_range, data->carrier_freq, *************** *** 193,198 **** */ static uint8_t ! header_seqno_convert(uint8_t header_seqno) { ! return header_seqno; } --- 193,198 ---- */ static uint8_t ! header_mote_id_convert(uint8_t header_mote_id) { ! return header_mote_id; } *************** *** 201,206 **** */ static uint8_t ! header_am_type_convert(uint8_t header_am_type) { ! return header_am_type; } --- 201,206 ---- */ static uint8_t ! header_seqno_convert(uint8_t header_seqno) { ! return header_seqno; } *************** *** 209,214 **** */ static uint8_t ! header_rsrvd1_convert(uint8_t header_rsrvd1) { ! return header_rsrvd1; } --- 209,214 ---- */ static uint8_t ! header_am_type_convert(uint8_t header_am_type) { ! return header_am_type; } *************** *** 217,222 **** */ static uint8_t ! header_rsrvd2_convert(uint8_t header_rsrvd2) { ! return header_rsrvd2; } --- 217,222 ---- */ static uint8_t ! header_blockcount_convert(uint8_t header_blockcount) { ! return header_blockcount; } *************** *** 255,262 **** void SiRF_ID28_2P_cook_packet(SiRF_ID28_2P * userdata) { userdata->header_seqno = header_seqno_convert(userdata->header_seqno); userdata->header_am_type = header_am_type_convert(userdata->header_am_type); ! userdata->header_rsrvd1 = header_rsrvd1_convert(userdata->header_rsrvd1); ! userdata->header_rsrvd2 = header_rsrvd2_convert(userdata->header_rsrvd2); userdata->pseudo_range = pseudo_range_convert(userdata->pseudo_range); userdata->carrier_freq = carrier_freq_convert(userdata->carrier_freq); --- 255,262 ---- void SiRF_ID28_2P_cook_packet(SiRF_ID28_2P * userdata) { + userdata->header_mote_id = header_mote_id_convert(userdata->header_mote_id); userdata->header_seqno = header_seqno_convert(userdata->header_seqno); userdata->header_am_type = header_am_type_convert(userdata->header_am_type); ! userdata->header_blockcount = header_blockcount_convert(userdata->header_blockcount); userdata->pseudo_range = pseudo_range_convert(userdata->pseudo_range); userdata->carrier_freq = carrier_freq_convert(userdata->carrier_freq); *************** *** 294,301 **** SiRF_ID28_2P * data = (SiRF_ID28_2P*)userdata; printf("SiRF_ID28_2P print cooked:\n"); printf(" header_seqno: %i,\n",data->header_seqno); printf(" header_am_type: %i,\n",data->header_am_type); ! printf(" header_rsrvd1: %i,\n",data->header_rsrvd1); ! printf(" header_rsrvd2: %i,\n",data->header_rsrvd2); printf(" pseudo_range: %i,\n",data->pseudo_range); printf(" carrier_freq: %i,\n",data->carrier_freq); --- 294,301 ---- SiRF_ID28_2P * data = (SiRF_ID28_2P*)userdata; printf("SiRF_ID28_2P print cooked:\n"); + printf(" header_mote_id: %i,\n",data->header_mote_id); printf(" header_seqno: %i,\n",data->header_seqno); printf(" header_am_type: %i,\n",data->header_am_type); ! printf(" header_blockcount: %i,\n",data->header_blockcount); printf(" pseudo_range: %i,\n",data->pseudo_range); printf(" carrier_freq: %i,\n",data->carrier_freq); Index: sirf_id28_3.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards/sirf_id28_3.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sirf_id28_3.c 9 Aug 2005 00:39:08 -0000 1.5 --- sirf_id28_3.c 17 Aug 2005 01:56:47 -0000 1.6 *************** *** 53,60 **** struct _SiRF_ID28_3P { uint8_t header_seqno; uint8_t header_am_type; ! uint8_t header_rsrvd1; ! uint8_t header_rsrvd2; uint8_t sync_flags; uint8_t cno1; --- 53,60 ---- struct _SiRF_ID28_3P { + uint8_t header_mote_id; uint8_t header_seqno; uint8_t header_am_type; ! uint8_t header_blockcount; uint8_t sync_flags; uint8_t cno1; *************** *** 78,81 **** --- 78,91 ---- void + SiRF_ID28_3P_set_header_mote_id(SiRF_ID28_3P * userdata, uint8_t header_mote_id) { + userdata->header_mote_id = header_mote_id; + } + + uint8_t + SiRF_ID28_3P_get_header_mote_id(SiRF_ID28_3P * userdata) { + return userdata->header_mote_id; + } + + void SiRF_ID28_3P_set_header_seqno(SiRF_ID28_3P * userdata, uint8_t header_seqno) { userdata->header_seqno = header_seqno; *************** *** 98,118 **** void ! SiRF_ID28_3P_set_header_rsrvd1(SiRF_ID28_3P * userdata, uint8_t header_rsrvd1) { ! userdata->header_rsrvd1 = header_rsrvd1; ! } ! ! uint8_t ! SiRF_ID28_3P_get_header_rsrvd1(SiRF_ID28_3P * userdata) { ! return userdata->header_rsrvd1; ! } ! ! void ! SiRF_ID28_3P_set_header_rsrvd2(SiRF_ID28_3P * userdata, uint8_t header_rsrvd2) { ! userdata->header_rsrvd2 = header_rsrvd2; } uint8_t ! SiRF_ID28_3P_get_header_rsrvd2(SiRF_ID28_3P * userdata) { ! return userdata->header_rsrvd2; } --- 108,118 ---- void ! SiRF_ID28_3P_set_header_blockcount(SiRF_ID28_3P * userdata, uint8_t header_blockcount) { ! userdata->header_blockcount = header_blockcount; } uint8_t ! SiRF_ID28_3P_get_header_blockcount(SiRF_ID28_3P * userdata) { ! return userdata->header_blockcount; } *************** *** 290,297 **** static char insert_stmt[] = "INSERT into SiRF_ID28_3P (" "result_time," "header_seqno," "header_am_type," ! "header_rsrvd1," ! "header_rsrvd2," "sync_flags," "cno1," --- 290,297 ---- static char insert_stmt[] = "INSERT into SiRF_ID28_3P (" "result_time," + "header_mote_id," "header_seqno," "header_am_type," ! "header_blockcount," "sync_flags," "cno1," *************** *** 317,324 **** SiRF_ID28_3P * data = (SiRF_ID28_3P*)userdata; sprintf(pg_command,insert_stmt, data->header_seqno, data->header_am_type, ! data->header_rsrvd1, ! data->header_rsrvd2, data->sync_flags, data->cno1, --- 317,324 ---- SiRF_ID28_3P * data = (SiRF_ID28_3P*)userdata; sprintf(pg_command,insert_stmt, + data->header_mote_id, data->header_seqno, data->header_am_type, ! data->header_blockcount, data->sync_flags, data->cno1, *************** *** 349,354 **** */ static uint8_t ! header_seqno_convert(uint8_t header_seqno) { ! return header_seqno; } --- 349,354 ---- */ static uint8_t ! header_mote_id_convert(uint8_t header_mote_id) { ! return header_mote_id; } *************** *** 357,362 **** */ static uint8_t ! header_am_type_convert(uint8_t header_am_type) { ! return header_am_type; } --- 357,362 ---- */ static uint8_t ! header_seqno_convert(uint8_t header_seqno) { ! return header_seqno; } *************** *** 365,370 **** */ static uint8_t ! header_rsrvd1_convert(uint8_t header_rsrvd1) { ! return header_rsrvd1; } --- 365,370 ---- */ static uint8_t ! header_am_type_convert(uint8_t header_am_type) { ! return header_am_type; } *************** *** 373,378 **** */ static uint8_t ! header_rsrvd2_convert(uint8_t header_rsrvd2) { ! return header_rsrvd2; } --- 373,378 ---- */ static uint8_t ! header_blockcount_convert(uint8_t header_blockcount) { ! return header_blockcount; } *************** *** 507,514 **** void SiRF_ID28_3P_cook_packet(SiRF_ID28_3P * userdata) { userdata->header_seqno = header_seqno_convert(userdata->header_seqno); userdata->header_am_type = header_am_type_convert(userdata->header_am_type); ! userdata->header_rsrvd1 = header_rsrvd1_convert(userdata->header_rsrvd1); ! userdata->header_rsrvd2 = header_rsrvd2_convert(userdata->header_rsrvd2); userdata->sync_flags = sync_flags_convert(userdata->sync_flags); userdata->cno1 = cno1_convert(userdata->cno1); --- 507,514 ---- void SiRF_ID28_3P_cook_packet(SiRF_ID28_3P * userdata) { + userdata->header_mote_id = header_mote_id_convert(userdata->header_mote_id); userdata->header_seqno = header_seqno_convert(userdata->header_seqno); userdata->header_am_type = header_am_type_convert(userdata->header_am_type); ! userdata->header_blockcount = header_blockcount_convert(userdata->header_blockcount); userdata->sync_flags = sync_flags_convert(userdata->sync_flags); userdata->cno1 = cno1_convert(userdata->cno1); *************** *** 558,565 **** SiRF_ID28_3P * data = (SiRF_ID28_3P*)userdata; printf("SiRF_ID28_3P print cooked:\n"); printf(" header_seqno: %i,\n",data->header_seqno); printf(" header_am_type: %i,\n",data->header_am_type); ! printf(" header_rsrvd1: %i,\n",data->header_rsrvd1); ! printf(" header_rsrvd2: %i,\n",data->header_rsrvd2); printf(" sync_flags: %i,\n",data->sync_flags); printf(" cno1: %i,\n",data->cno1); --- 558,565 ---- SiRF_ID28_3P * data = (SiRF_ID28_3P*)userdata; printf("SiRF_ID28_3P print cooked:\n"); + printf(" header_mote_id: %i,\n",data->header_mote_id); printf(" header_seqno: %i,\n",data->header_seqno); printf(" header_am_type: %i,\n",data->header_am_type); ! printf(" header_blockcount: %i,\n",data->header_blockcount); printf(" sync_flags: %i,\n",data->sync_flags); printf(" cno1: %i,\n",data->cno1); Index: sirf_id2_1.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards/sirf_id2_1.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sirf_id2_1.c 9 Aug 2005 00:39:08 -0000 1.5 --- sirf_id2_1.c 17 Aug 2005 01:56:47 -0000 1.6 *************** *** 53,60 **** struct _SiRF_ID2_1P { uint8_t header_seqno; uint8_t header_am_type; ! uint8_t header_rsrvd1; ! uint8_t header_rsrvd2; int xpos; int ypos; --- 53,60 ---- struct _SiRF_ID2_1P { + uint8_t header_mote_id; uint8_t header_seqno; uint8_t header_am_type; ! uint8_t header_blockcount; int xpos; int ypos; *************** *** 72,75 **** --- 72,85 ---- void + SiRF_ID2_1P_set_header_mote_id(SiRF_ID2_1P * userdata, uint8_t header_mote_id) { + userdata->header_mote_id = header_mote_id; + } + + uint8_t + SiRF_ID2_1P_get_header_mote_id(SiRF_ID2_1P * userdata) { + return userdata->header_mote_id; + } + + void SiRF_ID2_1P_set_header_seqno(SiRF_ID2_1P * userdata, uint8_t header_seqno) { userdata->header_seqno = header_seqno; *************** *** 92,112 **** void ! SiRF_ID2_1P_set_header_rsrvd1(SiRF_ID2_1P * userdata, uint8_t header_rsrvd1) { ! userdata->header_rsrvd1 = header_rsrvd1; ! } ! ! uint8_t ! SiRF_ID2_1P_get_header_rsrvd1(SiRF_ID2_1P * userdata) { ! return userdata->header_rsrvd1; ! } ! ! void ! SiRF_ID2_1P_set_header_rsrvd2(SiRF_ID2_1P * userdata, uint8_t header_rsrvd2) { ! userdata->header_rsrvd2 = header_rsrvd2; } uint8_t ! SiRF_ID2_1P_get_header_rsrvd2(SiRF_ID2_1P * userdata) { ! return userdata->header_rsrvd2; } --- 102,112 ---- void ! SiRF_ID2_1P_set_header_blockcount(SiRF_ID2_1P * userdata, uint8_t header_blockcount) { ! userdata->header_blockcount = header_blockcount; } uint8_t ! SiRF_ID2_1P_get_header_blockcount(SiRF_ID2_1P * userdata) { ! return userdata->header_blockcount; } *************** *** 224,231 **** static char insert_stmt[] = "INSERT into SiRF_ID2_1P (" "result_time," "header_seqno," "header_am_type," ! "header_rsrvd1," ! "header_rsrvd2," "xpos," "ypos," --- 224,231 ---- static char insert_stmt[] = "INSERT into SiRF_ID2_1P (" "result_time," + "header_mote_id," "header_seqno," "header_am_type," ! "header_blockcount," "xpos," "ypos," *************** *** 245,252 **** SiRF_ID2_1P * data = (SiRF_ID2_1P*)userdata; sprintf(pg_command,insert_stmt, data->header_seqno, data->header_am_type, ! data->header_rsrvd1, ! data->header_rsrvd2, data->xpos, data->ypos, --- 245,252 ---- SiRF_ID2_1P * data = (SiRF_ID2_1P*)userdata; sprintf(pg_command,insert_stmt, + data->header_mote_id, data->header_seqno, data->header_am_type, ! data->header_blockcount, data->xpos, data->ypos, *************** *** 271,276 **** */ static uint8_t ! header_seqno_convert(uint8_t header_seqno) { ! return header_seqno; } --- 271,276 ---- */ static uint8_t ! header_mote_id_convert(uint8_t header_mote_id) { ! return header_mote_id; } *************** *** 279,284 **** */ static uint8_t ! header_am_type_convert(uint8_t header_am_type) { ! return header_am_type; } --- 279,284 ---- */ static uint8_t ! header_seqno_convert(uint8_t header_seqno) { ! return header_seqno; } *************** *** 287,292 **** */ static uint8_t ! header_rsrvd1_convert(uint8_t header_rsrvd1) { ! return header_rsrvd1; } --- 287,292 ---- */ static uint8_t ! header_am_type_convert(uint8_t header_am_type) { ! return header_am_type; } *************** *** 295,300 **** */ static uint8_t ! header_rsrvd2_convert(uint8_t header_rsrvd2) { ! return header_rsrvd2; } --- 295,300 ---- */ static uint8_t ! header_blockcount_convert(uint8_t header_blockcount) { ! return header_blockcount; } *************** *** 381,388 **** void SiRF_ID2_1P_cook_packet(SiRF_ID2_1P * userdata) { userdata->header_seqno = header_seqno_convert(userdata->header_seqno); userdata->header_am_type = header_am_type_convert(userdata->header_am_type); ! userdata->header_rsrvd1 = header_rsrvd1_convert(userdata->header_rsrvd1); ! userdata->header_rsrvd2 = header_rsrvd2_convert(userdata->header_rsrvd2); userdata->xpos = xpos_convert(userdata->xpos); userdata->ypos = ypos_convert(userdata->ypos); --- 381,388 ---- void SiRF_ID2_1P_cook_packet(SiRF_ID2_1P * userdata) { + userdata->header_mote_id = header_mote_id_convert(userdata->header_mote_id); userdata->header_seqno = header_seqno_convert(userdata->header_seqno); userdata->header_am_type = header_am_type_convert(userdata->header_am_type); ! userdata->header_blockcount = header_blockcount_convert(userdata->header_blockcount); userdata->xpos = xpos_convert(userdata->xpos); userdata->ypos = ypos_convert(userdata->ypos); *************** *** 426,433 **** SiRF_ID2_1P * data = (SiRF_ID2_1P*)userdata; printf("SiRF_ID2_1P print cooked:\n"); printf(" header_seqno: %i,\n",data->header_seqno); printf(" header_am_type: %i,\n",data->header_am_type); ! printf(" header_rsrvd1: %i,\n",data->header_rsrvd1); ! printf(" header_rsrvd2: %i,\n",data->header_rsrvd2); printf(" xpos: %i,\n",data->xpos); printf(" ypos: %i,\n",data->ypos); --- 426,433 ---- SiRF_ID2_1P * data = (SiRF_ID2_1P*)userdata; printf("SiRF_ID2_1P print cooked:\n"); + printf(" header_mote_id: %i,\n",data->header_mote_id); printf(" header_seqno: %i,\n",data->header_seqno); printf(" header_am_type: %i,\n",data->header_am_type); ! printf(" header_blockcount: %i,\n",data->header_blockcount); printf(" xpos: %i,\n",data->xpos); printf(" ypos: %i,\n",data->ypos); Index: sirf_id28_1.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards/sirf_id28_1.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sirf_id28_1.c 9 Aug 2005 00:39:08 -0000 1.5 --- sirf_id28_1.c 17 Aug 2005 01:56:47 -0000 1.6 *************** *** 53,60 **** struct _SiRF_ID28_1P { uint8_t header_seqno; uint8_t header_am_type; ! uint8_t header_rsrvd1; ! uint8_t header_rsrvd2; uint8_t channel; uint32_t time_tag; --- 53,60 ---- struct _SiRF_ID28_1P { + uint8_t header_mote_id; uint8_t header_seqno; uint8_t header_am_type; ! uint8_t header_blockcount; uint8_t channel; uint32_t time_tag; *************** *** 66,69 **** --- 66,79 ---- void + SiRF_ID28_1P_set_header_mote_id(SiRF_ID28_1P * userdata, uint8_t header_mote_id) { + userdata->header_mote_id = header_mote_id; + } + + uint8_t + SiRF_ID28_1P_get_header_mote_id(SiRF_ID28_1P * userdata) { + return userdata->header_mote_id; + } + + void SiRF_ID28_1P_set_header_seqno(SiRF_ID28_1P * userdata, uint8_t header_seqno) { userdata->header_seqno = header_seqno; *************** *** 86,106 **** void ! SiRF_ID28_1P_set_header_rsrvd1(SiRF_ID28_1P * userdata, uint8_t header_rsrvd1) { ! userdata->header_rsrvd1 = header_rsrvd1; ! } ! ! uint8_t ! SiRF_ID28_1P_get_header_rsrvd1(SiRF_ID28_1P * userdata) { ! return userdata->header_rsrvd1; ! } ! ! void ! SiRF_ID28_1P_set_header_rsrvd2(SiRF_ID28_1P * userdata, uint8_t header_rsrvd2) { ! userdata->header_rsrvd2 = header_rsrvd2; } uint8_t ! SiRF_ID28_1P_get_header_rsrvd2(SiRF_ID28_1P * userdata) { ! return userdata->header_rsrvd2; } --- 96,106 ---- void ! SiRF_ID28_1P_set_header_blockcount(SiRF_ID28_1P * userdata, uint8_t header_blockcount) { ! userdata->header_blockcount = header_blockcount; } uint8_t ! SiRF_ID28_1P_get_header_blockcount(SiRF_ID28_1P * userdata) { ! return userdata->header_blockcount; } *************** *** 158,165 **** static char insert_stmt[] = "INSERT into SiRF_ID28_1P (" "result_time," "header_seqno," "header_am_type," ! "header_rsrvd1," ! "header_rsrvd2," "channel," "time_tag," --- 158,165 ---- static char insert_stmt[] = "INSERT into SiRF_ID28_1P (" "result_time," + "header_mote_id," "header_seqno," "header_am_type," ! "header_blockcount," "channel," "time_tag," *************** *** 173,180 **** SiRF_ID28_1P * data = (SiRF_ID28_1P*)userdata; sprintf(pg_command,insert_stmt, data->header_seqno, data->header_am_type, ! data->header_rsrvd1, ! data->header_rsrvd2, data->channel, data->time_tag, --- 173,180 ---- SiRF_ID28_1P * data = (SiRF_ID28_1P*)userdata; sprintf(pg_command,insert_stmt, + data->header_mote_id, data->header_seqno, data->header_am_type, ! data->header_blockcount, data->channel, data->time_tag, *************** *** 193,198 **** */ static uint8_t ! header_seqno_convert(uint8_t header_seqno) { ! return header_seqno; } --- 193,198 ---- */ static uint8_t ! header_mote_id_convert(uint8_t header_mote_id) { ! return header_mote_id; } *************** *** 201,206 **** */ static uint8_t ! header_am_type_convert(uint8_t header_am_type) { ! return header_am_type; } --- 201,206 ---- */ static uint8_t ! header_seqno_convert(uint8_t header_seqno) { ! return header_seqno; } *************** *** 209,214 **** */ static uint8_t ! header_rsrvd1_convert(uint8_t header_rsrvd1) { ! return header_rsrvd1; } --- 209,214 ---- */ static uint8_t ! header_am_type_convert(uint8_t header_am_type) { ! return header_am_type; } *************** *** 217,222 **** */ static uint8_t ! header_rsrvd2_convert(uint8_t header_rsrvd2) { ! return header_rsrvd2; } --- 217,222 ---- */ static uint8_t ! header_blockcount_convert(uint8_t header_blockcount) { ! return header_blockcount; } *************** *** 255,262 **** void SiRF_ID28_1P_cook_packet(SiRF_ID28_1P * userdata) { userdata->header_seqno = header_seqno_convert(userdata->header_seqno); userdata->header_am_type = header_am_type_convert(userdata->header_am_type); ! userdata->header_rsrvd1 = header_rsrvd1_convert(userdata->header_rsrvd1); ! userdata->header_rsrvd2 = header_rsrvd2_convert(userdata->header_rsrvd2); userdata->channel = channel_convert(userdata->channel); userdata->time_tag = time_tag_convert(userdata->time_tag); --- 255,262 ---- void SiRF_ID28_1P_cook_packet(SiRF_ID28_1P * userdata) { + userdata->header_mote_id = header_mote_id_convert(userdata->header_mote_id); userdata->header_seqno = header_seqno_convert(userdata->header_seqno); userdata->header_am_type = header_am_type_convert(userdata->header_am_type); ! userdata->header_blockcount = header_blockcount_convert(userdata->header_blockcount); userdata->channel = channel_convert(userdata->channel); userdata->time_tag = time_tag_convert(userdata->time_tag); *************** *** 294,301 **** SiRF_ID28_1P * data = (SiRF_ID28_1P*)userdata; printf("SiRF_ID28_1P print cooked:\n"); printf(" header_seqno: %i,\n",data->header_seqno); printf(" header_am_type: %i,\n",data->header_am_type); ! printf(" header_rsrvd1: %i,\n",data->header_rsrvd1); ! printf(" header_rsrvd2: %i,\n",data->header_rsrvd2); printf(" channel: %i,\n",data->channel); printf(" time_tag: %i,\n",data->time_tag); --- 294,301 ---- SiRF_ID28_1P * data = (SiRF_ID28_1P*)userdata; printf("SiRF_ID28_1P print cooked:\n"); + printf(" header_mote_id: %i,\n",data->header_mote_id); printf(" header_seqno: %i,\n",data->header_seqno); printf(" header_am_type: %i,\n",data->header_am_type); ! printf(" header_blockcount: %i,\n",data->header_blockcount); printf(" channel: %i,\n",data->channel); printf(" time_tag: %i,\n",data->time_tag); |
From: David M. D. <do...@us...> - 2005-08-17 01:56:56
|
Update of /cvsroot/firebug/fireboard/beta/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28568/bin Modified Files: sirf_id28_1.pgsql sirf_id28_2.pgsql sirf_id28_3.pgsql sirf_id2_1.pgsql sirf_id2_2.pgsql Log Message: Added code for parsing blocked sirf messages. Index: sirf_id28_2.pgsql =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/bin/sirf_id28_2.pgsql,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sirf_id28_2.pgsql 2 Aug 2005 01:44:16 -0000 1.3 --- sirf_id28_2.pgsql 17 Aug 2005 01:56:47 -0000 1.4 *************** *** 7,14 **** CREATE TABLE SiRF_ID28_2P ( result_time timestamp without time zone, header_seqno integer, header_am_type integer, ! header_rsrvd1 integer, ! header_rsrvd2 integer, pseudo_range integer, carrier_freq integer, --- 7,14 ---- CREATE TABLE SiRF_ID28_2P ( result_time timestamp without time zone, + header_mote_id integer, header_seqno integer, header_am_type integer, ! header_blockcount integer, pseudo_range integer, carrier_freq integer, Index: sirf_id28_1.pgsql =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/bin/sirf_id28_1.pgsql,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sirf_id28_1.pgsql 2 Aug 2005 01:44:16 -0000 1.3 --- sirf_id28_1.pgsql 17 Aug 2005 01:56:47 -0000 1.4 *************** *** 7,14 **** CREATE TABLE SiRF_ID28_1P ( result_time timestamp without time zone, header_seqno integer, header_am_type integer, ! header_rsrvd1 integer, ! header_rsrvd2 integer, channel integer, time_tag integer, --- 7,14 ---- CREATE TABLE SiRF_ID28_1P ( result_time timestamp without time zone, + header_mote_id integer, header_seqno integer, header_am_type integer, ! header_blockcount integer, channel integer, time_tag integer, Index: sirf_id2_1.pgsql =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/bin/sirf_id2_1.pgsql,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sirf_id2_1.pgsql 2 Aug 2005 01:44:16 -0000 1.4 --- sirf_id2_1.pgsql 17 Aug 2005 01:56:47 -0000 1.5 *************** *** 7,14 **** CREATE TABLE SiRF_ID2_1P ( result_time timestamp without time zone, header_seqno integer, header_am_type integer, ! header_rsrvd1 integer, ! header_rsrvd2 integer, xpos integer, ypos integer, --- 7,14 ---- CREATE TABLE SiRF_ID2_1P ( result_time timestamp without time zone, + header_mote_id integer, header_seqno integer, header_am_type integer, ! header_blockcount integer, xpos integer, ypos integer, Index: sirf_id28_3.pgsql =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/bin/sirf_id28_3.pgsql,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sirf_id28_3.pgsql 2 Aug 2005 01:44:16 -0000 1.3 --- sirf_id28_3.pgsql 17 Aug 2005 01:56:47 -0000 1.4 *************** *** 7,14 **** CREATE TABLE SiRF_ID28_3P ( result_time timestamp without time zone, header_seqno integer, header_am_type integer, ! header_rsrvd1 integer, ! header_rsrvd2 integer, sync_flags integer, cno1 integer, --- 7,14 ---- CREATE TABLE SiRF_ID28_3P ( result_time timestamp without time zone, + header_mote_id integer, header_seqno integer, header_am_type integer, ! header_blockcount integer, sync_flags integer, cno1 integer, Index: sirf_id2_2.pgsql =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/bin/sirf_id2_2.pgsql,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sirf_id2_2.pgsql 2 Aug 2005 01:44:16 -0000 1.3 --- sirf_id2_2.pgsql 17 Aug 2005 01:56:47 -0000 1.4 *************** *** 7,14 **** CREATE TABLE SiRF_ID2_2P ( result_time timestamp without time zone, header_seqno integer, header_am_type integer, ! header_rsrvd1 integer, ! header_rsrvd2 integer, gps_tow integer, sv_in_fix integer, --- 7,14 ---- CREATE TABLE SiRF_ID2_2P ( result_time timestamp without time zone, + header_mote_id integer, header_seqno integer, header_am_type integer, ! header_blockcount integer, gps_tow integer, sv_in_fix integer, |
From: David M. D. <do...@us...> - 2005-08-17 01:56:55
|
Update of /cvsroot/firebug/fireboard/beta/tos/lib/SiRF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28568/tos/lib/SiRF Modified Files: SiRFM.nc sirf.h Log Message: Added code for parsing blocked sirf messages. Index: SiRFM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tos/lib/SiRF/SiRFM.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SiRFM.nc 16 Aug 2005 00:57:34 -0000 1.2 --- SiRFM.nc 17 Aug 2005 01:56:47 -0000 1.3 *************** *** 42,45 **** --- 42,52 ---- #include "sirf.h" + //uint8_t cno[10] = {0}; + double gps_time; + double carrier_phase; + double carrier_frequency; + float xpos, ypos, zpos; + + command uint8_t SiRF.get_type (const char * sirfstring) { return 0; Index: sirf.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tos/lib/SiRF/sirf.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sirf.h 1 Aug 2005 19:52:58 -0000 1.1 --- sirf.h 17 Aug 2005 01:56:47 -0000 1.2 *************** *** 10,14 **** //#include <sys/types.h> ! #ifndef FB_HEADER --- 10,18 ---- //#include <sys/types.h> ! /** Enums for dispatching sirf messages. */ ! enum { ! SIRF2 = 2, ! SIRF28 = 28 ! }; #ifndef FB_HEADER *************** *** 16,23 **** typedef struct _fb_header { uint8_t seqno; uint8_t am_type; ! uint8_t rsrvd1; ! uint8_t rsrvd2; } fb_header; --- 20,28 ---- typedef struct _fb_header { + uint8_t mote_id; uint8_t seqno; uint8_t am_type; ! uint8_t blockcount; ! //uint8_t blocknumber; } fb_header; *************** *** 26,29 **** --- 31,36 ---- + + typedef struct SiRF_ID2_1 { *************** *** 41,47 **** uint8_t dop; uint8_t mode2; - uint16_t gps_week; } SiRF_ID2_1; --- 48,54 ---- uint8_t dop; uint8_t mode2; uint16_t gps_week; + } SiRF_ID2_1; *************** *** 140,143 **** --- 147,189 ---- + typedef struct SiRF_ID2 { + + fb_header header; + + int32_t xpos; + int32_t ypos; + int32_t zpos; + + uint16_t xvel; + uint16_t yvel; + uint16_t zvel; + + uint8_t mode1; + uint8_t dop; + uint8_t mode2; + uint16_t gps_week; + + uint32_t gps_tow; + uint8_t sv_in_fix; + + uint8_t ch1; + uint8_t ch2; + uint8_t ch3; + uint8_t ch4; + uint8_t ch5; + uint8_t ch6; + uint8_t ch7; + uint8_t ch8; + uint8_t ch9; + uint8_t ch10; + uint8_t ch11; + uint8_t ch12; + + } SiRF_ID2_t; + + enum { + AM_SIRF_ID2 = 155 + }; + #endif /* FB_SIRF_H */ |
From: David M. D. <do...@us...> - 2005-08-17 01:56:55
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28568/tools/src/xlisten Modified Files: genc.pm Log Message: Added code for parsing blocked sirf messages. |
From: David M. D. <do...@us...> - 2005-08-17 01:56:55
|
Update of /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28568/apps/XSensorMTS400 Modified Files: TestMTS400M.nc Log Message: Added code for parsing blocked sirf messages. Index: TestMTS400M.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/apps/XSensorMTS400/TestMTS400M.nc,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** TestMTS400M.nc 20 Jun 2005 03:06:04 -0000 1.15 --- TestMTS400M.nc 17 Aug 2005 01:56:47 -0000 1.16 *************** *** 845,848 **** --- 845,906 ---- } + + + event TOS_MsgPtr GpsReceive.receiveNew(TOS_MsgPtr data) { + + char * leadtek_string = (char*)data; + uint8_t sirftype; + + if (data[0] == '$') { + + // get NMEA or LTC type + if(is_gga_string(data)) { + call nmea.gga_parse(gga_data_ptr, leadtek_string); + } + + // Deal with the following later. + #if 0 + else if (is_gsa_string(data)) { + call nmea.gsa_parse(gsa_data_ptr, leadtek_string); + } else if (is_gva_string(data)) { + call nmea.gsv_parse(gsv_data_ptr, leadtek_string); + } else if (is_gll_string(data)) { + call nmea.gll_parse(gll_data_ptr, leadtek_string); + } else if (is_rmc_string(data)) { + call nmea.rmc_parse(rmc_data_ptr, leadtek_string); + } else if (is_vtg_string(data)) { + call nmea.vtg_parse(vtg_data_ptr, leadtek_string); + } else if (is_mss_string(data)) { + call nmea.mss_parse(mss_data_ptr, leadtek_string); + } else if (is_ltc_string(data)) { + call nmea.ltc_parse(ltc_data_ptr, leadtek_string); + } else { + // signal error + } + #endif + + } else if (data[0] == 0xA0) { + + sirftype = sirf.get_type(data); + switch sirftype { + case SIRF2: + call sirf.id2_parse(leadtek_string); + break; + case SIRF28: + call sirf.id28_parse(leadtek_string); + break; + default: + // signal error; + ; + } + } else { + // signal an error + } + + return data; + } + + + } |
From: David M. D. <do...@us...> - 2005-08-16 00:57:44
|
Update of /cvsroot/firebug/fireboard/beta/tos/lib/SiRF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv677/tos/lib/SiRF Modified Files: SiRFM.nc Log Message: Added sirf parsing test code. Index: SiRFM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tos/lib/SiRF/SiRFM.nc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SiRFM.nc 1 Aug 2005 19:52:58 -0000 1.1 --- SiRFM.nc 16 Aug 2005 00:57:34 -0000 1.2 *************** *** 30,34 **** ! includes sirf; module SiRFM { --- 30,34 ---- ! module SiRFM { *************** *** 40,47 **** --- 40,60 ---- implementation { + #include "sirf.h" + command uint8_t SiRF.get_type (const char * sirfstring) { return 0; } + command result_t SiRF.id2_parse(const char * sirf_string) { + + return FAIL; + } + + command result_t SiRF.id28_parse(const char * sirf_string) { + + return FAIL; + } + + } |