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: EthernetInterface mbed-rtos mbed NTPClient
Headers/PmedLog.h@22:a06c7bb05008, 2015-03-27 (annotated)
- Committer:
- mlucas82
- Date:
- Fri Mar 27 16:22:11 2015 +0000
- Branch:
- feature-logs
- Revision:
- 22:a06c7bb05008
- Parent:
- 11:2b79016076dc
- Child:
- 27:7664225b6036
Moved Pmed_reset to his own header file, changed way of resetting time, and various other tweaks
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mlucas82 | 11:2b79016076dc | 1 | /* |
| mlucas82 | 11:2b79016076dc | 2 | * Settings.h |
| mlucas82 | 11:2b79016076dc | 3 | * |
| mlucas82 | 11:2b79016076dc | 4 | * Created on: 19/jan/2015 |
| mlucas82 | 11:2b79016076dc | 5 | * Author: Marcos A. Lucas |
| mlucas82 | 11:2b79016076dc | 6 | */ |
| mlucas82 | 11:2b79016076dc | 7 | |
| mlucas82 | 11:2b79016076dc | 8 | #ifndef PMEDLOG_H |
| mlucas82 | 11:2b79016076dc | 9 | #define PMEDLOG_H |
| mlucas82 | 11:2b79016076dc | 10 | |
| mlucas82 | 11:2b79016076dc | 11 | #include "mbed.h" |
| mlucas82 | 11:2b79016076dc | 12 | #include "Settings.h" |
| mlucas82 | 11:2b79016076dc | 13 | |
| mlucas82 | 11:2b79016076dc | 14 | #define LOGFILE "/local/pmedlog.txt" |
| mlucas82 | 11:2b79016076dc | 15 | |
| mlucas82 | 22:a06c7bb05008 | 16 | |
| mlucas82 | 22:a06c7bb05008 | 17 | //define as constant some log entries |
| mlucas82 | 22:a06c7bb05008 | 18 | static const char *PMEDLOG_INITIALIZING = " Initializing Protegemed ... "; |
| mlucas82 | 22:a06c7bb05008 | 19 | static const char *PMEDLOG_STARTED = " Started Protegemed ! "; |
| mlucas82 | 22:a06c7bb05008 | 20 | static const char *PMEDLOG_WRONGCODE = " Oops... wrong code, a reset may be expected "; |
| mlucas82 | 22:a06c7bb05008 | 21 | static const char *PMEDLOG_RESET = " Programmatically resetting Protegemed ... "; |
| mlucas82 | 22:a06c7bb05008 | 22 | static const char *PMEDLOG_DEFAULTS = " Loaded defaults in Settings ! "; |
| mlucas82 | 22:a06c7bb05008 | 23 | |
| mlucas82 | 11:2b79016076dc | 24 | class PmedLog |
| mlucas82 | 11:2b79016076dc | 25 | { |
| mlucas82 | 11:2b79016076dc | 26 | |
| mlucas82 | 11:2b79016076dc | 27 | protected: |
| mlucas82 | 11:2b79016076dc | 28 | |
| mlucas82 | 11:2b79016076dc | 29 | static int m_entry; |
| mlucas82 | 11:2b79016076dc | 30 | static time_t m_lastMark; |
| mlucas82 | 11:2b79016076dc | 31 | |
| mlucas82 | 11:2b79016076dc | 32 | public: |
| mlucas82 | 11:2b79016076dc | 33 | |
| mlucas82 | 11:2b79016076dc | 34 | PmedLog(); |
| mlucas82 | 11:2b79016076dc | 35 | |
| mlucas82 | 11:2b79016076dc | 36 | // Control the marks behavior in log file |
| mlucas82 | 11:2b79016076dc | 37 | static bool get_LogMarks() { return Settings::get_LogMarks(); } |
| mlucas82 | 11:2b79016076dc | 38 | static void set_LogMarks(bool value) { Settings::set_LogMarks(value); } |
| mlucas82 | 11:2b79016076dc | 39 | static int get_LogMarksInterval() { return Settings::get_LogMarksInterval(); } |
| mlucas82 | 11:2b79016076dc | 40 | static void set_LogMarksInterval(int value) { Settings::set_LogMarksInterval(value); } |
| mlucas82 | 11:2b79016076dc | 41 | |
| mlucas82 | 22:a06c7bb05008 | 42 | static void WriteEntry(const char *value); |
| mlucas82 | 11:2b79016076dc | 43 | static void Mark(); |
| mlucas82 | 11:2b79016076dc | 44 | |
| mlucas82 | 11:2b79016076dc | 45 | }; |
| mlucas82 | 11:2b79016076dc | 46 | |
| mlucas82 | 22:a06c7bb05008 | 47 | #endif //#ifndef PMEDLOGS_H |
| mlucas82 | 22:a06c7bb05008 | 48 |
