PX4 Firmware
PX4 Autopilot Software http://px4.io
VirtualCanIface Class Reference

Objects of this class are owned by the sub-node thread. More...

#include <uavcan_virtual_can_driver.hpp>

Inheritance diagram for VirtualCanIface:
Collaboration diagram for VirtualCanIface:

Classes

struct  RxItem
 This class re-defines uavcan::RxCanFrame with flags. More...
 

Public Member Functions

 VirtualCanIface (uavcan::IPoolAllocator &allocator, uavcan::ISystemClock &clock, pthread_mutex_t &arg_mutex, unsigned quota_per_queue)
 
 ~VirtualCanIface ()
 
void addRxFrame (const uavcan::CanRxFrame &frame, uavcan::CanIOFlags flags)
 Note that RX queue overwrites oldest items when overflowed. More...
 
void flushTxQueueTo (uavcan::INode &main_node, std::uint8_t iface_index)
 Call this from the main thread only. More...
 
bool hasDataInRxQueue ()
 Call this from the sub-node thread only. More...
 

Private Member Functions

int16_t send (const uavcan::CanFrame &frame, uavcan::MonotonicTime tx_deadline, uavcan::CanIOFlags flags) override
 
int16_t receive (uavcan::CanFrame &out_frame, uavcan::MonotonicTime &out_ts_monotonic, uavcan::UtcTime &out_ts_utc, uavcan::CanIOFlags &out_flags) override
 
int16_t configureFilters (const uavcan::CanFilterConfig *, std::uint16_t) override
 
uint16_t getNumFilters () const override
 
uint64_t getErrorCount () const override
 

Private Attributes

pthread_mutex_t & common_driver_mutex_
 
uavcan::CanTxQueue prioritized_tx_queue_
 
Queue< RxItemrx_queue_
 

Detailed Description

Objects of this class are owned by the sub-node thread.

This class does not use heap memory.

Definition at line 193 of file uavcan_virtual_can_driver.hpp.

Constructor & Destructor Documentation

◆ VirtualCanIface()

VirtualCanIface::VirtualCanIface ( uavcan::IPoolAllocator &  allocator,
uavcan::ISystemClock &  clock,
pthread_mutex_t &  arg_mutex,
unsigned  quota_per_queue 
)
inline

Definition at line 256 of file uavcan_virtual_can_driver.hpp.

◆ ~VirtualCanIface()

VirtualCanIface::~VirtualCanIface ( )
inline

Definition at line 264 of file uavcan_virtual_can_driver.hpp.

Member Function Documentation

◆ addRxFrame()

void VirtualCanIface::addRxFrame ( const uavcan::CanRxFrame &  frame,
uavcan::CanIOFlags  flags 
)
inline

Note that RX queue overwrites oldest items when overflowed.

Call this from the main thread only. No additional locking is required.

Definition at line 273 of file uavcan_virtual_can_driver.hpp.

References Queue< T >::isEmpty(), MicroBenchHRT::lock(), Queue< T >::pop(), and Queue< T >::tryEmplace().

Here is the call graph for this function:

◆ configureFilters()

int16_t VirtualCanIface::configureFilters ( const uavcan::CanFilterConfig *  ,
std::uint16_t   
)
inlineoverrideprivate

Definition at line 251 of file uavcan_virtual_can_driver.hpp.

◆ flushTxQueueTo()

void VirtualCanIface::flushTxQueueTo ( uavcan::INode &  main_node,
std::uint8_t  iface_index 
)
inline

Call this from the main thread only.

No additional locking is required.

Definition at line 287 of file uavcan_virtual_can_driver.hpp.

References MicroBenchHRT::lock().

Here is the call graph for this function:

◆ getErrorCount()

uint64_t VirtualCanIface::getErrorCount ( ) const
inlineoverrideprivate

Definition at line 253 of file uavcan_virtual_can_driver.hpp.

◆ getNumFilters()

uint16_t VirtualCanIface::getNumFilters ( ) const
inlineoverrideprivate

Definition at line 252 of file uavcan_virtual_can_driver.hpp.

◆ hasDataInRxQueue()

bool VirtualCanIface::hasDataInRxQueue ( )
inline

Call this from the sub-node thread only.

No additional locking is required.

Definition at line 312 of file uavcan_virtual_can_driver.hpp.

References Queue< T >::isEmpty(), and MicroBenchHRT::lock().

Here is the call graph for this function:

◆ receive()

int16_t VirtualCanIface::receive ( uavcan::CanFrame &  out_frame,
uavcan::MonotonicTime &  out_ts_monotonic,
uavcan::UtcTime &  out_ts_utc,
uavcan::CanIOFlags &  out_flags 
)
inlineoverrideprivate

Definition at line 231 of file uavcan_virtual_can_driver.hpp.

References Queue< T >::isEmpty(), MicroBenchHRT::lock(), Queue< T >::peek(), and Queue< T >::pop().

Here is the call graph for this function:

◆ send()

int16_t VirtualCanIface::send ( const uavcan::CanFrame &  frame,
uavcan::MonotonicTime  tx_deadline,
uavcan::CanIOFlags  flags 
)
inlineoverrideprivate

Definition at line 224 of file uavcan_virtual_can_driver.hpp.

References MicroBenchHRT::lock().

Here is the call graph for this function:

Member Data Documentation

◆ common_driver_mutex_

pthread_mutex_t& VirtualCanIface::common_driver_mutex_
private

Definition at line 219 of file uavcan_virtual_can_driver.hpp.

◆ prioritized_tx_queue_

uavcan::CanTxQueue VirtualCanIface::prioritized_tx_queue_
private

Definition at line 221 of file uavcan_virtual_can_driver.hpp.

◆ rx_queue_

Queue<RxItem> VirtualCanIface::rx_queue_
private

Definition at line 222 of file uavcan_virtual_can_driver.hpp.


The documentation for this class was generated from the following file: