Template Class AsioDriver

Inheritance Relationships

Base Type

Class Documentation

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

Public Functions

inline virtual ~AsioDriver()
inline virtual State getState()
Returns:

current state of driver

inline virtual void run()
inline virtual bool send(const Frame &msg)

enqueue frame for sending

Parameters:

msg[in] message to be enqueued

Returns:

true if frame was enqueued succesfully, otherwise false

inline virtual void shutdown()

shutdown interface

Returns:

true if shutdown was succesful, false otherwise

inline virtual FrameListenerConstSharedPtr createMsgListener(const FrameFunc &delegate)

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

Parameters:

delegate[in] delegate to be bound by the listener

Returns:

managed pointer to listener

inline virtual FrameListenerConstSharedPtr createMsgListener(const Frame::Header &h, const FrameFunc &delegate)

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

Parameters:
  • header[in] CAN header to restrict listener on

  • delegate[in] delegate to be bound listener

Returns:

managed pointer to listener

inline virtual StateListenerConstSharedPtr createStateListener(const StateFunc &delegate)

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

Parameters:

delegate[in] delegate to be bound by the listener

Returns:

managed pointer to listener

Protected Functions

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

Protected Attributes

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