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

Last change on this file since 111 was 105, checked in by cerichar, 10 years ago

compilation OK under Windows 10 64 bits, Qt5.5, pacpus 0.2.2, boost 1.54

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