3rd Repo, trying to figure this out.
Fork of SOFT253_Template_Weather_OS_54 by
MessageLogger/MessageLogger.h@75:b44645bbf2d2, 2017-04-25 (annotated)
- Committer:
- aburch1
- Date:
- Tue Apr 25 16:06:35 2017 +0000
- Revision:
- 75:b44645bbf2d2
- Parent:
- 74:749727490f44
- Child:
- 76:ee1f132e5744
Logging thread set up to take and print error messages
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 | 74:749727490f44 | 14 | void SendError(string errorMessage); |
aburch1 | 74:749727490f44 | 15 | void SendMessage(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 | 74:749727490f44 | 22 | ostringstream fatalError; |
aburch1 | 74:749727490f44 | 23 | Mail<ostringstream, 16> message_mail; |
aburch1 | 74:749727490f44 | 24 | int messageCount; |
aburch1 | 75:b44645bbf2d2 | 25 | bool hasError; |
aburch1 | 75:b44645bbf2d2 | 26 | osStatus stat; |
aburch1 | 74:749727490f44 | 27 | |
aburch1 | 74:749727490f44 | 28 | void PrintError(); |
aburch1 | 74:749727490f44 | 29 | void PrintMessage(); |
aburch1 | 74:749727490f44 | 30 | }; |