Flair
Framework Libre Air
GpsData.h
Go to the documentation of this file.
1 // %flair:license{
2 // This file is part of the Flair framework distributed under the
3 // CECILL-C License, Version 1.0.
4 // %flair:license}
12 #ifndef GPSDATA_H
13 #define GPSDATA_H
14 
15 #include <io_data.h>
16 
17 namespace flair {
18 namespace core {
19 
20  class IODataElement;
21 
30 class GpsData : public io_data {
31 public:
32  class Type : public DataType {
33  public:
34  Type(void){}
35  std::string GetDescription() const { return "gps data"; }
36  size_t GetSize() const {
37  size_t size = 0;
38  size += 2*doubleType.GetSize(); // Latitude, Longitude
39  size += floatType.GetSize(); // Altitude
40  size += UInt8Type.GetSize(); // NumberOfSatellites
41  size += UInt8Type.GetSize(); // FixQuality_t
42  size += 5*floatType.GetSize();//e,n,u,ve,vn
43  size += 3*floatType.GetSize();//pdop,hdop,vdop
44  return size;
45  }
46 
47  private:
48  };
49 
54  typedef enum {
60  East ,
62  Up ,
65  Pdop /* dilution of precision*/,
66  Hdop /* horizontal dilution of precision*/,
67  Vdop /* vertical dilution of precision*/,
69 
74  enum class FixQuality_t : uint8_t {
75  Invalid = 0,
76  Gps = 1,
77  DGps = 2,
78  Pps = 3,
79  Rtk = 4,
80  RtkFloat = 5,
81  Estimated = 6,
82  Manual = 7,
83  Simulation = 8,
84  };
85 
95  GpsData(const Object *parent, std::string name = "", int n = 1);
96 
101  ~GpsData();
102 
112  IODataElement *Element(PlotableData_t data_type) const;
113 
124  void GetLla(double &latitude, double &longitude,
125  float &altitude) const;
126 
137  void SetLla(double latitude,double longitude,
138  float altitude);
139 
140 
151  void GetEnu(float &east, float &north,
152  float &up) const;
153 
164  void SetEnu(float east, float north,
165  float up);
166 
176  void GetVelocity(float &eastVelocity, float &northVelocity) const;
177 
187  void SetVelocity(float eastVelocity, float northVelocity);
188 
195  uint8_t GetNumberOfSatellites(void) const;
196 
203  void SetNumberOfSatellites(uint8_t numberOfSatellites);
204 
211  FixQuality_t GetFixQuality(void) const;
212 
219  void SetFixQuality(FixQuality_t fixQuality);
220 
231  void GetDop(float &pDop, float &hDop,float &vDop) const;
232 
243  void SetDop(float pDop, float hDop,float vDop);
244 
245  Type const &GetDataType() const { return dataType; }
246 
255  void RawRead(char *dst) const;
256 
257 private:
258  void Queue(char **dst, const void *src, size_t size) const;
259  Type dataType;
260  double latitude,longitude;
261  float altitude;
262  uint8_t numberOfSatellites;
263  FixQuality_t fixQuality;
264  float east,north,up,eastVelocity,northVelocity,pDop,hDop,vDop;
265 };
266 
267 } // end namespace core
268 } // end namespace flair
269 
270 #endif // GPSDATA_H
Abstract class for data types.
Definition: io_data.h:94
~GpsData()
Destructor.
void GetDop(float &pDop, float &hDop, float &vDop) const
Get dilution of precision.
Definition: GpsData.h:60
Definition: io_data.h:26
Definition: GpsData.h:57
Base class for all Framework's classes.
Definition: Object.h:83
void GetEnu(float &east, float &north, float &up) const
Get east, north and up.
namespace of the flair Framework
Definition: Ahrs.h:19
GpsData(const Object *parent, std::string name="", int n=1)
Constructor.
Class defining gps datas.
Definition: GpsData.h:30
Definition: GpsData.h:64
void RawRead(char *dst) const
Raw read datas.
Definition: GpsData.h:32
void SetNumberOfSatellites(uint8_t numberOfSatellites)
Set number of satellites.
Definition: GpsData.h:56
Abstract class for data types.
void SetEnu(float east, float north, float up)
Set east, north and up.
IODataElement * Element(PlotableData_t data_type) const
Element.
Definition: GpsData.h:61
void SetFixQuality(FixQuality_t fixQuality)
Set fix quality.
Definition: GpsData.h:59
uint8_t GetNumberOfSatellites(void) const
Get number of satellites.
PlotableData_t
Datas wich can be plotted in a DataPlot1D.
Definition: GpsData.h:54
Definition: GpsData.h:63
void GetVelocity(float &eastVelocity, float &northVelocity) const
Get east and north velocities.
Definition: GpsData.h:62
FixQuality_t
Fix qualty indicators.
Definition: GpsData.h:74
void SetLla(double latitude, double longitude, float altitude)
Set latitude, longitude and altitude.
void SetVelocity(float eastVelocity, float northVelocity)
Set east and north velocities.
Abstract class for accessing an element of an io_data.
Definition: IODataElement.h:27
Definition: GpsData.h:55
FixQuality_t GetFixQuality(void) const
Get fix quality.
void SetDop(float pDop, float hDop, float vDop)
Set dilution of precision.
void GetLla(double &latitude, double &longitude, float &altitude) const
Get latitude, longitude and altitude.