int main(int argc, char* argv[]) { if (argc != 3) { cout << "FICAFIC" << endl << " converts an ASCII FIC file to a binary FIC file" << endl << endl << "usage:" << endl << " ficfica inputfile outputfile" << endl << endl << "where:" << endl << " inputfile: an input ASCII FIC file name" << endl << " outputfile: an output binary FIC file name" << endl; return 0; } FICAStream fics(argv[1]); FICHeader header; header.getRecord(fics); fics.close(); FICStream out(argv[2], ios::out); out << header; out.close(); FileFilterFrame<FICAStream, FICData> input(argv[1]); FileFilterFrame<FICStream, FICData> output; list<FICData> alist = input.getData(); output.addData(alist); output.writeFile(argv[2], true); return 0; }
bool isFICAFile(const string& file) { try { FICAStream fics(file.c_str()); FICHeader header; header.getRecord(fics); fics.close(); FileFilterFrame<FICAStream, FICData> input(file.c_str()); return true; } catch(FFStreamError& ffse) { return false; } catch(Exception& e) { GPSTK_RETHROW(e); } }
int ReadFICAFile(string infile) { try { lofs << "Its an FICA file" << endl; FICAStream fics(infile.c_str()); FICHeader header; header.getRecord(fics); fics.close(); FileFilterFrame<FICAStream, FICData> input(infile.c_str()); list<long> blockList; blockList.push_back(9); blockList.push_back(62); input.filter(FICDataFilterBlock(blockList)); list<FICData> ficList = input.getData(); list<FICData>::iterator itr = ficList.begin(); while (itr != ficList.end()) { if (itr->blockNum == 62) { AlmOrbit ao(*itr); if (debug) lofs << "Its a 62 for PRN " << ao.getPRNID(); if (ao.getSVHealth() != 0) { itr++; continue; } // don't use if flag is unhealthy aolist.push_back(ao); if (aomap.find(ao.getPRNID()) == aomap.end()) { if (debug) lofs << " -- add it"; aomap[ao.getPRNID()] = ao; } if (debug) lofs << endl; } if (itr->blockNum == 9) { FICData& r = *itr; EngEphemeris ee(r); ges.addEphemeris(ee); } itr++; } return 0; } catch(Exception& e) { GPSTK_RETHROW(e); } }