Exemple #1
0
int main(int argc, char const *argv[]) {
    char strings[][73] = {  "$GPGGA,152606.000,3732.7200,N,07726.9881,W,1,4,1.56,159.0,M,-33.6,M,,*64",
                            "$GPGSA,A,3,21,14,22,24,,,,,,,,,1.85,1.56,0.99*0C",
                            "$GPRMC,152606.000,A,3732.7200,N,07726.9881,W,0.29,81.28,110413,,,A*48",
                            "$GPVTG,81.28,T,,M,0.29,N,0.53,K,A*03",
                            "$PGTOP,11,2*6E" };
    for (int i = 0; i < 5; i++) {
        nmea_parse(strings[i], strlen(strings[i]));
    }

    // Validate state
    within_range(get_latitude(), 37.545333, 0.00001f);
    within_range(get_longitude(), -77.449802, 0.00001f);
    within_range(get_altitude(), 159.0, 0.1f);
    validate_int(get_sat_count(), 4);
    validate_int(get_fix_type(), 3);

    nmea_parser_t *parser = nmea_parser_new();
    for (int i = 0; i < 5; i++) {
        nmea_parse_r(strings[i], strlen(strings[i]), parser);
    }
    within_range(get_latitude_r(parser), 37.545333, 0.00001f);
    within_range(get_longitude_r(parser), -77.449802, 0.00001f);
    within_range(get_altitude_r(parser), 159.0, 0.1f);
    validate_int(get_sat_count_r(parser), 4);
    validate_int(get_fix_type_r(parser), 3);
    nmea_parser_free(&parser); 
    assert(NULL == parser);
    return error;
}
/*
 *  Updates our gps coordinate structure with the newest buffer
 *  data.
 */
void update_coordinates(char *buffer, uint32_t index)
{
  char *latitude = get_latitude();
  char *longitude = get_longitude();
  char *altitude = get_altitude();

  index = index%BUFFERSIZE;

  // skip the time
  index = _skip_data(buffer, index);

  index = set_location(buffer, index, latitude, 10);
  index = set_location(buffer, index, longitude, 11);

  // skip the fix
  index = _skip_data(buffer, index);
  //sendIndex(index);

  //index = (index+2)%BUFFERSIZE;
  // get satalites tracked
  index = set_satellites_tracked(buffer, index);
  //sendIndex(index);

  //sendIndex(index);
  // skip Horizontal dilution of position
  index = _skip_data(buffer, index);

  // altitude
  index = set_location(buffer, index, altitude, 15);

}
Exemple #3
0
void config_handler::print() {
  //
  // Display internal settings set from reading steering
  //
  string mn = "print:";
  string def = "<default>";

  int w1=30; //arbitrary spacing size that makes formatting look pretty for data names
  int w2=30; //arbitrary spacing size that makes formatting look pretty for data options

  
  cout<<cn<<mn<<" >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
      <<"\n"<<setw(w1)<<"DEBUG: "                       <<setw(w2)<<(debug? "ON":"OFF")
      <<"\n"<<setw(w1)<<"RUN IN BACKGROUND: "           <<setw(w2)<<(get_background()? "ON":"OFF")
      <<"\n"<<setw(w1)<<"SIMULATION: "                  <<setw(w2)<<(get_simulate()? "ON":"OFF")
      <<"\n"<<setw(w1)<<"FILTER FIRST: "                <<setw(w2)<<(get_filter()? "ON":"OFF")
      <<"\n"<<setw(w1)<<"SAVE RECORDINGS: "             <<setw(w2)<<(get_save_rec()? "ON":"OFF")
      <<"\n"<<setw(w1)<<"HUMAN READABLE OUTPUT: "       <<setw(w2)<<(get_output_formatted()? "ON":"OFF")
      <<"\n"<<setw(w1)<<"Output Type ID: "              <<setw(w2)<<"\""<<get_output_type_id()<<"\""
      <<"\n"<<setw(w1)<<"RPi Latitude: "                <<setw(w2)<<"\""<<get_latitude()<<"\""
      <<"\n"<<setw(w1)<<"RPi Longitude: "               <<setw(w2)<<"\""<<get_longitude()<<"\""
      <<"\n"<<setw(w1)<<"RPi ID: "                      <<setw(w2)<<"\""<<get_rpid()<<"\""
      <<"\n"<<setw(w1)<<"Simulation Data Dir: "         <<setw(w2)<<"\""<<get_simulate_dir()<<"\""
      <<"\n"<<setw(w1)<<"Config Path: "                 <<setw(w2)<<"\""<<get_config_file_path()<<"\""
      <<"\n"<<setw(w1)<<"Config Name: "                 <<setw(w2)<<"\""<<get_config_file_name()<<"\""
      <<"\n"<<setw(w1)<<"Config File: "                 <<setw(w2)<<"\""<<get_config_file()<<"\""
      <<"\n"<<setw(w1)<<"Final Feature Format: "        <<setw(w2)<<"\""<<get_final_feature_format()<<"\""
      <<"\n"<<setw(w1)<<"Filter Vector Path: "          <<setw(w2)<<"\""<<get_fv_filter_path()<<"\""
      <<"\n"<<setw(w1)<<"Filter Vector Name: "          <<setw(w2)<<"\""<<get_fv_filter_name()<<"\""
      <<"\n"<<setw(w1)<<"Filter Vector File: "          <<setw(w2)<<"\""<<get_fv_filter()<<"\""
      <<"\n"<<setw(w1)<<"Feature Vector Path: "         <<setw(w2)<<"\""<<get_fv_file_path()<<"\""
      <<"\n"<<setw(w1)<<"Feature Vector Name: "         <<setw(w2)<<"\""<<get_fv_file_name()<<"\""
      <<"\n"<<setw(w1)<<"Feature Vector File: "         <<setw(w2)<<"\""<<get_fv_file()<<"\""
      <<"\n"<<setw(w1)<<"Analysis File(s) Path: "       <<setw(w2)<<"\""<<get_analysis_location()<<"\""
      <<"\n"<<setw(w1)<<"Data File(s) Path: "           <<setw(w2)<<"\""<<get_data_location()<<"\""
      <<"\n"<<setw(w1)<<"Media Location File Path: "    <<setw(w2)<<"\""<<get_media_location()<<"\""
      <<"\n"<<setw(w1)<<"Recording Extention: "         <<setw(w2)<<"\""<<get_rec_extention()<<"\""
      <<"\n"<<setw(w1)<<"Recording File Name Prefix: "  <<setw(w2)<<"\""<<get_rec_file_name_prefix()<<"\""
      <<"\n"<<setw(w1)<<"Recording Rate: "              <<setw(w2)<<"\""<<get_samp_rate()<<"\""
      <<"\n"<<setw(w1)<<"Recording Duration: "          <<setw(w2)<<"\""<<get_rec_duration()<<"\""
      <<"\n"<<setw(w1)<<"Recording Number: "            <<setw(w2)<<"\""<<get_rec_number()<<"\""<<endl;
  cout<<cn<<mn<<" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"<<endl;            
  
  return;
}