3rd Repo, trying to figure this out.
Fork of SOFT253_Template_Weather_OS_54 by
MessageLogger/MessageLogger.h@80:959151952153, 2017-05-10 (annotated)
- Committer:
- aburch1
- Date:
- Wed May 10 10:02:22 2017 +0000
- Revision:
- 80:959151952153
- Parent:
- 79:4e6b53eb678b
- Child:
- 81:996c0a3319b4
Fixed application crashing when sending 2 messages through to the logger at the same time. Other messages need to be changed to use the logger
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 | 79:4e6b53eb678b | 15 | void SendMessage(string message); |
aburch1 | 79:4e6b53eb678b | 16 | void SendMessage(char message); |
aburch1 | 74:749727490f44 | 17 | bool GetError(); |
aburch1 | 74:749727490f44 | 18 | bool GetMessage(); |
aburch1 | 75:b44645bbf2d2 | 19 | void SetThread(Thread* logger); |
aburch1 | 74:749727490f44 | 20 | |
aburch1 | 74:749727490f44 | 21 | private: |
aburch1 | 75:b44645bbf2d2 | 22 | Thread* loggingThread; |
aburch1 | 77:db3384071634 | 23 | ostringstream fatalError; |
aburch1 | 74:749727490f44 | 24 | int messageCount; |
aburch1 | 75:b44645bbf2d2 | 25 | bool hasError; |
aburch1 | 75:b44645bbf2d2 | 26 | osStatus stat; |
aburch1 | 79:4e6b53eb678b | 27 | char c; |
aburch1 | 80:959151952153 | 28 | Mutex *messageLock; |
aburch1 | 74:749727490f44 | 29 | |
aburch1 | 74:749727490f44 | 30 | void PrintError(); |
aburch1 | 74:749727490f44 | 31 | void PrintMessage(); |
aburch1 | 74:749727490f44 | 32 | }; |