ModbusSMA  v1.0.0
modbusSMA::Register Class Reference

Data and information of one SMA register. More...

#include <Register.hpp>

Public Member Functions

 Register (uint16_t _reg, std::string _desc, std::string _unit, DataType _type, DataFormat _format, DataAccess _access)
 Initializes the register. More...
 
uint16_t reg () const noexcept
 Returns the register (integer). More...
 
std::string desc () const noexcept
 Returns the register description. More...
 
std::string unit () const noexcept
 Returns the unit of the register. More...
 
DataType type () const noexcept
 Returns the data type. More...
 
DataFormat format () const noexcept
 Returns the data format. More...
 
DataAccess access () const noexcept
 Returns the access type. More...
 
bool canRead () const noexcept
 Read?
 
bool canWrite () const noexcept
 Write?
 
std::vector< uint16_t > raw () const
 Returns the raw data. More...
 
std::map< uint32_t, std::string > enums () const
 Returns all parsed enums. More...
 
std::string value ()
 Returns the value of the register as a string.
 
uint64_t valueUInt ()
 Get the value as an unsigned integer. Fixed point number formats are ignored.
 
int64_t valueInt ()
 Get the value as an signed integer. Fixed point number formats are ignored.
 
double valueDouble ()
 Get the value as floating point variable.
 
bool setRaw (std::vector< uint16_t > _data)
 Sets the new raw data. Returns false if the size differs from the expected size.
 
void resetData ()
 Reset all data to NaN. More...
 
std::vector< uint16_t > getNaN ()
 Generate NaN values for the current data type.
 
uint32_t size () const noexcept
 The size in 16-bit words of this register (returns 2 for an unknown type)
 

Detailed Description

Data and information of one SMA register.

Definition at line 33 of file Register.hpp.

Constructor & Destructor Documentation

◆ Register()

Register::Register ( uint16_t  _reg,
std::string  _desc,
std::string  _unit,
DataType  _type,
DataFormat  _format,
DataAccess  _access 
)

Initializes the register.

Parameters
_regThe starting register.
_descTextual desctiption of the register.
_unitUnit of the data stored.
_typeThe data type.
_formatThe data format.
_accessHow this register can be accessed.

Definition at line 48 of file Register.cpp.

Member Function Documentation

◆ access()

DataAccess modbusSMA::Register::access ( ) const
inlinenoexcept

Returns the access type.

Definition at line 55 of file Register.hpp.

◆ desc()

std::string modbusSMA::Register::desc ( ) const
inlinenoexcept

Returns the register description.

Definition at line 51 of file Register.hpp.

◆ enums()

std::map<uint32_t, std::string> modbusSMA::Register::enums ( ) const
inline

Returns all parsed enums.

Definition at line 61 of file Register.hpp.

◆ format()

DataFormat modbusSMA::Register::format ( ) const
inlinenoexcept

Returns the data format.

Definition at line 54 of file Register.hpp.

◆ raw()

std::vector<uint16_t> modbusSMA::Register::raw ( ) const
inline

Returns the raw data.

Definition at line 60 of file Register.hpp.

◆ reg()

uint16_t modbusSMA::Register::reg ( ) const
inlinenoexcept

Returns the register (integer).

Definition at line 50 of file Register.hpp.

◆ resetData()

void modbusSMA::Register::resetData ( )
inline

Reset all data to NaN.

Definition at line 69 of file Register.hpp.

◆ type()

DataType modbusSMA::Register::type ( ) const
inlinenoexcept

Returns the data type.

Definition at line 53 of file Register.hpp.

◆ unit()

std::string modbusSMA::Register::unit ( ) const
inlinenoexcept

Returns the unit of the register.

Definition at line 52 of file Register.hpp.


The documentation for this class was generated from the following files: