Veethree D7 SDK
Loading...
Searching...
No Matches
can_socket_impl.h
1#ifndef CAN_SOCKET_IMPL_H
2#define CAN_SOCKET_IMPL_H
3
4#ifndef DOXYGEN_SKIP_THIS
5
7#include <vector>
8
9namespace vsdk::comms {
10class can_socket_impl final : // NOLINT(*-special-member-functions)
12public:
13 can_socket_impl() = default;
14 ~can_socket_impl() noexcept final;
15
16#ifdef __linux__
17 native_handle handle() final;
18#elif !defined(_WIN32) // TODO: Investigate Win32 implementation D7SDK-295
19#error "Unsupported OS"
20#endif
21 std::errc open() final;
22 std::errc close() final;
23 bool is_open() final;
24 std::errc bind(const can_adapter& adapter) final;
25 std::errc send(const can_msg_frame& frame) final;
26 receive_result receive(
27 can_msg_frame& frame,
28 std::chrono::milliseconds timeout = std::chrono::milliseconds::zero()) final;
29 std::errc set_nonblocking() final;
30 std::errc set_blocking() final;
31 std::errc enable_error_frames() final;
32 std::errc disable_error_frames() final;
33 bool has_receive_callback() final;
34 void clear_receive_callback() final;
35 void set_receive_callback(const can_socket_recv_callback& cb) final;
36
37 std::optional<can_adapter> adapter() const final;
38
39 select_result_can select_receive_timeout(const std::vector<can_socket>& sockets,
40 std::chrono::milliseconds timeout) const final;
41
42private:
43 int _fd = -1;
44 bool _is_nonblocking = false;
45 std::optional<can_adapter> _adapter = std::nullopt;
46 can_socket_recv_callback _recv_cb;
47};
48} // namespace vsdk::comms
49
50#endif // DOXYGEN_SKIP_THIS
51
52#endif // CAN_SOCKET_IMPL_H
CAN Socket Interface.
The can_socket_interface lists the expected interface for a CAN socket implementation that can be use...
Definition can_socket_interface.h:58
int open(const std::string &path, int flags)
Wrapper implementation that deals with C++ linter (clang-tidy)
Any entities that belong to the comms library.
Definition can_adapter.h:11