Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
prbt_hardware_support::ModbusAdapterBrakeTest Class Reference

Listens to the modbus_read topic and publishes a message informing about a required brake test. More...

#include <modbus_adapter_brake_test.h>

Public Member Functions

bool isBrakeTestRequired (pilz_msgs::IsBrakeTestRequired::Request &, pilz_msgs::IsBrakeTestRequired::Response &res)
 Stores the brake test required flag and initializes the brake test service, the first time the function is called. More...
 
 ModbusAdapterBrakeTest (TWriteModbusRegister &&write_modbus_register_func, const ModbusApiSpec &read_api_spec, const ModbusApiSpec &write_api_spec)
 
void modbusMsgCallback (const ModbusMsgInStampedConstPtr &msg_raw)
 Called whenever a new modbus message arrives. More...
 
bool sendBrakeTestResult (SendBrakeTestResult::Request &req, SendBrakeTestResult::Response &res)
 Sends the brake test result data to the modbus client. More...
 

Private Types

using TBrakeTestRequired = pilz_msgs::IsBrakeTestRequiredResult::_value_type
 
using TRegIdx = uint16_t
 
using TRegIdxCont = std::map< std::string, TRegIdx >
 

Private Member Functions

void updateBrakeTestRequiredState (TBrakeTestRequired brake_test_required)
 

Static Private Member Functions

static const TRegIdxCont::mapped_type & getMaxRegisterIdx (const TRegIdxCont &reg_idx_cont)
 
static const TRegIdxCont::mapped_type & getMinRegisterIdx (const TRegIdxCont &reg_idx_cont)
 
static unsigned long getRegisterBlockSize (const TRegIdxCont &reg_idx_cont)
 
static TRegIdxCont getRegisters (const ModbusApiSpec &write_api_spec)
 

Private Attributes

const ModbusApiSpec api_spec_
 
TBrakeTestRequired brake_test_required_ {pilz_msgs::IsBrakeTestRequiredResult::UNKNOWN}
 Store the current state of whether a brake test is required. More...
 
const RegCont::size_type reg_block_size_ {getRegisterBlockSize(reg_idx_cont_)}
 
const TRegIdxCont reg_idx_cont_
 
const TRegIdx reg_start_idx_ {getMinRegisterIdx(reg_idx_cont_)}
 
TWriteModbusRegister write_modbus_register_func_
 

Detailed Description

Listens to the modbus_read topic and publishes a message informing about a required brake test.

Definition at line 45 of file modbus_adapter_brake_test.h.

Member Typedef Documentation

◆ TBrakeTestRequired

using prbt_hardware_support::ModbusAdapterBrakeTest::TBrakeTestRequired = pilz_msgs::IsBrakeTestRequiredResult::_value_type
private

Definition at line 76 of file modbus_adapter_brake_test.h.

◆ TRegIdx

Definition at line 80 of file modbus_adapter_brake_test.h.

◆ TRegIdxCont

Definition at line 81 of file modbus_adapter_brake_test.h.

Constructor & Destructor Documentation

◆ ModbusAdapterBrakeTest()

prbt_hardware_support::ModbusAdapterBrakeTest::ModbusAdapterBrakeTest ( TWriteModbusRegister &&  write_modbus_register_func,
const ModbusApiSpec read_api_spec,
const ModbusApiSpec write_api_spec 
)

Definition at line 31 of file modbus_adapter_brake_test.cpp.

Member Function Documentation

◆ getMaxRegisterIdx()

const ModbusAdapterBrakeTest::TRegIdxCont::mapped_type & prbt_hardware_support::ModbusAdapterBrakeTest::getMaxRegisterIdx ( const TRegIdxCont reg_idx_cont)
inlinestaticprivate
Returns
the highest register index stored in the specified container.

Definition at line 133 of file modbus_adapter_brake_test.h.

◆ getMinRegisterIdx()

const ModbusAdapterBrakeTest::TRegIdxCont::mapped_type & prbt_hardware_support::ModbusAdapterBrakeTest::getMinRegisterIdx ( const TRegIdxCont reg_idx_cont)
inlinestaticprivate
Returns
the lowest register index stored in the specified container.

Definition at line 125 of file modbus_adapter_brake_test.h.

◆ getRegisterBlockSize()

unsigned long prbt_hardware_support::ModbusAdapterBrakeTest::getRegisterBlockSize ( const TRegIdxCont reg_idx_cont)
inlinestaticprivate
Returns
the number of registers specified by the given register index container.

Definition at line 142 of file modbus_adapter_brake_test.h.

◆ getRegisters()

ModbusAdapterBrakeTest::TRegIdxCont prbt_hardware_support::ModbusAdapterBrakeTest::getRegisters ( const ModbusApiSpec write_api_spec)
staticprivate
Returns
the indicies of the modbus registers, needed to write the brake test results back to the modbus.

Definition at line 43 of file modbus_adapter_brake_test.cpp.

◆ isBrakeTestRequired()

bool prbt_hardware_support::ModbusAdapterBrakeTest::isBrakeTestRequired ( pilz_msgs::IsBrakeTestRequired::Request &  ,
pilz_msgs::IsBrakeTestRequired::Response &  res 
)
inline

Stores the brake test required flag and initializes the brake test service, the first time the function is called.

Definition at line 115 of file modbus_adapter_brake_test.h.

◆ modbusMsgCallback()

void prbt_hardware_support::ModbusAdapterBrakeTest::modbusMsgCallback ( const ModbusMsgInStampedConstPtr &  msg_raw)

Called whenever a new modbus message arrives.

Note
Filters like for example the UpdateFilter can restrict the number of incoming messages.

Definition at line 73 of file modbus_adapter_brake_test.cpp.

◆ sendBrakeTestResult()

bool prbt_hardware_support::ModbusAdapterBrakeTest::sendBrakeTestResult ( SendBrakeTestResult::Request &  req,
SendBrakeTestResult::Response &  res 
)

Sends the brake test result data to the modbus client.

Definition at line 118 of file modbus_adapter_brake_test.cpp.

◆ updateBrakeTestRequiredState()

void prbt_hardware_support::ModbusAdapterBrakeTest::updateBrakeTestRequiredState ( TBrakeTestRequired  brake_test_required)
private

Definition at line 107 of file modbus_adapter_brake_test.cpp.

Member Data Documentation

◆ api_spec_

const ModbusApiSpec prbt_hardware_support::ModbusAdapterBrakeTest::api_spec_
private

Definition at line 98 of file modbus_adapter_brake_test.h.

◆ brake_test_required_

TBrakeTestRequired prbt_hardware_support::ModbusAdapterBrakeTest::brake_test_required_ {pilz_msgs::IsBrakeTestRequiredResult::UNKNOWN}
private

Store the current state of whether a brake test is required.

Definition at line 101 of file modbus_adapter_brake_test.h.

◆ reg_block_size_

const RegCont::size_type prbt_hardware_support::ModbusAdapterBrakeTest::reg_block_size_ {getRegisterBlockSize(reg_idx_cont_)}
private

Definition at line 108 of file modbus_adapter_brake_test.h.

◆ reg_idx_cont_

const TRegIdxCont prbt_hardware_support::ModbusAdapterBrakeTest::reg_idx_cont_
private

Contains the indicies of the modbus registers, needed to write the brake test results back to the modbus.

Definition at line 105 of file modbus_adapter_brake_test.h.

◆ reg_start_idx_

const TRegIdx prbt_hardware_support::ModbusAdapterBrakeTest::reg_start_idx_ {getMinRegisterIdx(reg_idx_cont_)}
private

Definition at line 107 of file modbus_adapter_brake_test.h.

◆ write_modbus_register_func_

TWriteModbusRegister prbt_hardware_support::ModbusAdapterBrakeTest::write_modbus_register_func_
private

Definition at line 110 of file modbus_adapter_brake_test.h.


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


prbt_hardware_support
Author(s):
autogenerated on Tue Feb 25 2020 03:19:31