Руслан Урядинский / libuavcan

Dependents:   UAVCAN UAVCAN_Subscriber

Embed: (wiki syntax)

« Back to documentation index

ICanDriver Class Reference

ICanDriver Class Reference

Generic CAN driver. More...

#include <can.hpp>

Inherited by CanDriverMock, PairableCanDriver, SocketCanDriver, CanDriver, CanDriver, and VirtualCanDriver< SharedMemoryPoolSize >.

Public Member Functions

virtual ICanIfacegetIface (uint8_t iface_index)=0
 Returns an interface by index, or null pointer if the index is out of range.
virtual const ICanIfacegetIface (uint8_t iface_index) const
 Default implementation of this method calls the non-const overload of getIface().
virtual uint8_t getNumIfaces () const =0
 Total number of available CAN interfaces.
virtual int16_t select (CanSelectMasks &inout_masks, const CanFrame *(&pending_tx)[MaxCanIfaces], MonotonicTime blocking_deadline)=0
 Block until the deadline, or one of the specified interfaces becomes available for read or write.

Detailed Description

Generic CAN driver.

Definition at line 197 of file include/uavcan/driver/can.hpp.


Member Function Documentation

virtual ICanIface* getIface ( uint8_t  iface_index ) [pure virtual]

Returns an interface by index, or null pointer if the index is out of range.

Implemented in CanDriver, and CanDriver.

virtual const ICanIface* getIface ( uint8_t  iface_index ) const [virtual]

Default implementation of this method calls the non-const overload of getIface().

Can be overriden by the application if necessary.

Definition at line 211 of file include/uavcan/driver/can.hpp.

virtual uint8_t getNumIfaces (  ) const [pure virtual]

Total number of available CAN interfaces.

This value shall not change after initialization.

Implemented in SocketCanDriver, CanDriver, and CanDriver.

virtual int16_t select ( CanSelectMasks inout_masks,
const CanFrame *(&)  pending_tx[MaxCanIfaces],
MonotonicTime  blocking_deadline 
) [pure virtual]

Block until the deadline, or one of the specified interfaces becomes available for read or write.

Iface masks will be modified by the driver to indicate which exactly interfaces are available for IO.

Bit position in the masks defines interface index.

Note that it is allowed to return from this method even if no requested events actually happened, or if there are events that were not requested by the library.

The pending TX argument contains an array of pointers to CAN frames that the library wants to transmit next, per interface. This is intended to allow the driver to properly prioritize transmissions; many drivers will not need to use it. If a write flag for the given interface is set to one in the select mask structure, then the corresponding pointer is guaranteed to be valid (not UAVCAN_NULLPTR).

Parameters:
[in,out]inout_masksMasks indicating which interfaces are needed/available for IO.
[in]pending_txArray of frames, per interface, that are likely to be transmitted next.
[in]blocking_deadlineZero means non-blocking operation.
Returns:
Positive number of ready interfaces or negative error code.