From: Curt M. <we...@us...> - 2003-03-04 23:55:39
|
Update of /cvsroot/xastir/xastir/src In directory sc8-pr-cvs1:/tmp/cvs-serv27468 Modified Files: main.c Log Message: Converted to switch statement in new GPS transfer routines. Can now because it's an int. Index: main.c =================================================================== RCS file: /cvsroot/xastir/xastir/src/main.c,v retrieving revision 1.240 retrieving revision 1.241 diff -C2 -d -r1.240 -r1.241 *** main.c 4 Mar 2003 23:42:13 -0000 1.240 --- main.c 4 Mar 2003 23:55:34 -0000 1.241 *************** *** 8660,8780 **** // threading more efficient. (void)pthread_detach(pthread_self()); - - if (input_param == 1) { // Fetch track from GPS - // gpsman.tcl -dev /dev/ttyS0 getwrite TR Shapefile_2D track.date ! fprintf(stderr,"Fetch track from GPS\n"); ! xastir_snprintf(gps_filename, ! sizeof(gps_filename), ! "Team1_Track_Red.shp"); ! ! xastir_snprintf(temp, ! sizeof(temp), ! "%s getwrite TR %s%s", ! prefix, ! postfix, ! gps_filename); ! if ( system(temp) ) { ! fprintf(stderr,"Couldn't download the gps track\n"); ! gps_operation_pending = 0; // We're done ! return(NULL); ! } ! // Set the got_data flag ! gps_got_data_from++; ! } ! else if (input_param == 2) { // Fetch route from GPS ! // gpsman.tcl -dev /dev/ttyS0 getwrite RT Shapefile_2D routes.date ! fprintf(stderr,"Fetch routes from GPS\n"); ! xastir_snprintf(gps_filename, ! sizeof(gps_filename), ! "Team2_Routes_Green.shp"); ! xastir_snprintf(temp, ! sizeof(temp), ! "%s getwrite RT %s%s", ! prefix, ! postfix, ! gps_filename); ! ! if ( system(temp) ) { ! fprintf(stderr,"Couldn't download the gps routes\n"); ! gps_operation_pending = 0; // We're done ! return(NULL); ! } ! ! // Set the got_data flag ! gps_got_data_from++; ! } ! else if (input_param == 3) { // Fetch waypoints from GPS ! // gpsman.tcl -dev /dev/ttyS0 getwrite WP Shapefile_2D waypoints.date ! fprintf(stderr,"Fetch waypoints from GPS\n"); ! xastir_snprintf(gps_filename, ! sizeof(gps_filename), ! "Team3_Waypoints.shp"); ! xastir_snprintf(temp, ! sizeof(temp), ! "%s getwrite WP %s%s", ! prefix, ! postfix, ! gps_filename); ! ! if ( system(temp) ) { ! fprintf(stderr,"Couldn't download the gps waypoints\n"); ! gps_operation_pending = 0; // We're done ! return(NULL); ! } ! ! // Set the got_data flag ! gps_got_data_from++; ! } ! ! ! else if (input_param == 4) { // Send track to GPS ! // gpsman.tcl -dev /dev/ttyS0 readput Shapefile_2D track.date TR ! ! fprintf(stderr,"Send track to GPS\n"); ! fprintf(stderr,"Not implemented yet\n"); ! gps_operation_pending = 0; // We're done ! return(NULL); ! } ! else if (input_param == 5 ) { // Send route to GPS ! // gpsman.tcl -dev /dev/ttyS0 readput Shapefile_2D routes.date RT ! fprintf(stderr,"Send route to GPS\n"); ! fprintf(stderr,"Not implemented yet\n"); ! gps_operation_pending = 0; // We're done ! return(NULL); ! } ! else if (input_param == 6) { // Send waypoints to GPS ! // gpsman.tcl -dev /dev/ttyS0 readput Shapefile_2D waypoints.date WP ! fprintf(stderr,"Send waypoints to GPS\n"); ! fprintf(stderr,"Not implemented yet\n"); ! gps_operation_pending = 0; // We're done ! return(NULL); ! } ! else { ! fprintf(stderr,"Illegal parameter passed to GPS_operations function!\n"); ! gps_operation_pending = 0; // We're done ! return(NULL); ! } --- 8660,8774 ---- // threading more efficient. (void)pthread_detach(pthread_self()); ! switch (input_param) { ! case 1: // Fetch track from GPS ! // gpsman.tcl -dev /dev/ttyS0 getwrite TR Shapefile_2D track.date ! fprintf(stderr,"Fetch track from GPS\n"); ! xastir_snprintf(gps_filename, ! sizeof(gps_filename), ! "Team1_Track_Red.shp"); ! ! xastir_snprintf(temp, ! sizeof(temp), ! "%s getwrite TR %s%s", ! prefix, ! postfix, ! gps_filename); + if ( system(temp) ) { + fprintf(stderr,"Couldn't download the gps track\n"); + gps_operation_pending = 0; // We're done + return(NULL); + } + // Set the got_data flag + gps_got_data_from++; + break; ! case 2: // Fetch route from GPS ! // gpsman.tcl -dev /dev/ttyS0 getwrite RT Shapefile_2D routes.date ! fprintf(stderr,"Fetch routes from GPS\n"); ! xastir_snprintf(gps_filename, ! sizeof(gps_filename), ! "Team2_Routes_Green.shp"); ! xastir_snprintf(temp, ! sizeof(temp), ! "%s getwrite RT %s%s", ! prefix, ! postfix, ! gps_filename); + if ( system(temp) ) { + fprintf(stderr,"Couldn't download the gps routes\n"); + gps_operation_pending = 0; // We're done + return(NULL); + } + // Set the got_data flag + gps_got_data_from++; + break; ! case 3: // Fetch waypoints from GPS ! // gpsman.tcl -dev /dev/ttyS0 getwrite WP Shapefile_2D waypoints.date ! fprintf(stderr,"Fetch waypoints from GPS\n"); ! xastir_snprintf(gps_filename, ! sizeof(gps_filename), ! "Team3_Waypoints.shp"); ! xastir_snprintf(temp, ! sizeof(temp), ! "%s getwrite WP %s%s", ! prefix, ! postfix, ! gps_filename); + if ( system(temp) ) { + fprintf(stderr,"Couldn't download the gps waypoints\n"); + gps_operation_pending = 0; // We're done + return(NULL); + } + // Set the got_data flag + gps_got_data_from++; + break; ! case 4: // Send track to GPS ! // gpsman.tcl -dev /dev/ttyS0 readput Shapefile_2D track.date TR ! fprintf(stderr,"Send track to GPS\n"); ! fprintf(stderr,"Not implemented yet\n"); ! gps_operation_pending = 0; // We're done ! return(NULL); ! break; + case 5: // Send route to GPS + // gpsman.tcl -dev /dev/ttyS0 readput Shapefile_2D routes.date RT ! fprintf(stderr,"Send route to GPS\n"); ! fprintf(stderr,"Not implemented yet\n"); ! gps_operation_pending = 0; // We're done ! return(NULL); ! break; ! case 6: // Send waypoints to GPS ! // gpsman.tcl -dev /dev/ttyS0 readput Shapefile_2D waypoints.date WP + fprintf(stderr,"Send waypoints to GPS\n"); + fprintf(stderr,"Not implemented yet\n"); + gps_operation_pending = 0; // We're done + return(NULL); + break; ! default: ! fprintf(stderr,"Illegal parameter passed to GPS_operations function!\n"); ! gps_operation_pending = 0; // We're done ! return(NULL); ! break; ! } // End of switch |