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