source: trunk/MagicSoft/Cosy/tcpip/MCeCoCom.h@ 9432

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