SMACC2
Loading...
Searching...
No Matches
cl_modbus_tcp_relay.hpp
Go to the documentation of this file.
1// Copyright 2024 RobosoftAI Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15/*****************************************************************************************************************
16 *
17 * Authors: Pablo Inigo Blasco, Brett Aldrich
18 *
19 ******************************************************************************************************************/
20#pragma once
21
24#include <smacc2/smacc.hpp>
25
27{
28
29// Connection events
30template <typename TSource, typename TOrthogonal>
31struct EvConnectionLost : sc::event<EvConnectionLost<TSource, TOrthogonal>>
32{
33};
34
35template <typename TSource, typename TOrthogonal>
36struct EvConnectionRestored : sc::event<EvConnectionRestored<TSource, TOrthogonal>>
37{
38};
39
40// Relay operation events
41template <typename TSource, typename TOrthogonal>
42struct EvRelayWriteSuccess : sc::event<EvRelayWriteSuccess<TSource, TOrthogonal>>
43{
44};
45
46template <typename TSource, typename TOrthogonal>
47struct EvRelayWriteFailure : sc::event<EvRelayWriteFailure<TSource, TOrthogonal>>
48{
49};
50
65{
66public:
68
69 virtual ~ClModbusTcpRelay();
70
71 void onInitialize() override;
72
73 template <typename TOrthogonal, typename TSourceObject>
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 }
94
95 // Accessor for connection component
97
98 // Accessor for relay component
100
101private:
104};
105
106} // namespace cl_modbus_tcp_relay
SMACC2 Client for controlling Modbus TCP relays.
Component that manages Modbus TCP connection lifecycle and heartbeat monitoring.
Component that handles Modbus coil read/write operations for 8-channel relay.
SmaccComponentType * createComponent(TArgs... targs)