Go to the documentation of this file. 1 #ifndef H_CAN_INTERFACE
2 #define H_CAN_INTERFACE
8 #include <boost/system/error_code.hpp>
18 static const unsigned int ID_MASK = (1u << 29)-1;
20 static const unsigned int RTR_MASK = (1u << 30);
33 [[deprecated(
"use key() instead")]]
explicit operator unsigned int()
const {
return key(); }
44 Header(
unsigned int i,
bool extended,
bool rtr,
bool error)
64 std::array<value_type, 8>
data;
148 virtual bool send(
const Frame & msg) = 0;
158 return this->
createMsgListener(std::bind(callable, inst, std::placeholders::_1));
170 return this->
createMsgListener(header, std::bind(callable, inst, std::placeholders::_1));
180 [[deprecated(
"provide settings explicitly")]]
virtual bool init(
const std::string &device,
bool loopback) = 0;
191 ROSCANOPEN_ERROR(
"socketcan_interface",
"Driver does not support custom settings");
192 #pragma GCC diagnostic push
193 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
194 return init(device, loopback);
195 #pragma GCC diagnostic pop
217 virtual bool translateError(
unsigned int internal_error, std::string & str) = 0;
221 virtual void run() = 0;
FrameListener::ListenerConstSharedPtr FrameListenerConstSharedPtr
StateInterface::StateListenerConstSharedPtr StateListenerConstSharedPtr
virtual bool init(const std::string &device, bool loopback, SettingsConstSharedPtr settings)
StateListener::ListenerConstSharedPtr StateListenerConstSharedPtr
StateListenerConstSharedPtr createStateListenerM(Instance inst, Callable callable)
virtual bool init(const std::string &device, bool loopback)=0
virtual State getState()=0
virtual ~StateInterface()
std::function< void(const Frame &)> FrameFunc
virtual ~DriverInterface()
virtual bool doesLoopBack() const =0
unsigned char dlc
len of data
const value_type * c_array() const
std::shared_ptr< DriverInterface > DriverInterfaceSharedPtr
std::shared_ptr< StateInterface > StateInterfaceSharedPtr
std::shared_ptr< CommInterface > CommInterfaceSharedPtr
std::shared_ptr< const Listener > ListenerConstSharedPtr
virtual void shutdown()=0
virtual StateListenerConstSharedPtr createStateListener(const StateFunc &delegate)=0
#define ROSCANOPEN_ERROR(name, args)
boost::system::error_code error_code
device access error
FrameListenerConstSharedPtr createMsgListenerM(const Frame::Header &header, Instance inst, Callable callable)
Listener(const T &callable)
std::array< value_type, 8 > data
array for 8 data bytes with bounds checking
std::shared_ptr< const Settings > SettingsConstSharedPtr
void operator()(const U &u) const
virtual bool isReady() const
virtual bool translateError(unsigned int internal_error, std::string &str)=0
std::function< void(const State &)> StateFunc
CommInterface::FrameListenerConstSharedPtr FrameListenerConstSharedPtr
virtual bool send(const Frame &msg)=0
enum can::State::DriverState driver_state
Frame(const Header &h, unsigned char l=0)
FrameListenerConstSharedPtr createMsgListenerM(Instance inst, Callable callable)
unsigned int internal_error
driver specific error
virtual FrameListenerConstSharedPtr createMsgListener(const FrameFunc &delegate)=0