SMACC2
Loading...
Searching...
No Matches
cl_modbus_tcp_relay::ClModbusTcpRelay Class Reference

SMACC2 Client for controlling Modbus TCP relays. More...

#include <cl_modbus_tcp_relay.hpp>

Inheritance diagram for cl_modbus_tcp_relay::ClModbusTcpRelay:
Inheritance graph
Collaboration diagram for cl_modbus_tcp_relay::ClModbusTcpRelay:
Collaboration graph

Public Member Functions

 ClModbusTcpRelay ()
 
virtual ~ClModbusTcpRelay ()
 
void onInitialize () override
 
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 
CpModbusConnectiongetConnectionComponent ()
 
CpModbusRelaygetRelayComponent ()
 
- Public Member Functions inherited from smacc2::ISmaccClient
 ISmaccClient ()
 
virtual ~ISmaccClient ()
 
virtual std::string getName () const
 
template<typename TComponent >
TComponent * getComponent ()
 
template<typename TComponent >
TComponent * getComponent (std::string name)
 
template<typename TComponent >
TComponent * getComponent (int index)
 
virtual smacc2::introspection::TypeInfo::Ptr getType ()
 
ISmaccStateMachinegetStateMachine ()
 
template<typename TSmaccSignal , typename T >
void connectSignal (TSmaccSignal &signal, void(T::*callback)(), T *object)
 
template<typename SmaccClientType >
void requiresClient (SmaccClientType *&storage)
 
void getComponents (std::vector< std::shared_ptr< ISmaccComponent > > &components)
 
const std::vector< std::shared_ptr< ISmaccComponent > > & iterateComponents () const
 
template<typename EventType >
void postEvent (const EventType &ev)
 
template<typename EventType >
void postEvent ()
 

Private Attributes

CpModbusConnectionconnectionComponent_ = nullptr
 
CpModbusRelayrelayComponent_ = nullptr
 

Additional Inherited Members

- Protected Member Functions inherited from smacc2::ISmaccClient
template<typename TOrthogonal , typename TClient >
void onComponentInitialization ()
 
template<typename TOrthogonal , typename TSourceObject >
void onStateOrthogonalAllocation ()
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * createComponent (TArgs... targs)
 
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs>
SmaccComponentType * createNamedComponent (std::string name, TArgs... targs)
 
rclcpp::Node::SharedPtr getNode ()
 
rclcpp::Logger getLogger ()
 
- Protected Attributes inherited from smacc2::ISmaccClient
std::map< ComponentKey, std::shared_ptr< smacc2::ISmaccComponent > > components_
 

Detailed Description

SMACC2 Client for controlling Modbus TCP relays.

This client manages connection and control of Modbus TCP relay devices, specifically designed for 8-channel relays like the Waveshare POE ETH Relay.

Configuration is loaded from YAML parameters: modbus_relay.ip_address: IP address of the relay (default: "192.168.1.254") modbus_relay.port: Modbus TCP port (default: 502) modbus_relay.slave_id: Modbus slave ID (default: 1) modbus_relay.heartbeat_interval_ms: Heartbeat check interval (default: 1000) modbus_relay.connect_on_init: Connect automatically on init (default: true)

Definition at line 64 of file cl_modbus_tcp_relay.hpp.

Constructor & Destructor Documentation

◆ ClModbusTcpRelay()

cl_modbus_tcp_relay::ClModbusTcpRelay::ClModbusTcpRelay ( )

Definition at line 26 of file cl_modbus_tcp_relay.cpp.

26{}

◆ ~ClModbusTcpRelay()

cl_modbus_tcp_relay::ClModbusTcpRelay::~ClModbusTcpRelay ( )
virtual

Definition at line 28 of file cl_modbus_tcp_relay.cpp.

28{}

Member Function Documentation

◆ getConnectionComponent()

CpModbusConnection * cl_modbus_tcp_relay::ClModbusTcpRelay::getConnectionComponent ( )
inline

Definition at line 96 of file cl_modbus_tcp_relay.hpp.

References connectionComponent_.

◆ getRelayComponent()

CpModbusRelay * cl_modbus_tcp_relay::ClModbusTcpRelay::getRelayComponent ( )
inline

Definition at line 99 of file cl_modbus_tcp_relay.hpp.

References relayComponent_.

◆ onInitialize()

void cl_modbus_tcp_relay::ClModbusTcpRelay::onInitialize ( )
overridevirtual

Reimplemented from smacc2::ISmaccClient.

Definition at line 30 of file cl_modbus_tcp_relay.cpp.

31{
32 // Components will be created here in Phase 2
33 RCLCPP_INFO(getLogger(), "[ClModbusTcpRelay] Client initialized");
34}
rclcpp::Logger getLogger()

References smacc2::ISmaccClient::getLogger().

Here is the call graph for this function:

◆ onStateOrthogonalAllocation()

template<typename TOrthogonal , typename TSourceObject >
void cl_modbus_tcp_relay::ClModbusTcpRelay::onStateOrthogonalAllocation ( )
inline

Definition at line 74 of file cl_modbus_tcp_relay.hpp.

75 {
76 // Create connection component if not already created
78 {
81 }
82
83 // Create relay component if not already created
84 if (!relayComponent_)
85 {
88 }
89
90 // Configure components for this orthogonal
93 }
SmaccComponentType * createComponent(TArgs... targs)

References connectionComponent_, smacc2::ISmaccClient::createComponent(), onStateOrthogonalAllocation(), and relayComponent_.

Referenced by onStateOrthogonalAllocation().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ connectionComponent_

CpModbusConnection* cl_modbus_tcp_relay::ClModbusTcpRelay::connectionComponent_ = nullptr
private

Definition at line 102 of file cl_modbus_tcp_relay.hpp.

Referenced by getConnectionComponent(), and onStateOrthogonalAllocation().

◆ relayComponent_

CpModbusRelay* cl_modbus_tcp_relay::ClModbusTcpRelay::relayComponent_ = nullptr
private

Definition at line 103 of file cl_modbus_tcp_relay.hpp.

Referenced by getRelayComponent(), and onStateOrthogonalAllocation().


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