| 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}
|
---|
| 5 | // created: 2016/07/01
|
---|
| 6 | // filename: GpsData.cpp
|
---|
| 7 | //
|
---|
| 8 | // author: Guillaume Sanahuja
|
---|
| 9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 10 | //
|
---|
| 11 | // version: $Id: $
|
---|
| 12 | //
|
---|
| 13 | // purpose: class defining gps datas
|
---|
| 14 | //
|
---|
| 15 | //
|
---|
| 16 | /*********************************************************************/
|
---|
| 17 |
|
---|
| 18 | #include "GpsData.h"
|
---|
| 19 | #include "Euler.h"
|
---|
| 20 | #include <math.h>
|
---|
| 21 | #include <string.h>
|
---|
| 22 | #include <stdlib.h>
|
---|
| 23 |
|
---|
| 24 | using std::string;
|
---|
| 25 |
|
---|
| 26 | namespace flair {
|
---|
| 27 | namespace core {
|
---|
| 28 |
|
---|
| 29 | /*! \class GpsDataElement
|
---|
| 30 | */
|
---|
| 31 | class GpsDataElement : public IODataElement {
|
---|
| 32 | public:
|
---|
| 33 | GpsDataElement(const GpsData *inGpsdata, string name,
|
---|
| 34 | GpsData::PlotableData_t inPlotableData)
|
---|
| 35 | : IODataElement(inGpsdata, name) {
|
---|
| 36 | gpsdata = inGpsdata;
|
---|
| 37 | plotableData = inPlotableData;
|
---|
| 38 |
|
---|
| 39 | size = 0;
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | ~GpsDataElement() {}
|
---|
| 43 |
|
---|
| 44 | void CopyData(char *dst) const {
|
---|
| 45 |
|
---|
| 46 |
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | FloatType const &GetDataType(void) const { return dataType; }
|
---|
| 50 |
|
---|
| 51 | private:
|
---|
| 52 | const GpsData *gpsdata;
|
---|
| 53 | GpsData::PlotableData_t plotableData;
|
---|
| 54 | FloatType dataType;
|
---|
| 55 | };
|
---|
| 56 |
|
---|
| 57 | GpsData::GpsData(const Object *parent, std::string name, int n)
|
---|
| 58 | : io_data(parent, name, n), dataType() {
|
---|
| 59 | if (n > 1)
|
---|
| 60 | Warn("n>1 not supported\n");
|
---|
| 61 |
|
---|
| 62 | AppendLogDescription("latitude", floatType);
|
---|
| 63 | AppendLogDescription("longitude", floatType);
|
---|
| 64 | AppendLogDescription("altitude", floatType);
|
---|
| 65 |
|
---|
| 66 |
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | GpsData::~GpsData() {}
|
---|
| 70 |
|
---|
| 71 |
|
---|
| 72 | IODataElement *GpsData::Element(PlotableData_t data_type) const {
|
---|
| 73 |
|
---|
| 74 | //return new GpsDataElement(this, name, data_type);
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | void GpsData::CopyDatas(char *dst) const {
|
---|
| 78 | GetMutex();
|
---|
| 79 |
|
---|
| 80 | //Queue(&dst, &rawAcc.x, sizeof(rawAcc.x));
|
---|
| 81 |
|
---|
| 82 | ReleaseMutex();
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | void GpsData::Queue(char **dst, const void *src, size_t size) const {
|
---|
| 86 | memcpy(*dst, src, size);
|
---|
| 87 | *dst += size;
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | } // end namespace core
|
---|
| 91 | } // end namespace flair
|
---|