1 |
torben |
67 |
#pragma once |
2 |
|
|
|
3 |
|
|
#include <boost/thread/mutex.hpp> |
4 |
|
|
#include <queue> |
5 |
|
|
#include <cppsocket/tcpserver.h> |
6 |
|
|
|
7 |
|
|
#include "../H7Serial.h" |
8 |
|
|
#include "serialthread.h" |
9 |
|
|
|
10 |
|
|
struct WriteCommand |
11 |
|
|
{ |
12 |
|
|
WriteCommand(int t, int d) {target=t; data=d;} |
13 |
|
|
unsigned char target; |
14 |
|
|
unsigned char data; |
15 |
|
|
}; |
16 |
|
|
|
17 |
|
|
//Singleton |
18 |
|
|
class GlobalStorage |
19 |
|
|
{ |
20 |
|
|
public: |
21 |
|
|
static GlobalStorage* instance(); |
22 |
|
|
|
23 |
|
|
CH7Serial serialPort; |
24 |
|
|
boost::mutex writeMutex; |
25 |
|
|
std::queue<WriteCommand> commands; |
26 |
|
|
CPPSocket::TCPServer server; |
27 |
|
|
SerialThread serialThread; |
28 |
|
|
|
29 |
|
|
bool led3,led4,led5,switch2,switch3; |
30 |
|
|
int temp,potmeter; |
31 |
|
|
|
32 |
|
|
protected: |
33 |
|
|
GlobalStorage() {} //default constructor |
34 |
|
|
GlobalStorage(const GlobalStorage&) {} //copy constructor |
35 |
torben |
74 |
GlobalStorage& operator=(const GlobalStorage&) {} //assignment operator |
36 |
torben |
67 |
}; |