53 template <
typename TOrthogonal,
typename TSourceObject>
87 RCLCPP_INFO(
getLogger(),
"[CbRelayStatus] Status read callback: 0x%02X", channelStates);
98 RCLCPP_INFO(
getLogger(),
"[CbRelayStatus] Reading channel %d status", channel);
102 RCLCPP_ERROR(
getLogger(),
"[CbRelayStatus] Relay component not available");
113 RCLCPP_INFO(
getLogger(),
"[CbRelayStatus] Channel %d is %s", channel, state ?
"ON" :
"OFF");
119 RCLCPP_ERROR(
getLogger(),
"[CbRelayStatus] Failed to read channel %d", channel);
126 RCLCPP_INFO(
getLogger(),
"[CbRelayStatus] Reading all channel statuses");
130 RCLCPP_ERROR(
getLogger(),
"[CbRelayStatus] Relay component not available");
142 for (
int i = 0; i < 8; i++)
145 RCLCPP_INFO(
getLogger(),
"[CbRelayStatus] Channel %d: %s", i + 1, state ?
"ON" :
"OFF");
153 RCLCPP_ERROR(
getLogger(),
"[CbRelayStatus] Failed to read channel statuses");
Client behavior to read relay channel status.
ClModbusTcpRelay * client_
std::optional< int > channel_
virtual void onStatusRead(uint8_t channelStates)
Virtual callback for status read completion Override in derived classes for custom handling.
uint8_t getChannelStates() const
Get the last read channel states (bitmask)
CpModbusRelay * relayComponent_
CbRelayStatus(int channel)
Construct behavior to read a specific channel status.
void readSingleChannel(int channel)
virtual void onEntry() override
void onStateOrthogonalAllocation()
CbRelayStatus()
Construct behavior to read all channel statuses.
SMACC2 Client for controlling Modbus TCP relays.
Component that handles Modbus coil read/write operations for 8-channel relay.
bool readAllCoils(uint8_t &states)
bool readCoil(int channel, bool &state)
virtual rclcpp::Logger getLogger() const
void requiresClient(SmaccClientType *&storage)
void requiresComponent(SmaccComponentType *&storage, ComponentRequirement requirementType=ComponentRequirement::SOFT)
void onStateOrthogonalAllocation()