trivial RFID tag database
ReportDB.h@3:ea6ac7464011, 2014-09-24 (annotated)
- Committer:
- ansond
- Date:
- Wed Sep 24 18:52:53 2014 +0000
- Revision:
- 3:ea6ac7464011
renamed
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 3:ea6ac7464011 | 1 | /* Copyright C2014 ARM, MIT License |
ansond | 3:ea6ac7464011 | 2 | * |
ansond | 3:ea6ac7464011 | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
ansond | 3:ea6ac7464011 | 4 | * and associated documentation files the "Software", to deal in the Software without restriction, |
ansond | 3:ea6ac7464011 | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
ansond | 3:ea6ac7464011 | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
ansond | 3:ea6ac7464011 | 7 | * furnished to do so, subject to the following conditions: |
ansond | 3:ea6ac7464011 | 8 | * |
ansond | 3:ea6ac7464011 | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
ansond | 3:ea6ac7464011 | 10 | * substantial portions of the Software. |
ansond | 3:ea6ac7464011 | 11 | * |
ansond | 3:ea6ac7464011 | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
ansond | 3:ea6ac7464011 | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
ansond | 3:ea6ac7464011 | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
ansond | 3:ea6ac7464011 | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
ansond | 3:ea6ac7464011 | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
ansond | 3:ea6ac7464011 | 17 | */ |
ansond | 3:ea6ac7464011 | 18 | |
ansond | 3:ea6ac7464011 | 19 | #ifndef _REPORT_DB_H_ |
ansond | 3:ea6ac7464011 | 20 | #define _REPORT_DB_H_ |
ansond | 3:ea6ac7464011 | 21 | |
ansond | 3:ea6ac7464011 | 22 | #include "Definitions.h" |
ansond | 3:ea6ac7464011 | 23 | |
ansond | 3:ea6ac7464011 | 24 | // trivial widget db entry... |
ansond | 3:ea6ac7464011 | 25 | typedef struct { |
ansond | 3:ea6ac7464011 | 26 | int rfid; |
ansond | 3:ea6ac7464011 | 27 | char name[DB_MAX_NAME_LENGTH+1]; |
ansond | 3:ea6ac7464011 | 28 | char description[DB_MAX_DESCRIPTION_LENGTH+1]; |
ansond | 3:ea6ac7464011 | 29 | char condition[DB_MAX_CONDITION_LENGTH+1]; |
ansond | 3:ea6ac7464011 | 30 | char latitude[DB_MAX_LATLONG_LENGTH+1]; |
ansond | 3:ea6ac7464011 | 31 | char longitude[DB_MAX_LATLONG_LENGTH+1]; |
ansond | 3:ea6ac7464011 | 32 | |
ansond | 3:ea6ac7464011 | 33 | } ReportEntry; |
ansond | 3:ea6ac7464011 | 34 | |
ansond | 3:ea6ac7464011 | 35 | // trivial database of reports to generate cases with ... |
ansond | 3:ea6ac7464011 | 36 | class ReportDB { |
ansond | 3:ea6ac7464011 | 37 | private: |
ansond | 3:ea6ac7464011 | 38 | ReportEntry m_db[DB_MAX_NUM_REPORTS]; |
ansond | 3:ea6ac7464011 | 39 | |
ansond | 3:ea6ac7464011 | 40 | public: |
ansond | 3:ea6ac7464011 | 41 | ReportDB(); |
ansond | 3:ea6ac7464011 | 42 | virtual ~ReportDB(); |
ansond | 3:ea6ac7464011 | 43 | |
ansond | 3:ea6ac7464011 | 44 | char *lookupReportName(int rfid); |
ansond | 3:ea6ac7464011 | 45 | char *lookupReportDescription(int rfid); |
ansond | 3:ea6ac7464011 | 46 | char *lookupReportCondition(int rfid); |
ansond | 3:ea6ac7464011 | 47 | char *lookupReportLatitude(int rfid); |
ansond | 3:ea6ac7464011 | 48 | char *lookupReportLongitude(int rfid); |
ansond | 3:ea6ac7464011 | 49 | |
ansond | 3:ea6ac7464011 | 50 | private: |
ansond | 3:ea6ac7464011 | 51 | void initDB(); |
ansond | 3:ea6ac7464011 | 52 | ReportEntry *lookup(int rfid); |
ansond | 3:ea6ac7464011 | 53 | }; |
ansond | 3:ea6ac7464011 | 54 | |
ansond | 3:ea6ac7464011 | 55 | #endif // _REPORT_DB_H_ |