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.
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
config/ConfigSync.h@110:ee9ae4a5e55c, 2015-05-15 (annotated)
- Committer:
- xinlei
- Date:
- Fri May 15 10:13:19 2015 +0000
- Revision:
- 110:ee9ae4a5e55c
- Parent:
- 107:f1ee3e1eb126
- Child:
- 136:a52821cdb108
bugfix for factory reset has no effect
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| xinlei | 100:dbcd3bc51758 | 1 | #ifndef CONFIGSYNC_H |
| xinlei | 100:dbcd3bc51758 | 2 | #define CONFIGSYNC_H |
| xinlei | 100:dbcd3bc51758 | 3 | #include "AbstractReporter.h" |
| xinlei | 100:dbcd3bc51758 | 4 | #include "ConfigParser.h" |
| xinlei | 98:e369fc75c000 | 5 | |
| xinlei | 100:dbcd3bc51758 | 6 | class ConfigSync : public AbstractReporter |
| xinlei | 98:e369fc75c000 | 7 | { |
| xinlei | 107:f1ee3e1eb126 | 8 | private: |
| xinlei | 107:f1ee3e1eb126 | 9 | ConfigSync(): dict(), cp(), changed(true) {} |
| xinlei | 98:e369fc75c000 | 10 | public: |
| xinlei | 100:dbcd3bc51758 | 11 | virtual ~ConfigSync() {} |
| xinlei | 100:dbcd3bc51758 | 12 | virtual bool init() { |
| xinlei | 100:dbcd3bc51758 | 13 | loadConfiguration(); |
| xinlei | 100:dbcd3bc51758 | 14 | return true; |
| xinlei | 100:dbcd3bc51758 | 15 | } |
| xinlei | 107:f1ee3e1eb126 | 16 | static ConfigSync& inst() { |
| xinlei | 107:f1ee3e1eb126 | 17 | static ConfigSync _ref; |
| xinlei | 107:f1ee3e1eb126 | 18 | return _ref; |
| xinlei | 107:f1ee3e1eb126 | 19 | } |
| xinlei | 100:dbcd3bc51758 | 20 | virtual const char* name() const { return "Conf"; } |
| xinlei | 100:dbcd3bc51758 | 21 | virtual size_t read(char*, size_t, char*, size_t); |
| xinlei | 100:dbcd3bc51758 | 22 | bool updateConfiguration(const char*); |
| xinlei | 98:e369fc75c000 | 23 | protected: |
| xinlei | 100:dbcd3bc51758 | 24 | void resetConfiguration(); |
| xinlei | 100:dbcd3bc51758 | 25 | void loadConfiguration(); |
| xinlei | 100:dbcd3bc51758 | 26 | void saveConfiguration() const; |
| xinlei | 98:e369fc75c000 | 27 | private: |
| xinlei | 100:dbcd3bc51758 | 28 | Dict dict; |
| xinlei | 100:dbcd3bc51758 | 29 | ConfigParser cp; |
| xinlei | 100:dbcd3bc51758 | 30 | bool changed; |
| xinlei | 98:e369fc75c000 | 31 | }; |
| xinlei | 98:e369fc75c000 | 32 | |
| xinlei | 100:dbcd3bc51758 | 33 | #endif /* CONFIGSYNC_H */ |
