Lely core libraries 2.3.4
|
A CAN network interface. This class is a wrapper around io_can_net_t*
.
More...
#include <can_net.hpp>
Public Member Functions | |
CanNet (ev_exec_t *exec, io_timer_t *timer, io_can_chan_t *chan, ::std::size_t txlen=0, int txtimeo=0) | |
CanNet (io_timer_t *timer, io_can_chan_t *chan, ::std::size_t txlen=0, int txtimeo=0) | |
virtual | ~CanNet () |
void | start () noexcept |
ContextBase | get_ctx () const noexcept |
ev::Executor | get_executor () const noexcept |
Clock | get_clock () const noexcept |
Protected Member Functions | |
void | lock () final |
Blocks until a lock can be obtained for the current execution agent (thread, process, task). | |
void | unlock () final |
Releases the lock held by the execution agent. Throws no exceptions. | |
void | set_time () |
Updates the CAN network time. | |
virtual void | on_read_error (::std::error_code ec, ::std::size_t errcnt) noexcept |
The function invoked when a new CAN frame read error occurs, or when a read operation completes successfully after one or more errors. | |
virtual void | on_queue_error (::std::error_code ec, ::std::size_t errcnt) noexcept |
The function invoked when a CAN frame is dropped because the transmit queue is full, or when a frame is successfully queued after one or more errors. | |
virtual void | on_write_error (::std::error_code ec, ::std::size_t errcnt) noexcept |
The function invoked when a new CAN frame write error occurs, or when a write operation completes successfully after one or more errors. | |
virtual void | on_can_state (CanState new_state, CanState old_state) noexcept |
The function invoked when a CAN bus state change is detected. | |
virtual void | on_can_error (CanError error) noexcept |
The function invoked when an error is detected on the CAN bus. | |
A CAN network interface. This class is a wrapper around io_can_net_t*
.
Definition at line 38 of file can_net.hpp.
|
inlineexplicit |
Definition at line 41 of file can_net.hpp.
|
inlineexplicit |
Definition at line 62 of file can_net.hpp.
|
inlinevirtual |
Definition at line 70 of file can_net.hpp.
|
inlinenoexcept |
Definition at line 80 of file can_net.hpp.
|
inlinenoexcept |
Definition at line 86 of file can_net.hpp.
|
inlinenoexcept |
Definition at line 92 of file can_net.hpp.
|
inlinenoexcept |
Definition at line 98 of file can_net.hpp.
|
inlinefinalprotectedvirtual |
Blocks until a lock can be obtained for the current execution agent (thread, process, task).
If an exception is thrown, no lock is obtained.
Implements lely::util::BasicLockable.
Definition at line 104 of file can_net.hpp.
|
inlineprotected |
Updates the CAN network time.
The mutex protecting the CAN network interface MUST be locked for the duration of this call.
Definition at line 124 of file can_net.hpp.
|
inlineprotectedvirtualnoexcept |
The function invoked when a new CAN frame read error occurs, or when a read operation completes successfully after one or more errors.
The mutex protecting the CAN network interface will be locked when this function is called.
ec | the error code (0 on success). |
errcnt | the number of errors since the last successful read operation. |
Definition at line 140 of file can_net.hpp.
|
inlineprotectedvirtualnoexcept |
The function invoked when a CAN frame is dropped because the transmit queue is full, or when a frame is successfully queued after one or more errors.
The mutex protecting the CAN network interface will be locked when this function is called.
ec | the error code (0 on success). |
errcnt | the number of errors since the last frame was successfully queued. |
Definition at line 157 of file can_net.hpp.
|
inlineprotectedvirtualnoexcept |
The function invoked when a new CAN frame write error occurs, or when a write operation completes successfully after one or more errors.
The mutex protecting the CAN network interface will be locked when this function is called.
ec | the error code (0 on success). |
errcnt | the number of errors since the last successful write operation. |
Definition at line 174 of file can_net.hpp.
|
inlineprotectedvirtualnoexcept |
The function invoked when a CAN bus state change is detected.
The state is represented by one the CanState::ACTIVE
, CanState::PASSIVE
, CanState::BUSOFF
, CanState::SLEEPING
or CanState::STOPPED
values.
The mutex protecting the CAN network interface will be locked when this function is called.
new_state | the current state of the CAN bus. |
old_state | the previous state of the CAN bus. |
Definition at line 191 of file can_net.hpp.
The function invoked when an error is detected on the CAN bus.
The mutex protecting the CAN network interface will be locked when this function is called.
error | the detected errors (any combination of CanError::BIT , CanError::STUFF , CanError::CRC , CanError::FORM , CanError::ACK and CanError::OTHER ). |
Definition at line 208 of file can_net.hpp.