#include <RobonetDataElement.h>
Public Types | |
enum | ElementStyle { Normal = 0, MotCom = 1, Temperature = 2, BrakePwm = 3, FixedPointMilli = 4, UnsignedFixedPointMilli = 5, FixedPointCenti = 6, UnsignedFixedPointCenti = 7, PowConTemperature = 8, PowConCurrentMany = 9, PowConVoltageMany = 10 } |
typedef std::pair< std::string, std::string > | OffsetPair |
A std::pair of offsets stored as std::string's. | |
typedef std::pair< uint16_t, uint16_t > | RawPair |
enum | TrimValues { MotComMax = 255, MotComMin = -255, TemperatureMin = 0, BrakePwmMax = 4096 } |
Public Member Functions | |
std::string | getChannel () |
Get the channel that the value will be read from (or written to). | |
std::string | getGroup () |
Get the data group with which the value will be transferred. | |
std::string | getNode () |
Get the node that the value will be read from (or written to). | |
OffsetPair | getOffsetPair () |
Get the offset pair storing the offsets at which the value will be read from (or written to). | |
RawPair | getRawPair () |
Get the raw pair storing ... | |
ElementSize | getRawSize () |
const RawPair | pull () |
Used by the DataClient to pull 16-bit raw values out, based on current DataElement::value . | |
void | push (RawPair rawPair) |
Used by the DataClient to push new 16-bit raw values in, and modify the current DataElement::value . | |
RobonetDataElement (const std::string &type, DataElement::ReadWrite readWrite, const std::string &channel, const std::string &node, OffsetPair offsetPair, const std::string &group, ElementStyle mangleOption=Normal, std::shared_ptr< SMT::Resource > resource=NULL) | |
The specific constructor for the RobonetDataElement class. | |
void | setChannel (const std::string &channel) |
Set the channel that the value will be read from (or written to). | |
void | setGroup (const std::string &group) |
Set the data group with which the value will be transferred. | |
void | setNode (const std::string &node) |
Set the node that the value will be read from (or written to). | |
void | setOffsetPair (OffsetPair offsetPair) |
Set the offset pair storing the offsets at which the value will be read from (or written to). | |
template<typename T > | |
void | setValue (const T v) |
Set the value held by the DataElement in the specified data type. | |
std::string | toString () |
Convert the RobonetDataElement into a string representation. | |
template<typename T > | |
uint16_t | TrimBrakePwm (const T t) |
template<typename T > | |
int16_t | TrimMotCom (const T t) |
template<typename T > | |
float | TrimTemperature (const T t) |
virtual | ~RobonetDataElement () |
The destructor for the RobonetDataElement class. | |
Private Attributes | |
BitWizard< uint16_t > | bitWizard16 |
std::string | channel |
The name of the channel that the value will be read from (or written to). For example: "LL". | |
std::string | group |
The data group that this element will be transferred with. For example: "Command". | |
std::string | node |
The name of the node that the value will be read from (or written to). For example: "J1". | |
OffsetPair | offsetPair |
The offset pair storing the offsets at which the value will be read from (or written to). For example: RobonetDataElement::OffsetPair("APS1L","APS1H"). | |
RawPair | rawPair |
ElementStyle | style |
Static Private Attributes | |
static const BitMinion::BitIndexEnumType | BRAKEPWM_CERTIFICATE_INDEX = BitMinion::BIT_FOURTEEN_INDEX |
static const BitMinion::BitCountMaskEnumType | BRAKEPWM_CERTIFICATE_SIZE = BitMinion::TWO_BIT_MASK |
static const uint16_t | BRAKEPWM_CERTIFICATE_VALUE = 0x3 |
static const BitMinion::BitIndexEnumType | MOTCOM_CERTIFICATE_INDEX = BitMinion::BIT_NINE_INDEX |
static const BitMinion::BitCountMaskEnumType | MOTCOM_CERTIFICATE_SIZE = BitMinion::THREE_BIT_MASK |
static const uint16_t | MOTCOM_CERTIFICATE_VALUE = 0x7 |
static const BitMinion::BitIndexEnumType | MOTCOM_SIGN_BIT_INDEX = BitMinion::BIT_EIGHT_INDEX |
Definition at line 76 of file RobonetDataElement.h.
typedef std::pair<std::string, std::string> RobonetDataElement::OffsetPair |
A std::pair of offsets stored as std::string's.
Each offset represents a name of a memory offset token, like "APS1H".
Definition at line 84 of file RobonetDataElement.h.
typedef std::pair<uint16_t, uint16_t> RobonetDataElement::RawPair |
Definition at line 88 of file RobonetDataElement.h.
Normal | |
MotCom | |
Temperature | |
BrakePwm | |
FixedPointMilli | |
UnsignedFixedPointMilli | |
FixedPointCenti | |
UnsignedFixedPointCenti | |
PowConTemperature | |
PowConCurrentMany | |
PowConVoltageMany |
Definition at line 90 of file RobonetDataElement.h.
Definition at line 111 of file RobonetDataElement.h.
RobonetDataElement::RobonetDataElement | ( | const std::string & | type, |
DataElement::ReadWrite | readWrite, | ||
const std::string & | channel, | ||
const std::string & | node, | ||
OffsetPair | offsetPair, | ||
const std::string & | group, | ||
ElementStyle | mangleOption = Normal , |
||
std::shared_ptr< SMT::Resource > | resource = NULL |
||
) |
The specific constructor for the RobonetDataElement class.
type | A string containing the data type of the value. For example: "uint32_t" or other types specified in DataElement::ValueType |
readWrite | Whether the DataElement should be read from (or written to) hardware. For example: DataElement::Read |
channel | A string containing the name of the channel that the value will be read from (or written to). For example: "LL". |
node | A string containing the name of the node that the value will be read from (or written to). For example: "J1". |
offsetPair | The offset pair storing the offsets at which the value will be read from (or written to). For example: RobonetDataElement::OffsetPair("APS1L","APS1H"). |
group | A string containing the data group with which the value will be transferred. For example: "Command". |
mangleOption | A value of type ElementStyle defining any special features of this element, like Normal, MotCom, Temperature, or BrakePwm |
std::invalid_argument | If any of channel, node, offsetPair.first, or group are empty |
std::invalid_argument | If the RobonetDataElement size is DataElement::ThirtyTwoBit and offsetPair.second is empty |
RobonetDataElement::rawPair is initialized to (0,0)
Definition at line 71 of file RobonetDataElement.cpp.
RobonetDataElement::~RobonetDataElement | ( | ) | [virtual] |
The destructor for the RobonetDataElement class.
Definition at line 183 of file RobonetDataElement.cpp.
std::string RobonetDataElement::getChannel | ( | ) |
Get the channel that the value will be read from (or written to).
Definition at line 293 of file RobonetDataElement.cpp.
std::string RobonetDataElement::getGroup | ( | ) |
Get the data group with which the value will be transferred.
Definition at line 320 of file RobonetDataElement.cpp.
std::string RobonetDataElement::getNode | ( | ) |
Get the node that the value will be read from (or written to).
Definition at line 302 of file RobonetDataElement.cpp.
Get the offset pair storing the offsets at which the value will be read from (or written to).
Definition at line 311 of file RobonetDataElement.cpp.
Get the raw pair storing ...
Definition at line 328 of file RobonetDataElement.cpp.
Definition at line 187 of file RobonetDataElement.cpp.
Used by the DataClient to pull 16-bit raw values out, based on current DataElement::value .
Uses the DataMangler class to separate the raw values.
MotCom is a 9-bit signed integer with a 3-bit certificate.
Get sign bit of user-supplied signed value.
Get absolute value of user-supplied signed value.
Make sure top eight bits are clear.
Set sign bit in MotCom value in ninth bit (bit eight).
Apply MotCom certificate.
Temperature is a 16-bit unsigned integer, representing the number of half-degrees Celcius
BrakePWM is an unsigned integer with a max value of 4096 with a 2-bit certificate.
Apply BrakePWM certificate.
FixedPointMilli is a 16-bit fixed point number where the decimal place is assumed third from the right (123456.789)
UnsignedFixedPointMilli is an unsigned 16-bit fixed point number where the decimal place is assumed third from the right (123456.789)
FixedPointCenti is a 16-bit fixed point number where the decimal place is assumed second from the right (1234567.89)
UnsignedFixedPointCenti is an unsigned 16-bit fixed point number where the decimal place is assumed second from the right (1234567.89)
PowConTemperature is a 16-bit float, representing temperature in degrees Celcius
Make sure top four bits are clear.
PowConCurrentMany is a 16-bit float, representing current in amps
Make sure top four bits are clear.
PowConVoltageMany is a 16-bit float, representing voltage in volts
Make sure top four bits are clear.
Definition at line 374 of file RobonetDataElement.cpp.
void RobonetDataElement::push | ( | RawPair | rawPair | ) |
Used by the DataClient to push new 16-bit raw values in, and modify the current DataElement::value .
rawPair | The pair of 16-bit raw values. |
PushToWriteElementException | If user tries to push() raw values into a 'Writable' RobonetDataElement. |
Uses the DataMangler class to combine the raw values.
MotCom is a 9-bit signed integer with a 3-bit certificate.
Get raw value.
Remove MotCom certificate
Get sign bit of raw value;
Make sure top eight bits are clear.
Set positive or negative value.
Temperature is a 16-bit unsigned integer, representing the number of half-degrees Celcius
BrakePWM is an unsigned integer with a max value of 4096 with a 2-bit certificate.
Remove BrakePWM certificate.
FixedPointMilli is a 16-bit fixed point number where the decimal place is assumed third from the right (123456.789)
UnsignedFixedPointMilli is an unsigned 16-bit fixed point number where the decimal place is assumed third from the right (123456.789)
FixedPointCenti is a 16-bit fixed point number where the decimal place is assumed second from the right (1234567.89)
UnsignedFixedPointCenti is an unsigned 16-bit fixed point number where the decimal place is assumed second from the right (1234567.89)
PowConTemperature is a 16-bit float, representing temperature in degrees Celcius
PowConCurrentMany is a 16-bit float, representing current in amps
PowConVoltageMany is a 16-bit float, representing voltage in volts
Definition at line 551 of file RobonetDataElement.cpp.
void RobonetDataElement::setChannel | ( | const std::string & | channel | ) |
Set the channel that the value will be read from (or written to).
channel | The channel that the value will be read from (or written to). For example: "LL". |
Definition at line 209 of file RobonetDataElement.cpp.
void RobonetDataElement::setGroup | ( | const std::string & | group | ) |
Set the data group with which the value will be transferred.
group | The group with which the value will be transferred. For example: "Command". |
Definition at line 273 of file RobonetDataElement.cpp.
void RobonetDataElement::setNode | ( | const std::string & | node | ) |
Set the node that the value will be read from (or written to).
node | The node that the value will be read from (or written to). For example: "J1". |
Definition at line 228 of file RobonetDataElement.cpp.
void RobonetDataElement::setOffsetPair | ( | OffsetPair | offsetPair | ) |
Set the offset pair storing the offsets at which the value will be read from (or written to).
offsetPair | The offset pair storing the offsets at which the value will be read from (or written to). For example: RobonetDataElement::OffsetPair("APS1L","APS1H"). |
Definition at line 247 of file RobonetDataElement.cpp.
void RobonetDataElement::setValue | ( | const T | v | ) |
Set the value held by the DataElement in the specified data type.
v | The value to be held by the DataElement in the specified data type. |
When you set the value, is doesn't matter what the previous type was, this method will overwrite the type as well as the value.
Reimplemented from DataElement.
Definition at line 205 of file RobonetDataElement.h.
std::string RobonetDataElement::toString | ( | ) | [virtual] |
Convert the RobonetDataElement into a string representation.
Reimplemented from DataElement.
Definition at line 337 of file RobonetDataElement.cpp.
uint16_t RobonetDataElement::TrimBrakePwm | ( | const T | t | ) | [inline] |
Definition at line 150 of file RobonetDataElement.h.
int16_t RobonetDataElement::TrimMotCom | ( | const T | t | ) | [inline] |
Definition at line 120 of file RobonetDataElement.h.
float RobonetDataElement::TrimTemperature | ( | const T | t | ) | [inline] |
Definition at line 137 of file RobonetDataElement.h.
BitWizard<uint16_t> RobonetDataElement::bitWizard16 [private] |
Definition at line 188 of file RobonetDataElement.h.
const BitMinion::BitIndexEnumType RobonetDataElement::BRAKEPWM_CERTIFICATE_INDEX = BitMinion::BIT_FOURTEEN_INDEX [static, private] |
Definition at line 194 of file RobonetDataElement.h.
const BitMinion::BitCountMaskEnumType RobonetDataElement::BRAKEPWM_CERTIFICATE_SIZE = BitMinion::TWO_BIT_MASK [static, private] |
Definition at line 195 of file RobonetDataElement.h.
const uint16_t RobonetDataElement::BRAKEPWM_CERTIFICATE_VALUE = 0x3 [static, private] |
Definition at line 196 of file RobonetDataElement.h.
std::string RobonetDataElement::channel [private] |
The name of the channel that the value will be read from (or written to). For example: "LL".
Definition at line 182 of file RobonetDataElement.h.
std::string RobonetDataElement::group [private] |
The data group that this element will be transferred with. For example: "Command".
Definition at line 184 of file RobonetDataElement.h.
const BitMinion::BitIndexEnumType RobonetDataElement::MOTCOM_CERTIFICATE_INDEX = BitMinion::BIT_NINE_INDEX [static, private] |
Definition at line 191 of file RobonetDataElement.h.
const BitMinion::BitCountMaskEnumType RobonetDataElement::MOTCOM_CERTIFICATE_SIZE = BitMinion::THREE_BIT_MASK [static, private] |
Definition at line 192 of file RobonetDataElement.h.
const uint16_t RobonetDataElement::MOTCOM_CERTIFICATE_VALUE = 0x7 [static, private] |
Definition at line 193 of file RobonetDataElement.h.
const BitMinion::BitIndexEnumType RobonetDataElement::MOTCOM_SIGN_BIT_INDEX = BitMinion::BIT_EIGHT_INDEX [static, private] |
Definition at line 190 of file RobonetDataElement.h.
std::string RobonetDataElement::node [private] |
The name of the node that the value will be read from (or written to). For example: "J1".
Definition at line 183 of file RobonetDataElement.h.
OffsetPair RobonetDataElement::offsetPair [private] |
The offset pair storing the offsets at which the value will be read from (or written to). For example: RobonetDataElement::OffsetPair("APS1L","APS1H").
Definition at line 185 of file RobonetDataElement.h.
RawPair RobonetDataElement::rawPair [private] |
Definition at line 186 of file RobonetDataElement.h.
ElementStyle RobonetDataElement::style [private] |
Definition at line 187 of file RobonetDataElement.h.