1 | #ifndef COSY_MCeCoCom
|
---|
2 | #define COSY_MCeCoCom
|
---|
3 |
|
---|
4 | #ifndef ROOT_TString
|
---|
5 | #include <TString.h>
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | #ifndef COSY_MTcpIpIO
|
---|
9 | #include "MTcpIpIO.h"
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | #ifndef MARS_MTime
|
---|
13 | #include "MTime.h"
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | class MCeCoCom : public MTcpIpIO
|
---|
17 | {
|
---|
18 | private:
|
---|
19 | enum ComStatus_t
|
---|
20 | {
|
---|
21 | kCmdReceived,
|
---|
22 | kNoCmdReceived,
|
---|
23 | kComProblem
|
---|
24 | };
|
---|
25 |
|
---|
26 | //TString fCommand; // report string of the current system
|
---|
27 | MTime fT; // time of last report received
|
---|
28 | char fStatus; // current status of this system
|
---|
29 | int fCCStatus; // global status of CC
|
---|
30 |
|
---|
31 | ComStatus_t fComStat; // communication status
|
---|
32 |
|
---|
33 | Float_t fHumidity; // [%]
|
---|
34 | Float_t fTemperature; // [deg] celsius
|
---|
35 | Float_t fWindSpeed; // [km/h]
|
---|
36 | Float_t fSolarRadiation; // [W/m^2] IR-Radiation
|
---|
37 |
|
---|
38 | Int_t fAlarmCounter; // Counter for alarm cases
|
---|
39 |
|
---|
40 | virtual bool InterpreteCmd(TString cmd, TString str);
|
---|
41 |
|
---|
42 | bool InterpreteReport(TString &str);
|
---|
43 | bool InterpreteStr(TString str);
|
---|
44 |
|
---|
45 | public:
|
---|
46 | MCeCoCom::MCeCoCom(const char *cmd, MLog &out=gLog)
|
---|
47 | : MTcpIpIO(out), /*fCommand(cmd),*/ fStatus(0), fComStat(kNoCmdReceived), fSolarRadiation(-1)
|
---|
48 | {
|
---|
49 | }
|
---|
50 |
|
---|
51 | bool Send(const char *cmd, const char *str);
|
---|
52 | void SetStatus(Byte_t s) { fStatus=s; }
|
---|
53 |
|
---|
54 | Float_t GetHumidity() const { return fHumidity; }
|
---|
55 | Float_t GetTemperature() const { return fTemperature; }
|
---|
56 | Float_t GetWindSpeed() const { return fWindSpeed; }
|
---|
57 |
|
---|
58 | TString GetWeather() const;
|
---|
59 | Int_t GetWeatherStatus() const;
|
---|
60 |
|
---|
61 | Bool_t HasAlarm() const { return fAlarmCounter>3; }
|
---|
62 | };
|
---|
63 |
|
---|
64 | #endif
|
---|