firebug-cvs Mailing List for FireBug: wireless wildfire monitoring (Page 7)
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-07-30 02:15:34
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20044 Added Files: linkmsg.c testlink.c Log Message: fireworks messages compile. --- NEW FILE: linkmsg.c --- /** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This code implements C interface to the 'LinkMsg' * message type. */ #include <stdio.h> #include <stdlib.h> #include <memory.h> /** Private header is programmer specified for handling * conversion functions, etc. */ //#include "LinkMsg_private.h" /** Not the best way to handle xbow dependencies. */ #include "../xdb.h" /** These need to be moved to a header file. */ typedef struct _LinkMsg LinkMsg; typedef struct _XbowSensorboardPacket XbowSensorboardPacket; // 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 _LinkMsg { uint16_t header_am_type; uint16_t header_seqno; uint32_t tstamp; uint16_t moteid; uint16_t RSSI; uint16_t LQI; }; void LinkMsg_set_header_am_type(LinkMsg * userdata, uint16_t header_am_type) { userdata->header_am_type = header_am_type; } uint16_t LinkMsg_get_header_am_type(LinkMsg * userdata) { return userdata->header_am_type; } void LinkMsg_set_header_seqno(LinkMsg * userdata, uint16_t header_seqno) { userdata->header_seqno = header_seqno; } uint16_t LinkMsg_get_header_seqno(LinkMsg * userdata) { return userdata->header_seqno; } void LinkMsg_set_tstamp(LinkMsg * userdata, uint32_t tstamp) { userdata->tstamp = tstamp; } uint32_t LinkMsg_get_tstamp(LinkMsg * userdata) { return userdata->tstamp; } void LinkMsg_set_moteid(LinkMsg * userdata, uint16_t moteid) { userdata->moteid = moteid; } uint16_t LinkMsg_get_moteid(LinkMsg * userdata) { return userdata->moteid; } void LinkMsg_set_RSSI(LinkMsg * userdata, uint16_t RSSI) { userdata->RSSI = RSSI; } uint16_t LinkMsg_get_RSSI(LinkMsg * userdata) { return userdata->RSSI; } void LinkMsg_set_LQI(LinkMsg * userdata, uint16_t LQI) { userdata->LQI = LQI; } uint16_t LinkMsg_get_LQI(LinkMsg * userdata) { return userdata->LQI; } //Format string generated automatically, //static char formatstring[] = "%i, %i, %i, %i, %i, %i"; //static char formatstring[] = "%i, %i, %i, %i, %i, %i"; static char insert_stmt[] = "INSERT into LinkMsg (" "header_am_type," "header_seqno," "tstamp," "moteid," "RSSI," "LQI) values (%i, %i, %i, %i, %i, %i)"; void LinkMsg_pg_log(XbowSensorboardPacket * userdata) { char pg_command[255]; LinkMsg * data = (LinkMsg*)userdata; sprintf(pg_command,insert_stmt, data->header_am_type, data->header_seqno, data->tstamp, data->moteid, data->RSSI, data->LQI); xdb_execute(pg_command); } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint16_t header_am_type_convert(uint16_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 uint16_t header_seqno_convert(uint16_t header_seqno) { return header_seqno; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint32_t tstamp_convert(uint32_t tstamp) { return tstamp; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint16_t moteid_convert(uint16_t moteid) { return moteid; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint16_t RSSI_convert(uint16_t RSSI) { return RSSI; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint16_t LQI_convert(uint16_t LQI) { return LQI; } void LinkMsg_cook_packet(LinkMsg * userdata) { userdata->header_am_type = header_am_type_convert(userdata->header_am_type); userdata->header_seqno = header_seqno_convert(userdata->header_seqno); userdata->tstamp = tstamp_convert(userdata->tstamp); userdata->moteid = moteid_convert(userdata->moteid); userdata->RSSI = RSSI_convert(userdata->RSSI); userdata->LQI = LQI_convert(userdata->LQI); } /** User has to fill in any conversion code * necessary for processing. */ LinkMsg * LinkMsg_convert(char * data) { // Just to keep gcc happy. return (LinkMsg*)data; } /** Print the bytes of the packet. */ void LinkMsg_print_raw (XbowSensorboardPacket *packet) { } /** Print cooked output. */ void LinkMsg_print_cooked (XbowSensorboardPacket * userdata) { LinkMsg * data = (LinkMsg*)userdata; printf("header_am_type: %i,\n",data->header_am_type); printf("header_seqno: %i,\n",data->header_seqno); printf("tstamp: %i,\n",data->tstamp); printf("moteid: %i,\n",data->moteid); printf("RSSI: %i,\n",data->RSSI); printf("LQI: %i,\n",data->LQI); } /** The default size of this message type in bytes. */ //static int DEFAULT_MESSAGE_SIZE = 14; /** The Active Message type associated with this message. */ //static int AM_TYPE = 200; /** If incomplete types are used, we need to provide a way * to manage memory. */ LinkMsg * LinkMsg_new() { LinkMsg * userdata = (LinkMsg*)malloc(sizeof(LinkMsg)); memset((void*)userdata,0xda,sizeof(LinkMsg)); return userdata; } void LinkMsg_delete(LinkMsg * userdata) { memset((void*)userdata,0xdd,sizeof(LinkMsg)); free(userdata); } --- NEW FILE: testlink.c --- #include "fireboard.h" void LinkMsg_print_raw(XbowSensorboardPacket *packet); void LinkMsg_print_cooked(XbowSensorboardPacket *packet); void testlink_print_raw(XbowSensorboardPacket *packet) { } void testlink_print_cooked(XbowSensorboardPacket *packet) { } void testlink_log_raw(XbowSensorboardPacket *packet) { } XPacketHandler testlink_packet_handler = { XTYPE_TESTLINK, "$Id: testlink.c,v 1.1 2005/07/30 02:15:17 doolin Exp $", LinkMsg_print_raw, LinkMsg_print_cooked, testlink_print_raw, testlink_print_cooked, testlink_log_raw }; void testlink_initialize() { xpacket_add_type(&testlink_packet_handler); } |
From: David M. D. <do...@us...> - 2005-07-30 02:15:00
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19975 Added Files: sirf_id28_1.c sirf_id28_2.c sirf_id28_3.c Log Message: sirf message 28 autogenerated and compiles. --- NEW FILE: sirf_id28_3.c --- /** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This code implements C interface to the 'SiRF_ID28_3' * message type. */ #include <stdio.h> #include <stdlib.h> #include <memory.h> /** Private header is programmer specified for handling * conversion functions, etc. */ //#include "SiRF_ID28_3_private.h" /** Not the best way to handle xbow dependencies. */ #include "../xdb.h" /** These need to be moved to a header file. */ typedef struct _SiRF_ID28_3 SiRF_ID28_3; typedef struct _XbowSensorboardPacket XbowSensorboardPacket; // 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_ID28_3 { uint8_t header_seqno; uint8_t header_am_type; uint8_t header_rsrvd1; uint8_t header_rsrvd2; 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_ID28_3_set_header_seqno(SiRF_ID28_3 * userdata, uint8_t header_seqno) { userdata->header_seqno = header_seqno; } uint8_t SiRF_ID28_3_get_header_seqno(SiRF_ID28_3 * userdata) { return userdata->header_seqno; } void SiRF_ID28_3_set_header_am_type(SiRF_ID28_3 * userdata, uint8_t header_am_type) { userdata->header_am_type = header_am_type; } uint8_t SiRF_ID28_3_get_header_am_type(SiRF_ID28_3 * userdata) { return userdata->header_am_type; } void SiRF_ID28_3_set_header_rsrvd1(SiRF_ID28_3 * userdata, uint8_t header_rsrvd1) { userdata->header_rsrvd1 = header_rsrvd1; } uint8_t SiRF_ID28_3_get_header_rsrvd1(SiRF_ID28_3 * userdata) { return userdata->header_rsrvd1; } void SiRF_ID28_3_set_header_rsrvd2(SiRF_ID28_3 * userdata, uint8_t header_rsrvd2) { userdata->header_rsrvd2 = header_rsrvd2; } uint8_t SiRF_ID28_3_get_header_rsrvd2(SiRF_ID28_3 * userdata) { return userdata->header_rsrvd2; } void SiRF_ID28_3_set_sync_flags(SiRF_ID28_3 * userdata, uint8_t sync_flags) { userdata->sync_flags = sync_flags; } uint8_t SiRF_ID28_3_get_sync_flags(SiRF_ID28_3 * userdata) { return userdata->sync_flags; } void SiRF_ID28_3_set_cno1(SiRF_ID28_3 * userdata, uint8_t cno1) { userdata->cno1 = cno1; } uint8_t SiRF_ID28_3_get_cno1(SiRF_ID28_3 * userdata) { return userdata->cno1; } void SiRF_ID28_3_set_cno2(SiRF_ID28_3 * userdata, uint8_t cno2) { userdata->cno2 = cno2; } uint8_t SiRF_ID28_3_get_cno2(SiRF_ID28_3 * userdata) { return userdata->cno2; } void SiRF_ID28_3_set_cno3(SiRF_ID28_3 * userdata, uint8_t cno3) { userdata->cno3 = cno3; } uint8_t SiRF_ID28_3_get_cno3(SiRF_ID28_3 * userdata) { return userdata->cno3; } void SiRF_ID28_3_set_cno4(SiRF_ID28_3 * userdata, uint8_t cno4) { userdata->cno4 = cno4; } uint8_t SiRF_ID28_3_get_cno4(SiRF_ID28_3 * userdata) { return userdata->cno4; } void SiRF_ID28_3_set_cno5(SiRF_ID28_3 * userdata, uint8_t cno5) { userdata->cno5 = cno5; } uint8_t SiRF_ID28_3_get_cno5(SiRF_ID28_3 * userdata) { return userdata->cno5; } void SiRF_ID28_3_set_cno6(SiRF_ID28_3 * userdata, uint8_t cno6) { userdata->cno6 = cno6; } uint8_t SiRF_ID28_3_get_cno6(SiRF_ID28_3 * userdata) { return userdata->cno6; } void SiRF_ID28_3_set_cno7(SiRF_ID28_3 * userdata, uint8_t cno7) { userdata->cno7 = cno7; } uint8_t SiRF_ID28_3_get_cno7(SiRF_ID28_3 * userdata) { return userdata->cno7; } void SiRF_ID28_3_set_cno8(SiRF_ID28_3 * userdata, uint8_t cno8) { userdata->cno8 = cno8; } uint8_t SiRF_ID28_3_get_cno8(SiRF_ID28_3 * userdata) { return userdata->cno8; } void SiRF_ID28_3_set_cno9(SiRF_ID28_3 * userdata, uint8_t cno9) { userdata->cno9 = cno9; } uint8_t SiRF_ID28_3_get_cno9(SiRF_ID28_3 * userdata) { return userdata->cno9; } void SiRF_ID28_3_set_cno10(SiRF_ID28_3 * userdata, uint8_t cno10) { userdata->cno10 = cno10; } uint8_t SiRF_ID28_3_get_cno10(SiRF_ID28_3 * userdata) { return userdata->cno10; } void SiRF_ID28_3_set_delta_range_interval(SiRF_ID28_3 * userdata, uint16_t delta_range_interval) { userdata->delta_range_interval = delta_range_interval; } uint16_t SiRF_ID28_3_get_delta_range_interval(SiRF_ID28_3 * userdata) { return userdata->delta_range_interval; } void SiRF_ID28_3_set_mean_delta_range_time(SiRF_ID28_3 * userdata, uint16_t mean_delta_range_time) { userdata->mean_delta_range_time = mean_delta_range_time; } uint16_t SiRF_ID28_3_get_mean_delta_range_time(SiRF_ID28_3 * userdata) { return userdata->mean_delta_range_time; } void SiRF_ID28_3_set_extrapolation_time(SiRF_ID28_3 * userdata, uint16_t extrapolation_time) { userdata->extrapolation_time = extrapolation_time; } uint16_t SiRF_ID28_3_get_extrapolation_time(SiRF_ID28_3 * userdata) { return userdata->extrapolation_time; } void SiRF_ID28_3_set_phase_error_count(SiRF_ID28_3 * userdata, uint8_t phase_error_count) { userdata->phase_error_count = phase_error_count; } uint8_t SiRF_ID28_3_get_phase_error_count(SiRF_ID28_3 * userdata) { return userdata->phase_error_count; } void SiRF_ID28_3_set_low_power_count(SiRF_ID28_3 * userdata, uint8_t low_power_count) { userdata->low_power_count = low_power_count; } uint8_t SiRF_ID28_3_get_low_power_count(SiRF_ID28_3 * 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"; //static char formatstring[] = "%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_ID28_3 (" "header_seqno," "header_am_type," "header_rsrvd1," "header_rsrvd2," "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 (%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"; void SiRF_ID28_3_pg_log(XbowSensorboardPacket * userdata) { char pg_command[255]; SiRF_ID28_3 * data = (SiRF_ID28_3*)userdata; sprintf(pg_command,insert_stmt, data->header_seqno, data->header_am_type, data->header_rsrvd1, data->header_rsrvd2, 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); xdb_execute(pg_command); } /** @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_rsrvd1_convert(uint8_t header_rsrvd1) { return header_rsrvd1; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t header_rsrvd2_convert(uint8_t header_rsrvd2) { return header_rsrvd2; } /** @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_ID28_3_cook_packet(SiRF_ID28_3 * 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); 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_ID28_3 * SiRF_ID28_3_convert(char * data) { // Just to keep gcc happy. return (SiRF_ID28_3*)data; } /** Print the bytes of the packet. */ void SiRF_ID28_3_print_raw (XbowSensorboardPacket *packet) { } /** Print cooked output. */ void SiRF_ID28_3_print_cooked (XbowSensorboardPacket * userdata) { SiRF_ID28_3 * data = (SiRF_ID28_3*)userdata; 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); 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); } /** The default size of this message type in bytes. */ //static int DEFAULT_MESSAGE_SIZE = 23; /** The Active Message type associated with this message. */ //static int AM_TYPE = 154; /** If incomplete types are used, we need to provide a way * to manage memory. */ SiRF_ID28_3 * SiRF_ID28_3_new() { SiRF_ID28_3 * userdata = (SiRF_ID28_3*)malloc(sizeof(SiRF_ID28_3)); memset((void*)userdata,0xda,sizeof(SiRF_ID28_3)); return userdata; } void SiRF_ID28_3_delete(SiRF_ID28_3 * userdata) { memset((void*)userdata,0xdd,sizeof(SiRF_ID28_3)); free(userdata); } --- NEW FILE: sirf_id28_1.c --- /** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This code implements C interface to the 'SiRF_ID28_1' * message type. */ #include <stdio.h> #include <stdlib.h> #include <memory.h> /** Private header is programmer specified for handling * conversion functions, etc. */ //#include "SiRF_ID28_1_private.h" /** Not the best way to handle xbow dependencies. */ #include "../xdb.h" /** These need to be moved to a header file. */ typedef struct _SiRF_ID28_1 SiRF_ID28_1; typedef struct _XbowSensorboardPacket XbowSensorboardPacket; // 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_ID28_1 { uint8_t header_seqno; uint8_t header_am_type; uint8_t header_rsrvd1; uint8_t header_rsrvd2; uint8_t channel; uint32_t time_tag; uint8_t sat_id; uint32_t gps_sw_time; }; void SiRF_ID28_1_set_header_seqno(SiRF_ID28_1 * userdata, uint8_t header_seqno) { userdata->header_seqno = header_seqno; } uint8_t SiRF_ID28_1_get_header_seqno(SiRF_ID28_1 * userdata) { return userdata->header_seqno; } void SiRF_ID28_1_set_header_am_type(SiRF_ID28_1 * userdata, uint8_t header_am_type) { userdata->header_am_type = header_am_type; } uint8_t SiRF_ID28_1_get_header_am_type(SiRF_ID28_1 * userdata) { return userdata->header_am_type; } void SiRF_ID28_1_set_header_rsrvd1(SiRF_ID28_1 * userdata, uint8_t header_rsrvd1) { userdata->header_rsrvd1 = header_rsrvd1; } uint8_t SiRF_ID28_1_get_header_rsrvd1(SiRF_ID28_1 * userdata) { return userdata->header_rsrvd1; } void SiRF_ID28_1_set_header_rsrvd2(SiRF_ID28_1 * userdata, uint8_t header_rsrvd2) { userdata->header_rsrvd2 = header_rsrvd2; } uint8_t SiRF_ID28_1_get_header_rsrvd2(SiRF_ID28_1 * userdata) { return userdata->header_rsrvd2; } void SiRF_ID28_1_set_channel(SiRF_ID28_1 * userdata, uint8_t channel) { userdata->channel = channel; } uint8_t SiRF_ID28_1_get_channel(SiRF_ID28_1 * userdata) { return userdata->channel; } void SiRF_ID28_1_set_time_tag(SiRF_ID28_1 * userdata, uint32_t time_tag) { userdata->time_tag = time_tag; } uint32_t SiRF_ID28_1_get_time_tag(SiRF_ID28_1 * userdata) { return userdata->time_tag; } void SiRF_ID28_1_set_sat_id(SiRF_ID28_1 * userdata, uint8_t sat_id) { userdata->sat_id = sat_id; } uint8_t SiRF_ID28_1_get_sat_id(SiRF_ID28_1 * userdata) { return userdata->sat_id; } void SiRF_ID28_1_set_gps_sw_time(SiRF_ID28_1 * userdata, uint32_t gps_sw_time) { userdata->gps_sw_time = gps_sw_time; } uint32_t SiRF_ID28_1_get_gps_sw_time(SiRF_ID28_1 * userdata) { return userdata->gps_sw_time; } //Format string generated automatically, //static char formatstring[] = "%i, %i, %i, %i, %i, %i, %i, %i"; //static char formatstring[] = "%i, %i, %i, %i, %i, %i, %i, %i"; static char insert_stmt[] = "INSERT into SiRF_ID28_1 (" "header_seqno," "header_am_type," "header_rsrvd1," "header_rsrvd2," "channel," "time_tag," "sat_id," "gps_sw_time) values (%i, %i, %i, %i, %i, %i, %i, %i)"; void SiRF_ID28_1_pg_log(XbowSensorboardPacket * userdata) { char pg_command[255]; SiRF_ID28_1 * data = (SiRF_ID28_1*)userdata; sprintf(pg_command,insert_stmt, data->header_seqno, data->header_am_type, data->header_rsrvd1, data->header_rsrvd2, data->channel, data->time_tag, data->sat_id, data->gps_sw_time); xdb_execute(pg_command); } /** @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_rsrvd1_convert(uint8_t header_rsrvd1) { return header_rsrvd1; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t header_rsrvd2_convert(uint8_t header_rsrvd2) { return header_rsrvd2; } /** @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 uint32_t gps_sw_time_convert(uint32_t gps_sw_time) { return gps_sw_time; } void SiRF_ID28_1_cook_packet(SiRF_ID28_1 * 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); userdata->sat_id = sat_id_convert(userdata->sat_id); userdata->gps_sw_time = gps_sw_time_convert(userdata->gps_sw_time); } /** User has to fill in any conversion code * necessary for processing. */ SiRF_ID28_1 * SiRF_ID28_1_convert(char * data) { // Just to keep gcc happy. return (SiRF_ID28_1*)data; } /** Print the bytes of the packet. */ void SiRF_ID28_1_print_raw (XbowSensorboardPacket *packet) { } /** Print cooked output. */ void SiRF_ID28_1_print_cooked (XbowSensorboardPacket * userdata) { SiRF_ID28_1 * data = (SiRF_ID28_1*)userdata; 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); printf("sat_id: %i,\n",data->sat_id); printf("gps_sw_time: %i,\n",data->gps_sw_time); } /** The default size of this message type in bytes. */ //static int DEFAULT_MESSAGE_SIZE = 18; /** The Active Message type associated with this message. */ //static int AM_TYPE = 152; /** If incomplete types are used, we need to provide a way * to manage memory. */ SiRF_ID28_1 * SiRF_ID28_1_new() { SiRF_ID28_1 * userdata = (SiRF_ID28_1*)malloc(sizeof(SiRF_ID28_1)); memset((void*)userdata,0xda,sizeof(SiRF_ID28_1)); return userdata; } void SiRF_ID28_1_delete(SiRF_ID28_1 * userdata) { memset((void*)userdata,0xdd,sizeof(SiRF_ID28_1)); free(userdata); } --- NEW FILE: sirf_id28_2.c --- /** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This code implements C interface to the 'SiRF_ID28_2' * message type. */ #include <stdio.h> #include <stdlib.h> #include <memory.h> /** Private header is programmer specified for handling * conversion functions, etc. */ //#include "SiRF_ID28_2_private.h" /** Not the best way to handle xbow dependencies. */ #include "../xdb.h" /** These need to be moved to a header file. */ typedef struct _SiRF_ID28_2 SiRF_ID28_2; typedef struct _XbowSensorboardPacket XbowSensorboardPacket; // 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_ID28_2 { 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; uint32_t carrier_phase; uint16_t time_in_track; }; void SiRF_ID28_2_set_header_seqno(SiRF_ID28_2 * userdata, uint8_t header_seqno) { userdata->header_seqno = header_seqno; } uint8_t SiRF_ID28_2_get_header_seqno(SiRF_ID28_2 * userdata) { return userdata->header_seqno; } void SiRF_ID28_2_set_header_am_type(SiRF_ID28_2 * userdata, uint8_t header_am_type) { userdata->header_am_type = header_am_type; } uint8_t SiRF_ID28_2_get_header_am_type(SiRF_ID28_2 * userdata) { return userdata->header_am_type; } void SiRF_ID28_2_set_header_rsrvd1(SiRF_ID28_2 * userdata, uint8_t header_rsrvd1) { userdata->header_rsrvd1 = header_rsrvd1; } uint8_t SiRF_ID28_2_get_header_rsrvd1(SiRF_ID28_2 * userdata) { return userdata->header_rsrvd1; } void SiRF_ID28_2_set_header_rsrvd2(SiRF_ID28_2 * userdata, uint8_t header_rsrvd2) { userdata->header_rsrvd2 = header_rsrvd2; } uint8_t SiRF_ID28_2_get_header_rsrvd2(SiRF_ID28_2 * userdata) { return userdata->header_rsrvd2; } void SiRF_ID28_2_set_pseudo_range(SiRF_ID28_2 * userdata, uint32_t pseudo_range) { userdata->pseudo_range = pseudo_range; } uint32_t SiRF_ID28_2_get_pseudo_range(SiRF_ID28_2 * userdata) { return userdata->pseudo_range; } void SiRF_ID28_2_set_carrier_freq(SiRF_ID28_2 * userdata, uint32_t carrier_freq) { userdata->carrier_freq = carrier_freq; } uint32_t SiRF_ID28_2_get_carrier_freq(SiRF_ID28_2 * userdata) { return userdata->carrier_freq; } void SiRF_ID28_2_set_carrier_phase(SiRF_ID28_2 * userdata, uint32_t carrier_phase) { userdata->carrier_phase = carrier_phase; } uint32_t SiRF_ID28_2_get_carrier_phase(SiRF_ID28_2 * userdata) { return userdata->carrier_phase; } void SiRF_ID28_2_set_time_in_track(SiRF_ID28_2 * userdata, uint16_t time_in_track) { userdata->time_in_track = time_in_track; } uint16_t SiRF_ID28_2_get_time_in_track(SiRF_ID28_2 * userdata) { return userdata->time_in_track; } //Format string generated automatically, //static char formatstring[] = "%i, %i, %i, %i, %i, %i, %i, %i"; //static char formatstring[] = "%i, %i, %i, %i, %i, %i, %i, %i"; static char insert_stmt[] = "INSERT into SiRF_ID28_2 (" "header_seqno," "header_am_type," "header_rsrvd1," "header_rsrvd2," "pseudo_range," "carrier_freq," "carrier_phase," "time_in_track) values (%i, %i, %i, %i, %i, %i, %i, %i)"; void SiRF_ID28_2_pg_log(XbowSensorboardPacket * userdata) { char pg_command[255]; SiRF_ID28_2 * data = (SiRF_ID28_2*)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, data->carrier_phase, data->time_in_track); xdb_execute(pg_command); } /** @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_rsrvd1_convert(uint8_t header_rsrvd1) { return header_rsrvd1; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t header_rsrvd2_convert(uint8_t header_rsrvd2) { return header_rsrvd2; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint32_t pseudo_range_convert(uint32_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 uint32_t carrier_phase_convert(uint32_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; } void SiRF_ID28_2_cook_packet(SiRF_ID28_2 * 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); userdata->carrier_phase = carrier_phase_convert(userdata->carrier_phase); userdata->time_in_track = time_in_track_convert(userdata->time_in_track); } /** User has to fill in any conversion code * necessary for processing. */ SiRF_ID28_2 * SiRF_ID28_2_convert(char * data) { // Just to keep gcc happy. return (SiRF_ID28_2*)data; } /** Print the bytes of the packet. */ void SiRF_ID28_2_print_raw (XbowSensorboardPacket *packet) { } /** Print cooked output. */ void SiRF_ID28_2_print_cooked (XbowSensorboardPacket * userdata) { SiRF_ID28_2 * data = (SiRF_ID28_2*)userdata; 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); printf("carrier_phase: %i,\n",data->carrier_phase); printf("time_in_track: %i,\n",data->time_in_track); } /** The default size of this message type in bytes. */ //static int DEFAULT_MESSAGE_SIZE = 26; /** The Active Message type associated with this message. */ //static int AM_TYPE = 153; /** If incomplete types are used, we need to provide a way * to manage memory. */ SiRF_ID28_2 * SiRF_ID28_2_new() { SiRF_ID28_2 * userdata = (SiRF_ID28_2*)malloc(sizeof(SiRF_ID28_2)); memset((void*)userdata,0xda,sizeof(SiRF_ID28_2)); return userdata; } void SiRF_ID28_2_delete(SiRF_ID28_2 * userdata) { memset((void*)userdata,0xdd,sizeof(SiRF_ID28_2)); free(userdata); } |
From: David M. D. <do...@us...> - 2005-07-30 02:14:42
|
Update of /cvsroot/firebug/fireboard/beta/tools/src/xlisten/boards In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19931 Added Files: sirf_id2_1.c sirf_id2_2.c Log Message: sirf message 2 autogenerated and compiles. --- NEW FILE: sirf_id2_2.c --- /** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This code implements C interface to the 'SiRF_ID2_2' * message type. */ #include <stdio.h> #include <stdlib.h> #include <memory.h> /** Private header is programmer specified for handling * conversion functions, etc. */ //#include "SiRF_ID2_2_private.h" /** Not the best way to handle xbow dependencies. */ #include "../xdb.h" /** These need to be moved to a header file. */ typedef struct _SiRF_ID2_2 SiRF_ID2_2; typedef struct _XbowSensorboardPacket XbowSensorboardPacket; // 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_ID2_2 { 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; 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_ID2_2_set_header_seqno(SiRF_ID2_2 * userdata, uint8_t header_seqno) { userdata->header_seqno = header_seqno; } uint8_t SiRF_ID2_2_get_header_seqno(SiRF_ID2_2 * userdata) { return userdata->header_seqno; } void SiRF_ID2_2_set_header_am_type(SiRF_ID2_2 * userdata, uint8_t header_am_type) { userdata->header_am_type = header_am_type; } uint8_t SiRF_ID2_2_get_header_am_type(SiRF_ID2_2 * userdata) { return userdata->header_am_type; } void SiRF_ID2_2_set_header_rsrvd1(SiRF_ID2_2 * userdata, uint8_t header_rsrvd1) { userdata->header_rsrvd1 = header_rsrvd1; } uint8_t SiRF_ID2_2_get_header_rsrvd1(SiRF_ID2_2 * userdata) { return userdata->header_rsrvd1; } void SiRF_ID2_2_set_header_rsrvd2(SiRF_ID2_2 * userdata, uint8_t header_rsrvd2) { userdata->header_rsrvd2 = header_rsrvd2; } uint8_t SiRF_ID2_2_get_header_rsrvd2(SiRF_ID2_2 * userdata) { return userdata->header_rsrvd2; } void SiRF_ID2_2_set_gps_tow(SiRF_ID2_2 * userdata, uint32_t gps_tow) { userdata->gps_tow = gps_tow; } uint32_t SiRF_ID2_2_get_gps_tow(SiRF_ID2_2 * userdata) { return userdata->gps_tow; } void SiRF_ID2_2_set_sv_in_fix(SiRF_ID2_2 * userdata, uint8_t sv_in_fix) { userdata->sv_in_fix = sv_in_fix; } uint8_t SiRF_ID2_2_get_sv_in_fix(SiRF_ID2_2 * userdata) { return userdata->sv_in_fix; } void SiRF_ID2_2_set_ch1(SiRF_ID2_2 * userdata, uint8_t ch1) { userdata->ch1 = ch1; } uint8_t SiRF_ID2_2_get_ch1(SiRF_ID2_2 * userdata) { return userdata->ch1; } void SiRF_ID2_2_set_ch2(SiRF_ID2_2 * userdata, uint8_t ch2) { userdata->ch2 = ch2; } uint8_t SiRF_ID2_2_get_ch2(SiRF_ID2_2 * userdata) { return userdata->ch2; } void SiRF_ID2_2_set_ch3(SiRF_ID2_2 * userdata, uint8_t ch3) { userdata->ch3 = ch3; } uint8_t SiRF_ID2_2_get_ch3(SiRF_ID2_2 * userdata) { return userdata->ch3; } void SiRF_ID2_2_set_ch4(SiRF_ID2_2 * userdata, uint8_t ch4) { userdata->ch4 = ch4; } uint8_t SiRF_ID2_2_get_ch4(SiRF_ID2_2 * userdata) { return userdata->ch4; } void SiRF_ID2_2_set_ch5(SiRF_ID2_2 * userdata, uint8_t ch5) { userdata->ch5 = ch5; } uint8_t SiRF_ID2_2_get_ch5(SiRF_ID2_2 * userdata) { return userdata->ch5; } void SiRF_ID2_2_set_ch6(SiRF_ID2_2 * userdata, uint8_t ch6) { userdata->ch6 = ch6; } uint8_t SiRF_ID2_2_get_ch6(SiRF_ID2_2 * userdata) { return userdata->ch6; } void SiRF_ID2_2_set_ch7(SiRF_ID2_2 * userdata, uint8_t ch7) { userdata->ch7 = ch7; } uint8_t SiRF_ID2_2_get_ch7(SiRF_ID2_2 * userdata) { return userdata->ch7; } void SiRF_ID2_2_set_ch8(SiRF_ID2_2 * userdata, uint8_t ch8) { userdata->ch8 = ch8; } uint8_t SiRF_ID2_2_get_ch8(SiRF_ID2_2 * userdata) { return userdata->ch8; } void SiRF_ID2_2_set_ch9(SiRF_ID2_2 * userdata, uint8_t ch9) { userdata->ch9 = ch9; } uint8_t SiRF_ID2_2_get_ch9(SiRF_ID2_2 * userdata) { return userdata->ch9; } void SiRF_ID2_2_set_ch10(SiRF_ID2_2 * userdata, uint8_t ch10) { userdata->ch10 = ch10; } uint8_t SiRF_ID2_2_get_ch10(SiRF_ID2_2 * userdata) { return userdata->ch10; } void SiRF_ID2_2_set_ch11(SiRF_ID2_2 * userdata, uint8_t ch11) { userdata->ch11 = ch11; } uint8_t SiRF_ID2_2_get_ch11(SiRF_ID2_2 * userdata) { return userdata->ch11; } void SiRF_ID2_2_set_ch12(SiRF_ID2_2 * userdata, uint8_t ch12) { userdata->ch12 = ch12; } uint8_t SiRF_ID2_2_get_ch12(SiRF_ID2_2 * 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"; //static char formatstring[] = "%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_ID2_2 (" "header_seqno," "header_am_type," "header_rsrvd1," "header_rsrvd2," "gps_tow," "sv_in_fix," "ch1," "ch2," "ch3," "ch4," "ch5," "ch6," "ch7," "ch8," "ch9," "ch10," "ch11," "ch12) values (%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"; void SiRF_ID2_2_pg_log(XbowSensorboardPacket * userdata) { char pg_command[255]; SiRF_ID2_2 * data = (SiRF_ID2_2*)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, data->ch1, data->ch2, data->ch3, data->ch4, data->ch5, data->ch6, data->ch7, data->ch8, data->ch9, data->ch10, data->ch11, data->ch12); xdb_execute(pg_command); } /** @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_rsrvd1_convert(uint8_t header_rsrvd1) { return header_rsrvd1; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t header_rsrvd2_convert(uint8_t header_rsrvd2) { return header_rsrvd2; } /** @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_ID2_2_cook_packet(SiRF_ID2_2 * 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); 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_ID2_2 * SiRF_ID2_2_convert(char * data) { // Just to keep gcc happy. return (SiRF_ID2_2*)data; } /** Print the bytes of the packet. */ void SiRF_ID2_2_print_raw (XbowSensorboardPacket *packet) { } /** Print cooked output. */ void SiRF_ID2_2_print_cooked (XbowSensorboardPacket * userdata) { SiRF_ID2_2 * data = (SiRF_ID2_2*)userdata; 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); 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); } /** The default size of this message type in bytes. */ //static int DEFAULT_MESSAGE_SIZE = 21; /** The Active Message type associated with this message. */ //static int AM_TYPE = 151; /** If incomplete types are used, we need to provide a way * to manage memory. */ SiRF_ID2_2 * SiRF_ID2_2_new() { SiRF_ID2_2 * userdata = (SiRF_ID2_2*)malloc(sizeof(SiRF_ID2_2)); memset((void*)userdata,0xda,sizeof(SiRF_ID2_2)); return userdata; } void SiRF_ID2_2_delete(SiRF_ID2_2 * userdata) { memset((void*)userdata,0xdd,sizeof(SiRF_ID2_2)); free(userdata); } --- NEW FILE: sirf_id2_1.c --- /** * This class is automatically generated by mig. DO NOT EDIT THIS FILE. * This code implements C interface to the 'SiRF_ID2_1' * message type. */ #include <stdio.h> #include <stdlib.h> #include <memory.h> /** Private header is programmer specified for handling * conversion functions, etc. */ //#include "SiRF_ID2_1_private.h" /** Not the best way to handle xbow dependencies. */ #include "../xdb.h" /** These need to be moved to a header file. */ typedef struct _SiRF_ID2_1 SiRF_ID2_1; typedef struct _XbowSensorboardPacket XbowSensorboardPacket; // 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_ID2_1 { uint8_t header_seqno; uint8_t header_am_type; uint8_t header_rsrvd1; uint8_t header_rsrvd2; 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; }; void SiRF_ID2_1_set_header_seqno(SiRF_ID2_1 * userdata, uint8_t header_seqno) { userdata->header_seqno = header_seqno; } uint8_t SiRF_ID2_1_get_header_seqno(SiRF_ID2_1 * userdata) { return userdata->header_seqno; } void SiRF_ID2_1_set_header_am_type(SiRF_ID2_1 * userdata, uint8_t header_am_type) { userdata->header_am_type = header_am_type; } uint8_t SiRF_ID2_1_get_header_am_type(SiRF_ID2_1 * userdata) { return userdata->header_am_type; } void SiRF_ID2_1_set_header_rsrvd1(SiRF_ID2_1 * userdata, uint8_t header_rsrvd1) { userdata->header_rsrvd1 = header_rsrvd1; } uint8_t SiRF_ID2_1_get_header_rsrvd1(SiRF_ID2_1 * userdata) { return userdata->header_rsrvd1; } void SiRF_ID2_1_set_header_rsrvd2(SiRF_ID2_1 * userdata, uint8_t header_rsrvd2) { userdata->header_rsrvd2 = header_rsrvd2; } uint8_t SiRF_ID2_1_get_header_rsrvd2(SiRF_ID2_1 * userdata) { return userdata->header_rsrvd2; } void SiRF_ID2_1_set_xpos(SiRF_ID2_1 * userdata, int xpos) { userdata->xpos = xpos; } int SiRF_ID2_1_get_xpos(SiRF_ID2_1 * userdata) { return userdata->xpos; } void SiRF_ID2_1_set_ypos(SiRF_ID2_1 * userdata, int ypos) { userdata->ypos = ypos; } int SiRF_ID2_1_get_ypos(SiRF_ID2_1 * userdata) { return userdata->ypos; } void SiRF_ID2_1_set_zpos(SiRF_ID2_1 * userdata, int zpos) { userdata->zpos = zpos; } int SiRF_ID2_1_get_zpos(SiRF_ID2_1 * userdata) { return userdata->zpos; } void SiRF_ID2_1_set_xvel(SiRF_ID2_1 * userdata, uint16_t xvel) { userdata->xvel = xvel; } uint16_t SiRF_ID2_1_get_xvel(SiRF_ID2_1 * userdata) { return userdata->xvel; } void SiRF_ID2_1_set_yvel(SiRF_ID2_1 * userdata, uint16_t yvel) { userdata->yvel = yvel; } uint16_t SiRF_ID2_1_get_yvel(SiRF_ID2_1 * userdata) { return userdata->yvel; } void SiRF_ID2_1_set_zvel(SiRF_ID2_1 * userdata, uint16_t zvel) { userdata->zvel = zvel; } uint16_t SiRF_ID2_1_get_zvel(SiRF_ID2_1 * userdata) { return userdata->zvel; } void SiRF_ID2_1_set_mode1(SiRF_ID2_1 * userdata, uint8_t mode1) { userdata->mode1 = mode1; } uint8_t SiRF_ID2_1_get_mode1(SiRF_ID2_1 * userdata) { return userdata->mode1; } void SiRF_ID2_1_set_dop(SiRF_ID2_1 * userdata, uint8_t dop) { userdata->dop = dop; } uint8_t SiRF_ID2_1_get_dop(SiRF_ID2_1 * userdata) { return userdata->dop; } void SiRF_ID2_1_set_mode2(SiRF_ID2_1 * userdata, uint8_t mode2) { userdata->mode2 = mode2; } uint8_t SiRF_ID2_1_get_mode2(SiRF_ID2_1 * userdata) { return userdata->mode2; } void SiRF_ID2_1_set_gps_week(SiRF_ID2_1 * userdata, uint16_t gps_week) { userdata->gps_week = gps_week; } uint16_t SiRF_ID2_1_get_gps_week(SiRF_ID2_1 * userdata) { return userdata->gps_week; } //Format string generated automatically, //static char formatstring[] = "%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"; static char insert_stmt[] = "INSERT into SiRF_ID2_1 (" "header_seqno," "header_am_type," "header_rsrvd1," "header_rsrvd2," "xpos," "ypos," "zpos," "xvel," "yvel," "zvel," "mode1," "dop," "mode2," "gps_week) values (%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i)"; void SiRF_ID2_1_pg_log(XbowSensorboardPacket * userdata) { char pg_command[255]; SiRF_ID2_1 * data = (SiRF_ID2_1*)userdata; sprintf(pg_command,insert_stmt, data->header_seqno, data->header_am_type, data->header_rsrvd1, data->header_rsrvd2, data->xpos, data->ypos, data->zpos, data->xvel, data->yvel, data->zvel, data->mode1, data->dop, data->mode2, data->gps_week); xdb_execute(pg_command); } /** @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_rsrvd1_convert(uint8_t header_rsrvd1) { return header_rsrvd1; } /** @brief Default behavior is to return the input as output. * User is responsible for "cooking" the data. */ static uint8_t header_rsrvd2_convert(uint8_t header_rsrvd2) { return header_rsrvd2; } /** @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; } void SiRF_ID2_1_cook_packet(SiRF_ID2_1 * 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); 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); } /** User has to fill in any conversion code * necessary for processing. */ SiRF_ID2_1 * SiRF_ID2_1_convert(char * data) { // Just to keep gcc happy. return (SiRF_ID2_1*)data; } /** Print the bytes of the packet. */ void SiRF_ID2_1_print_raw (XbowSensorboardPacket *packet) { } /** Print cooked output. */ void SiRF_ID2_1_print_cooked (XbowSensorboardPacket * userdata) { SiRF_ID2_1 * data = (SiRF_ID2_1*)userdata; 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); 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); } /** The default size of this message type in bytes. */ //static int DEFAULT_MESSAGE_SIZE = 27; /** The Active Message type associated with this message. */ //static int AM_TYPE = 150; /** If incomplete types are used, we need to provide a way * to manage memory. */ SiRF_ID2_1 * SiRF_ID2_1_new() { SiRF_ID2_1 * userdata = (SiRF_ID2_1*)malloc(sizeof(SiRF_ID2_1)); memset((void*)userdata,0xda,sizeof(SiRF_ID2_1)); return userdata; } void SiRF_ID2_1_delete(SiRF_ID2_1 * userdata) { memset((void*)userdata,0xdd,sizeof(SiRF_ID2_1)); free(userdata); } |
From: Karthik D. <da...@us...> - 2005-07-30 00:24:22
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/TestLink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1573 Added Files: Makefile Log Message: CVS: ---------------------------------------------------------------------- --- NEW FILE: Makefile --- SENSORBOARD=micasb COMPONENT=TestLinkC PFLAGS +=-DDELUGE_LEDS PFLAGS += -I%T/lib/Deluge -I%T/interfaces -I%T/tos/lib/Commands -I%T/platform/mica2 include $(TOSROOT)/apps/Makerules PLATFORMS = mica2 mica2dot telos telosb telosa |
From: David M. D. <do...@us...> - 2005-07-30 00:14:22
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/TestLink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32165/apps/TestLink Modified Files: LinkMsg.h Log Message: Fixed link struct. Index: LinkMsg.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/TestLink/LinkMsg.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** LinkMsg.h 30 Jul 2005 00:10:35 -0000 1.5 --- LinkMsg.h 30 Jul 2005 00:14:13 -0000 1.6 *************** *** 4,9 **** #define FW_HEADER typedef struct fw_header { - uint16_t seqno; uint16_t am_type; } fw_header; #endif --- 4,9 ---- #define FW_HEADER typedef struct fw_header { uint16_t am_type; + uint16_t seqno; } fw_header; #endif *************** *** 16,24 **** struct LinkMsg { - uint32_t seqno; - uint16_t moteid; fw_header header; - uint16_t addr; uint32_t tstamp; uint16_t RSSI; uint16_t LQI; --- 16,22 ---- struct LinkMsg { fw_header header; uint32_t tstamp; + uint16_t moteid; uint16_t RSSI; uint16_t LQI; |
From: Karthik D. <da...@us...> - 2005-07-30 00:10:44
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/TestLink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31643 Modified Files: LinkMsg.h Log Message: Index: LinkMsg.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/TestLink/LinkMsg.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LinkMsg.h 30 Jul 2005 00:01:14 -0000 1.4 --- LinkMsg.h 30 Jul 2005 00:10:35 -0000 1.5 *************** *** 16,19 **** --- 16,21 ---- struct LinkMsg { + uint32_t seqno; + uint16_t moteid; fw_header header; uint16_t addr; |
From: Karthik D. <da...@us...> - 2005-07-30 00:08:09
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/TestLink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31226 Added Files: TestLinkM.nc Log Message: TestLinkM module added --- NEW FILE: TestLinkM.nc --- includes LinkMsg; module TestLinkM { provides { interface StdControl; } uses { interface StdControl as CommControl; interface SendMsg as SendLinkMsg; interface ReceiveMsg as ReceiveLinkMsg; interface Timer; interface Leds; interface CC1000Control; } } implementation { uint32_t seqno; uint16_t lastRSSI; uint16_t lastLQI; uint16_t lastAddress; TOS_Msg msg; LinkMsg *lMsg; void blink(uint8_t seq) { if(seq&0x1) { call Leds.redOn(); } else { call Leds.redOff(); } if(seq&0x2) { call Leds.greenOn(); } else { call Leds.greenOff(); } if(seq&0x4) { call Leds.yellowOn(); } else { call Leds.yellowOff(); } } void clearPacket() { uint8_t i; for(i=0; i< 29; i++) msg.data[i]=0x0; } task sendLinkQualityData() { blink(0x5); clearPacket(); lMsg = (LinkMsg) &(msg.data); lMsg->seqno = seqno++; lMsg->addr = lastAddress; lMsg->tstamp = 0; lMsg->RSSI = lastRSSI; lMsg->LQI = lastLQI; if(!sendBusy) { sendBusy = TRUE; if(!call SendLinkMsg.send(TOS_BCAST_ADDR, sizeof(LinkMsg), &msg)) { sendBusy = FALSE; blink(0x7); return; } else { blink(0x6); } } } command result_t StdControl.init() { call Leds.init(); call CommControl.init(); return SUCCESS; } command result_t StdControl.start() { blink(CLEAR); seqno = 1; sendBusy = FALSE; call CommControl.start(); return SUCCESS; } command result_t StdControl.stop() { call CommControl.stop(); call Timer.stop(); return SUCCESS; } command TOS_MsgPtr ReceiveLinkMsg.receive(TOS_MsgPtr m) { blink(0x3); lastRSSI = m->RSSI; lastLQI = m->LQI; /* Copy timestamp here */ post sendLinkQualityData(); return m; } |
From: David M. D. <do...@us...> - 2005-07-30 00:01:24
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/TestLink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30194 Modified Files: LinkMsg.h Log Message: Fixed defined Index: LinkMsg.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/TestLink/LinkMsg.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LinkMsg.h 29 Jul 2005 23:55:09 -0000 1.3 --- LinkMsg.h 30 Jul 2005 00:01:14 -0000 1.4 *************** *** 7,11 **** uint16_t am_type; } fw_header; ! --- 7,11 ---- uint16_t am_type; } fw_header; ! #endif |
From: Karthik D. <da...@us...> - 2005-07-29 23:57:05
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/TestLink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29523 Added Files: TestLinkC.nc Log Message: Added TestLinkC configuration file --- NEW FILE: TestLinkC.nc --- includes LinkMsg; configuration TestLinkC { } implementation { components Main, GenericComm, DelugeC, CC2420RadioC, TestLinkM, LedsC; Main.StdControl -> TestLinkM.StdControl; Main.StdControl -> GenericComm.StdControl; Main.StdControl -> DelugeC; Main.StdControl -> TimerC; TestLinkM.CommControl -> GenericComm; TestLinkM.CommControl -> GenericComm; TestLinkM.SendLinkMsg -> GenericComm.SendMsg[AM_LINKMSG]; TestLinkM.ReceiveLinkMsg -> GenericComm.ReceiveMsg[AM_LINKMSG]; TestLinkM.CC1000Control -> CC1000RadioC; TestLinkM.Leds -> LedsC; TestLinkM.Timer -> TimerC.Timer[unique("Timer")]; } |
From: David M. D. <do...@us...> - 2005-07-29 23:55:17
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/TestLink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29231 Modified Files: LinkMsg.h Log Message: embedded header Index: LinkMsg.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/TestLink/LinkMsg.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LinkMsg.h 29 Jul 2005 23:53:13 -0000 1.2 --- LinkMsg.h 29 Jul 2005 23:55:09 -0000 1.3 *************** *** 1,8 **** enum { AM_LINKMSG = 200 }; struct LinkMsg { ! uint32_t seqno; uint16_t addr; uint32_t tstamp; --- 1,20 ---- + + + #ifndef FW_HEADER + #define FW_HEADER + typedef struct fw_header { + uint16_t seqno; + uint16_t am_type; + } fw_header; + + + enum { AM_LINKMSG = 200 }; + struct LinkMsg { ! fw_header header; uint16_t addr; uint32_t tstamp; |
From: Karthik D. <da...@us...> - 2005-07-29 23:53:21
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/TestLink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28920 Modified Files: LinkMsg.h Log Message: Added AM type Index: LinkMsg.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/TestLink/LinkMsg.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LinkMsg.h 29 Jul 2005 23:49:40 -0000 1.1 --- LinkMsg.h 29 Jul 2005 23:53:13 -0000 1.2 *************** *** 1,2 **** --- 1,6 ---- + enum { + AM_LINKMSG = 200 + }; + struct LinkMsg { uint32_t seqno; |
From: Karthik D. <da...@us...> - 2005-07-29 23:49:48
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/TestLink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28304 Added Files: LinkMsg.h Log Message: Link quality testing --- NEW FILE: LinkMsg.h --- struct LinkMsg { uint32_t seqno; uint16_t addr; uint32_t tstamp; uint16_t RSSI; uint16_t LQI; }; typedef struct LinkMsg LinkMsg; |
From: Karthik D. <da...@us...> - 2005-07-29 23:49:25
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/TestLink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28245/TestLink Log Message: Directory /cvsroot/firebug/fireboard/beta/fireworks/apps/TestLink added to the repository |
From: David M. D. <do...@us...> - 2005-07-29 23:26:43
|
Update of /cvsroot/firebug/fireboard/beta/bin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24367 Modified Files: firebug-db-setup.sh sirf_id2_1.pgsql Added Files: sirf_functions.pgsql Log Message: Added functions for converting sirf data on queries. --- NEW FILE: sirf_functions.pgsql --- create or replace function velocity(int /* raw position */) returns real as 'select ( $1 / 8.0 )::real as result;' language sql; create or replace function dop(int /* raw dop */) returns real as 'select ($1/2.0)::real as result;' language sql; create or replace function get_gps_tow(int) returns real as 'select ($1/100.0)::real as result;' language sql; Index: sirf_id2_1.pgsql =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/bin/sirf_id2_1.pgsql,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sirf_id2_1.pgsql 15 Jul 2005 16:37:01 -0000 1.1 --- sirf_id2_1.pgsql 29 Jul 2005 23:26:31 -0000 1.2 *************** *** 17,20 **** --- 17,22 ---- zvel smallint, mode1 smallint, + dop smallint, + mode2 smallint, gps_week smallint); Index: firebug-db-setup.sh =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/bin/firebug-db-setup.sh,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** firebug-db-setup.sh 15 Jul 2005 16:37:01 -0000 1.3 --- firebug-db-setup.sh 29 Jul 2005 23:26:31 -0000 1.4 *************** *** 54,58 **** psql --echo-queries --dbname firebug firebug < sirf_id28_3.pgsql ! #### The following are just examples of how to set up --- 54,58 ---- psql --echo-queries --dbname firebug firebug < sirf_id28_3.pgsql ! psql --echo-queries --dbname firebug firebug < sirf_functions.pgsql; #### The following are just examples of how to set up |
From: David M. D. <do...@us...> - 2005-07-29 21:34:34
|
Update of /cvsroot/firebug/fireboard/beta/tools/gps/SiRF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3417 Modified Files: sirftest.c Log Message: sirf 28 parses, problems with conversions though, so the test function fails. Index: sirftest.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/gps/SiRF/sirftest.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** sirftest.c 29 Jul 2005 19:12:26 -0000 1.4 --- sirftest.c 29 Jul 2005 21:34:26 -0000 1.5 *************** *** 51,55 **** 0x00, // channel 0x00, 0x06, 0x60, 0xd0, // time tag ! 0x15, // satellite id 0xf1, 0x43, 0xf6, 0x2c, // GPS Software time, 1st 4 bytes 0x41, 0x13, 0xf4, 0x2f, // GPS Software time, 2d 4 bytes --- 51,55 ---- 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 *************** *** 94,97 **** --- 94,114 ---- } + /* + 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. static float *************** *** 278,286 **** fb_sirfid28_test() { ! return FALSE; } int fb_sirfid2_test() { --- 295,405 ---- 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; } + /** + * This function tests for correct extraction of data + * from the raw sirf message. + */ int fb_sirfid2_test() { *************** *** 441,448 **** main(int argc, char ** argv) { outstream = stdout; fb_sirf_test(); ! print_sirf2_message(); return 0; --- 560,573 ---- main(int argc, char ** argv) { + //uint64_t foo = 0xf143f62c4113f42f; outstream = stdout; fb_sirf_test(); ! ! ! //print_sirf2_message(); ! ! //temporary(); ! //printf("Foo: %f\n", foo); return 0; |
From: David M. D. <do...@us...> - 2005-07-29 19:12:37
|
Update of /cvsroot/firebug/fireboard/beta/tools/gps/SiRF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7305 Modified Files: Makefile sirf.h sirf_id28_1.c sirf_id28_2.c sirf_id28_3.c sirf_id2_1.c sirf_id2_2.c sirftest.c Log Message: Added more test code for sirf parsing. Index: sirf_id28_3.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/gps/SiRF/sirf_id28_3.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sirf_id28_3.c 15 Jul 2005 16:23:37 -0000 1.1 --- sirf_id28_3.c 29 Jul 2005 19:12:26 -0000 1.2 *************** *** 66,70 **** //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"; --- 66,70 ---- //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"; *************** *** 273,276 **** --- 273,278 ---- + // Not yet used. + #if 0 static char insert_stmt[] = "INSERT into SiRF_ID28_3 (" "header_seqno," *************** *** 295,298 **** --- 297,301 ---- "low_power_count) values (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)"; + #endif #if 0 void *************** *** 528,553 **** /** Print the bytes of the packet. */ ! void SiRF_ID28_3_print_raw (XbowSensorboardPacket *packet) { ! ! SiRF_ID28_3 * userdata = (SiRF_ID28_3*)packet->data; ! } ! ! /** Print typed output. */ ! void SiRF_ID28_3_print_cooked (XbowSensorboardPacket *packet) { - SiRF_ID28_3 * userdata = (SiRF_ID28_3*)packet->data; } ! /** Print cooked with tabs. */ ! void SiRF_ID28_3_print_tabbed (XbowSensorboardPacket *packet) { ! SiRF_ID28_3 * userdata = (SiRF_ID28_3*)packet->data; } /** The default size of this message type in bytes. */ ! static int DEFAULT_MESSAGE_SIZE = 23; /** The Active Message type associated with this message. */ ! static int AM_TYPE = 154; /** If incomplete types are used, we need to provide a way --- 531,571 ---- /** Print the bytes of the packet. */ ! void ! SiRF_ID28_3_print_raw (XbowSensorboardPacket *packet) { } ! /** Print cooked output. */ ! void ! SiRF_ID28_3_print_cooked (void * userdata) { ! SiRF_ID28_3 * data = (SiRF_ID28_3*)userdata; ! 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); ! 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); } /** The default size of this message type in bytes. */ ! //static int DEFAULT_MESSAGE_SIZE = 23; /** The Active Message type associated with this message. */ ! //static int AM_TYPE = 154; /** If incomplete types are used, we need to provide a way Index: sirf.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/gps/SiRF/sirf.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sirf.h 15 Jul 2005 16:23:37 -0000 1.2 --- sirf.h 29 Jul 2005 19:12:26 -0000 1.3 *************** *** 30,36 **** fb_header header; ! uint32_t xpos; ! uint32_t ypos; ! uint32_t zpos; uint16_t xvel; --- 30,36 ---- fb_header header; ! int32_t xpos; ! int32_t ypos; ! int32_t zpos; uint16_t xvel; *************** *** 39,42 **** --- 39,44 ---- uint8_t mode1; + uint8_t dop; + uint8_t mode2; uint16_t gps_week; Index: sirf_id2_1.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/gps/SiRF/sirf_id2_1.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sirf_id2_1.c 15 Jul 2005 16:23:37 -0000 1.1 --- sirf_id2_1.c 29 Jul 2005 19:12:26 -0000 1.2 *************** *** 45,55 **** uint8_t header_rsrvd1; uint8_t header_rsrvd2; ! uint32_t xpos; ! uint32_t ypos; ! uint32_t zpos; uint16_t xvel; uint16_t yvel; uint16_t zvel; uint8_t mode1; uint16_t gps_week; }; --- 45,57 ---- uint8_t header_rsrvd1; uint8_t header_rsrvd2; ! 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; }; *************** *** 58,62 **** //Format string generated automatically, ! static char formatstring[] = "%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i"; --- 60,64 ---- //Format string generated automatically, ! //static char formatstring[] = "%i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i, %i"; *************** *** 102,110 **** void ! SiRF_ID2_1_set_xpos(SiRF_ID2_1 * userdata, uint32_t xpos) { userdata->xpos = xpos; } ! uint32_t SiRF_ID2_1_get_xpos(SiRF_ID2_1 * userdata) { return userdata->xpos; --- 104,112 ---- void ! SiRF_ID2_1_set_xpos(SiRF_ID2_1 * userdata, int xpos) { userdata->xpos = xpos; } ! int SiRF_ID2_1_get_xpos(SiRF_ID2_1 * userdata) { return userdata->xpos; *************** *** 112,120 **** void ! SiRF_ID2_1_set_ypos(SiRF_ID2_1 * userdata, uint32_t ypos) { userdata->ypos = ypos; } ! uint32_t SiRF_ID2_1_get_ypos(SiRF_ID2_1 * userdata) { return userdata->ypos; --- 114,122 ---- void ! SiRF_ID2_1_set_ypos(SiRF_ID2_1 * userdata, int ypos) { userdata->ypos = ypos; } ! int SiRF_ID2_1_get_ypos(SiRF_ID2_1 * userdata) { return userdata->ypos; *************** *** 122,130 **** void ! SiRF_ID2_1_set_zpos(SiRF_ID2_1 * userdata, uint32_t zpos) { userdata->zpos = zpos; } ! uint32_t SiRF_ID2_1_get_zpos(SiRF_ID2_1 * userdata) { return userdata->zpos; --- 124,132 ---- void ! SiRF_ID2_1_set_zpos(SiRF_ID2_1 * userdata, int zpos) { userdata->zpos = zpos; } ! int SiRF_ID2_1_get_zpos(SiRF_ID2_1 * userdata) { return userdata->zpos; *************** *** 172,175 **** --- 174,197 ---- void + SiRF_ID2_1_set_dop(SiRF_ID2_1 * userdata, uint8_t dop) { + userdata->dop = dop; + } + + uint8_t + SiRF_ID2_1_get_dop(SiRF_ID2_1 * userdata) { + return userdata->dop; + } + + void + SiRF_ID2_1_set_mode2(SiRF_ID2_1 * userdata, uint8_t mode2) { + userdata->mode2 = mode2; + } + + uint8_t + SiRF_ID2_1_get_mode2(SiRF_ID2_1 * userdata) { + return userdata->mode2; + } + + void SiRF_ID2_1_set_gps_week(SiRF_ID2_1 * userdata, uint16_t gps_week) { userdata->gps_week = gps_week; *************** *** 185,188 **** --- 207,212 ---- + // Not yet used. + #if 0 static char insert_stmt[] = "INSERT into SiRF_ID2_1 (" "header_seqno," *************** *** 197,202 **** "zvel," "mode1," ! "gps_week) values (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)"; #if 0 void --- 221,229 ---- "zvel," "mode1," ! "dop," ! "mode2," ! "gps_week) values (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)"; + #endif #if 0 void *************** *** 206,209 **** --- 233,237 ---- sprintf(pg_command,formatstring, data->mode1, + data->dop, data->header_rsrvd2, data->yvel, *************** *** 213,216 **** --- 241,245 ---- data->xpos, data->xvel, + data->mode2, data->header_seqno, data->ypos, *************** *** 258,263 **** * User is responsible for "cooking" the data. */ ! static uint32_t ! xpos_convert(uint32_t xpos) { return xpos; } --- 287,292 ---- * User is responsible for "cooking" the data. */ ! static int ! xpos_convert(int xpos) { return xpos; } *************** *** 266,271 **** * User is responsible for "cooking" the data. */ ! static uint32_t ! ypos_convert(uint32_t ypos) { return ypos; } --- 295,300 ---- * User is responsible for "cooking" the data. */ ! static int ! ypos_convert(int ypos) { return ypos; } *************** *** 274,279 **** * User is responsible for "cooking" the data. */ ! static uint32_t ! zpos_convert(uint32_t zpos) { return zpos; } --- 303,308 ---- * User is responsible for "cooking" the data. */ ! static int ! zpos_convert(int zpos) { return zpos; } *************** *** 314,317 **** --- 343,362 ---- * 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) { *************** *** 332,335 **** --- 377,382 ---- 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); } *************** *** 352,377 **** /** Print the bytes of the packet. */ ! void SiRF_ID2_1_print_raw (XbowSensorboardPacket *packet) { ! ! SiRF_ID2_1 * userdata = (SiRF_ID2_1*)packet->data; ! } ! ! /** Print typed output. */ ! void SiRF_ID2_1_print_cooked (XbowSensorboardPacket *packet) { - SiRF_ID2_1 * userdata = (SiRF_ID2_1*)packet->data; } ! /** Print cooked with tabs. */ ! void SiRF_ID2_1_print_tabbed (XbowSensorboardPacket *packet) { ! SiRF_ID2_1 * userdata = (SiRF_ID2_1*)packet->data; } /** The default size of this message type in bytes. */ ! static int DEFAULT_MESSAGE_SIZE = 25; /** The Active Message type associated with this message. */ ! static int AM_TYPE = 150; /** If incomplete types are used, we need to provide a way --- 399,433 ---- /** Print the bytes of the packet. */ ! void ! SiRF_ID2_1_print_raw (XbowSensorboardPacket *packet) { } ! /** Print cooked output. */ ! void ! SiRF_ID2_1_print_cooked (void * userdata) { ! SiRF_ID2_1 * data = (SiRF_ID2_1*)userdata; ! 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); ! 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); } /** The default size of this message type in bytes. */ ! //static int DEFAULT_MESSAGE_SIZE = 27; /** The Active Message type associated with this message. */ ! //static int AM_TYPE = 150; /** If incomplete types are used, we need to provide a way Index: sirf_id2_2.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/gps/SiRF/sirf_id2_2.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sirf_id2_2.c 15 Jul 2005 16:23:37 -0000 1.1 --- sirf_id2_2.c 29 Jul 2005 19:12:26 -0000 1.2 *************** *** 64,68 **** //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"; --- 64,68 ---- //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"; *************** *** 251,254 **** --- 251,256 ---- + // Not yet used. + #if 0 static char insert_stmt[] = "INSERT into SiRF_ID2_2 (" "header_seqno," *************** *** 271,274 **** --- 273,277 ---- "ch12) values (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)"; + #endif #if 0 void *************** *** 484,509 **** /** Print the bytes of the packet. */ ! void SiRF_ID2_2_print_raw (XbowSensorboardPacket *packet) { ! ! SiRF_ID2_2 * userdata = (SiRF_ID2_2*)packet->data; ! } ! ! /** Print typed output. */ ! void SiRF_ID2_2_print_cooked (XbowSensorboardPacket *packet) { - SiRF_ID2_2 * userdata = (SiRF_ID2_2*)packet->data; } ! /** Print cooked with tabs. */ ! void SiRF_ID2_2_print_tabbed (XbowSensorboardPacket *packet) { ! SiRF_ID2_2 * userdata = (SiRF_ID2_2*)packet->data; } /** The default size of this message type in bytes. */ ! static int DEFAULT_MESSAGE_SIZE = 21; /** The Active Message type associated with this message. */ ! static int AM_TYPE = 151; /** If incomplete types are used, we need to provide a way --- 487,525 ---- /** Print the bytes of the packet. */ ! void ! SiRF_ID2_2_print_raw (XbowSensorboardPacket *packet) { } ! /** Print cooked output. */ ! void ! SiRF_ID2_2_print_cooked (void * userdata) { ! SiRF_ID2_2 * data = (SiRF_ID2_2*)userdata; ! 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: %d,\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); } /** The default size of this message type in bytes. */ ! //static int DEFAULT_MESSAGE_SIZE = 21; /** The Active Message type associated with this message. */ ! //static int AM_TYPE = 151; /** If incomplete types are used, we need to provide a way Index: sirf_id28_1.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/gps/SiRF/sirf_id28_1.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sirf_id28_1.c 15 Jul 2005 16:23:37 -0000 1.1 --- sirf_id28_1.c 29 Jul 2005 19:12:26 -0000 1.2 *************** *** 54,58 **** //Format string generated automatically, ! static char formatstring[] = "%i, %i, %i, %i, %i, %i, %i, %i"; --- 54,58 ---- //Format string generated automatically, ! //static char formatstring[] = "%i, %i, %i, %i, %i, %i, %i, %i"; *************** *** 141,144 **** --- 141,146 ---- + // Not yet used. + #if 0 static char insert_stmt[] = "INSERT into SiRF_ID28_1 (" "header_seqno," *************** *** 151,154 **** --- 153,157 ---- "gps_sw_time) values (0, 0, 0, 0, 0, 0, 0, 0)"; + #endif #if 0 void *************** *** 264,289 **** /** Print the bytes of the packet. */ ! void SiRF_ID28_1_print_raw (XbowSensorboardPacket *packet) { ! ! SiRF_ID28_1 * userdata = (SiRF_ID28_1*)packet->data; ! } ! ! /** Print typed output. */ ! void SiRF_ID28_1_print_cooked (XbowSensorboardPacket *packet) { - SiRF_ID28_1 * userdata = (SiRF_ID28_1*)packet->data; } ! /** Print cooked with tabs. */ ! void SiRF_ID28_1_print_tabbed (XbowSensorboardPacket *packet) { ! SiRF_ID28_1 * userdata = (SiRF_ID28_1*)packet->data; } /** The default size of this message type in bytes. */ ! static int DEFAULT_MESSAGE_SIZE = 18; /** The Active Message type associated with this message. */ ! static int AM_TYPE = 152; /** If incomplete types are used, we need to provide a way --- 267,295 ---- /** Print the bytes of the packet. */ ! void ! SiRF_ID28_1_print_raw (XbowSensorboardPacket *packet) { } ! /** Print cooked output. */ ! void ! SiRF_ID28_1_print_cooked (void * userdata) { ! SiRF_ID28_1 * data = (SiRF_ID28_1*)userdata; ! 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); ! printf("sat_id: %i,\n",data->sat_id); ! printf("gps_sw_time: %i,\n",data->gps_sw_time); } /** The default size of this message type in bytes. */ ! //static int DEFAULT_MESSAGE_SIZE = 18; /** The Active Message type associated with this message. */ ! //static int AM_TYPE = 152; /** If incomplete types are used, we need to provide a way Index: sirftest.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/gps/SiRF/sirftest.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sirftest.c 15 Jul 2005 17:34:36 -0000 1.3 --- sirftest.c 29 Jul 2005 19:12:26 -0000 1.4 *************** *** 2,18 **** #include <stdio.h> #include "sirf.h" static char sirf_id2[] = { ! 0x02, ! 0xff, 0xd6, 0xf7, 0x8c, ! 0xff, 0xbe, 0x53, 0x6e}; ! int ! main(int argc, char ** argv) { ! int32_t xpos = 0; ! int32_t ypos = 0; ! uint8_t message_id; printf("sirf id 2,1: %d\n",sizeof(SiRF_ID2_1)); --- 2,188 ---- #include <stdio.h> + #ifndef FALSE + #define FALSE 0 + #endif + #ifndef TRUE + #define TRUE !FALSE + #endif + #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 ! }; ! // 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 ! 0x15, // 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 ! }; ! ! // TODO: Make a macro for this. ! static 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; ! } ! ! // TODO: Make a macro for this. ! static 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. ! static 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. ! static 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. ! static 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; ! } ! ! ! 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)); *************** *** 22,51 **** printf("sirf id 28,3: %d\n",sizeof(SiRF_ID28_3)); ! printf("sirf_id2 string: %x\n",sirf_id2); ! message_id = sirf_id2[0]; ! printf("message_id: %d\n", message_id); - /** This works, needs to be moved to a macro. */ - xpos |= sirf_id2[1] & 0xFF; - xpos <<= 8; - xpos |= sirf_id2[2] & 0xFF; - xpos <<= 8; - xpos |= sirf_id2[3] & 0xFF; - xpos <<= 8; - xpos |= sirf_id2[4] & 0xFF; ! ypos |= sirf_id2[5] & 0xFF; ! ypos <<= 8; ! ypos |= sirf_id2[6] & 0xFF; ! ypos <<= 8; ! ypos |= sirf_id2[7] & 0xFF; ! ypos <<= 8; ! ypos |= sirf_id2[8] & 0xFF; ! printf("X Pos: %i\n", xpos); ! printf("Y Pos: %i\n", ypos); return 0; --- 192,448 ---- 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)); ! printf("Size of sirf id 28 string: %d\n", sizeof(sirf_id28)); ! } ! 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; ! } ! ! ! int ! fb_sirfid28_test() { ! ! return FALSE; ! } ! ! ! ! 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"); ! } ! ! if (fb_sirfid28_test()) { ! fprintf(outstream, "SiRF ID 28 parsing passed.\n"); ! } else { ! fprintf(outstream, "SiRF ID 28 parsing failed.\n"); ! } ! ! return FALSE; ! } ! ! ! void ! temporary(void) { ! ! double tmp = 0; ! tmp = convert_8_bytes_to_double(&sirf_id28[7]); ! tmp = convert_4_bytes_to_float(&sirf_id28[23]); ! ! printf("CRC 2: %x\n",sirf_crc(sirf_id2,41)); ! ! printf("tmp: %lf\n", tmp); ! ! //print_message_sizes(); ! //print_struct_sizes(); ! //test_sirf_id2_parsing(); ! ! ! } ! ! ! int ! main(int argc, char ** argv) { ! ! outstream = stdout; ! fb_sirf_test(); ! ! print_sirf2_message(); return 0; Index: Makefile =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/gps/SiRF/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 15 Jul 2005 16:23:36 -0000 1.2 --- Makefile 29 Jul 2005 19:12:26 -0000 1.3 *************** *** 2,7 **** SRC = sirf_id2_1.c sirf_id2_2.c sirf_id28_1.c sirf_id28_2.c sirf_id28_3.c ! test: sirftest ! gcc -o sirftest sirftest.c $(SRC) --- 2,10 ---- SRC = sirf_id2_1.c sirf_id2_2.c sirf_id28_1.c sirf_id28_2.c sirf_id28_3.c ! ! # uint32_t -> int format produces annoying warning messages, ! # disable it for now. ! test: ! gcc -Wall -Wno-format -o sirftest sirftest.c $(SRC) Index: sirf_id28_2.c =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/tools/gps/SiRF/sirf_id28_2.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sirf_id28_2.c 15 Jul 2005 16:23:37 -0000 1.1 --- sirf_id28_2.c 29 Jul 2005 19:12:26 -0000 1.2 *************** *** 54,58 **** //Format string generated automatically, ! static char formatstring[] = "%i, %i, %i, %i, %i, %i, %i, %i"; --- 54,58 ---- //Format string generated automatically, ! //static char formatstring[] = "%i, %i, %i, %i, %i, %i, %i, %i"; *************** *** 141,144 **** --- 141,146 ---- + // Not yet used. + #if 0 static char insert_stmt[] = "INSERT into SiRF_ID28_2 (" "header_seqno," *************** *** 151,154 **** --- 153,157 ---- "time_in_track) values (0, 0, 0, 0, 0, 0, 0, 0)"; + #endif #if 0 void *************** *** 264,289 **** /** Print the bytes of the packet. */ ! void SiRF_ID28_2_print_raw (XbowSensorboardPacket *packet) { ! ! SiRF_ID28_2 * userdata = (SiRF_ID28_2*)packet->data; ! } ! ! /** Print typed output. */ ! void SiRF_ID28_2_print_cooked (XbowSensorboardPacket *packet) { - SiRF_ID28_2 * userdata = (SiRF_ID28_2*)packet->data; } ! /** Print cooked with tabs. */ ! void SiRF_ID28_2_print_tabbed (XbowSensorboardPacket *packet) { ! SiRF_ID28_2 * userdata = (SiRF_ID28_2*)packet->data; } /** The default size of this message type in bytes. */ ! static int DEFAULT_MESSAGE_SIZE = 26; /** The Active Message type associated with this message. */ ! static int AM_TYPE = 153; /** If incomplete types are used, we need to provide a way --- 267,295 ---- /** Print the bytes of the packet. */ ! void ! SiRF_ID28_2_print_raw (XbowSensorboardPacket *packet) { } ! /** Print cooked output. */ ! void ! SiRF_ID28_2_print_cooked (void * userdata) { ! SiRF_ID28_2 * data = (SiRF_ID28_2*)userdata; ! 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); ! printf("carrier_phase: %i,\n",data->carrier_phase); ! printf("time_in_track: %i,\n",data->time_in_track); } /** The default size of this message type in bytes. */ ! //static int DEFAULT_MESSAGE_SIZE = 26; /** The Active Message type associated with this message. */ ! //static int AM_TYPE = 153; /** If incomplete types are used, we need to provide a way |
From: Karthik D. <da...@us...> - 2005-07-26 18:51:16
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/tools/java/net/sf/firebug/fireworks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6852 Added Files: DataElement.java Fireworks.java Makefile Log Message: Java portion of Fireworks --- NEW FILE: Makefile --- TOS = $(shell ncc -print-tosdir) PACKAGE = net.sf.firebug.fireworks APP = $(FIREBOARDROOT)/beta/fireworks/apps/Fireworks MIG = mig java # List of message classes to build MSGS = DataRequestMsg.java DataMsg.java PingMsg.java PingReplyMsg.java INITIAL_TARGETS = $(MSGS) OTHER_CLEAN = cleanmig ROOT = $(TOSROOT)/tools/java include $(ROOT)/Makefile.include DataRequestMsg.java: $(MIG) -java-classname=$(PACKAGE).DataRequestMsg $(APP)/Fireworks.h DataRequestMsg -o $@ $(JAVAC) $@ DataMsg.java: $(MIG) -java-classname=$(PACKAGE).DataMsg $(APP)/Fireworks.h DataMsg -o $@ $(JAVAC) $@ PingMsg.java: $(MIG) -java-classname=$(PACKAGE).PingMsg $(APP)/Fireworks.h PingMsg -o $@ $(JAVAC) $@ PingReplyMsg.java: $(MIG) -java-classname=$(PACKAGE).PingReplyMsg $(APP)/Fireworks.h PingReplyMsg -o $@ $(JAVAC) $@ cleanmig: rm -f $(MSGS) --- NEW FILE: DataElement.java --- /* * Authors: Karthik Dantu * Graduate Student * Firebug Project * http://firebug.sf.net * * Date: 7/25/2005 * */ package net.sf.firebug.fireworks; public class DataElement { int[] RSSI; int source; private int counter; DataElement() { counter = 0; RSSI = new int[100]; } DataElement(int src) { source = src; counter = 0; RSSI = new int[100]; } public void add(int rssivalue) { RSSI[counter++]= rssivalue; } public int get(int idx) { return RSSI[idx]; } public int get() { return RSSI[counter-1]; } public int get_index() { return counter; } public void set_source(int src) { source = src; return; } public int get_source() { return source; } public void add(int[] rssi, int src) { int i=0; if(this.source != src) { System.err.println("Adding RSSI values to DataElement with different source"); System.exit(1); } for(i=0;i<rssi.length;i++) RSSI[counter++]=rssi[i]; return; } } --- NEW FILE: Fireworks.java --- /* * Authors: Karthik Dantu * Graduate Student * Firebug Project * http://firebug.sf.net * * Date: 7/25/2005 * */ package net.sf.firebug.fireworks; import net.tinyos.util.*; import net.tinyos.packet.*; import net.tinyos.message.*; import java.io.*; import java.util.*; public class Fireworks implements MessageListener { private static final boolean VERBOSE = false; static int group_id = 0x7d; MoteIF mote; static Fireworks fw; LinkedList data; static int numNodes; static int numTrials; static int numPowerLevels; static int frequency; Fireworks() { data = new LinkedList(); mote = new MoteIF(PrintStreamMessenger.err, group_id); mote.registerListener(new DataMsg(), this); mote.registerListener(new DataRequestMsg(), this); mote.registerListener(new PingMsg(), this); mote.registerListener(new PingReplyMsg(), this); } static void printUsage() { System.err.println("Fireworks Usage: java net.sf.firebug.fireworks.Fireworks <numNodes> <numTrials> <numPowerLevels> <frequency> <group id>"); System.err.println("Please pass all parameters in the same order"); System.exit(1); } public static void main(String[] args) throws IOException { if(args.length != 6) { printUsage(); } else { numNodes = Integer.parseInt(args[1]); numTrials = Integer.parseInt(args[2]); numPowerLevels = Integer.parseInt(args[3]); frequency = Integer.parseInt(args[4]); group_id = Integer.parseInt(args[5]); fw = new Fireworks(); /* Now that we have all the data we need, start sending datarequest packets and wait for data packets to come in */ } } public void messageReceived(int dest, Message msg) { if(msg instanceof PingMsg) { PingMsg pMsg = (PingMsg) msg; if(VERBOSE) { System.out.println("Received Ping Msg from " + dest + " to " + pMsg.get_source() + " with sequence number " + pMsg.get_seqno()); } } else if(msg instanceof PingReplyMsg) { PingReplyMsg prMsg = (PingReplyMsg) msg; if(VERBOSE) { System.out.println("Received Ping Reply Msg from " + dest + " to " + prMsg.get_source() + " with sequence number " + prMsg.get_seqno() + " and RSSI value " + prMsg.get_RSSI()); } } else if(msg instanceof DataMsg) { DataMsg dMsg = (DataMsg) msg; int src=0; int seq; DataElement dElement=new DataElement(); if(VERBOSE) { System.out.println("Received Data Msg from " + dest); } if(dMsg.get_seqno() == 0) { /* Beginning of data msg. */ DataRequestMsg drMsg = new DataRequestMsg(dMsg, 1); src = drMsg.get_source(); dElement = new DataElement(src); data.add(dElement); } else { if(dElement.get_source() != 0 && dElement.get_source() != src) { dElement.add(dMsg.get_data(), src); } else { System.err.println("DataElement Uninitialized"); } } } } } |
From: Karthik D. <da...@us...> - 2005-07-26 01:49:37
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/tools/java/net/sf/firebug/fireworks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28994/fireworks Log Message: Directory /cvsroot/firebug/fireboard/beta/fireworks/tools/java/net/sf/firebug/fireworks added to the repository |
From: Karthik D. <da...@us...> - 2005-07-26 01:49:25
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/tools/java/net/sf/firebug In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28965/firebug Log Message: Directory /cvsroot/firebug/fireboard/beta/fireworks/tools/java/net/sf/firebug added to the repository |
From: Karthik D. <da...@us...> - 2005-07-26 01:49:14
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/tools/java/net/sf In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28901/sf Log Message: Directory /cvsroot/firebug/fireboard/beta/fireworks/tools/java/net/sf added to the repository |
From: Karthik D. <da...@us...> - 2005-07-26 01:48:48
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/tools/java/net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28851/net Log Message: Directory /cvsroot/firebug/fireboard/beta/fireworks/tools/java/net added to the repository |
From: Karthik D. <da...@us...> - 2005-07-26 01:48:21
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/tools/java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28776/java Log Message: Directory /cvsroot/firebug/fireboard/beta/fireworks/tools/java added to the repository |
From: Karthik D. <da...@us...> - 2005-07-26 01:46:08
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28459/tools Log Message: Directory /cvsroot/firebug/fireboard/beta/fireworks/tools added to the repository |
From: Karthik D. <da...@us...> - 2005-07-26 01:45:13
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28280 Modified Files: Fireworks.h FireworksC.nc FireworksM.nc TODO Log Message: Final TinyOS version Index: FireworksC.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks/FireworksC.nc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FireworksC.nc 25 Jul 2005 22:08:16 -0000 1.3 --- FireworksC.nc 26 Jul 2005 01:44:46 -0000 1.4 *************** *** 32,36 **** FireworksM.ReceivePingReplyMsg -> GenericComm.ReceiveMsg[AM_PINGREPLYMSG]; FireworksM.SendDataMsg -> GenericComm.SendMsg[AM_DATAMSG]; - FireworksM.ReceiveDataMsg -> GenericComm.ReceiveMsg[AM_DATAMSG]; FireworksM.ReceiveDataRequestMsg -> GenericComm.ReceiveMsg[AM_DATAREQUESTMSG]; FireworksM.CC1000Control -> CC1000RadioC; --- 32,35 ---- Index: Fireworks.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks/Fireworks.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Fireworks.h 26 Jul 2005 01:15:45 -0000 1.5 --- Fireworks.h 26 Jul 2005 01:44:46 -0000 1.6 *************** *** 20,23 **** --- 20,27 ---- }; + enum { + NUM_READINGS_PER_PACKET = 14 + }; + /* LED count sequence. 1 - Red *************** *** 39,42 **** --- 43,47 ---- uint16_t seqno; uint16_t source; + uint16_t client; uint16_t numNodes; uint16_t numTrials; *************** *** 57,61 **** struct DataMsg { uint8_t seqno; ! uint16_t data[14]; } ; --- 62,66 ---- struct DataMsg { uint8_t seqno; ! uint16_t data[NUM_READINGS_PER_PACKET]; } ; Index: TODO =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks/TODO,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TODO 26 Jul 2005 01:15:45 -0000 1.2 --- TODO 26 Jul 2005 01:44:46 -0000 1.3 *************** *** 8,11 **** --- 8,13 ---- an artificial limitation. Use dynamic memory allocation to go beyond this. + - Implement reliability for DataMsg since it has multiple packets. + Do a simple NACK scheme. LONG TERM Index: FireworksM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks/FireworksM.nc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FireworksM.nc 26 Jul 2005 01:15:45 -0000 1.4 --- FireworksM.nc 26 Jul 2005 01:44:46 -0000 1.5 *************** *** 136,140 **** /* Send all the collected data to the client */ uint8_t dseq = 0; ! clearPacket(); dMsg = (DataMsg *) &(msg.data); --- 136,142 ---- /* Send all the collected data to the client */ uint8_t dseq = 0; ! uint8_t dst = 0, trial=0; ! uint8_t cnt=0; ! uint8_t seq=0; clearPacket(); dMsg = (DataMsg *) &(msg.data); *************** *** 147,153 **** drMsg->trialFrequency = tFrequency; ! if(!call SendDataMsg.send( } ! task void takeMeasurements() { uint16_t trial; --- 149,188 ---- drMsg->trialFrequency = tFrequency; ! while(sendBusy); ! if(!sendBusy) { ! sendBusy = TRUE; ! if(!call SendDataMsg.send(client, sizeof(DataMsg), &msg)) { ! sendBusy = FALSE; ! blink(ERROR); ! return; ! } ! else { ! blink(SND_D_MSG); ! } ! } ! ! /* Now start sending the data */ ! while(dst<nNodes) { ! while(trial<nTrials) { ! if(!sendBusy) { ! clearPacket(); ! dMsg = (DataMsg*) &(msg.data); ! dMsg->seqno=seq++; ! while(cnt < NUM_READINGS_PER_PACKET) // We can put 14 2-byte RSSI readings per packet ! dMsg->data[cnt++]= data[dst][trial++]; ! ! if(!call SendDataMsg.send(client, sizeof(DataMsg), &msg)) { ! sendBusy = FALSE; ! blink(ERROR); ! return; ! } ! else { ! blink(SND_D_MSG); ! } ! } ! } ! } } ! task void takeMeasurements() { uint16_t trial; *************** *** 224,227 **** --- 259,263 ---- if(TOS_LOCAL_ADDRESS == drMsg->source) { blink(RCV_DR_MSG); + client = drMsg->client; nTrials = drMsg->numTrials; nNodes = drMsg->numNodes; |
From: Karthik D. <da...@us...> - 2005-07-26 01:15:54
|
Update of /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22589 Modified Files: Fireworks.h FireworksM.nc Makefile TODO Log Message: More modifications Index: Makefile =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 25 Jul 2005 22:08:16 -0000 1.2 --- Makefile 26 Jul 2005 01:15:45 -0000 1.3 *************** *** 3,7 **** PFLAGS +=-DDELUGE_LEDS PFLAGS += -I%T/lib/Deluge -I%T/interfaces -I%T/tos/lib/Commands -I%T/platform/mica2 ! include ../Makerules PLATFORMS = mica2 mica2dot telos telosb telosa --- 3,7 ---- PFLAGS +=-DDELUGE_LEDS PFLAGS += -I%T/lib/Deluge -I%T/interfaces -I%T/tos/lib/Commands -I%T/platform/mica2 ! include $(TOSROOT)/apps/Makerules PLATFORMS = mica2 mica2dot telos telosb telosa Index: Fireworks.h =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks/Fireworks.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Fireworks.h 25 Jul 2005 22:19:40 -0000 1.4 --- Fireworks.h 26 Jul 2005 01:15:45 -0000 1.5 *************** *** 3,6 **** --- 3,8 ---- * Graduate Student * Firebug Project + * http://firebug.sf.net + * * Date: 7/20/2005 * *************** *** 24,39 **** */ enum { ! CLEAR = 0x0, \\ Begin application ! RCV_DR_MSG = 0x1, \\Received DataRequestMsg ! SND_P_MSG = 0x2, \\ Sent Ping Msg ! RCV_PR_MSG = 0x3, \\ Received PingReplyMsg ! RCV_P_MSG = 0x4, \\ Received Ping Msg ! SND_PR_MSG = 0x5, \\ Sent PingReplyMsg ! SND_D_MSG = 0x6, \\ Sent DataMsg ! ERROR = 0x7 \\ Error }; struct DataRequestMsg { ! uint16_t seqNo; uint16_t source; uint16_t numNodes; --- 26,41 ---- */ enum { ! CLEAR = 0x0, // Begin application ! RCV_DR_MSG = 0x1, // Received DataRequestMsg ! SND_P_MSG = 0x2, // Sent Ping Msg ! RCV_PR_MSG = 0x3, // Received PingReplyMsg ! RCV_P_MSG = 0x4, // Received Ping Msg ! SND_PR_MSG = 0x5, // Sent PingReplyMsg ! SND_D_MSG = 0x6, // Sent DataMsg ! ERROR = 0x7 // Error }; struct DataRequestMsg { ! uint16_t seqno; uint16_t source; uint16_t numNodes; *************** *** 45,54 **** typedef struct DataRequestMsg DataRequestMsg; struct DataMsg { ! uint16_t seqNo; ! uint16_t source; ! uint16_t numNodes; ! uint16_t numPowerLevels; ! uint16_t trialFrequency; } ; --- 47,61 ---- typedef struct DataRequestMsg DataRequestMsg; + /* The data msg is complicated since it goes over one packet. + The first packet is the header. It has all the above + information from the DataRequestMsg. The following packets + have just a sequence number and 16-bit RSSI values. It is + upto the client to figure out that there will be 'numTrials' + number of RSSI values for each destination and 'numNodes' + destinations */ + struct DataMsg { ! uint8_t seqno; ! uint16_t data[14]; } ; Index: TODO =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks/TODO,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TODO 25 Jul 2005 22:08:16 -0000 1.1 --- TODO 26 Jul 2005 01:15:45 -0000 1.2 *************** *** 1,3 **** ! - Implement ReceiveDataMsg.receive ! - Write README.txt --- 1,20 ---- ! SHORT TERM ! - Send data to client ! - Handle tFrequency - as of now, we do things at our own pace ! Ideally, we want two timers - one for timeouts and other for ! sending packets at a certain frequency ! - Handle power levels - as of now, we do everything at max power ! - Max number of trials that can be performed is 100. This is ! an artificial limitation. Use dynamic memory allocation to ! go beyond this. ! ! LONG TERM ! - Implement multi-hop data collection ! - We now assume that 3 seconds is long enough for a one-hop reply ! to receive the sender of the ping. If we are to do multihop, ! it might be dicy. Think of a better scheme to do loss resolution ! ! - Try to study path loss alongwith link loss ! - We can incorporate studies like congestion loss to error loss ! Index: FireworksM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/beta/fireworks/apps/Fireworks/FireworksM.nc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FireworksM.nc 25 Jul 2005 22:08:16 -0000 1.3 --- FireworksM.nc 26 Jul 2005 01:15:45 -0000 1.4 *************** *** 3,6 **** --- 3,8 ---- * Graduate Student * Firebug Project + * http://firebug.sf.net + * * Date: 7/20/2005 * *************** *** 19,23 **** interface SendMsg as SendPingReplyMsg; interface ReceiveMsg as ReceiveDataRequestMsg; - interface ReceiveMsg as ReceiveDataMsg; interface ReceiveMsg as ReceivePingMsg; interface ReceiveMsg as ReceivePingReplyMsg; --- 21,24 ---- *************** *** 41,44 **** --- 42,48 ---- uint16_t counter; uint16_t dest; + uint16_t rcvseq; + uint16_t lastseq; + uint16_t client; TOS_Msg msg; *************** *** 77,83 **** } ! task void sendPing() { ! /* NOTE: Again, since tasks dont seem to allow parameters, ! we use the global 'dest' as destination */ clearPacket(); pMsg = (PingMsg *) &(msg.data); --- 81,88 ---- } ! void sendPing() { ! /* NOTE: Since tasks do not seem to allow parameters, we use ! dest as a global variable. It should not be ! used by anybody else */ clearPacket(); pMsg = (PingMsg *) &(msg.data); *************** *** 95,98 **** --- 100,104 ---- /* We have sent the msg. Set timer to fire after 3 seconds */ blink(SND_P_MSG); + lastseq = pMsg->seqno; call Timer.start(TIMER_ONE_SHOT, 3072); counter++; *************** *** 104,114 **** task void sendPingReply() { /* NOTE: Since tasks do not seem to allow parameters, we use ! src and seqno as global variables. They should not be used by anybody else */ prMsg = (PingReplyMsg *) &(msg.data); prMsg->source = src; ! prMsg->seqno = seqno; if(!sendBusy) { --- 110,121 ---- task void sendPingReply() { /* NOTE: Since tasks do not seem to allow parameters, we use ! src and rcvseq as global variables. They should not be used by anybody else */ + clearPacket(); prMsg = (PingReplyMsg *) &(msg.data); prMsg->source = src; ! prMsg->seqno = rcvseq; if(!sendBusy) { *************** *** 127,133 **** task void sendData() { } - task void takeMeasurements() { uint16_t trial; --- 134,153 ---- task void sendData() { + /* Send all the collected data to the client */ + uint8_t dseq = 0; + + clearPacket(); + dMsg = (DataMsg *) &(msg.data); + dMsg->seqno = dseq++; + drMsg = (DataRequestMsg *) (&dMsg->data); + drMsg->source = TOS_LOCAL_ADDRESS; + drMsg->numNodes = nNodes; + drMsg->numTrials = nTrials; + drMsg->numPowerLevels = nPowerLevels; + drMsg->trialFrequency = tFrequency; + + if(!call SendDataMsg.send( } task void takeMeasurements() { uint16_t trial; *************** *** 136,140 **** RSSI value. Once we send a ping, we start a timer. If the timer expires, we assume that the node is out of range/unreachable */ - dest = 1; for(dest=1; dest <= nNodes; dest++) { counter = 0; --- 156,159 ---- *************** *** 147,151 **** trial ++; taskBusy = TRUE; ! post sendPing(); } } --- 166,170 ---- trial ++; taskBusy = TRUE; ! sendPing(); } } *************** *** 171,175 **** counter = 0; dest = 0; ! call CommControl.start(); --- 190,196 ---- counter = 0; dest = 0; ! rcvseq = 0; ! src = 0; ! client = 0; call CommControl.start(); *************** *** 192,196 **** blink(RCV_PR_MSG); taskBusy = FALSE; - } --- 213,216 ---- *************** *** 215,227 **** } - event TOS_MsgPtr ReceiveDataMsg.receive(TOS_MsgPtr m) { - return m; - } - event TOS_MsgPtr ReceivePingMsg.receive(TOS_MsgPtr m) { if(TOS_LOCAL_ADDRESS == m->addr) { blink(RCV_P_MSG); pMsg = (PingMsg *) &(m->data); ! while(taskBusy); --- 235,245 ---- } event TOS_MsgPtr ReceivePingMsg.receive(TOS_MsgPtr m) { if(TOS_LOCAL_ADDRESS == m->addr) { blink(RCV_P_MSG); pMsg = (PingMsg *) &(m->data); ! rcvseq = pMsg->seqno; ! src = pMsg->source; ! while(taskBusy); *************** *** 238,242 **** data[dest][counter]=LOST; taskBusy = FALSE; - sendBusy = FALSE; return SUCCESS; } --- 256,259 ---- |