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

Dependents:   UAVCAN UAVCAN_Subscriber

Embed: (wiki syntax)

« Back to documentation index

ICanIface Class Reference

ICanIface Class Reference

Single non-blocking CAN interface. More...

#include <can.hpp>

Inherited by CanIfaceMock, PairableCanDriver, SocketCanIface, CanDriver, CanIface, and VirtualCanIface.

Public Member Functions

virtual int16_t send (const CanFrame &frame, MonotonicTime tx_deadline, CanIOFlags flags)=0
 Non-blocking transmission.
virtual int16_t receive (CanFrame &out_frame, MonotonicTime &out_ts_monotonic, UtcTime &out_ts_utc, CanIOFlags &out_flags)=0
 Non-blocking reception.
virtual int16_t configureFilters (const CanFilterConfig *filter_configs, uint16_t num_configs)=0
 Configure the hardware CAN filters.
virtual uint16_t getNumFilters () const =0
 Number of available hardware filters.
virtual uint64_t getErrorCount () const =0
 Continuously incrementing counter of hardware errors.

Detailed Description

Single non-blocking CAN interface.

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


Member Function Documentation

virtual int16_t configureFilters ( const CanFilterConfig filter_configs,
uint16_t  num_configs 
) [pure virtual]

Configure the hardware CAN filters.

CanFilterConfig.

Returns:
0 = success, negative for error.

Implemented in CanDriver.

virtual uint64_t getErrorCount (  ) const [pure virtual]

Continuously incrementing counter of hardware errors.

Arbitration lost should not be treated as a hardware error.

Implemented in SocketCanIface, CanDriver, and CanIface.

virtual uint16_t getNumFilters (  ) const [pure virtual]

Number of available hardware filters.

Implemented in SocketCanIface, and CanDriver.

virtual int16_t receive ( CanFrame out_frame,
MonotonicTime &  out_ts_monotonic,
UtcTime out_ts_utc,
CanIOFlags &  out_flags 
) [pure virtual]

Non-blocking reception.

Timestamps should be provided by the CAN driver, ideally by the hardware CAN controller.

Monotonic timestamp is required and can be not precise since it is needed only for protocol timing validation (transfer timeouts and inter-transfer intervals).

UTC timestamp is optional, if available it will be used for precise time synchronization; must be set to zero if not available.

Refer to ISystemClock to learn more about timestamps.

Parameters:
[out]out_ts_monotonicMonotonic timestamp, mandatory.
[out]out_ts_utcUTC timestamp, optional, zero if unknown.
Returns:
1 = one frame received, 0 = RX buffer empty, negative for error.

Implemented in SocketCanIface, and CanDriver.

virtual int16_t send ( const CanFrame frame,
MonotonicTime  tx_deadline,
CanIOFlags  flags 
) [pure virtual]

Non-blocking transmission.

If the frame wasn't transmitted upon TX deadline, the driver should discard it.

Note that it is LIKELY that the library will want to send the frames that were passed into the select() method as the next ones to transmit, but it is NOT guaranteed. The library can replace those with new frames between the calls.

Returns:
1 = one frame transmitted, 0 = TX buffer full, negative for error.

Implemented in SocketCanIface, and CanDriver.