Public Member Functions | Protected Member Functions | Protected Attributes | Static Private Member Functions | Private Attributes | List of all members
can::SocketCANInterface Class Reference

#include <socketcan.h>

Inheritance diagram for can::SocketCANInterface:
Inheritance graph
[legend]

Public Member Functions

virtual bool doesLoopBack () const
 
can_err_mask_t getErrorMask () const
 
can_err_mask_t getFatalErrorMask () const
 
int getInternalSocket ()
 
virtual bool init (const std::string &device, bool loopback) override
 
virtual bool init (const std::string &device, bool loopback, SettingsConstSharedPtr settings) override
 
virtual bool recover ()
 
 SocketCANInterface ()
 
virtual bool translateError (unsigned int internal_error, std::string &str)
 
- Public Member Functions inherited from can::AsioDriver< boost::asio::posix::stream_descriptor >
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 ~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

virtual bool enqueue (const Frame &msg)
 
bool init (const std::string &device, bool loopback, can_err_mask_t error_mask, can_err_mask_t fatal_error_mask)
 
void readFrame (const boost::system::error_code &error)
 
virtual void triggerReadSome ()
 
- Protected Member Functions inherited from can::AsioDriver< boost::asio::posix::stream_descriptor >
 AsioDriver ()
 
void dispatchFrame (const Frame &msg)
 
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 ()
 

Protected Attributes

std::string device_
 
can_frame frame_
 
- Protected Attributes inherited from can::AsioDriver< boost::asio::posix::stream_descriptor >
Frame input_
 
boost::asio::io_service io_service_
 
boost::asio::posix::stream_descriptor socket_
 
boost::asio::strand strand_
 

Static Private Member Functions

static can_err_mask_t parse_error_mask (SettingsConstSharedPtr settings, const std::string &entry, can_err_mask_t defaults)
 

Private Attributes

can_err_mask_t error_mask_
 
can_err_mask_t fatal_error_mask_
 
bool loopback_
 
int sc_
 
boost::mutex send_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

Definition at line 23 of file socketcan.h.

Constructor & Destructor Documentation

◆ SocketCANInterface()

can::SocketCANInterface::SocketCANInterface ( )
inline

Definition at line 46 of file socketcan.h.

Member Function Documentation

◆ doesLoopBack()

virtual bool can::SocketCANInterface::doesLoopBack ( ) const
inlinevirtual

Implements can::DriverInterface.

Definition at line 50 of file socketcan.h.

◆ enqueue()

virtual bool can::SocketCANInterface::enqueue ( const Frame msg)
inlineprotectedvirtual

◆ getErrorMask()

can_err_mask_t can::SocketCANInterface::getErrorMask ( ) const
inline

Definition at line 54 of file socketcan.h.

◆ getFatalErrorMask()

can_err_mask_t can::SocketCANInterface::getFatalErrorMask ( ) const
inline

Definition at line 58 of file socketcan.h.

◆ getInternalSocket()

int can::SocketCANInterface::getInternalSocket ( )
inline

Definition at line 129 of file socketcan.h.

◆ init() [1/3]

virtual bool can::SocketCANInterface::init ( const std::string &  device,
bool  loopback 
)
inlineoverridevirtual

Implements can::DriverInterface.

Definition at line 61 of file socketcan.h.

◆ init() [2/3]

bool can::SocketCANInterface::init ( const std::string &  device,
bool  loopback,
can_err_mask_t  error_mask,
can_err_mask_t  fatal_error_mask 
)
inlineprotected

Definition at line 136 of file socketcan.h.

◆ init() [3/3]

virtual bool can::SocketCANInterface::init ( const std::string &  device,
bool  loopback,
SettingsConstSharedPtr  settings 
)
inlineoverridevirtual

initialize interface

Parameters
[in]devicedriver-specific device name/path
[in]loopbackloop-back own messages
[in]settingsdriver-specific settings
Returns
true if device was initialized succesfully, false otherwise

Reimplemented from can::DriverInterface.

Definition at line 64 of file socketcan.h.

◆ parse_error_mask()

static can_err_mask_t can::SocketCANInterface::parse_error_mask ( SettingsConstSharedPtr  settings,
const std::string &  entry,
can_err_mask_t  defaults 
)
inlinestaticprivate

Definition at line 28 of file socketcan.h.

◆ readFrame()

void can::SocketCANInterface::readFrame ( const boost::system::error_code &  error)
inlineprotected

Definition at line 236 of file socketcan.h.

◆ recover()

virtual bool can::SocketCANInterface::recover ( )
inlinevirtual

Recover interface after errors and emergency stops

Returns
true if device was recovered succesfully, false otherwise

Implements can::DriverInterface.

Definition at line 85 of file socketcan.h.

◆ translateError()

virtual bool can::SocketCANInterface::translateError ( unsigned int  internal_error,
std::string &  str 
)
inlinevirtual

Implements can::DriverInterface.

Definition at line 92 of file socketcan.h.

◆ triggerReadSome()

virtual void can::SocketCANInterface::triggerReadSome ( )
inlineprotectedvirtual

Member Data Documentation

◆ device_

std::string can::SocketCANInterface::device_
protected

Definition at line 133 of file socketcan.h.

◆ error_mask_

can_err_mask_t can::SocketCANInterface::error_mask_
private

Definition at line 26 of file socketcan.h.

◆ fatal_error_mask_

can_err_mask_t can::SocketCANInterface::fatal_error_mask_
private

Definition at line 26 of file socketcan.h.

◆ frame_

can_frame can::SocketCANInterface::frame_
protected

Definition at line 134 of file socketcan.h.

◆ loopback_

bool can::SocketCANInterface::loopback_
private

Definition at line 24 of file socketcan.h.

◆ sc_

int can::SocketCANInterface::sc_
private

Definition at line 25 of file socketcan.h.

◆ send_mutex_

boost::mutex can::SocketCANInterface::send_mutex_
private

Definition at line 263 of file socketcan.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