3rd Repo, trying to figure this out.
Fork of SOFT253_Template_Weather_OS_54 by
MessageLogger/MessageLogger.h@77:db3384071634, 2017-04-26 (annotated)
- Committer:
- aburch1
- Date:
- Wed Apr 26 21:58:08 2017 +0000
- Revision:
- 77:db3384071634
- Parent:
- 76:ee1f132e5744
- Child:
- 79:4e6b53eb678b
Finished message logger so both errors and normal messages can be sent through to be printed. Any error codes are also displayed.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aburch1 | 74:749727490f44 | 1 | #include "mbed.h" |
aburch1 | 74:749727490f44 | 2 | #include "rtos.h" |
aburch1 | 74:749727490f44 | 3 | #include <string> |
aburch1 | 74:749727490f44 | 4 | #include <sstream> |
aburch1 | 74:749727490f44 | 5 | #include <iostream> |
aburch1 | 74:749727490f44 | 6 | |
aburch1 | 74:749727490f44 | 7 | class MessageLogger |
aburch1 | 74:749727490f44 | 8 | { |
aburch1 | 74:749727490f44 | 9 | public: |
aburch1 | 74:749727490f44 | 10 | // constructor |
aburch1 | 75:b44645bbf2d2 | 11 | MessageLogger(); |
aburch1 | 74:749727490f44 | 12 | |
aburch1 | 74:749727490f44 | 13 | // public methods: |
aburch1 | 77:db3384071634 | 14 | void SendError(string errorMessage); |
aburch1 | 77:db3384071634 | 15 | void SendMessage(const string message); |
aburch1 | 74:749727490f44 | 16 | bool GetError(); |
aburch1 | 74:749727490f44 | 17 | bool GetMessage(); |
aburch1 | 75:b44645bbf2d2 | 18 | void SetThread(Thread* logger); |
aburch1 | 74:749727490f44 | 19 | |
aburch1 | 74:749727490f44 | 20 | private: |
aburch1 | 75:b44645bbf2d2 | 21 | Thread* loggingThread; |
aburch1 | 77:db3384071634 | 22 | ostringstream fatalError; |
aburch1 | 74:749727490f44 | 23 | int messageCount; |
aburch1 | 75:b44645bbf2d2 | 24 | bool hasError; |
aburch1 | 75:b44645bbf2d2 | 25 | osStatus stat; |
aburch1 | 74:749727490f44 | 26 | |
aburch1 | 74:749727490f44 | 27 | void PrintError(); |
aburch1 | 74:749727490f44 | 28 | void PrintMessage(); |
aburch1 | 74:749727490f44 | 29 | }; |