ModbusSMA  v1.0.0
modbusSMA::MBConnectionRTU Class Reference

Class for an IP based modbus connection. More...

#include <MBConnectionRTU.hpp>

Inheritance diagram for modbusSMA::MBConnectionRTU:
[legend]
Collaboration diagram for modbusSMA::MBConnectionRTU:
[legend]

Public Member Functions

 MBConnectionRTU (std::string _device, uint32_t _baud, char _parity, int _dataBit, int _stopBit)
 This constructor only initializes the IP and the port.
 
 MBConnectionRTU (MBConnectionRTU const &)=delete
 
void operator= (MBConnectionRTU const &)=delete
 
std::string getDevice () const
 Returns the device used. More...
 
uint32_t getBaud () const
 Returns the baud used. More...
 
char getParity () const
 Returns the parity used. More...
 
int getDataBit () const
 Returns the data bit used. More...
 
int getStopBit () const
 Returns the stop bit used. More...
 
ConnectionType type () override
 Returns the modbus connection type. More...
 
std::string description () override
 Textual description of the connection. More...
 
- Public Member Functions inherited from modbusSMA::MBConnectionBase
virtual ~MBConnectionBase ()
 Disconnects the modbus connection if neccessary.
 
 MBConnectionBase (MBConnectionBase const &)=delete
 
void operator= (MBConnectionBase const &)=delete
 
ErrorCode connect ()
 Creates the modbus connection based on the backend context implementation. More...
 
ErrorCode setSlaveID (int _id)
 Sets the slave/uinit ID of the modbus connection. More...
 
void disconnect ()
 Disconnects an active modbus connnection (if present, else does nothing).
 
bool isConnected () const
 Returns whether a valid conection exists. More...
 
std::vector< uint16_t > readRegisters (uint32_t _reg, uint32_t _num)
 read _num registers from the device More...
 
modbus_t * getConnection ()
 Returns the raw connection. More...
 

Protected Member Functions

modbus_t * createModbusContext () override
 Creates the modbus IP context. More...
 

Detailed Description

Class for an IP based modbus connection.

Definition at line 29 of file MBConnectionRTU.hpp.

Member Function Documentation

◆ createModbusContext()

modbus_t * MBConnectionRTU::createModbusContext ( )
overrideprotectedvirtual

Creates the modbus IP context.

Returns nullptr on error.

Implements modbusSMA::MBConnectionBase.

Definition at line 35 of file MBConnectionRTU.cpp.

◆ description()

string MBConnectionRTU::description ( )
overridevirtual

Textual description of the connection.

Implements modbusSMA::MBConnectionBase.

Definition at line 52 of file MBConnectionRTU.cpp.

◆ getBaud()

uint32_t modbusSMA::MBConnectionRTU::getBaud ( ) const
inline

Returns the baud used.

Definition at line 48 of file MBConnectionRTU.hpp.

◆ getDataBit()

int modbusSMA::MBConnectionRTU::getDataBit ( ) const
inline

Returns the data bit used.

Definition at line 50 of file MBConnectionRTU.hpp.

◆ getDevice()

std::string modbusSMA::MBConnectionRTU::getDevice ( ) const
inline

Returns the device used.

Definition at line 47 of file MBConnectionRTU.hpp.

◆ getParity()

char modbusSMA::MBConnectionRTU::getParity ( ) const
inline

Returns the parity used.

Definition at line 49 of file MBConnectionRTU.hpp.

◆ getStopBit()

int modbusSMA::MBConnectionRTU::getStopBit ( ) const
inline

Returns the stop bit used.

Definition at line 51 of file MBConnectionRTU.hpp.

◆ type()

ConnectionType modbusSMA::MBConnectionRTU::type ( )
inlineoverridevirtual

Returns the modbus connection type.

Implements modbusSMA::MBConnectionBase.

Definition at line 53 of file MBConnectionRTU.hpp.


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