QC Control software

Dependencies:   mbed

Fork of dgps by Colin Stearns

Committer:
dylanembed123
Date:
Thu Apr 03 17:15:29 2014 +0000
Revision:
9:da906eeac51e
Parent:
7:c75d5e5e6bfc
Child:
14:6be57da62283
Fix compile errors

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