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
class  OceanServerParser
class  OceanServerReader
class  OceanServerSystem
class  SmartBattery

Enumerations

enum  SmartBatteryDataField

Functions

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)
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

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. 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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Expects 4 hex characters, returns minutes May throw ParsingException

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

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

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

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

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

Expects 4 hex characters, returns a count May throw ParsingException

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

Expects 4 hex characters, returns a number May throw ParsingException

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

Expects 4 hex characters, returns a rate May throw ParsingException

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

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.

 

Generated for GearBox by  doxygen 1.4.5