-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommThread.h
More file actions
40 lines (29 loc) · 814 Bytes
/
CommThread.h
File metadata and controls
40 lines (29 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef CLIENTTHREAD_H
#define CLIENTTHREAD_H
#include "fbtctl_message.h"
#include "ClientStream.h"
#include "Thread.h"
#define MAX_MESSAGE_SIZE 10000
class CommThread : public Thread {
public:
CommThread(int clientID, int defaultTimeout) : clientID(clientID), timeout(defaultTimeout) {
numClients++; // sollte atomic sein
};
void begin(ClientStream *client, bool doDelete) { this->client=client; this->doDelete = doDelete; this->msgNum=0; };
virtual ~CommThread();
virtual void run()=0;
void sendMessage(const FBTCtlMessage &msg);
FBTCtlMessage readMessage();
void readSelect();
void close();
ClientStream *client=NULL;
bool doDelete=false;
int msgNum=0;
// ID vom client
int clientID;
// anzahl clients die gerade laufen
static int numClients;
private:
int timeout=0;
};
#endif