source: trunk/FACT++/src/HeadersPower.h@ 16887

Last change on this file since 16887 was 14522, checked in by tbretz, 12 years ago
Added some abbreviations for combined states.
File size: 1.5 KB
Line 
1#ifndef FACT_HeadersPower
2#define FACT_HeadersPower
3
4#include <iosfwd>
5#include <stdint.h>
6
7class QString;
8class QDomNamedNodeMap;
9
10namespace Power
11{
12 namespace State
13 {
14 enum states_t
15 {
16 kDisconnected = 1,
17 kConnected,
18 kSystemOff,
19 kCameraOn = 4,
20 kBiasOn = 8,
21 kDriveOn = 16,
22 kCameraOff = kBiasOn|kDriveOn,
23 kBiasOff = kCameraOn|kDriveOn,
24 kDriveOff = kCameraOn|kBiasOn,
25 kSystemOn = kCameraOn|kBiasOn|kDriveOn,
26 kCoolingFailure
27 };
28 };
29
30 struct Status
31 {
32 bool fWaterLevelOk;
33 bool fWaterFlowOk;
34
35 bool fPwr24VOn;
36 bool fPwrPumpOn;
37 bool fPwrBiasOn;
38 bool fPwrDriveOn;
39
40 bool fDriveMainSwitchOn;
41 bool fDriveFeedbackOn;
42
43 Status() { }
44
45 bool Set(bool &rc, const QString &value);
46 bool Set(const QDomNamedNodeMap &map);
47
48 void Print(std::ostream &out, const char *title, const bool &val, const char *t="enabled", const char *f="disabled");
49 void Print(std::ostream &out);
50
51 uint8_t GetVal() const
52 {
53 return
54 fWaterLevelOk <<0 |
55 fWaterFlowOk <<1 |
56 fPwr24VOn <<2 |
57 fPwrPumpOn <<3 |
58 fPwrDriveOn <<4 |
59 fDriveMainSwitchOn <<5 |
60 fDriveFeedbackOn <<6;
61 }
62
63 } __attribute__((__packed__));
64};
65#endif
Note: See TracBrowser for help on using the repository browser.