Function create_command_message

Source
fn create_command_message(
    internal_command: InternalCommand,
    config: &ActuateControllinoConfig,
) -> Result<ControllinoMessage, RelayError>
Expand description

Creates the message to be sent to Controllino based on an internal command.

This function translates a high-level InternalCommand into a low-level, hardware-specific ControllinoMessage ready for serial transmission.

§Arguments

  • internal_command - The InternalCommand specifying the device and action.
  • config - A reference to the ActuateControllinoConfig for device-to-relay mappings.

§Returns

A Result containing the constructed ControllinoMessage on success.

§Errors

Returns a RelayError if the internal_command is not applicable for actuation (e.g., ResetAllErrors) or if get_relay_command fails for other reasons.