22 #ifndef LELY_COAPP_IO_CONTEXT_HPP_ 23 #define LELY_COAPP_IO_CONTEXT_HPP_ 25 #include <lely/aio/can_bus.hpp> 26 #include <lely/aio/timer.hpp> 44 using CanState = aio::CanBus::State;
45 using CanError = aio::CanBus::Error;
58 IoContext(aio::TimerBase& timer, aio::CanBusBase& bus,
71 auto* op =
new aio::TaskWrapper([=](::std::error_code ec) {
92 #ifndef DOXYGEN_SHOULD_SKIP_THIS 104 OnCanState(CanState new_state, CanState old_state) noexcept {
123 ::std::unique_ptr<Impl_> impl_;
130 #endif // LELY_COAPP_IO_CONTEXT_HPP_ virtual void OnCanState(CanState new_state, CanState old_state) noexcept
The function invoked when a CAN bus state change is detected.
This is the public header file of the C++ CANopen application library.
virtual void OnCanError(CanError error) noexcept
The function invoked when an error is detected on the CAN bus.
CANNet * net() const noexcept
Returns a pointer to the internal CAN network interface from <lely/can/net.hpp>.
void SetTime()
Update the CAN network time.
The type of objects thrown as exceptions to report a system error with an associated error code...
An abstract interface conforming to the BasicLockable concept.
void Post(F &&f)
Schedules the specified Callable object for execution.
Global namespace for the Lely Industries N.V. libraries.
An opaque CAN network interface type.
aio::ExecutorBase GetExecutor() const noexcept
Returns the executor used to process I/O events on the CAN bus.
IoContext(aio::TimerBase &timer, aio::CanBusBase &bus, BasicLockable *mutex=nullptr)
Creates a new I/O context.