ark::canbus
Enums
-
Cia315MessageType (uint8_t)
CIA315 message types. -
Cia315StatusField (uint8_t)
Represents a status field that is returned as part of a diagnostic response.
Typedefs
Defined in “ark/canbus/canopen/sdo.hh”:
- using QueuedSdo = std::variant< QueuedUploadSdo, QueuedDownloadSdo >
Variables
Defined in “ark/canbus/canopen.hh”:
-
constexpr uint32_t COB_FLAG_STANDARD= (0 « 29)
-
constexpr uint32_t COB_FLAG_EXTENDED= (1 « 29)
-
constexpr uint32_t COB_FLAG_RTR= (0 « 30)
-
constexpr uint32_t COB_FLAG_NO_RTR= (1 « 30)
-
constexpr uint32_t COB_FLAG_ENABLED= (0 « 31)
-
constexpr uint32_t COB_FLAG_DISABLED= (1 « 31)
Defined in “ark/canbus/canopen/node.hh”:
- constexpr auto kHeartbeatPeriod= std::chrono::seconds(1)
Defined in “ark/canbus/cia315_frames.hh”:
- constexpr uint8_t CIA315_PREAMBLE_MAGIC= 0x55
The ‘preamble’ magic bytes that begin each packet.
Defined in “ark/canbus/testing/has_vcan.hh”:
- constexpr const auto *const TEST_CANBUS_NAME= “ark_test_vcan0”
Name for the magic CANbus name we use for testing.
Classes
-
ark::canbus::AbstractSdo
Abstract SDO transfer. -
ark::canbus::CanSplitterStage
This stage listens on a CANbus and will split out packets into different channels based on their CAN identifiers. Similarly, any packets received will be forwarded (as-is).This is a convenience class to allow you to only listen to CAN packets that you want to listen to.
-
ark::canbus::Cia315Controller
Represents a controller for the CIA315 protocol, allowing you to package up CAN frames and retransmit them over some other protocol (such as UDP or TCP).This class can consume raw CAN frame and produce CIA315 frames, or vice-versa.
-
ark::canbus::Cia315ControllerStage
This stage manages a CIA315 controller for a CAN device and UDP socket. It expects to be paired with a UdpSocketStage and a SocketCanStage. -
ark::canbus::SdoQueue
A queue of SDOs that needs to go out. If any SDO fails, all remaining SDOs in this queue are canceled. -
ark::canbus::SocketCanDevice
A class that allows interacting with CAN devices (on Linux) via the socketcan interface. This abstracts away some of the C-level socket (and netlink) details. -
ark::canbus::SocketCanStage
A generic SocketCAN interface stage that will listen to a given CAN device and publish any packets received onto the configured channel. -
ark::canbus::Cia315DiagnosticResponse
This represents a response to a diagnostic request within the CIA315 generic frame. -
ark::canbus::Cia315ForwardedCanMessage
This represents a CAN frame within the CIA315 generic frame. -
ark::canbus::Cia315GenericFrame
This is the packet as it exists on the wire. The CIA315 decoder can produce these. -
ark::canbus::EmergencyDataObject
Defines a packet representing an emergency (EMCY) object. -
ark::canbus::QueuedDownloadSdo
A queued download SDO (configuration for an SDO that is waiting to be executed). -
ark::canbus::QueuedUploadSdo
A queued upload SDO (configuration for an SDO that is waiting to be executed). -
ark::canbus::SdoConfig
SDO configuration.
Functions
Declared in “ark/canbus/can_csv_io.hh”:
-
std::string can_csv_header()
Outputs the header for the CAN CSV format. -
std::string to_csv_row(const std::string & channel_name, const CanPacket & packet)
Converts the given CAN packet into a CSV row, suitable for parsing in other languages. This is a bit different then the generic CSV tool, in that it formats things in a way that is more usable.
Declared in “ark/canbus/canopen.hh”:
-
core::ByteBuffer encode_nmt_heartbeat(NmtStateCode state)
Encodes the given state code into a CANopen packet, returning the contents in the given byte buffer. -
NmtStateCode decode_nmt_heartbeat(const core::ByteBuffer & buffer)
Decodes the given CANopen packet, as if it was an NMT heartbeat message. -
uint8_t encode_nmt_heartbeat(void * destination, NmtStateCode state)
Encodes the given NMT command into a CANopen packet. The data is written to the destination, and the size is returned. -
uint8_t encode_nmt_command(void * destination, NmtCommandCode command, uint8_t node_id)
Encodes the given NMT command into a CANopen packet. The data is written to the destination, and the size is returned. -
NmtStateCode decode_nmt_heartbeat(const void * source, size_t source_length)
Decodes the given CANopen packet, as if it was an NMT heartbeat message. -
core::ByteBuffer encode_emcy(const EmergencyDataObject & object)
Encodes the given EMCY data into specified packet. -
uint8_t encode_emcy(void * destination, const EmergencyDataObject & object)
Encodes the given EMCY data into specified packet. The data is written to the given destination, and the length of bytes written is written out to output_length. Destination must always be at least 8 bytes large. -
EmergencyDataObject decode_emcy(const core::ByteBuffer & buffer)
Decodes the given buffer into an EMCY. -
EmergencyDataObject decode_emcy(const void * source, size_t source_length)
Decodes the given buffer into an SDO. -
uint32_t encode_cob_id(FunctionCode function_code, uint32_t node_id)
-
uint32_t encode_cob_id(const CanOpenPacket & packet)
-
std::string to_str(const CanOpenPacket & packet)
Emits a CanOpenPacket as a string suitable for printing on a single line. -
CanOpenPacket decode_canopen_packet(uint32_t can_id, const void * source, size_t source_length, std::chrono::steady_clock::time_point receive_time)
Decode the canopen packet. -
CanOpenPacket decode_canopen_packet(const CanPacket & packet)
-
CanPacket encode_canopen_packet(const CanOpenPacket & canopen_packet)
Declared in “ark/canbus/canopen/bytes.hh”:
-
T as_type(const ark::core::ByteBuffer & buffer)
-
T as_type(const PdoResult & buffer)
-
T as_type(const SdoResult & buffer)
-
ark::core::ByteBuffer as_buffer(const T & value)
-
void unpack_buffer(const ark::core::ByteBuffer & buffer, Args &… args)
-
void unpack_buffer(const PdoResult & result, Args &… args)
-
void unpack_buffer(const SdoResult & result, Args &… args)
-
ark::core::ByteBuffer pack_buffer(const Args &… args)
Declared in “ark/canbus/canopen/encoder.hh”:
-
void decode(FunctionCode & code, uint32_t raw)
-
void encode(uint32_t & raw, const FunctionCode & code)
-
uint32_t encode(const FunctionCode & code)
-
void decode(NmtCommandCode & code, uint8_t raw)
-
void encode(uint8_t & raw, const NmtCommandCode & code)
-
uint8_t encode(const NmtCommandCode & code)
-
void decode(NmtStateCode & state, uint8_t raw)
-
void encode(uint8_t & raw, const NmtStateCode & state)
-
uint8_t encode(const NmtStateCode & state)
-
void decode(CommandSpecifier & cmd, uint8_t raw)
-
void encode(uint8_t & raw, const CommandSpecifier & cmd)
-
uint8_t encode(const CommandSpecifier & cmd)
-
void decode(ConsumerHeartbeat & heartbeat, uint32_t raw)
-
void encode(uint32_t & raw, const ConsumerHeartbeat & heartbeat)
-
uint32_t encode(const ConsumerHeartbeat & heartbeat)
Declared in “ark/canbus/canopen/error_descriptions.hh”:
- const char * canopen_error_to_string(uint32_t code)
Returns a human readable string for the given error description.
Declared in “ark/canbus/cia315_frames.hh”:
-
core::ByteBuffer encode(const Cia315ForwardedCanMessage & input)
Encodes a forwarded CAN message. -
Cia315ForwardedCanMessage decode_cia315_can_message(const core::ByteBuffer & input, size_t & consumed_bytes)
Decodes a forwarded CAN message. Returns the number of bytes consumed as an additional parameter. -
core::ByteBuffer encode(const Cia315GenericFrame & input)
Encodes a generic CIA315 frame. -
Cia315GenericFrame decode_cia315_generic_frame(const core::ByteBuffer & input, size_t & consumed_bytes)
Decodes a generic CIA315 frame. Returns the number of bytes consumed as an additional parameter.
Declared in “ark/canbus/sae_j1939.hh”:
-
void decode(SaeJ1939CanId & id, uint32_t canid)
-
void encode(uint32_t & canid, const SaeJ1939CanId & id)
Declared in “ark/canbus/testing/has_vcan.hh”:
- bool has_vcan()
Returns true if we have a vcan device, or false otherwise. If false, prints a warning message.