source: pacpussensors/trunk/SpanCPTComponent/CPTComponent.h@ 88

Last change on this file since 88 was 88, checked in by DHERBOMEZ Gérald, 9 years ago

add output of 2D ENU position

File size: 3.7 KB
Line 
1
2/*********************************************************************
3// created: 2011/06/28 - 18:18
4// filename: cptComponent.h
5//
6// author: Sergio Rodriguez
7//
8// version: $Id: $
9//
10// purpose: Acquire SPAN CPT data
11//
12*********************************************************************/
13
14#ifndef CPTCOMPONENT_H
15#define CPTCOMPONENT_H
16
17#include <fstream>
18#include <qobject.h>
19#include <string>
20
21#include "../NMEA0183/include/nmea0183.h"
22#include <Pacpus/kernel/ComponentBase.h>
23#include <Pacpus/kernel/DbiteFile.h>
24#include <Pacpus/kernel/pacpus.h>
25#include <Pacpus/kernel/InputOutputInterface.h>
26#include "../Gps/structure_gps.h"
27
28
29#ifdef WIN32
30# include "../driver/win32SerialPort.h"
31#else
32# include "../driver/PosixSerialPort.h"
33#endif
34
35// Export macro for CPTComponent DLL for Windows only
36#ifdef WIN32
37# ifdef CPTCOMPONENT_EXPORTS
38 // make DLL
39# define CPTCOMPONENT_API __declspec(dllexport)
40# else
41 // use DLL
42# define CPTCOMPONENT_API __declspec(dllimport)
43# endif
44#else
45 // On other platforms, simply ignore this
46# define CPTCOMPONENT_API
47#endif
48
49namespace pacpus {
50
51class ShMem;
52
53struct CPTCOMPONENT_API Stream8Position
54{
55 int32_t dataPos;
56 int32_t length;
57};
58
59#define UNKNOWN_NMEA_FRAME -1
60
61/// The definition of the CPTComponent class
62class CPTCOMPONENT_API CPTComponent
63 : public QObject
64 , public ComponentBase
65{
66 Q_OBJECT
67
68public:
69 CPTComponent(QString name);
70 ~CPTComponent();
71
72 virtual void stopActivity(); /*!< to stop the processing thread */
73 virtual void startActivity(); /*!< to start the processing thread */
74 virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
75
76 void setPortCOM(const char * port);
77
78public slots:
79 void processing(int v); /*!< to unlock the processing thread */
80
81private:
82 char * mAllFramesBuffer;
83#ifdef WIN32
84 Win32SerialPort * serialPort;
85#else
86 PosixSerialPort * serialPort;
87#endif
88
89
90
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 int currentDataFrameLength_;
119
120 QString frameToDecode;
121 road_time_t timeOfFrameToDecode;
122 road_timerange_t timerangeOfFrameToDecode;
123
124 QString restOfFrame;
125
126 bool newFrameToDecode;
127 bool startOfFrame;
128 int sofIdx_;
129 bool endOfFrame;
130 int type;
131 int eofIdx_;
132
133 NMEA0183 nmea0183_;
134
135 trame_gga_dbl ggaFrame_;
136 trame_gsa gsaFrame_;
137 trame_gst gstFrame_;
138 trame_gsv gsvFrame_;
139 trame_hdt hdtFrame_;
140 trame_rmc rmcFrame_;
141 trame_rot rotFrame_;
142 trame_vtg vtgFrame_;
143 trame_zda zdaFrame_;
144
145 trame_bestgpsposa bestgpsposaFrame_;
146 trame_rawimusa rawimuFrame_;
147 trame_inspvaa inspvaFrame_;
148 trame_inscov inscovFrame_;
149
150 int analyzeFrame(void);
151 int frameType(const QString);
152 int decodeFrame(int);
153
154 int parseCPTbestgpsposa(QString);
155 int parseCPTrawimusa(QString);
156 int parseCPTinspvaa(QString);
157 int parseCPTinscov(QString);
158
159 void initBuffer( TimestampedBestgpsposaFrame*,
160 TimestampedRawimusaFrame*,
161 TimestampedInspvaaFrame*,
162 TimestampedInscovFrame*);
163
164 // component ouputs
165 void addOutputs();
166 OutputInterface<QPointF, CPTComponent>* position2DENUOutput_;
167};
168
169} // namespace pacpus
170
171#endif // CPTCOMPONENT_H
Note: See TracBrowser for help on using the repository browser.