Veethree D7 SDK
Loading...
Searching...
No Matches
can.h
1#ifndef CAN_H
2#define CAN_H
3
4#ifndef DOXYGEN_SKIP_THIS
5
7#include <libmnl/libmnl.h>
8#include <optional>
9#include <unordered_map>
10
11namespace vsdk::comms {
12
13// NOLINTNEXTLINE(*-special-member-functions)
14class can final : public can_adapter_interface {
15public:
16 explicit can(std::string_view if_name);
17 can() = default;
18 ~can() noexcept final;
19
20 can_type type() final;
21 void get_config(can_parameters& param) final;
22 bool set_config(const can_parameters& param) final;
23 bool restart_adapter() final;
24 std::vector<std::tuple<std::string, can_type>> list_adapters() final;
25
26private:
27 using interfaces_info = std::unordered_map<std::string, comms::can_parameters>;
28 class netlink_msg;
29
30 void open_socket();
31 std::optional<interfaces_info> send_request(netlink_msg& msg);
32
33 mnl_socket* _nl = nullptr;
34};
35
36} // namespace vsdk::comms
37
38#endif // DOXYGEN_SKIP_THIS
39
40#endif // CAN_H
CAN Adapter Interface.
Class for abstracting lower level interactions with the CAN interfaces. A concrete implementation may...
Definition can_adapter_interface.h:83
can_type
CAN adapter kinds.
Definition can_adapter_interface.h:38
@ can
interface is a socketcan interface, e.g. can0
Definition network_manager.h:37
Any entities that belong to the comms library.
Definition can_adapter.h:11