INTRODUCTION Overview Download and Install Documentation Publications REPOSITORY Libraries DEVELOPER Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
receiverstatusdecoder.h00001 /* 00002 * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics 00003 * http://gearbox.sf.net/ 00004 * Copyright (c) 2004-2010 Michael Moser 00005 * 00006 * This distribution is licensed to you under the terms described in 00007 * the LICENSE file included in this distribution. 00008 * 00009 */ 00010 #ifndef GBX_NOVATEL_RECEIVER_STATUS_DECODER_H 00011 #define GBX_NOVATEL_RECEIVER_STATUS_DECODER_H 00012 00013 #include <stdint.h> 00014 #include <string> 00015 #include <sstream> 00016 namespace gbxnovatelutilacfr{ 00017 bool receiverStatusIsGood(uint32_t receiverStatus){ 00018 return 0 == (receiverStatus & 0xe1fe8fef); // quick cross-check: this magic value needs to be the sum of the magic values in the next three functions 00019 } 00020 bool receiverStatusIsWarning(uint32_t receiverStatus){ 00021 return 0 != (receiverStatus & 0xe1fc000e); 00022 } 00023 bool receiverStatusIsError(uint32_t receiverStatus){ 00024 return 0 != (receiverStatus & 0x00028fe0); 00025 } 00026 bool receiverStatusIsFatal(uint32_t receiverStatus){ 00027 return 0 != (receiverStatus & 0x00000001); 00028 } 00029 bool receiverStatusIsReservedValue(uint32_t receiverStatus){ 00030 return 0 != (receiverStatus & 0x1e017010); // quick cross-check: this magic value, summed with the one from receiverStatusIsGood() should yield 0xffffffff 00031 } 00032 std::string receiverStatusToString(uint32_t receiverStatus){ 00033 std::stringstream ss; 00034 ss << "Error flag: " 00035 << ((0 == (receiverStatus & 0x00000001)) ? "No error" : "Error") << "; "; // unrecoverable --> exception 00036 ss << "Temperature status: " 00037 << ((0 == (receiverStatus & 0x00000002)) ? "Within specifications" : "Warning") << "; ";// warning (error?) 00038 ss << "Voltage supply status: " 00039 << ((0 == (receiverStatus & 0x00000004)) ? "OK" : "Warning") << "; "; // warning (error?) 00040 ss << "Antenna power status: " 00041 << ((0 == (receiverStatus & 0x00000008)) ? "Powered" : "Not powered") << "; "; // warning (are there unpowered antennas??) 00042 ss << "Antenna open flag: " 00043 << ((0 == (receiverStatus & 0x00000020)) ? "OK" : "Open") << "; "; // error 00044 ss << "Antenna shorted flag: " 00045 << ((0 == (receiverStatus & 0x00000040)) ? "OK" : "Shorted") << "; "; // error 00046 ss << "CPU overload flag: " 00047 << ((0 == (receiverStatus & 0x00000080)) ? "No overload" : "Overload") << "; "; // error (recoverable? warning?) 00048 ss << "COM1 buffer overrun flag: " 00049 << ((0 == (receiverStatus & 0x00000100)) ? "No overrun" : "Overrun") << "; "; // error (recoverable? warning?) 00050 ss << "COM2 buffer overrun flag: " 00051 << ((0 == (receiverStatus & 0x00000200)) ? "No overrun" : "Overrun") << "; "; // error (recoverable? warning?) 00052 ss << "COM3 buffer overrun flag: " 00053 << ((0 == (receiverStatus & 0x00000400)) ? "No overrun" : "Overrun") << "; "; // error (recoverable? warning?) 00054 ss << "USB buffer overrun flag: " 00055 << ((0 == (receiverStatus & 0x00000800)) ? "No overrun" : "Overrun") << "; "; // error (recoverable? warning?) 00056 ss << "RF1 AGC status: " 00057 << ((0 == (receiverStatus & 0x00008000)) ? "OK" : "Bad") << "; "; // error 00058 ss << "RF2 AGC status: " 00059 << ((0 == (receiverStatus & 0x00020000)) ? "OK" : "Bad") << "; "; // error 00060 ss << "Almanac flag/UTC known: " 00061 << ((0 == (receiverStatus & 0x00040000)) ? "Valid" : "Invalid") << "; "; //warning 00062 ss << "Position solution flag: " 00063 << ((0 == (receiverStatus & 0x00080000)) ? "Valid" : "Invalid") << "; "; //warning 00064 ss << "Position fixed flag: " 00065 << ((0 == (receiverStatus & 0x00100000)) ? "Not" : "fixed Fixed") << "; "; //warning 00066 ss << "Clock steering status: " 00067 << ((0 == (receiverStatus & 0x00200000)) ? "Enabled" : "Disabled") << "; "; //warning 00068 ss << "Clock model flag: " 00069 << ((0 == (receiverStatus & 0x00400000)) ? "Valid" : "Invalid") << "; "; //warning 00070 ss << "OEMV card external oscillator flag: " 00071 << ((0 == (receiverStatus & 0x00800000)) ? "Disabled" : "Enabled") << "; "; //warning (is this really a warning??) 00072 ss << "Software resource: " 00073 << ((0 == (receiverStatus & 0x01000000)) ? "OK" : "Warning") << "; "; //warning (error?) 00074 ss << "Auxiliary 3 status event flag: " 00075 << ((0 == (receiverStatus & 0x20000000)) ? "No event" : "Event") << "; "; //warning 00076 ss << "Auxiliary 2 status event flag: " 00077 << ((0 == (receiverStatus & 0x40000000)) ? "No event" : "Event") << "; "; //warning 00078 ss << "Auxiliary 1 status event flag: " 00079 << ((0 == (receiverStatus & 0x80000000)) ? "No event" : "Event"); //warning 00080 return ss.str(); 00081 } 00082 }//namespace 00083 00084 #endif |