Public Member Functions | Protected Member Functions | Private Attributes | List of all members
prbt_hardware_support::ModbusMsgWrapper Class Reference

Wrapper class to add semantic to a raw ModbusMsgInStamped. More...

#include <modbus_msg_wrapper.h>

Inheritance diagram for prbt_hardware_support::ModbusMsgWrapper:
Inheritance graph
[legend]

Public Member Functions

virtual void checkStructuralIntegrity () const
 Checks that the Modbus messages consists of all registers needed. More...
 
const ros::TimegetTimeStamp () const
 
unsigned int getVersion () const
 
bool isDisconnect () const
 Check if the Modbus message informs about a disconnect from the server. More...
 
 ModbusMsgWrapper (const ModbusMsgInStampedConstPtr &modbus_msg_raw, const ModbusApiSpec &api_spec)
 Construct a new Modbus Msg Wrapper object. More...
 
virtual ~ModbusMsgWrapper ()=default
 

Protected Member Functions

const ModbusApiSpecgetApiSpec () const
 
uint16_t getRegister (uint32_t reg) const
 
bool hasRegister (uint32_t reg) const
 Check if a certain holding register is define in the Modbus message. More...
 
bool hasVersion () const
 Check if the modbus_msg contains the API version. More...
 

Private Attributes

const ModbusApiSpec api_spec_
 
const ModbusMsgInStampedConstPtr msg_
 

Detailed Description

Wrapper class to add semantic to a raw ModbusMsgInStamped.

Allows easy access to the content behind a raw modbus message.

Definition at line 34 of file modbus_msg_wrapper.h.

Constructor & Destructor Documentation

◆ ModbusMsgWrapper()

prbt_hardware_support::ModbusMsgWrapper::ModbusMsgWrapper ( const ModbusMsgInStampedConstPtr &  modbus_msg_raw,
const ModbusApiSpec api_spec 
)
inline

Construct a new Modbus Msg Wrapper object.

Definition at line 102 of file modbus_msg_wrapper.h.

◆ ~ModbusMsgWrapper()

virtual prbt_hardware_support::ModbusMsgWrapper::~ModbusMsgWrapper ( )
virtualdefault

Member Function Documentation

◆ checkStructuralIntegrity()

void prbt_hardware_support::ModbusMsgWrapper::checkStructuralIntegrity ( ) const
inlinevirtual

Checks that the Modbus messages consists of all registers needed.

Please note: This method does not check if the content of the registers is correct. It only checks that they exist.

Exceptions
ModbusMsgWrapperExceptionif no version can be found in the message and thus interpretation is impossible.

Reimplemented in prbt_hardware_support::ModbusMsgBrakeTestWrapper, prbt_hardware_support::ModbusMsgOperationModeWrapper, and prbt_hardware_support::ModbusMsgStoWrapper.

Definition at line 136 of file modbus_msg_wrapper.h.

◆ getApiSpec()

const ModbusApiSpec & prbt_hardware_support::ModbusMsgWrapper::getApiSpec ( ) const
inlineprotected
Returns
a reference to the internally stored API specification.

Definition at line 144 of file modbus_msg_wrapper.h.

◆ getRegister()

uint16_t prbt_hardware_support::ModbusMsgWrapper::getRegister ( uint32_t  reg) const
inlineprotected
Returns
the content of the holding register.

Definition at line 116 of file modbus_msg_wrapper.h.

◆ getTimeStamp()

const ros::Time & prbt_hardware_support::ModbusMsgWrapper::getTimeStamp ( ) const
inline

Definition at line 149 of file modbus_msg_wrapper.h.

◆ getVersion()

unsigned int prbt_hardware_support::ModbusMsgWrapper::getVersion ( ) const
inline
Returns
Get the API version defined in the Modbus message.

Definition at line 126 of file modbus_msg_wrapper.h.

◆ hasRegister()

bool prbt_hardware_support::ModbusMsgWrapper::hasRegister ( uint32_t  reg) const
inlineprotected

Check if a certain holding register is define in the Modbus message.

Returns
true if the message has the register defined, otherwise false.

Definition at line 109 of file modbus_msg_wrapper.h.

◆ hasVersion()

bool prbt_hardware_support::ModbusMsgWrapper::hasVersion ( ) const
inlineprotected

Check if the modbus_msg contains the API version.

Definition at line 121 of file modbus_msg_wrapper.h.

◆ isDisconnect()

bool prbt_hardware_support::ModbusMsgWrapper::isDisconnect ( ) const
inline

Check if the Modbus message informs about a disconnect from the server.

Returns
true if the message informs about a disconnect, otherwise false.

Definition at line 131 of file modbus_msg_wrapper.h.

Member Data Documentation

◆ api_spec_

const ModbusApiSpec prbt_hardware_support::ModbusMsgWrapper::api_spec_
private

Definition at line 97 of file modbus_msg_wrapper.h.

◆ msg_

const ModbusMsgInStampedConstPtr prbt_hardware_support::ModbusMsgWrapper::msg_
private

Definition at line 98 of file modbus_msg_wrapper.h.


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


prbt_hardware_support
Author(s):
autogenerated on Thu Feb 13 2020 03:16:52