43 #ifndef _MLAB_CANINTERFACE_H_ 44 #define _MLAB_CANINTERFACE_H_ 50 #include <boost/shared_ptr.hpp> 51 #include <boost/thread.hpp> 60 namespace mira {
namespace can {
65 class CANOpenPDOListener;
73 typedef boost::function<void (const CANMessage&, const Time&)>
PDOCallback;
106 virtual void sendMessage(
const CANMessage& msg) = 0;
121 uint32 pMask = 0x00000000,
122 uint32 pFilter = 0xFFFFFFFF);
128 void removeMessageSentListener(uint32 pFuncID);
149 uint32 pMask = 0x00000000,
150 uint32 pFilter = 0xFFFFFFFF);
156 void removeMessageRecvListener(uint32 pFuncID);
170 uint32 addPDOListener(
PDOCallback pFunc, uint32 pPDO);
176 void removePDOListener(uint32 pFuncID);
182 void onMessageReceived(
const CANMessage& message,
const Time& time);
203 boost::mutex mOutgoingListenersMutex;
204 uint32 mOutgoingListenersNextID;
205 std::vector<MsgListener> mOutgoingListeners;
208 boost::mutex mIncomingListenersMutex;
209 uint32 mIncomingListenersNextID;
210 std::vector<MsgListener> mIncomingListeners;
213 boost::mutex mPDOCallbacksMutex;
214 uint32 mPDOCallbacksNextID;
215 std::vector<PDOListener> mPDOCallbacks;
218 CANOpenPDOListener* mPDOListener;
virtual ~CANInterface()
The destructor.
Definition: CANInterface.h:93
boost::shared_ptr< CANInterface > CANInterfacePtr
A shared pointer of the CANInterface.
Definition: CANInterface.h:224
boost::function< void(const CANMessage &, const Time &)> PDOCallback
A PDO callback.
Definition: CANInterface.h:73
#define MLAB_CAN_EXPORT
Definition: CANExports.h:57
A general interface for a CAN driver.
Definition: CANInterface.h:83
boost::function< void(const CANMessage &, const Time &)> CANMessageCallback
A callback for CAN message.
Definition: CANInterface.h:65
Base class for all CAN-Bus drivers.
A definition of a CAN message.
Definition: CANDefs.h:105
Common CANbus definitions.