Skip to content

Add MCM & MVEC Endpoint Structs to Reduce Client Const Definitions#17

Open
Ryanbahl9 wants to merge 2 commits intomainfrom
ryan/add_interface_endpoint_structs
Open

Add MCM & MVEC Endpoint Structs to Reduce Client Const Definitions#17
Ryanbahl9 wants to merge 2 commits intomainfrom
ryan/add_interface_endpoint_structs

Conversation

@Ryanbahl9
Copy link
Copy Markdown

@Ryanbahl9 Ryanbahl9 commented May 6, 2026

Add MCM & MVEC Endpoint Structs to Reduce Client Const Definitions

Add endpoint structs for MCM Interfaces, MCM Relays, and MVEC Relays to help simplify the number of constants the client needs to store.

Questions:

  1. Did I put the structs in the right files? Should they live in those header files or somewhere else?

SygnalInterfaceSocketcan

Structs Added

/// @brief Represents an interface endpoint in the Sygnal CAN interface
struct InterfaceEndpoint
{
  uint8_t bus_id;
  uint8_t subsystem_id;
  uint8_t interface_id;
  int min_value;
  int max_value;
  bool is_continuous;
  std::string_view name;
};

/// @brief Represents a relay endpoint in the Sygnal CAN interface
struct RelayEndpoint
{
  uint8_t bus_id;
  uint8_t subsystem_id;
  uint8_t relay_id;
  std::string_view name;
};

Wrapper Functions Added

SendCommandResult SygnalInterfaceSocketcan::sendControlStateCommand(
  InterfaceEndpoint interface,
  SygnalControlState control_state,
  bool expect_reply,
  std::string & error_message)
{
  return sendControlStateCommand(interface.bus_id, interface.interface_id, interface.subsystem_id, control_state, expect_reply, error_message);
}

SendCommandResult SygnalInterfaceSocketcan::sendControlCommand(
  InterfaceEndpoint interface,
  double value,
  bool expect_reply,
  std::string & error_message)
{
  return sendControlCommand(interface.bus_id, interface.interface_id, interface.subsystem_id, value, expect_reply, error_message);
}

SendCommandResult SygnalInterfaceSocketcan::sendRelayCommand(
  InterfaceEndpoint interface, bool relay_state, bool expect_reply, std::string & error_message)
{
  return sendRelayCommand(interface.bus_id, interface.subsystem_id, relay_state, expect_reply, error_message);
}

MvecRelaySocketcan

Structs Added

/// @brief Represents an MVEC Relay endpoint..
struct MvecEndpoint
{
  uint8_t id;
  std::string_view name;
};

Wrapper Functions Added

void MvecRelaySocketcan::set_relay_in_command(MvecEndpoint relay, uint8_t relay_state)
{
  relay_impl_.set_relay_in_command(relay.id, relay_state);
}

@Ryanbahl9 Ryanbahl9 requested a review from zeerekahmad May 6, 2026 19:11
@Ryanbahl9 Ryanbahl9 self-assigned this May 6, 2026
@Ryanbahl9 Ryanbahl9 changed the title add endpoint structs to help usage Add MCM & MVEC Endpoint Structs to Reduce Client Const Definitions May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant