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

Last change on this file since 8869 was 8869, checked in by tbretz, 17 years ago
*** empty log message ***
File size: 1.8 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 ComStatus_t fComStat; // communication status
36
37 Float_t fHumidity; // [%]
38 Float_t fTemperature; // [deg] celsius
39 Float_t fWindSpeed; // [km/h]
40 Float_t fSolarRadiation; // [W/m^2] IR-Radiation
41
42 Int_t fAlarmCounter; // Counter for alarm cases
43
44 virtual bool InterpreteCmd(TString cmd, TString str);
45
46 bool InterpreteReport(TString &str);
47 bool InterpreteStr(TString str);
48
49public:
50 MCeCoCom(const char *addr, const int tx=7304, const int rx=7404, MLog *out=NULL)
51 : MTcpIpIO(addr, tx, rx), fOut(out), fStatus(0), fComStat(kNoCmdReceived),
52 fHumidity(0), fTemperature(0), fWindSpeed(0), fSolarRadiation(-1),
53 fAlarmCounter(0)
54 {
55 }
56 //virtual bool SendMsg(const char *msg, bool force);
57
58 void SetOutRep(MLog *out) { fOut = out; }
59
60 bool SendRep(const char *cmd, const char *str, bool force);
61 void SetStatus(Byte_t s) { fStatus=s; }
62
63 Float_t GetHumidity() const { return fHumidity; }
64 Float_t GetTemperature() const { return fTemperature; }
65 Float_t GetWindSpeed() const { return fWindSpeed; }
66
67 TString GetWeather() const;
68 Int_t GetWeatherStatus() const;
69
70 Bool_t HasAlarm() const { return fAlarmCounter>3; }
71};
72
73#endif
Note: See TracBrowser for help on using the repository browser.