Template Class CanNode

Inheritance Relationships

Base Types

Class Documentation

template<std::uint32_t SEND_ID_OFFSET, std::uint32_t RECEIVE_ID_OFFSET>
class CanNode : public myactuator_rmd::Driver, protected myactuator_rmd::can::Node

Base class for the CAN driver as well as the actuator mock.

Protected Functions

CanNode(std::string const &ifname)
CanNode() = delete

Class constructor.

Parameters:

ifname[in] The name of the network interface that should communicated over

CanNode(CanNode const&) = delete
CanNode &operator=(CanNode const&) = default
CanNode(CanNode&&) = default
CanNode &operator=(CanNode&&) = default
virtual void addId(std::uint32_t const actuator_id) override

Updates the id as well as the send and receive ids in a consistent manner.

Parameters:

actuator_id[in] The id of the actuator [0, 32]

inline virtual void send(Message const &msg, std::uint32_t const actuator_id) override

Writes a given CAN frame based on the request to the CAN participant with the actuator id actuator_id.

Parameters:
  • msg[in] The message that should be sent to the corresponding actuator

  • actuator_id[in] The ID of the actuator that the message should be sent to

inline virtual std::array<std::uint8_t, 8> sendRecv(Message const &request, std::uint32_t const actuator_id) override

Writes a given CAN frame based on the request to the actuator with the corresponding id and waits for a corresponding reply.

Parameters:
  • request[in] Request that should be sent to the corresponding actuator

  • actuator_id[in] The ID of the actuator that the message should be sent to

Returns:

The response bytes

constexpr std::uint32_t getCanSendId(std::uint32_t const actuator_id) noexcept

Get the CAN id that a message should be sent to.

Parameters:

actuator_id[in] The ID of the actuator that the message should be sent to

Returns:

The CAN id that the message should be sent to

constexpr std::uint32_t getCanReceiveId(std::uint32_t const actuator_id) noexcept

Get the CAN id that a message will be received from.

Parameters:

actuator_id[in] The ID of the actuator that the message should be received from

Returns:

The CAN id that the message should be received from

Protected Attributes

std::vector<std::uint32_t> actuator_ids_