#include <socketcan.hpp>
Classes | |
class | IfaceWrapper |
Public Member Functions | |
int | addIface (const std::string &iface_name) |
SocketCanIface * | getIface (std::uint8_t iface_index) override |
std::uint8_t | getNumIfaces () const override |
bool | isIfaceDown (std::uint8_t iface_index) const |
std::int16_t | select (uavcan::CanSelectMasks &inout_masks, const uavcan::CanFrame *(&)[uavcan::MaxCanIfaces], uavcan::MonotonicTime blocking_deadline) override |
SocketCanDriver (const SystemClock &clock) | |
![]() | |
virtual const ICanIface * | getIface (uint8_t iface_index) const |
virtual int16_t | select (CanSelectMasks &inout_masks, const CanFrame *(&pending_tx)[MaxCanIfaces], MonotonicTime blocking_deadline)=0 |
virtual | ~ICanDriver () |
Private Attributes | |
const SystemClock & | clock_ |
std::vector< std::unique_ptr< IfaceWrapper > > | ifaces_ |
Multiplexing container for multiple SocketCAN sockets. Uses ppoll() for multiplexing.
When an interface becomes down/disconnected while the node is running, the driver will silently exclude it from the IO loop and continue to run on the remaining interfaces. When all interfaces become down/disconnected, the driver will throw AllIfacesDownException from SocketCanDriver::select(). Whether a certain interface is down can be checked with SocketCanDriver::isIfaceDown().
Definition at line 618 of file socketcan.hpp.
|
inlineexplicit |
Reference to the clock object shall remain valid.
Definition at line 652 of file socketcan.hpp.
|
inline |
Adds one iface by name. Will fail if there are MaxIfaces ifaces registered already.
iface_name | E.g. "can0", "vcan1" |
uavcan_linux::Exception. |
Definition at line 765 of file socketcan.hpp.
|
inlineoverridevirtual |
Returns an interface by index, or null pointer if the index is out of range.
Implements uavcan::ICanDriver.
Definition at line 752 of file socketcan.hpp.
|
inlineoverridevirtual |
Total number of available CAN interfaces. This value shall not change after initialization.
Implements uavcan::ICanDriver.
Definition at line 757 of file socketcan.hpp.
|
inline |
Returns false if the specified interface is functioning, true if it became unavailable.
Definition at line 798 of file socketcan.hpp.
|
inlineoverride |
This function may return before deadline expiration even if no requested IO operations become possible. This behavior makes implementation way simpler, and it is OK since libuavcan can properly handle such early returns. Also it can return more events than were originally requested by uavcan, which is also acceptable.
Definition at line 664 of file socketcan.hpp.
|
private |
Definition at line 645 of file socketcan.hpp.
|
private |
Definition at line 646 of file socketcan.hpp.