CANOPEN_CLIENT Driver 0.1.0
API reference
Loading...
Searching...
No Matches
canopen_client_can_interface.hpp
Go to the documentation of this file.
1// clang-format off: the table below must keep one row per line.
32// clang-format on
33#ifndef CANOPEN_CLIENT_CAN_INTERFACE_HPP
34#define CANOPEN_CLIENT_CAN_INTERFACE_HPP
35
36#include <concepts>
37#include <cstdint>
38
41
42namespace canopen_client {
43
52template <typename Derived>
54public:
56 CanInterface(const CanInterface&) = delete;
59
60protected:
62 CanInterface() noexcept = default;
64 ~CanInterface() noexcept = default;
65};
66
72template <typename Port>
73concept CanPort = std::derived_from<Port, CanInterface<Port>> && requires {
74 detail::ExactHook<Port, bool() noexcept>::Take(&Port::EnsureInitialized);
75 detail::ExactHook<Port, bool(const CanFrame&) noexcept>::Take(&Port::Send);
76};
77
82template <typename Port>
83concept CanRxPort = CanPort<Port> && requires {
84 detail::ExactHook<Port, RxStatus(CanFrame&, uint32_t) noexcept>::Take(&Port::Receive);
85 detail::ExactHook<Port, uint32_t() noexcept>::Take(&Port::NowUs);
86};
87
88} // namespace canopen_client
89
90#endif // CANOPEN_CLIENT_CAN_INTERFACE_HPP
Compile-time helpers of the CANOPEN_CLIENT driver: typed integer literals, exact hook matching,...
Public types of the CANopen client driver: errors, Result<T>, the CAN frame, the protocol vocabulary ...
CRTP base of the platform CAN port.
Definition canopen_client_can_interface.hpp:53
CanInterface(const CanInterface &)=delete
Ports are not copied: the driver holds a reference.
CanInterface & operator=(const CanInterface &)=delete
Ports are not copied: the driver holds a reference.
CanInterface() noexcept=default
Only the derived port is constructed.
Satisfied by a class that derives from CanInterface<Port> and implements the required hooks with exac...
Definition canopen_client_can_interface.hpp:73
Satisfied by a CanPort that also receives frames and keeps time: the full client port.
Definition canopen_client_can_interface.hpp:83
RxStatus
What a port's Receive() hook reports.
Definition canopen_client_types.hpp:207
The CANopen client driver: everything it declares lives here; internals in detail.
Definition canopen_client.hpp:28