Class Packet¶
Defined in File hi_can_packet.hpp
Class Documentation¶
-
class Packet¶
A CAN packet containing an address and data.
Public Functions¶
-
Packet() = default¶
Default constructor - zero address, no data.
-
Packet(const addressing::flagged_address_t &address, const uint8_t data[] = nullptr, size_t data_len = 0)¶
Construct a packet from an address and data array.
-
Packet(const addressing::flagged_address_t &address, const std::vector<uint8_t> &data)¶
Construct a packet from an address and data vector.
-
template<typename T>
inline Packet(const addressing::flagged_address_t &address, const T &data)¶ Construct a packet from an address and data.
-
inline auto get_data_len() const¶
Get the length of the data in the packet.
- Returns:¶
The data length
-
void set_address(const addressing::flagged_address_t &address)¶
Set the packet address.
- Parameters:¶
- const addressing::flagged_address_t &address¶
The address to set
-
inline bool get_is_rtr() const¶
Get whether the packet address is RTR.
- Returns:¶
Whether the address is RTR
-
inline bool get_is_error() const¶
Get whether the packet address is an error.
- Returns:¶
Whether the address is an error
-
inline bool get_is_extended() const¶
Get whether the packet address is extended.
- Returns:¶
Whether the address is extended
-
inline void set_is_extended(const bool &is_extended)¶
Set whether the packet address is extended.
-
inline auto operator<=>(const Packet &other) const¶
Compare two packets (for sorting). Sorts only by address.
-
Packet() = default¶