source: trunk/Cosy/tcpip/MCeCoCom.h@ 19813

Last change on this file since 19813 was 12597, checked in by tbretz, 13 years ago
Replaced MTcpIpIO by MTcpIpFact for FACT
File size: 2.0 KB
Line 
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#ifdef FACT
17#define MTcpIpCom MTcpIpFact
18#else
19#define MTcpIpCom MTcpIpIO
20#endif
21
22class MCeCoCom : public MTcpIpCom
23{
24private:
25 enum ComStatus_t
26 {
27 kCmdReceived = 1,
28 kComProblem = 2
29 };
30
31 MLog *fOut; // Stream to which reports are written in addition
32
33// Int_t fSendInterval; // [ms]
34// MTime fTime;
35
36 MTime fT; // time of last report received
37 char fStatus; // current status of this system
38 int fCCStatus; // global status of CC
39
40 Byte_t fTelescope;
41
42 ComStatus_t fComStat; // communication status
43
44 Float_t fHumidity; // [%]
45 Float_t fTemperature; // [deg] celsius
46 Float_t fWindSpeed; // [km/h]
47 Float_t fSolarRadiation; // [W/m^2] IR-Radiation
48
49 Int_t fAlarmCounter; // Counter for alarm cases
50
51 virtual bool InterpreteCmd(TString cmd, TString str);
52
53 bool InterpreteReport(TString &str);
54 bool InterpreteStr(TString str);
55
56public:
57 MCeCoCom(const char *addr, const int tx=7304, const int rx=7404, MLog *out=NULL)
58 : MTcpIpCom(addr, tx, rx, 15000), fOut(out), fStatus(0),
59 fTelescope(1), fComStat(kComProblem),
60 fHumidity(0), fTemperature(0), fWindSpeed(0), fSolarRadiation(-1),
61 fAlarmCounter(0)
62 {
63 }
64 //virtual bool SendMsg(const char *msg, bool force);
65
66 void SetOutRep(MLog *out) { fOut = out; }
67
68 bool SendRep(const char *cmd, const char *str, bool force);
69 void SetStatus(Byte_t s) { fStatus=s; }
70
71 void SetTelescope(Byte_t tel) { fTelescope = tel; }
72
73 Float_t GetHumidity() const { return fHumidity; }
74 Float_t GetTemperature() const { return fTemperature; }
75 Float_t GetWindSpeed() const { return fWindSpeed; }
76
77 TString GetWeather() const;
78 Int_t GetWeatherStatus() const;
79
80 Bool_t HasAlarm() const { return fAlarmCounter>3; }
81};
82
83#endif
Note: See TracBrowser for help on using the repository browser.