Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
handle/dataLocation.h@5:eef5ea6a9916, 2014-04-03 (annotated)
- Committer:
- dylanembed123
- Date:
- Thu Apr 03 15:56:05 2014 +0000
- Revision:
- 5:eef5ea6a9916
- Parent:
- 4:c75d5e5e6bfc
- Child:
- 6:f0248eb6714d
Update data location;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dylanembed123 | 5:eef5ea6a9916 | 1 | /** |
dylanembed123 | 5:eef5ea6a9916 | 2 | * \brief Camera interface |
dylanembed123 | 5:eef5ea6a9916 | 3 | **/ |
dylanembed123 | 5:eef5ea6a9916 | 4 | |
dylanembed123 | 4:c75d5e5e6bfc | 5 | #define MAXNUMLOCS 256 |
dylanembed123 | 4:c75d5e5e6bfc | 6 | |
dylanembed123 | 4:c75d5e5e6bfc | 7 | // Storage of data location |
dylanembed123 | 4:c75d5e5e6bfc | 8 | class DataLocation{ |
dylanembed123 | 4:c75d5e5e6bfc | 9 | private: |
dylanembed123 | 4:c75d5e5e6bfc | 10 | // Current value of lat lon and alt |
dylanembed123 | 4:c75d5e5e6bfc | 11 | double lat,lon,alt; |
dylanembed123 | 4:c75d5e5e6bfc | 12 | public: |
dylanembed123 | 5:eef5ea6a9916 | 13 | DataLocation(double latA,double lonA,double altA):lat(latA),lon(lonA),alt(altA){} |
dylanembed123 | 4:c75d5e5e6bfc | 14 | double& getLat(){return lat;} |
dylanembed123 | 4:c75d5e5e6bfc | 15 | double& getLon(){return lon;} |
dylanembed123 | 4:c75d5e5e6bfc | 16 | double& getAlt(){return alt;} |
dylanembed123 | 4:c75d5e5e6bfc | 17 | } |
dylanembed123 | 4:c75d5e5e6bfc | 18 | |
dylanembed123 | 5:eef5ea6a9916 | 19 | /// \brief Location holder type |
dylanembed123 | 5:eef5ea6a9916 | 20 | enum LHType{ |
dylanembed123 | 5:eef5ea6a9916 | 21 | LHType_locs=0, |
dylanembed123 | 5:eef5ea6a9916 | 22 | LHType_targ, |
dylanembed123 | 5:eef5ea6a9916 | 23 | LHType_base |
dylanembed123 | 5:eef5ea6a9916 | 24 | }; |
dylanembed123 | 5:eef5ea6a9916 | 25 | |
dylanembed123 | 5:eef5ea6a9916 | 26 | /// \brief Location holder index type |
dylanembed123 | 5:eef5ea6a9916 | 27 | enum LHIType{ |
dylanembed123 | 5:eef5ea6a9916 | 28 | LHIType_head=0, |
dylanembed123 | 5:eef5ea6a9916 | 29 | LHIType_size |
dylanembed123 | 5:eef5ea6a9916 | 30 | }; |
dylanembed123 | 5:eef5ea6a9916 | 31 | |
dylanembed123 | 4:c75d5e5e6bfc | 32 | // Singleton location holder |
dylanembed123 | 4:c75d5e5e6bfc | 33 | class LocHolder{ |
dylanembed123 | 4:c75d5e5e6bfc | 34 | private: |
dylanembed123 | 4:c75d5e5e6bfc | 35 | // Actual Locations (absolute) |
dylanembed123 | 4:c75d5e5e6bfc | 36 | static DataLocation locs[MAXNUMLOCS]; |
dylanembed123 | 4:c75d5e5e6bfc | 37 | // Target Locations (relative to base station -> base station is at 0,0,0) |
dylanembed123 | 4:c75d5e5e6bfc | 38 | static DataLocation targ[MAXNUMLOCS]; |
dylanembed123 | 4:c75d5e5e6bfc | 39 | // Base Station Locations (absolute) |
dylanembed123 | 4:c75d5e5e6bfc | 40 | static DataLocation base[MAXNUMLOCS]; |
dylanembed123 | 4:c75d5e5e6bfc | 41 | // Index of the head of the circular buffers |
dylanembed123 | 4:c75d5e5e6bfc | 42 | static unsigned int headLocs,headTarg,headBase; |
dylanembed123 | 5:eef5ea6a9916 | 43 | // Number of locations |
dylanembed123 | 5:eef5ea6a9916 | 44 | static unsigned int sizeLocs,sizeTarg,sizeBase; |
dylanembed123 | 4:c75d5e5e6bfc | 45 | public: |
dylanembed123 | 5:eef5ea6a9916 | 46 | /// \brief Get locations type |
dylanembed123 | 5:eef5ea6a9916 | 47 | static DataLocation* get(LHType type); |
dylanembed123 | 5:eef5ea6a9916 | 48 | |
dylanembed123 | 5:eef5ea6a9916 | 49 | /// \brief Get Current value |
dylanembed123 | 5:eef5ea6a9916 | 50 | DataLocation& getC(LHType type,int offset=0); |
dylanembed123 | 5:eef5ea6a9916 | 51 | |
dylanembed123 | 5:eef5ea6a9916 | 52 | /// \brief Get Index |
dylanembed123 | 5:eef5ea6a9916 | 53 | unsigned int& getI(LHType type,LHIType indexType=LHIType_head); |
dylanembed123 | 4:c75d5e5e6bfc | 54 | |
dylanembed123 | 5:eef5ea6a9916 | 55 | /// \brief Increment index |
dylanembed123 | 5:eef5ea6a9916 | 56 | void inc(LHType type,int amount=1); |
dylanembed123 | 4:c75d5e5e6bfc | 57 | |
dylanembed123 | 5:eef5ea6a9916 | 58 | /// \brief Add data |
dylanembed123 | 5:eef5ea6a9916 | 59 | void addLocs(DataLocation newLoc); |
dylanembed123 | 5:eef5ea6a9916 | 60 | void addTarg(DataLocation newLoc); |
dylanembed123 | 5:eef5ea6a9916 | 61 | void addBase(DataLocation newLoc); |
dylanembed123 | 4:c75d5e5e6bfc | 62 | |
dylanembed123 | 5:eef5ea6a9916 | 63 | void incLocs(int amount=1); |
dylanembed123 | 5:eef5ea6a9916 | 64 | void incLocs(int amount=1); |
dylanembed123 | 5:eef5ea6a9916 | 65 | void incLocs(int amount=1); |
dylanembed123 | 4:c75d5e5e6bfc | 66 | }; |