Lely core libraries
2.3.4
|
Go to the documentation of this file.
24 #ifndef LELY_IO2_USER_CAN_HPP_
25 #define LELY_IO2_USER_CAN_HPP_
41 CanBusFlag flags = CanBusFlag::NONE,
size_t rxlen = 0,
45 ctx, exec, static_cast<int>(flags), rxlen, txtime, func, arg)) {
46 if (!chan) util::throw_errc(
"UserCanChannel");
61 swap(chan, other.chan);
71 on_read(
const can_msg* msg, const ::std::chrono::nanoseconds& d,
int timeout,
72 ::std::error_code& ec) noexcept {
73 auto ts = util::to_timespec(d);
89 if (ec) throw ::std::system_error(ec,
"on_read");
107 ::std::error_code ec;
109 if (ec) throw ::std::system_error(ec,
"on_read");
115 ::std::error_code& ec) noexcept {
116 auto ts = util::to_timespec(d);
130 ::std::error_code ec;
132 if (ec) throw ::std::system_error(ec,
"on_read");
150 ::std::error_code ec;
152 if (ec) throw ::std::system_error(ec,
"on_read");
159 #endif // !LELY_IO2_USER_CAN_HPP_
const struct ev_exec_vtbl *const ev_exec_t
An abstract task executor.
void on_read(const can_err *err, const ::std::chrono::nanoseconds &d, int timeout, ::std::error_code &ec) noexcept
A CAN or CAN FD format frame.
int get_errc(void)
Returns the last (thread-specific) native error code set by a system call or library function.
A reference to an abstract CAN channel.
void on_read(const can_msg *msg, const ::std::chrono::nanoseconds &d, int timeout=-1)
CanBusFlag
The CAN bus flags.
void on_read(const can_msg *msg, const ::std::chrono::nanoseconds &d, int timeout, ::std::error_code &ec) noexcept
void on_read(const can_msg *msg, int timeout, ::std::error_code &ec) noexcept
int io_user_can_chan_on_msg(io_can_chan_t *chan, const struct can_msg *msg, const struct timespec *tp, int timeout)
Processes an incoming CAN frame.
void set_errc(int errc)
Sets the current (thread-specific) native error code to errc.
io_can_chan_t * io_user_can_chan_create(io_ctx_t *ctx, ev_exec_t *exec, int flags, size_t rxlen, int txtimeo, io_user_can_chan_write_t *func, void *arg)
Creates a new user-defined CAN channel.
void on_read(const can_msg *msg, int timeout=-1)
UserCanChannel(io_ctx_t *ctx, ev_exec_t *exec, CanBusFlag flags=CanBusFlag::NONE, size_t rxlen=0, int txtime=0, io_user_can_chan_write_t *func=nullptr, void *arg=nullptr)
void on_read(const can_err *err, int timeout, ::std::error_code &ec) noexcept
void io_user_can_chan_destroy(io_can_chan_t *chan)
Destroys a user-defined CAN channel.
void on_read(const can_err *err, const ::std::chrono::nanoseconds &d, int timeout=-1)
int io_user_can_chan_on_err(io_can_chan_t *chan, const struct can_err *err, const struct timespec *tp, int timeout)
Processes an incoming CAN error frame.
int io_user_can_chan_write_t(const struct can_msg *msg, int timeout, void *arg)
The type of function invoked by a user-defined CAN channel when a CAN frame needs to be written.
::std::error_code make_error_code(SdoErrc e) noexcept
Creates an error code corresponding to an SDO abort code.
void on_read(const can_err *err, int timeout=-1)
A user-defined CAN channel.