1 | /*********************************************************************
|
---|
2 | // created: 2011/06/28 - 18:18
|
---|
3 | // filename: cptComponent.h
|
---|
4 | //
|
---|
5 | // author: Sergio Rodriguez
|
---|
6 | //
|
---|
7 | // version: $Id: $
|
---|
8 | //
|
---|
9 | // purpose: Acquire SPAN CPT data
|
---|
10 | //
|
---|
11 | *********************************************************************/
|
---|
12 |
|
---|
13 | #ifndef CPTCOMPONENT_H
|
---|
14 | #define CPTCOMPONENT_H
|
---|
15 |
|
---|
16 | #include <fstream>
|
---|
17 | #include <qobject.h>
|
---|
18 | #include <string>
|
---|
19 |
|
---|
20 | #include "extlib/NMEA0183/nmea0183.h"
|
---|
21 | #include "kernel/ComponentBase.h"
|
---|
22 | #include "kernel/DbiteFile.h"
|
---|
23 | #include "kernel/pacpus.h"
|
---|
24 |
|
---|
25 | #ifdef WIN32
|
---|
26 | # include "../../driver/win32SerialPort.h"
|
---|
27 | #else
|
---|
28 | # include "../../driver/PosixSerialPort.h"
|
---|
29 | #endif
|
---|
30 |
|
---|
31 | #include "structure/structure_gps.h"
|
---|
32 | #include "PacpusCityVIP/Tools/genericStructures.h"
|
---|
33 |
|
---|
34 | // Export macro for CPTComponent DLL for Windows only
|
---|
35 | #ifdef WIN32
|
---|
36 | # ifdef CPTCOMPONENT_EXPORTS
|
---|
37 | // make DLL
|
---|
38 | # define CPTCOMPONENT_API __declspec(dllexport)
|
---|
39 | # else
|
---|
40 | // use DLL
|
---|
41 | # define CPTCOMPONENT_API __declspec(dllimport)
|
---|
42 | # endif
|
---|
43 | #else
|
---|
44 | // On other platforms, simply ignore this
|
---|
45 | # define CPTCOMPONENT_API
|
---|
46 | #endif
|
---|
47 |
|
---|
48 | namespace pacpus {
|
---|
49 |
|
---|
50 | class ShMem;
|
---|
51 |
|
---|
52 | struct CPTCOMPONENT_API Stream8Position
|
---|
53 | {
|
---|
54 | int32_t dataPos;
|
---|
55 | int32_t length;
|
---|
56 | };
|
---|
57 |
|
---|
58 | #define UNKNOWN_NMEA_FRAME -1
|
---|
59 |
|
---|
60 | /// The definition of the CPTComponent class
|
---|
61 | class CPTCOMPONENT_API CPTComponent
|
---|
62 | : public QObject
|
---|
63 | , public ComponentBase
|
---|
64 | {
|
---|
65 | Q_OBJECT
|
---|
66 |
|
---|
67 | public:
|
---|
68 | CPTComponent(QString name);
|
---|
69 | ~CPTComponent();
|
---|
70 |
|
---|
71 | virtual void stopActivity(); /*!< to stop the processing thread */
|
---|
72 | virtual void startActivity(); /*!< to start the processing thread */
|
---|
73 | virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
|
---|
74 |
|
---|
75 | void setPortCOM(const char * port);
|
---|
76 |
|
---|
77 | public slots:
|
---|
78 | void processing(int v); /*!< to unlock the processing thread */
|
---|
79 |
|
---|
80 | private:
|
---|
81 | char * mAllFramesBuffer;
|
---|
82 | #ifdef WIN32
|
---|
83 | Win32SerialPort * serialPort;
|
---|
84 | #else
|
---|
85 | PosixSerialPort * serialPort;
|
---|
86 | #endif
|
---|
87 |
|
---|
88 | road_time_t currentRoadtime_;
|
---|
89 | road_timerange_t currentTimerange_;
|
---|
90 | int currentDataFrameLength_;
|
---|
91 |
|
---|
92 | bool mVerbose;
|
---|
93 | bool enuRef_;
|
---|
94 | double LAT_REF;
|
---|
95 | double LON_REF;
|
---|
96 | double HE_REF;
|
---|
97 |
|
---|
98 | QString portName;
|
---|
99 |
|
---|
100 | //ShMems
|
---|
101 | ShMem * mShMem;
|
---|
102 |
|
---|
103 | //Dbt files
|
---|
104 | pacpus::DbiteFile raws8hdFile;
|
---|
105 | std::ofstream dataFile_;
|
---|
106 |
|
---|
107 | pacpus::DbiteFile bestgpsposaFile_;
|
---|
108 | pacpus::DbiteFile rawimuFile_;
|
---|
109 | pacpus::DbiteFile inspvaFile_;
|
---|
110 | pacpus::DbiteFile inscovFile_;
|
---|
111 |
|
---|
112 | Stream8Position s8Data_;
|
---|
113 |
|
---|
114 | //Decoding
|
---|
115 | QString currentDataFrame;
|
---|
116 | road_time_t currentRoadtime;
|
---|
117 | road_timerange_t currentTimerange;
|
---|
118 |
|
---|
119 | QString frameToDecode;
|
---|
120 | road_time_t timeOfFrameToDecode;
|
---|
121 | road_timerange_t timerangeOfFrameToDecode;
|
---|
122 |
|
---|
123 | QString restOfFrame;
|
---|
124 |
|
---|
125 | bool newFrameToDecode;
|
---|
126 | bool startOfFrame;
|
---|
127 | int sofIdx_;
|
---|
128 | bool endOfFrame;
|
---|
129 | int type;
|
---|
130 | int eofIdx_;
|
---|
131 |
|
---|
132 | NMEA0183 nmea0183_;
|
---|
133 |
|
---|
134 | trame_gga_dbl ggaFrame_;
|
---|
135 | trame_gsa gsaFrame_;
|
---|
136 | trame_gst gstFrame_;
|
---|
137 | trame_gsv gsvFrame_;
|
---|
138 | trame_hdt hdtFrame_;
|
---|
139 | trame_rmc rmcFrame_;
|
---|
140 | trame_rot rotFrame_;
|
---|
141 | trame_vtg vtgFrame_;
|
---|
142 | trame_zda zdaFrame_;
|
---|
143 |
|
---|
144 | trame_bestgpsposa bestgpsposaFrame_;
|
---|
145 | trame_rawimusa rawimuFrame_;
|
---|
146 | trame_inspvaa inspvaFrame_;
|
---|
147 | trame_inscov inscovFrame_;
|
---|
148 |
|
---|
149 | int analyzeFrame(void);
|
---|
150 | int frameType(const QString);
|
---|
151 | int decodeFrame(int);
|
---|
152 |
|
---|
153 | int parseCPTbestgpsposa(QString);
|
---|
154 | int parseCPTrawimusa(QString);
|
---|
155 | int parseCPTinspvaa(QString);
|
---|
156 | int parseCPTinscov(QString);
|
---|
157 |
|
---|
158 | void initBuffer( TimestampedBestgpsposaFrame*,
|
---|
159 | TimestampedRawimusaFrame*,
|
---|
160 | TimestampedInspvaaFrame*,
|
---|
161 | TimestampedInscovFrame*);
|
---|
162 |
|
---|
163 | void addInputOutput();
|
---|
164 |
|
---|
165 | Pose3D genericEnuPose_;
|
---|
166 | };
|
---|
167 |
|
---|
168 | } // namespace pacpus
|
---|
169 |
|
---|
170 | #endif // CPTCOMPONENT_H
|
---|