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

Last change on this file since 2452 was 661, checked in by mervart, 17 years ago

* empty log message *

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