![](/media/cache/profiles/ba5be68d3d541f2ca043d77fc54fe702.jpg.50x50_q85.jpg)
3rd Repo, trying to figure this out.
Fork of SOFT253_Template_Weather_OS_54 by
MessageLogger/MessageLogger.h@81:996c0a3319b4, 2017-05-11 (annotated)
- Committer:
- aburch1
- Date:
- Thu May 11 14:34:53 2017 +0000
- Revision:
- 81:996c0a3319b4
- Parent:
- 80:959151952153
- Child:
- 83:0d3572a8a851
Changed the logger to use char arrays of a size 256 and fixed some issues that cropped up from this. Moved all printing statements over to use the logger
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aburch1 | 81:996c0a3319b4 | 1 | #ifndef MESSAGELOGGER_H |
aburch1 | 81:996c0a3319b4 | 2 | #define MESSAGELOGGER_H |
aburch1 | 81:996c0a3319b4 | 3 | |
aburch1 | 74:749727490f44 | 4 | #include "mbed.h" |
aburch1 | 74:749727490f44 | 5 | #include "rtos.h" |
aburch1 | 81:996c0a3319b4 | 6 | |
aburch1 | 74:749727490f44 | 7 | #include <string> |
aburch1 | 74:749727490f44 | 8 | #include <sstream> |
aburch1 | 74:749727490f44 | 9 | #include <iostream> |
aburch1 | 74:749727490f44 | 10 | |
aburch1 | 74:749727490f44 | 11 | class MessageLogger |
aburch1 | 74:749727490f44 | 12 | { |
aburch1 | 74:749727490f44 | 13 | public: |
aburch1 | 74:749727490f44 | 14 | // constructor |
aburch1 | 75:b44645bbf2d2 | 15 | MessageLogger(); |
aburch1 | 74:749727490f44 | 16 | |
aburch1 | 74:749727490f44 | 17 | // public methods: |
aburch1 | 77:db3384071634 | 18 | void SendError(string errorMessage); |
aburch1 | 81:996c0a3319b4 | 19 | void SendMessage(char* message); |
aburch1 | 74:749727490f44 | 20 | bool GetError(); |
aburch1 | 74:749727490f44 | 21 | bool GetMessage(); |
aburch1 | 75:b44645bbf2d2 | 22 | void SetThread(Thread* logger); |
aburch1 | 74:749727490f44 | 23 | |
aburch1 | 74:749727490f44 | 24 | private: |
aburch1 | 75:b44645bbf2d2 | 25 | Thread* loggingThread; |
aburch1 | 77:db3384071634 | 26 | ostringstream fatalError; |
aburch1 | 74:749727490f44 | 27 | int messageCount; |
aburch1 | 75:b44645bbf2d2 | 28 | bool hasError; |
aburch1 | 75:b44645bbf2d2 | 29 | osStatus stat; |
aburch1 | 79:4e6b53eb678b | 30 | char c; |
aburch1 | 81:996c0a3319b4 | 31 | Mutex messageLock; |
aburch1 | 74:749727490f44 | 32 | |
aburch1 | 74:749727490f44 | 33 | void PrintError(); |
aburch1 | 74:749727490f44 | 34 | void PrintMessage(); |
aburch1 | 81:996c0a3319b4 | 35 | }; |
aburch1 | 81:996c0a3319b4 | 36 | #endif |