00001 #pragma ident "$Id: EngNav.hpp 3190 2012-07-05 13:27:16Z jwbasden $"
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00044 #ifndef GPSTK_ENGNAV_HPP
00045 #define GPSTK_ENGNAV_HPP
00046
00047
00048 #include <sys/types.h>
00049 #include <ostream>
00050
00051 #include "gpstkplatform.h"
00052 #include "BinUtils.hpp"
00053
00054 namespace gpstk
00055 {
00058
00059 struct DecodeQuant;
00060
00067 class EngNav
00068 {
00069 public:
00071 enum BitConvertType
00072 {
00073 BITS8 = 0,
00074 BITS10 = 1
00075 };
00076
00078 EngNav() throw();
00079
00081 virtual ~EngNav() {}
00082
00083
00097 static uint32_t computeParity(uint32_t sfword,
00098 uint32_t psfword,
00099 bool knownUpright=true);
00100
00113 static uint32_t fixParity(uint32_t sfword,
00114 uint32_t psfword,
00115 bool nib);
00116
00121 static bool checkParity(const uint32_t input[10], bool knownUpright=true);
00122 static bool checkParity(const std::vector<uint32_t>& v, bool knownUpright=true);
00123
00124
00126 static bool subframeParity(const long input[10]);
00127
00128
00131 static inline uint32_t getd30(uint32_t sfword)
00132 {
00133 return (sfword & 0x01);
00134 }
00135
00137 static inline uint32_t getd29(uint32_t sfword)
00138 {
00139 return ((sfword & 0x02) >> 1);
00140 }
00141
00143 static inline unsigned long getHOWTime(uint32_t word2)
00144 {
00145 word2 >>= 13;
00146 word2 &= 0x0001FFFFL;
00147 return word2 * 6;
00148 }
00149
00151 static inline short getSFID(uint32_t word2)
00152 {
00153 word2 >>= 8;
00154 word2 &= 0x00000007L;
00155 return word2 ;
00156 }
00157
00158
00171 static bool subframeConvert(const long input[10],
00172 int gpsWeek,
00173 double output[60])
00174 throw();
00175
00188 static bool subframeConvert(const uint32_t input[10],
00189 short gpsWeek,
00190 double output[60])
00191 throw();
00192
00200 static bool convert8bit(int gpsWeek, double *out)
00201 throw();
00202
00210 static bool convert10bit(int gpsWeek, double *out)
00211 throw();
00212
00222 static short convertXBit( short fullGPSWeek,
00223 short incompleteGPSWeek,
00224 BitConvertType type);
00225
00250 static short getSubframePattern(const long input[10])
00251 throw();
00252 static short getSubframePattern(const uint32_t input[10])
00253 throw();
00254 static void dump(std::ostream& s = std::cout);
00255
00256
00257 private:
00258
00277 static void convertQuant(const uint32_t input[10],
00278 double output[60],
00279 DecodeQuant *p)
00280 throw();
00281 };
00282
00284
00285 }
00286
00287 #endif