#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main(int argc, char *argv[]) { struct termios SerialOptions; string Port = argv[1]; int FileDescriptor = open(Port.c_str(), O_RDWR | O_NOCTTY); if(FileDescriptor == -1) { cout<<"Error: Cannot open port "< CommaPos; for(unsigned int k = FoundGPGGA+1; k < FoundStar; k++) if(Data.substr(k,1) == ",") CommaPos.push_back(k); if(CommaPos.size() == 14) { float GpsClockH = 0; float GpsClockM = 0; float GpsClockS = 0; if(CommaPos.at(1)-CommaPos.at(0) > 6) { string Temp = Data.substr(CommaPos.at(0)+1,CommaPos.at(1)-CommaPos.at(0)-1); GpsClockH = atoi(Temp.substr(0,2).c_str()); GpsClockM = atof(Temp.substr(2,2).c_str()); GpsClockS = atof(Temp.substr(4,CommaPos.at(1)-1).c_str()); cout<<"gps clock: "< 4) { string Temp = Data.substr(CommaPos.at(1)+1,CommaPos.at(2)-CommaPos.at(1)-1); Latitude += atoi(Temp.substr(0,2).c_str()); Latitude += atof(Temp.substr(2,CommaPos.at(2)-1).c_str())/60; cout<<"latitude: "< 5) { string Temp = Data.substr(CommaPos.at(3)+1,CommaPos.at(4)-CommaPos.at(1)-1); Longitude += atoi(Temp.substr(0,3).c_str()); Longitude += atof(Temp.substr(3,CommaPos.at(4)-1).c_str())/60; cout<<"longitude: "< 1) { QualityIndicator = (atoi(Data.substr(CommaPos.at(5)+1,CommaPos.at(6)-1).c_str())) & 0x0F; cout<<"quality: "< 1) { Satellites = atoi(Data.substr(CommaPos.at(6)+1,CommaPos.at(7)-1).c_str()); cout<<"satellites: "< 1) { Hdop = atof(Data.substr(CommaPos.at(7)+1,CommaPos.at(8)-1).c_str()); cout<<"hdop: "< 1) { Altitude = atof(Data.substr(CommaPos.at(8)+1,CommaPos.at(9)-1).c_str()); cout<<"altitude: "< 1) { Separation = atof(Data.substr(CommaPos.at(10)+1,CommaPos.at(11)-1).c_str()); cout<<"separation: "< 1) { Delay = atof(Data.substr(CommaPos.at(12)+1,CommaPos.at(13)-1).c_str()); cout<<"delay: "< 1) { StationId = atof(Data.substr(CommaPos.at(13)+1,FoundStar-1).c_str()); cout<<"station id: "<