INTRODUCTION
Overview
Download and Install
Documentation
Publications

REPOSITORY
Libraries

DEVELOPER
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

gbxsmartbatteryacfr Namespace Reference

SmartBattery library. More...


Classes

class  HardwareReadingException
 Exception for hardware reading problems. More...
class  ParsingException
 Exception for parsing problems. More...
class  OceanServer
struct  BatteryHealthWarningConfig
class  OceanServerParser
class  OceanServerReader
class  OceanServerSystem
class  SmartBattery

Enumerations

enum  SmartBatteryDataField

Functions

bool checkNumberOfBatteries (const OceanServerSystem &batteryData, std::vector< std::string > &warnShort, std::vector< std::string > &warnVerbose, int expectedNumBatteries)
bool conductAllHealthChecks (const OceanServerSystem &batteryData, const BatteryHealthWarningConfig &batteryConfig, std::vector< std::string > &warnShort, std::vector< std::string > &warnVerbose, bool printRawRecord)
bool checkNumCycles (const OceanServerSystem &batteryData, std::vector< std::string > &warnShort, std::vector< std::string > &warnVerbose, int numCyclesThreshhold, bool printRawRecord=false)
bool checkTemperatures (const OceanServerSystem &batteryData, std::vector< std::string > &warnShort, std::vector< std::string > &warnVerbose, double chargeTempThreshhold, double dischargeTempThreshhold, bool printRawRecord=false)
bool checkCharges (const OceanServerSystem &batteryData, std::vector< std::string > &warnShort, std::vector< std::string > &warnVerbose, int chargeWarnThreshhold, int chargeDeviationThreshold)
bool checkModuleHealth (const OceanServerSystem &batteryData, std::vector< std::string > &warnShort, std::vector< std::string > &warnVerbose)
string toString (const OceanServerSystem &system)
 Puts OceanServerSystem data into a human-readable string.
string toLogString (const OceanServerSystem &system)
 Puts OceanServerSystem data into a machine-readable ASCII string.
void updateWithNewData (const OceanServerSystem &from, OceanServerSystem &to)
bool isChargePowerPresent (const OceanServerSystem &batterySystem)
 Returns true if the charge power is present for at least one of the battery modules, otherwise false.
string toString (const SmartBattery &b)
 Puts SmartBattery data into a human-readable string.
string toLogString (const SmartBattery &b)
 Puts SmartBattery data into a machine-readable ASCII string.
SmartBatteryDataField keyToSmartField (const std::string &key)
void readFlags (const std::string &str, std::vector< bool > &flags)
double readTemperature (const std::string &str)
double readCurrent (const std::string &str)
double readVoltage (const std::string &str)
int readNumBatteries (const std::string &str)
int readPercentWord (const std::string &str)
int readPercentByte (const std::string &str)
int readMinutes (const std::string &str)
int readCapacity (const std::string &str)
uint16_t read16Flags (const std::string &str)
int readCount (const std::string &str)
int readNumber (const std::string &str)
int readRate (const std::string &str)
bool isChecksumValid (const std::string &input, const std::string &expected)
void toKeyValuePairs (const std::vector< std::string > &fields, std::map< std::string, std::string > &pairs, gbxutilacfr::Tracer &tracer)


Detailed Description

SmartBattery library.

This namespace is part of a SmartBattery library.

See also:
GbxSmartBatteryAcfr


Enumeration Type Documentation

Smart battery data specification Specs can be found at http://sbs-forum.org/specs/


Function Documentation

bool gbxsmartbatteryacfr::checkCharges ( const OceanServerSystem &  batteryData,
std::vector< std::string > &  warnShort,
std::vector< std::string > &  warnVerbose,
int  chargeWarnThreshhold,
int  chargeDeviationThreshold 
)

Issues a short and verbose warning if the charge of one or more batteries is below the threshold or if the charge of any battery deviates by chargeDeviationThreshold percent from the average of all batteries Returns true if there was a warning otherwise false

bool gbxsmartbatteryacfr::checkModuleHealth ( const OceanServerSystem &  batteryData,
std::vector< std::string > &  warnShort,
std::vector< std::string > &  warnVerbose 
)

Issues a short and verbose warning if any of the individual modules have "bad power" or are "charge-inhibited" Returns true if there was a warning otherwise false

bool gbxsmartbatteryacfr::checkNumberOfBatteries ( const OceanServerSystem &  batteryData,
std::vector< std::string > &  warnShort,
std::vector< std::string > &  warnVerbose,
int  expectedNumBatteries 
)

Issues a short and verbose warning if the number of expected batteries are not installed Returns true if there was a warning otherwise false

References gbxsmartbatteryacfr::OceanServerSystem::availableBatteries().

Referenced by conductAllHealthChecks().

bool gbxsmartbatteryacfr::checkNumCycles ( const OceanServerSystem &  batteryData,
std::vector< std::string > &  warnShort,
std::vector< std::string > &  warnVerbose,
int  numCyclesThreshhold,
bool  printRawRecord = false 
)

Issues a short and verbose warning if the number of recharge cycles of one or more batteries are exceeded Optionally includes the raw battery record in warnVerbose Returns true if there was a warning otherwise false

bool gbxsmartbatteryacfr::checkTemperatures ( const OceanServerSystem &  batteryData,
std::vector< std::string > &  warnShort,
std::vector< std::string > &  warnVerbose,
double  chargeTempThreshhold,
double  dischargeTempThreshhold,
bool  printRawRecord = false 
)

Issues a short and verbose warning if the temperature threshholds are of one or more batteries are exceeded Optionally includes the raw battery record in warnVerbose Returns true if there was a warning otherwise false

bool gbxsmartbatteryacfr::conductAllHealthChecks ( const OceanServerSystem &  batteryData,
const BatteryHealthWarningConfig &  batteryCheckConfig,
std::vector< std::string > &  warnShort,
std::vector< std::string > &  warnVerbose,
bool  printRawRecord = false 
)

bool gbxsmartbatteryacfr::isChecksumValid ( const std::string &  input,
const std::string &  expected 
)

Computes an XOR checksum from 'input' (skips the first character). Returns true if it matches with 'expected', otherwise false

SmartBatteryDataField gbxsmartbatteryacfr::keyToSmartField ( const std::string &  key  ) 

Converts a key (string) to a SmartBatteryDataField. Throws a ParsingException if key is unknown.

uint16_t gbxsmartbatteryacfr::read16Flags ( const std::string &  str  ) 

Expects 4 hex characters, translates them into uint16_t May throw ParsingException

int gbxsmartbatteryacfr::readCapacity ( const std::string &  str  ) 

Expects 4 hex characters, returns capacity [%] May throw ParsingException

int gbxsmartbatteryacfr::readCount ( const std::string &  str  ) 

Expects 4 hex characters, returns a count May throw ParsingException

double gbxsmartbatteryacfr::readCurrent ( const std::string &  str  ) 

Expects 4 hex characters, returns current [A] May throw ParsingException

void gbxsmartbatteryacfr::readFlags ( const std::string &  str,
std::vector< bool > &  flags 
)

Expects 2 hex characters and translates them into a vector of boolean flags May throw ParsingException

int gbxsmartbatteryacfr::readMinutes ( const std::string &  str  ) 

Expects 4 hex characters, returns minutes May throw ParsingException

int gbxsmartbatteryacfr::readNumBatteries ( const std::string &  str  ) 

Expects 2 hex characters, returns number of batteries May throw ParsingException

int gbxsmartbatteryacfr::readNumber ( const std::string &  str  ) 

Expects 4 hex characters, returns a number May throw ParsingException

int gbxsmartbatteryacfr::readPercentByte ( const std::string &  str  ) 

Expects 2 hex characters, returns percentage [%] May throw ParsingException

int gbxsmartbatteryacfr::readPercentWord ( const std::string &  str  ) 

Expects 4 hex characters, returns percentage [%] May throw ParsingException

int gbxsmartbatteryacfr::readRate ( const std::string &  str  ) 

Expects 4 hex characters, returns a rate May throw ParsingException

double gbxsmartbatteryacfr::readTemperature ( const std::string &  str  ) 

Expects 4 hex characters, returns temperature [degC] May throw ParsingException

double gbxsmartbatteryacfr::readVoltage ( const std::string &  str  ) 

Expects 4 hex characters, returns voltage [V] May throw ParsingException

void gbxsmartbatteryacfr::toKeyValuePairs ( const std::vector< std::string > &  fields,
std::map< std::string, std::string > &  pairs,
gbxutilacfr::Tracer tracer 
)

Decomposes 'fields' (a flat list of keys and values) into 'pairs' (a map of keys and values). May throw ParsingException.

void gbxsmartbatteryacfr::updateWithNewData ( const OceanServerSystem &  from,
OceanServerSystem &  to 
)

Updates all fields in 'to' with data from 'from'. Also reaps batteries in 'to' if they are not in 'from'. Has persistence capabilities: if fields in 'from' are not set and corresponding fields in 'to' are set, the ones in 'to' are kept. There's one exception: the rawRecord field is always updated Use case: a class stores 'to' as a member variable, receives the latest records into 'from', calls this function to update 'to'. The reaping capability makes sure that battery modules which are no longer connected don't persist.

References gbxsmartbatteryacfr::SmartBattery::absoluteStateOfCharge(), gbxsmartbatteryacfr::SmartBattery::atRate(), gbxsmartbatteryacfr::SmartBattery::atRateOk(), gbxsmartbatteryacfr::SmartBattery::atRateTimeToEmpty(), gbxsmartbatteryacfr::SmartBattery::atRateTimeToFull(), gbxsmartbatteryacfr::OceanServerSystem::availableBatteries(), gbxsmartbatteryacfr::SmartBattery::averageCurrent(), gbxsmartbatteryacfr::SmartBattery::averageTimeToEmpty(), gbxsmartbatteryacfr::SmartBattery::averageTimeToFull(), gbxsmartbatteryacfr::OceanServerSystem::batteries(), gbxsmartbatteryacfr::OceanServerSystem::battery(), gbxsmartbatteryacfr::SmartBattery::batteryMode(), gbxsmartbatteryacfr::SmartBattery::batteryStatus(), gbxsmartbatteryacfr::OceanServerSystem::chargeInhibitedStates(), gbxsmartbatteryacfr::OceanServerSystem::chargePowerPresentStates(), gbxsmartbatteryacfr::SmartBattery::chargingCurrent(), gbxsmartbatteryacfr::OceanServerSystem::chargingStates(), gbxsmartbatteryacfr::SmartBattery::chargingVoltage(), gbxsmartbatteryacfr::SmartBattery::current(), gbxsmartbatteryacfr::SmartBattery::cycleCount(), gbxsmartbatteryacfr::SmartBattery::designCapacity(), gbxsmartbatteryacfr::SmartBattery::designVoltage(), gbxsmartbatteryacfr::SmartBattery::deviceChemistry(), gbxsmartbatteryacfr::SmartBattery::deviceName(), gbxsmartbatteryacfr::OceanServerSystem::eraseBattery(), gbxsmartbatteryacfr::SmartBattery::fullChargeCapacity(), gbxsmartbatteryacfr::SmartBattery::has(), gbxsmartbatteryacfr::SmartBattery::manufactureDate(), gbxsmartbatteryacfr::SmartBattery::manufacturerAccess(), gbxsmartbatteryacfr::SmartBattery::manufacturerData(), gbxsmartbatteryacfr::SmartBattery::manufacturerName(), gbxsmartbatteryacfr::SmartBattery::maxError(), gbxsmartbatteryacfr::OceanServerSystem::messageToSystem(), gbxsmartbatteryacfr::OceanServerSystem::minToEmpty(), gbxsmartbatteryacfr::OceanServerSystem::percentCharge(), gbxsmartbatteryacfr::OceanServerSystem::powerNoGoodStates(), gbxsmartbatteryacfr::OceanServerSystem::rawRecord(), gbxsmartbatteryacfr::SmartBattery::relativeStateOfCharge(), gbxsmartbatteryacfr::SmartBattery::remainingCapacity(), gbxsmartbatteryacfr::SmartBattery::remainingCapacityAlarm(), gbxsmartbatteryacfr::SmartBattery::remainingTimeAlarm(), gbxsmartbatteryacfr::SmartBattery::runTimeToEmpty(), gbxsmartbatteryacfr::SmartBattery::serialNumber(), gbxsmartbatteryacfr::SmartBattery::setAbsoluteStateOfCharge(), gbxsmartbatteryacfr::SmartBattery::setAtRate(), gbxsmartbatteryacfr::SmartBattery::setAtRateOk(), gbxsmartbatteryacfr::SmartBattery::setAtRateTimeToEmpty(), gbxsmartbatteryacfr::SmartBattery::setAtRateTimeToFull(), gbxsmartbatteryacfr::SmartBattery::setAverageCurrent(), gbxsmartbatteryacfr::SmartBattery::setAverageTimeToEmpty(), gbxsmartbatteryacfr::SmartBattery::setAverageTimeToFull(), gbxsmartbatteryacfr::SmartBattery::setBatteryMode(), gbxsmartbatteryacfr::SmartBattery::setBatteryStatus(), gbxsmartbatteryacfr::SmartBattery::setChargingCurrent(), gbxsmartbatteryacfr::SmartBattery::setChargingVoltage(), gbxsmartbatteryacfr::SmartBattery::setCurrent(), gbxsmartbatteryacfr::SmartBattery::setCycleCount(), gbxsmartbatteryacfr::SmartBattery::setDesignCapacity(), gbxsmartbatteryacfr::SmartBattery::setDesignVoltage(), gbxsmartbatteryacfr::SmartBattery::setDeviceChemistry(), gbxsmartbatteryacfr::SmartBattery::setDeviceName(), gbxsmartbatteryacfr::SmartBattery::setFullChargeCapacity(), gbxsmartbatteryacfr::SmartBattery::setManufactureDate(), gbxsmartbatteryacfr::SmartBattery::setManufacturerAccess(), gbxsmartbatteryacfr::SmartBattery::setManufacturerData(), gbxsmartbatteryacfr::SmartBattery::setManufacturerName(), gbxsmartbatteryacfr::SmartBattery::setMaxError(), gbxsmartbatteryacfr::OceanServerSystem::setMessageToSystem(), gbxsmartbatteryacfr::OceanServerSystem::setMinToEmpty(), gbxsmartbatteryacfr::OceanServerSystem::setPercentCharge(), gbxsmartbatteryacfr::SmartBattery::setRelativeStateOfCharge(), gbxsmartbatteryacfr::SmartBattery::setRemainingCapacity(), gbxsmartbatteryacfr::SmartBattery::setRemainingCapacityAlarm(), gbxsmartbatteryacfr::SmartBattery::setRemainingTimeAlarm(), gbxsmartbatteryacfr::SmartBattery::setRunTimeToEmpty(), gbxsmartbatteryacfr::SmartBattery::setSerialNumber(), gbxsmartbatteryacfr::SmartBattery::setSpecificationInfo(), gbxsmartbatteryacfr::SmartBattery::setTemperature(), gbxsmartbatteryacfr::SmartBattery::setVoltage(), gbxsmartbatteryacfr::SmartBattery::specificationInfo(), gbxsmartbatteryacfr::OceanServerSystem::supplyingPowerStates(), gbxsmartbatteryacfr::SmartBattery::temperature(), and gbxsmartbatteryacfr::SmartBattery::voltage().

Referenced by gbxsmartbatteryacfr::OceanServer::walk().

 

Generated for GearBox by  doxygen 1.4.5