source: ntrip/trunk/BNC/RTIGS/cgps_transform.h@ 543

Last change on this file since 543 was 306, checked in by mervart, 18 years ago

* empty log message *

File size: 5.5 KB
Line 
1
2#ifndef CGPS_TRANSFORM_H
3#define CGPS_TRANSFORM_H
4
5#include <string.h>
6#include <stdio.h>
7#include <math.h>
8#include <sys/time.h>
9#include <iostream>
10
11using namespace std;
12
13#include "rtacp.h"
14#include "rtstruct.h"
15#include "rtigs_records.h"
16
17#define MAXCHANNELS_FOR_SOCKETS_TYPE1 12
18#define MAXSV 32
19#define ScaleFactor1 4.0914555603263203 //(f1ion + f2ion)
20#define ScaleFactor2 2 * F1ION
21#define MAXL1L2 41.94302
22
23void SwitchBytes( char *Start, int Size );
24
25typedef struct
26{
27 unsigned char prn; // satellite ID
28 unsigned short epoch_sequence; // like Ashtech seq number of phase epochs
29 // was like this, now modulo 10 hours,
30 // each digit is now 1 sec, not .05 secs like before
31
32 char ca_range[5]; // ca range in millimeters
33 // first 4 bits are status bits, as follows
34 // if bit 7 on, sucessful packing of ca_range
35 // if bit 6 on, Z track mode or AS is on
36 // if bit 5 on, overflow of L2_block phase
37 // if bit 4 on, overflow of L1_block phase
38 // next 36 bits are the observable
39 // 68719.476735 is the max allowable obsev.
40 // if not packed, L2_block and L1_block is
41 // just then packed with 0s
42
43 unsigned char CA_snr; // receiver snr for ca in dbHz KML the SNR is (DBHz * 4.25) rounded to an int (max is 60.0)
44
45 char L2_range_phase[5];
46 // first 2 bytes and 2 bits is for the range, next 6 bits and 2 bytes are for phase.
47 //
48 // range units are in millimeters, from -131071 to 131071 (2^17 - 1)
49 // 0000 0000 0000 0000 01 would be +1 mm
50 // 1000 0000 0000 0000 01 would be -1 mm
51 // 0100 0000 0000 0000 00 would be 65536 mm
52 // 1100 0000 0000 0000 00 would be -65536 mm
53 // 0111 1111 1111 1111 11 would be 131071 mm
54 // 1111 1111 1111 1111 11 woule be -131071 mm
55 // dynamic range must be <= 131.071 meters
56 //
57 // phase units are in 2/100 millimeters from -4194304 to 4194304
58 // 00 0000 0000 0000 0000 0001 would be +.02 mm
59 // 10 0000 0000 0000 0000 0001 would be -.02 mm
60 // 01 1111 1111 1111 1111 1111 ( 2097151) would be 41943.02 mm
61 // 11 1111 1111 1111 1111 1111 (-2097151) would be -41943.02 mm
62 // (2^21 - 1)*2 mm
63 // dynamic range must be <= 41.94302 meters
64 //
65 // note if the limits are exceded, a -0 (minus zero) is returned
66 // indicating not a number
67 //
68 // Note however, we extended this dynamic range to 83.88606 meters as
69 // below with the spare bits in the ca_range field. If this limit
70 // is exceeded we return a -0 ( minus zero )
71 unsigned char L2_snr; // snr for this data type in dbHz KML the SNR is (DBHz * 4.25) rounded to an int (max is 60.0 )
72
73 char L1_range_phase[5]; // same as format for L2_range_phase
74
75 unsigned char L1_snr; // snr for this data type in dbHz KML the SNR is (DBHz * 4.25) rounded to an int (max is 60.0 )
76
77} JPL_COMP_OBS_T;
78
79typedef struct
80{
81 TNAV_T Eph[MAXSV]; //32 prns
82} ARR_TNAV_T;
83
84typedef struct {
85 CMEAS_T Obs[MAXSV]; //32 obs
86} ARR_OBS_T ;
87
88class CGPS_Transform {
89 friend class RTIGSDecoder;
90private:
91 ARR_OBS_T DecObs;
92 ARR_TNAV_T TNAV_Eph;
93 short NumObsRead;
94 short CAFlag;
95 short ASFlag;
96 short P2Flag;
97 short P1Flag;
98 bool f_IsLittleEndian;
99 unsigned short PhaseArcStartTime[MAXSV];
100public:
101 CGPS_Transform();
102 ~CGPS_Transform();
103 void InitEndianFlag();
104 short Decode_Soc_Obs(unsigned char *SocStr, short &StrIndex, short index, short SocBytes);
105 short Decode_RTIGS_Soc_Obs(unsigned char *SocStr, short &StrPos, short CMeasIndex, short SocBytes, unsigned long GPSTime);
106 short RTIGSO_Str_To_CMEAS(unsigned char *RTIGSO_Str, short RTIGS_Bytes, RTIGSO_T &rtigs_obs); //done needs testing KML
107 void print_CMEAS();
108 short Save_TNAV_T_To_Container(TNAV_T *rtcurrent_eph, short &prn);
109 short CA_Extract(char * CAStr, double &CA_Rng); //done
110 short P1_P2_Block_Extract(char * P1P2Str, double CA, double &Rng , double &Phase, double &RngF2Delta,short decode_F1orF2Flag );//done
111 unsigned long JPL_xtractLongVal (unsigned startBitNbr, unsigned xtractNbrBits, const char *msg); //done
112 inline void SwitchIGS_Sta_HdrBytes( RTIGSS_T *StaHdr);
113 inline void SwitchIGS_Obs_HdrBytes( RTIGSO_T *ObsHdr);
114 inline void SwitchIGS_Eph_HdrBytes( RTIGSE_T *EphHdr);
115 inline short SwitchIGS_Met_RecBytes( RTIGSM_T *MetHdr);
116 unsigned short GetRTIGSHdrRecType(unsigned char *RTIGS_Str);
117 unsigned short GetRTIGSHdrStaID(unsigned char *RTIGS_Str);
118 unsigned short GetRTIGSHdrRecBytes(unsigned char *RTIGS_Str);
119 unsigned long GetRTIGSHdrGPSSeconds(unsigned char *RTIGS_Str);
120 short Decode_RTIGS_Sta(unsigned char *RTIGS_Str, unsigned short RTIGS_Bytes, RTIGSS_T &rtigs_sta_dec); // contents of record contain all info
121 short Decode_RTIGS_Obs(unsigned char *RTIGS_Str, unsigned short RTIGS_Bytes, RTIGSO_T &rtigs_obs); // stores obs in class container
122 short Decode_RTIGS_Eph(unsigned char *RTIGS_Str, unsigned short RTIGS_Bytes, RTIGSE_T &rtigs_eph, short arrPRN[]); // stores eph in class container
123 short Decode_RTIGS_Eph(unsigned char *RTIGS_Str, unsigned short RTIGS_Bytes, RTIGSE_T &rtigs_eph, short &PRN); //stors in class and returns prn
124 short Decode_RTIGS_Met(unsigned char *RTIGS_Str, unsigned short RTIGS_Bytes, RTIGSM_T *rtigs_met); // contents of record contain all info.
125};
126
127#endif
Note: See TracBrowser for help on using the repository browser.