QC Control software

Dependencies:   mbed

Fork of dgps by Colin Stearns

Committer:
dylanembed123
Date:
Thu Apr 10 02:19:07 2014 +0000
Revision:
14:6be57da62283
Parent:
9:da906eeac51e
Child:
15:e3e03a9df89e
Update GPS;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dylanembed123 9:da906eeac51e 1 /**
dylanembed123 9:da906eeac51e 2 * \brief Data location data holder
dylanembed123 9:da906eeac51e 3 **/
dylanembed123 9:da906eeac51e 4
dylanembed123 14:6be57da62283 5 #define MAXNUMLOCS 64
dylanembed123 14:6be57da62283 6
dylanembed123 14:6be57da62283 7 typedef struct DataLocS{
dylanembed123 14:6be57da62283 8 double lat,lon,alt;
dylanembed123 14:6be57da62283 9 double timestamp;
dylanembed123 14:6be57da62283 10 }DataLoc;
dylanembed123 7:c75d5e5e6bfc 11
dylanembed123 7:c75d5e5e6bfc 12 // Storage of data location
dylanembed123 7:c75d5e5e6bfc 13 class DataLocation{
dylanembed123 7:c75d5e5e6bfc 14 private:
dylanembed123 7:c75d5e5e6bfc 15 // Current value of lat lon and alt
dylanembed123 7:c75d5e5e6bfc 16 double lat,lon,alt;
dylanembed123 9:da906eeac51e 17 double timestamp;
dylanembed123 7:c75d5e5e6bfc 18 public:
dylanembed123 9:da906eeac51e 19 DataLocation(){}
dylanembed123 9:da906eeac51e 20 DataLocation(double latA,double lonA,double altA,double timestampA=0):lat(latA),lon(lonA),alt(altA),timestamp(timestampA){}
dylanembed123 7:c75d5e5e6bfc 21 double& getLat(){return lat;}
dylanembed123 7:c75d5e5e6bfc 22 double& getLon(){return lon;}
dylanembed123 7:c75d5e5e6bfc 23 double& getAlt(){return alt;}
dylanembed123 9:da906eeac51e 24 };
dylanembed123 9:da906eeac51e 25
dylanembed123 9:da906eeac51e 26 /// \brief Location holder type
dylanembed123 9:da906eeac51e 27 enum LHType{
dylanembed123 9:da906eeac51e 28 LHType_locs=0,
dylanembed123 9:da906eeac51e 29 LHType_targ,
dylanembed123 9:da906eeac51e 30 LHType_base
dylanembed123 9:da906eeac51e 31 };
dylanembed123 9:da906eeac51e 32
dylanembed123 9:da906eeac51e 33 /// \brief Location holder index type
dylanembed123 9:da906eeac51e 34 enum LHIType{
dylanembed123 9:da906eeac51e 35 LHIType_head=0,
dylanembed123 9:da906eeac51e 36 LHIType_size
dylanembed123 9:da906eeac51e 37 };
dylanembed123 7:c75d5e5e6bfc 38
dylanembed123 7:c75d5e5e6bfc 39 // Singleton location holder
dylanembed123 7:c75d5e5e6bfc 40 class LocHolder{
dylanembed123 7:c75d5e5e6bfc 41 private:
dylanembed123 7:c75d5e5e6bfc 42 // Actual Locations (absolute)
dylanembed123 9:da906eeac51e 43 DataLocation locs[MAXNUMLOCS];
dylanembed123 7:c75d5e5e6bfc 44 // Target Locations (relative to base station -> base station is at 0,0,0)
dylanembed123 9:da906eeac51e 45 DataLocation targ[MAXNUMLOCS];
dylanembed123 7:c75d5e5e6bfc 46 // Base Station Locations (absolute)
dylanembed123 9:da906eeac51e 47 DataLocation base[MAXNUMLOCS];
dylanembed123 7:c75d5e5e6bfc 48 // Index of the head of the circular buffers
dylanembed123 9:da906eeac51e 49 unsigned int headLocs,headTarg,headBase;
dylanembed123 9:da906eeac51e 50 // Number of locations
dylanembed123 9:da906eeac51e 51 unsigned int sizeLocs,sizeTarg,sizeBase;
dylanembed123 7:c75d5e5e6bfc 52 public:
dylanembed123 9:da906eeac51e 53 /// \brief Default constructor
dylanembed123 9:da906eeac51e 54 LocHolder():headLocs(0),headTarg(0),headBase(0),sizeLocs(0),sizeTarg(0),sizeBase(0){}
dylanembed123 9:da906eeac51e 55
dylanembed123 9:da906eeac51e 56 /// \brief Get locations type
dylanembed123 9:da906eeac51e 57 DataLocation* get(LHType type);
dylanembed123 9:da906eeac51e 58
dylanembed123 9:da906eeac51e 59 /// \brief Get Current value
dylanembed123 9:da906eeac51e 60 DataLocation& getC(LHType type,int offset=0);
dylanembed123 9:da906eeac51e 61
dylanembed123 9:da906eeac51e 62 /// \brief Get Index
dylanembed123 9:da906eeac51e 63 unsigned int& getI(LHType type,LHIType indexType=LHIType_head);
dylanembed123 7:c75d5e5e6bfc 64
dylanembed123 9:da906eeac51e 65 /// \brief Fix an index that might be out of bounds;
dylanembed123 9:da906eeac51e 66 unsigned int getRealIndex(LHType type,int index,int offset=0,bool useSize=true);
dylanembed123 9:da906eeac51e 67
dylanembed123 9:da906eeac51e 68 /// \brief Increment index
dylanembed123 9:da906eeac51e 69 void inc(LHType type,int amount=1,bool abs=false);
dylanembed123 7:c75d5e5e6bfc 70
dylanembed123 9:da906eeac51e 71 /// \brief Append a location to the end.
dylanembed123 9:da906eeac51e 72 void add(LHType type,DataLocation newLoc);
dylanembed123 9:da906eeac51e 73 };
dylanembed123 9:da906eeac51e 74
dylanembed123 9:da906eeac51e 75 static LocHolder mainLocHolder;
dylanembed123 9:da906eeac51e 76 static LocHolder& Locs(){return mainLocHolder;}