Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
VirtualCanDriver< SharedMemoryPoolSize > Class Template Reference
Inheritance diagram for VirtualCanDriver< SharedMemoryPoolSize >:
Inheritance graph
[legend]

Classes

class  Event
 

Public Member Functions

 VirtualCanDriver (unsigned arg_num_ifaces)
 
- Public Member Functions inherited from uavcan::ICanDriver
virtual const ICanIfacegetIface (uint8_t iface_index) const
 
virtual ICanIfacegetIface (uint8_t iface_index)=0
 
virtual int16_t select (CanSelectMasks &inout_masks, const CanFrame *(&pending_tx)[MaxCanIfaces], MonotonicTime blocking_deadline)=0
 
virtual ~ICanDriver ()
 
- Public Member Functions inherited from uavcan::IRxFrameListener
virtual void handleRxFrame (const CanRxFrame &frame, CanIOFlags flags)=0
 
virtual ~IRxFrameListener ()
 
- Public Member Functions inherited from ITxQueueInjector
virtual ~ITxQueueInjector ()
 

Private Member Functions

uavcan::ICanIfacegetIface (uint8_t iface_index) override
 
uint8_t getNumIfaces () const override
 
void handleRxFrame (const uavcan::CanRxFrame &frame, uavcan::CanIOFlags flags) override
 
void injectTxFramesInto (uavcan::INode &main_node) override
 
int16_t select (uavcan::CanSelectMasks &inout_masks, const uavcan::CanFrame *(&)[uavcan::MaxCanIfaces], uavcan::MonotonicTime blocking_deadline) override
 
- Private Member Functions inherited from uavcan::Noncopyable
 Noncopyable ()
 
 ~Noncopyable ()
 

Private Attributes

uavcan::PoolAllocator< SharedMemoryPoolSize, uavcan::MemPoolBlockSizeallocator_
 Shared across all ifaces. More...
 
uavcan_linux::SystemClock clock_
 
Event event_
 Used to unblock the select() call when IO happens. More...
 
uavcan::LazyConstructor< VirtualCanIfaceifaces_ [uavcan::MaxCanIfaces]
 
std::mutex mutex_
 Shared across all ifaces. More...
 
const unsigned num_ifaces_
 

Detailed Description

template<unsigned SharedMemoryPoolSize>
class VirtualCanDriver< SharedMemoryPoolSize >

Objects of this class are owned by the sub-node thread. This class does not use heap memory.

Template Parameters
SharedMemoryPoolSizeAmount of memory, in bytes, that will be statically allocated for the memory pool that will be shared across all interfaces for RX/TX queues. Typically this value should be no less than 4K per interface.

Definition at line 273 of file test_multithreading.cpp.

Constructor & Destructor Documentation

◆ VirtualCanDriver()

template<unsigned SharedMemoryPoolSize>
VirtualCanDriver< SharedMemoryPoolSize >::VirtualCanDriver ( unsigned  arg_num_ifaces)
inline

Definition at line 372 of file test_multithreading.cpp.

Member Function Documentation

◆ getIface()

template<unsigned SharedMemoryPoolSize>
uavcan::ICanIface* VirtualCanDriver< SharedMemoryPoolSize >::getIface ( uint8_t  iface_index)
inlineoverrideprivate

Definition at line 303 of file test_multithreading.cpp.

◆ getNumIfaces()

template<unsigned SharedMemoryPoolSize>
uint8_t VirtualCanDriver< SharedMemoryPoolSize >::getNumIfaces ( ) const
inlineoverrideprivatevirtual

Total number of available CAN interfaces. This value shall not change after initialization.

Implements uavcan::ICanDriver.

Definition at line 308 of file test_multithreading.cpp.

◆ handleRxFrame()

template<unsigned SharedMemoryPoolSize>
void VirtualCanDriver< SharedMemoryPoolSize >::handleRxFrame ( const uavcan::CanRxFrame frame,
uavcan::CanIOFlags  flags 
)
inlineoverrideprivate

This handler will be invoked by the main node thread.

Definition at line 349 of file test_multithreading.cpp.

◆ injectTxFramesInto()

template<unsigned SharedMemoryPoolSize>
void VirtualCanDriver< SharedMemoryPoolSize >::injectTxFramesInto ( uavcan::INode main_node)
inlineoverrideprivatevirtual

This method will be invoked by the main node thread.

Implements ITxQueueInjector.

Definition at line 362 of file test_multithreading.cpp.

◆ select()

template<unsigned SharedMemoryPoolSize>
int16_t VirtualCanDriver< SharedMemoryPoolSize >::select ( uavcan::CanSelectMasks inout_masks,
const uavcan::CanFrame (&)[uavcan::MaxCanIfaces],
uavcan::MonotonicTime  blocking_deadline 
)
inlineoverrideprivate

This and other methods of ICanDriver will be invoked by the sub-node thread.

Definition at line 313 of file test_multithreading.cpp.

Member Data Documentation

◆ allocator_

template<unsigned SharedMemoryPoolSize>
uavcan::PoolAllocator<SharedMemoryPoolSize, uavcan::MemPoolBlockSize> VirtualCanDriver< SharedMemoryPoolSize >::allocator_
private

Shared across all ifaces.

Definition at line 298 of file test_multithreading.cpp.

◆ clock_

template<unsigned SharedMemoryPoolSize>
uavcan_linux::SystemClock VirtualCanDriver< SharedMemoryPoolSize >::clock_
private

Definition at line 301 of file test_multithreading.cpp.

◆ event_

template<unsigned SharedMemoryPoolSize>
Event VirtualCanDriver< SharedMemoryPoolSize >::event_
private

Used to unblock the select() call when IO happens.

Definition at line 296 of file test_multithreading.cpp.

◆ ifaces_

template<unsigned SharedMemoryPoolSize>
uavcan::LazyConstructor<VirtualCanIface> VirtualCanDriver< SharedMemoryPoolSize >::ifaces_[uavcan::MaxCanIfaces]
private

Definition at line 299 of file test_multithreading.cpp.

◆ mutex_

template<unsigned SharedMemoryPoolSize>
std::mutex VirtualCanDriver< SharedMemoryPoolSize >::mutex_
private

Shared across all ifaces.

Definition at line 297 of file test_multithreading.cpp.

◆ num_ifaces_

template<unsigned SharedMemoryPoolSize>
const unsigned VirtualCanDriver< SharedMemoryPoolSize >::num_ifaces_
private

Definition at line 300 of file test_multithreading.cpp.


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


uavcan_communicator
Author(s):
autogenerated on Fri Dec 13 2024 03:10:04