Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Attributes | List of all members
can::AsioDriver< Socket > Class Template Referenceabstract

#include <asio_base.h>

Inheritance diagram for can::AsioDriver< Socket >:
Inheritance graph
[legend]

Public Member Functions

virtual FrameListenerConstSharedPtr createMsgListener (const Frame::Header &h, const FrameFunc &delegate)
 
virtual FrameListenerConstSharedPtr createMsgListener (const FrameFunc &delegate)
 
virtual StateListenerConstSharedPtr createStateListener (const StateFunc &delegate)
 
State getState ()
 
virtual void run ()
 
virtual bool send (const Frame &msg)
 
virtual void shutdown ()
 
virtual ~AsioDriver ()
 
- Public Member Functions inherited from can::DriverInterface
virtual bool doesLoopBack () const =0
 
virtual bool init (const std::string &device, bool loopback)=0
 
virtual bool init (const std::string &device, bool loopback, SettingsConstSharedPtr settings)
 
virtual bool recover ()=0
 
virtual bool translateError (unsigned int internal_error, std::string &str)=0
 
virtual ~DriverInterface ()
 
- Public Member Functions inherited from can::CommInterface
template<typename Instance , typename Callable >
FrameListenerConstSharedPtr createMsgListenerM (const Frame::Header &header, Instance inst, Callable callable)
 
template<typename Instance , typename Callable >
FrameListenerConstSharedPtr createMsgListenerM (Instance inst, Callable callable)
 
virtual ~CommInterface ()
 
- Public Member Functions inherited from can::StateInterface
template<typename Instance , typename Callable >
StateListenerConstSharedPtr createStateListenerM (Instance inst, Callable callable)
 
virtual ~StateInterface ()
 

Protected Member Functions

 AsioDriver ()
 
void dispatchFrame (const Frame &msg)
 
virtual bool enqueue (const Frame &msg)=0
 
void frameReceived (const boost::system::error_code &error)
 
void setDriverState (State::DriverState state)
 
void setErrorCode (const boost::system::error_code &error)
 
void setInternalError (unsigned int internal_error)
 
void setNotReady ()
 
virtual void triggerReadSome ()=0
 

Protected Attributes

Frame input_
 
boost::asio::io_service io_service_
 
Socket socket_
 
boost::asio::strand strand_
 

Private Types

using FrameDispatcher = FilteredDispatcher< unsigned int, CommInterface::FrameListener >
 
using StateDispatcher = SimpleDispatcher< StateInterface::StateListener >
 

Private Attributes

FrameDispatcher frame_dispatcher_
 
boost::mutex socket_mutex_
 
State state_
 
StateDispatcher state_dispatcher_
 
boost::mutex state_mutex_
 

Additional Inherited Members

- Public Types inherited from can::CommInterface
using FrameDelegate = DelegateHelper< FrameFunc >
 
using FrameFunc = std::function< void(const Frame &)>
 
using FrameListener = Listener< const FrameFunc, const Frame & >
 
using FrameListenerConstSharedPtr = FrameListener::ListenerConstSharedPtr
 
- Public Types inherited from can::StateInterface
using StateDelegate = DelegateHelper< StateFunc >
 
using StateFunc = std::function< void(const State &)>
 
using StateListener = Listener< const StateFunc, const State & >
 
using StateListenerConstSharedPtr = StateListener::ListenerConstSharedPtr
 

Detailed Description

template<typename Socket>
class can::AsioDriver< Socket >

Definition at line 14 of file asio_base.h.

Member Typedef Documentation

◆ FrameDispatcher

template<typename Socket >
using can::AsioDriver< Socket >::FrameDispatcher = FilteredDispatcher<unsigned int, CommInterface::FrameListener>
private

Definition at line 15 of file asio_base.h.

◆ StateDispatcher

template<typename Socket >
using can::AsioDriver< Socket >::StateDispatcher = SimpleDispatcher<StateInterface::StateListener>
private

Definition at line 16 of file asio_base.h.

Constructor & Destructor Documentation

◆ AsioDriver()

template<typename Socket >
can::AsioDriver< Socket >::AsioDriver ( )
inlineprotected

Definition at line 76 of file asio_base.h.

◆ ~AsioDriver()

template<typename Socket >
virtual can::AsioDriver< Socket >::~AsioDriver ( )
inlinevirtual

Definition at line 81 of file asio_base.h.

Member Function Documentation

◆ createMsgListener() [1/2]

template<typename Socket >
virtual FrameListenerConstSharedPtr can::AsioDriver< Socket >::createMsgListener ( const Frame::Header ,
const FrameFunc delegate 
)
inlinevirtual

acquire a listener for the specified delegate, that will get called for messages with demanded ID

Parameters
[in]headerCAN header to restrict listener on
[in]delegatedelegate to be bound listener
Returns
managed pointer to listener

Implements can::CommInterface.

Definition at line 122 of file asio_base.h.

◆ createMsgListener() [2/2]

template<typename Socket >
virtual FrameListenerConstSharedPtr can::AsioDriver< Socket >::createMsgListener ( const FrameFunc delegate)
inlinevirtual

acquire a listener for the specified delegate, that will get called for all messages

Parameters
[in]delegatedelegate to be bound by the listener
Returns
managed pointer to listener

Implements can::CommInterface.

Definition at line 119 of file asio_base.h.

◆ createStateListener()

template<typename Socket >
virtual StateListenerConstSharedPtr can::AsioDriver< Socket >::createStateListener ( const StateFunc delegate)
inlinevirtual

acquire a listener for the specified delegate, that will get called for all state changes

Parameters
[in]delegatedelegate to be bound by the listener
Returns
managed pointer to listener

Implements can::StateInterface.

Definition at line 125 of file asio_base.h.

◆ dispatchFrame()

template<typename Socket >
void can::AsioDriver< Socket >::dispatchFrame ( const Frame msg)
inlineprotected

Definition at line 37 of file asio_base.h.

◆ enqueue()

template<typename Socket >
virtual bool can::AsioDriver< Socket >::enqueue ( const Frame msg)
protectedpure virtual

Implemented in can::SocketCANInterface.

◆ frameReceived()

template<typename Socket >
void can::AsioDriver< Socket >::frameReceived ( const boost::system::error_code &  error)
inlineprotected

Definition at line 66 of file asio_base.h.

◆ getState()

template<typename Socket >
State can::AsioDriver< Socket >::getState ( )
inlinevirtual
Returns
current state of driver

Implements can::DriverInterface.

Definition at line 83 of file asio_base.h.

◆ run()

template<typename Socket >
virtual void can::AsioDriver< Socket >::run ( )
inlinevirtual

Implements can::DriverInterface.

Definition at line 87 of file asio_base.h.

◆ send()

template<typename Socket >
virtual bool can::AsioDriver< Socket >::send ( const Frame msg)
inlinevirtual

enqueue frame for sending

Parameters
[in]msgmessage to be enqueued
Returns
true if frame was enqueued succesfully, otherwise false

Implements can::CommInterface.

Definition at line 107 of file asio_base.h.

◆ setDriverState()

template<typename Socket >
void can::AsioDriver< Socket >::setDriverState ( State::DriverState  state)
inlineprotected

Definition at line 55 of file asio_base.h.

◆ setErrorCode()

template<typename Socket >
void can::AsioDriver< Socket >::setErrorCode ( const boost::system::error_code &  error)
inlineprotected

Definition at line 40 of file asio_base.h.

◆ setInternalError()

template<typename Socket >
void can::AsioDriver< Socket >::setInternalError ( unsigned int  internal_error)
inlineprotected

Definition at line 47 of file asio_base.h.

◆ setNotReady()

template<typename Socket >
void can::AsioDriver< Socket >::setNotReady ( )
inlineprotected

Definition at line 62 of file asio_base.h.

◆ shutdown()

template<typename Socket >
virtual void can::AsioDriver< Socket >::shutdown ( )
inlinevirtual

shutdown interface

Returns
true if shutdown was succesful, false otherwise

Implements can::DriverInterface.

Definition at line 111 of file asio_base.h.

◆ triggerReadSome()

template<typename Socket >
virtual void can::AsioDriver< Socket >::triggerReadSome ( )
protectedpure virtual

Implemented in can::SocketCANInterface.

Member Data Documentation

◆ frame_dispatcher_

template<typename Socket >
FrameDispatcher can::AsioDriver< Socket >::frame_dispatcher_
private

Definition at line 17 of file asio_base.h.

◆ input_

template<typename Socket >
Frame can::AsioDriver< Socket >::input_
protected

Definition at line 32 of file asio_base.h.

◆ io_service_

template<typename Socket >
boost::asio::io_service can::AsioDriver< Socket >::io_service_
protected

Definition at line 25 of file asio_base.h.

◆ socket_

template<typename Socket >
Socket can::AsioDriver< Socket >::socket_
protected

Definition at line 31 of file asio_base.h.

◆ socket_mutex_

template<typename Socket >
boost::mutex can::AsioDriver< Socket >::socket_mutex_
private

Definition at line 22 of file asio_base.h.

◆ state_

template<typename Socket >
State can::AsioDriver< Socket >::state_
private

Definition at line 20 of file asio_base.h.

◆ state_dispatcher_

template<typename Socket >
StateDispatcher can::AsioDriver< Socket >::state_dispatcher_
private

Definition at line 18 of file asio_base.h.

◆ state_mutex_

template<typename Socket >
boost::mutex can::AsioDriver< Socket >::state_mutex_
private

Definition at line 21 of file asio_base.h.

◆ strand_

template<typename Socket >
boost::asio::strand can::AsioDriver< Socket >::strand_
protected

Definition at line 29 of file asio_base.h.


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


socketcan_interface
Author(s): Mathias Lüdtke
autogenerated on Wed Mar 2 2022 00:52:25