-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathedSession.h
More file actions
111 lines (82 loc) · 2.61 KB
/
edSession.h
File metadata and controls
111 lines (82 loc) · 2.61 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#ifndef EDSESSION_H
#define EDSESSION_H
#include <string>
#include <log4cpp/Category.hh>
#include <time.h>
#include "utils.h"
#include "nodeConfigurator.h"
using namespace std;
class edSession
{
public:
edSession(log4cpp::Category *logger,int sessionuid);
virtual ~edSession();
void setClientId(int client_id);
int getClientId();
void setClientIP(int client_ip);
int getClientIP();
int getSessionUid();
void setLoco(int loco);
int getLoco();
void setSession(byte session);
byte getSession();
void setSpeed(byte val);
byte getSpeed();
void setDirection(byte direction);
byte getDirection();
void setAddressType(byte val);
byte getAddressType();
void setCbusTime(struct timespec val);
struct timespec getCbusTime();
void setEDTime(struct timespec val);
struct timespec getEDTime();
void setFnType(int fn ,FN_TYPE state);
FN_TYPE getFnType(int fn);
void setFnState(int fn ,FN_STATE state);
FN_STATE getFnState(int fn);
void setEdName(string edname);
string getEdName();
void setEdHW(string hw);
string getEdHW();
void setLocoName(string loconame);
string getLocoName();
void setNodeConfigurator(nodeConfigurator *config);
byte getDccByte(int fn);
void configChanged();
void getMomentaryFNs();
void getMomentaryFNs(int loco);
string getMomentary();
bool isOrphan();
void setOrphan(bool orphan);
bool isSessionSet();
void setSessionType(char stype);
char getSessionType();
protected:
private:
int loco;
char sessionid;
long last_keep_alive;
bool orphan;
bool session_set;
int client_id; //id from the tcp client. set by the session manager
int sessionuid; //unique number for the session set by the session manager
long client_ip;
byte direction;
byte ad_type;
struct timespec cbus_time;
struct timespec ed_time;
FN_STATE fns[FN_SIZE];
FN_TYPE fnstype[FN_SIZE];
byte speed;
string session_name;
string hname;
string loconame;
log4cpp::Category *logger;
nodeConfigurator *config;
char sessionType;
byte setBit(byte val, int pos);
byte clearBit(byte val, int pos);
void setMomentaryFNs(string val);
vector<string> & split(const string &s, char delim, vector<string> &elems);
};
#endif // EDSESSION_H