My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
DliPowerStrip.h
Go to the documentation of this file.
1 // $Id: DliPowerStrip.h,v 1.2 2010/11/24 00:46:01 sjcm Exp $
2 
3 #ifndef GCP_UTIL_DLIPOWERSTRIP_H
4 #define GCP_UTIL_DLIPOWERSTRIP_H
5 
15 #include <vector>
16 
17 namespace gcp {
18  namespace util {
19 
20  class DliPowerStrip {
21  public:
22 
23  enum State {
24  UNKNOWN = 0x0,
25  OFF = 0x1,
26  ON = 0x2,
27  };
28 
29  enum Outlet {
30  OUTLET_NONE = 0x0,
31  OUTLET_1 = 0x1,
32  OUTLET_2 = 0x2,
33  OUTLET_3 = 0x4,
34  OUTLET_4 = 0x8,
35  OUTLET_5 = 0x10,
36  OUTLET_6 = 0x20,
37  OUTLET_7 = 0x40,
38  OUTLET_8 = 0x80,
39  };
40 
41  static const unsigned MAX_OUTLETS;
42 
46  DliPowerStrip(std::string host);
47 
51  virtual ~DliPowerStrip();
52 
53  // Turn an outlet on
54 
55  void on(unsigned outlet);
56 
57  // Turn a set of outlets on
58 
59  void on(Outlet outletMask);
60 
61  // Turn an outlet off
62 
63  void off(unsigned outlet);
64 
65  // Turn a set of outlets off
66 
67  void off(Outlet outletMask);
68 
69  // Cycle power to an outlet
70 
71  void cycle(unsigned outlet);
72 
73  // Cycle power to a set of outlets
74 
75  void cycle(Outlet outletMask);
76 
77  // Turn all outlets on
78 
79  void allOn();
80 
81  // Turn all outlets off
82 
83  void allOff();
84 
85  // Cycle power to all outlets
86 
87  void cycleAll();
88 
89  // Query the status of all outlets
90 
91  std::vector<State> queryStatus();
92 
93  private:
94 
95  std::vector<State> state_;
96  std::string host_;
97 
98  void checkOutlet(unsigned outlet);
99  std::string sendRequest(std::string str);
100 
101  }; // End class DliPowerStrip
102 
103  } // End namespace util
104 } // End namespace gcp
105 
106 
107 
108 #endif // End #ifndef GCP_UTIL_DLIPOWERSTRIP_H
DliPowerStrip(std::string host)
Definition: DliPowerStrip.cc:14
Definition: DliPowerStrip.h:20
virtual ~DliPowerStrip()
Definition: DliPowerStrip.cc:28