INTRODUCTION
Overview
Download and Install
Documentation
Publications

REPOSITORY
Libraries

DEVELOPER
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         
oceanserversystem.h
1 /*
2  * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
3  * http://gearbox.sf.net/
4  * Copyright (c) 2004-2010 Tobias Kaupp
5  *
6  * This distribution is licensed to you under the terms described in
7  * the LICENSE file included in this distribution.
8  *
9  */
10 
11 #ifndef GBX_OCEANSERVER_SYSTEM_H
12 #define GBX_OCEANSERVER_SYSTEM_H
13 
14 #include <map>
15 #include <gbxsmartbatteryacfr/smartbattery.h>
16 
17 namespace gbxsmartbatteryacfr
18 {
19 
27 {
28  public:
29 
32 
34  bool isEmpty() const { return isEmpty_; };
35 
37  const std::map<int,SmartBattery>& batteries() const;
38 
40  SmartBattery& battery( unsigned int batteryNumber );
41 
43  const SmartBattery& battery( unsigned int batteryNumber ) const;
44 
46  void eraseBattery( unsigned int batteryNumber );
47 
49  void setPercentCharge(int percentCharge) { isEmpty_=false; percentCharge_ = percentCharge; };
51  int percentCharge() const { return percentCharge_; };
53  void setMinToEmpty(int minToEmpty) { isEmpty_=false; minToEmpty_ = minToEmpty; };
55  int minToEmpty() const { return minToEmpty_; };
57  void setMessageToSystem(const std::string &messageToSystem) { isEmpty_=false; messageToSystem_ = messageToSystem; };
59  std::string messageToSystem() const { return messageToSystem_; };
60 
62  const std::vector<bool> &availableBatteries() const { return availableBatteries_; };
64  std::vector<bool> &availableBatteries() { isEmpty_=false; return availableBatteries_; };
66  const std::vector<bool> &chargingStates() const { return chargingStates_; };
68  std::vector<bool> &chargingStates() { isEmpty_=false; return chargingStates_; };
70  const std::vector<bool> &supplyingPowerStates() const { return supplyingPowerStates_; };
72  std::vector<bool> &supplyingPowerStates() { isEmpty_=false; return supplyingPowerStates_; };
74  const std::vector<bool> &chargePowerPresentStates() const { return chargePowerPresentStates_; };
76  std::vector<bool> &chargePowerPresentStates() { isEmpty_=false; return chargePowerPresentStates_; };
78  const std::vector<bool> &powerNoGoodStates() const { return powerNoGoodStates_; };
80  std::vector<bool> &powerNoGoodStates() { isEmpty_=false; return powerNoGoodStates_; };
82  const std::vector<bool> &chargeInhibitedStates() const { return chargeInhibitedStates_; }
84  std::vector<bool> &chargeInhibitedStates() { isEmpty_=false; return chargeInhibitedStates_; }
85 
87  const std::vector<std::string> &rawRecord() const { return rawRecord_; };
89  std::vector<std::string> &rawRecord() { isEmpty_=false; return rawRecord_; };
90 
91  private:
92 
93  bool isEmpty_;
94 
95  // Average battery values
96  int percentCharge_;
97  int minToEmpty_;
98  std::string messageToSystem_;
99 
100  // Battery module states. Each vector is always of size 8 because OceanServer's Battery
101  // Management Modules have a maximum of 8 slots (either 2, 4, or 8 dependent on the model)
102  std::vector<bool> availableBatteries_;
103  std::vector<bool> chargingStates_;
104  std::vector<bool> supplyingPowerStates_;
105  std::vector<bool> chargePowerPresentStates_;
106  std::vector<bool> powerNoGoodStates_;
107  std::vector<bool> chargeInhibitedStates_;
108 
109  // the latest raw record, useful for debugging
110  std::vector<std::string> rawRecord_;
111 
112  // key: slot number, data: a single smart battery module
113  std::map<int,SmartBattery> batteries_;
114 };
115 
117 std::string toString( const OceanServerSystem &system );
118 
120 std::string toLogString( const OceanServerSystem &system );
121 
127 void updateWithNewData( const OceanServerSystem &from,
128  OceanServerSystem &to );
129 
131 bool isChargePowerPresent( const OceanServerSystem &batterySystem );
132 
133 } // namespace
134 
135 #endif
 

Generated for GearBox by  doxygen 1.4.5