9 #ifndef CARMA_CANBUS_SOCKETCAN_H
10 #define CARMA_CANBUS_SOCKETCAN_H
16 #include <boost/thread.hpp>
17 #include <boost/thread/mutex.hpp>
38 explicit SocketCan( const ::std::vector< ::std::string > & canInterfaces );
81 commonConstruction( const ::std::vector< ::std::string > & canInterfaces );
86 const ::std::string name;
94 double lastOneMinUpdateMJD;
97 BusInfo( const ::std::string & name,
101 void updateBusStatus( );
105 ::std::vector< int > fileDescriptors_;
106 int maxFileDescriptor_;
108 typedef ::std::map< int, BusInfo > BusInfoMap;
109 typedef ::std::map< int, int > BusIdToInterfaceMap;
112 BusIdToInterfaceMap busIdToIf_;
114 mutable boost::mutex mutex_;
115 boost::thread updateThread_;
BusStatusMap getBusStatus() const
Retrieve bus statistics indexed by bus id.
Declaration of carma::canbus::Message class.
static busIdType parseBusId(const std::string &canInterfaceName)
Parse bus id given an interface name (e.g.
Declarations of carma::canbus types.
Class to encapsulate a CAN message.
Declaration of carma::canbus::CanIo interface.
virtual ~SocketCan()
Destructor.
std::map< busIdType, busStatusType > BusStatusMap
Map to hold bus status for multiple busses.
Implements the CanIo interface using the socketcan framework.
txPriorityType
CAN Tx priority type.
unsigned short busIdType
Carma Bus Id type.
SocketCan()
Constructor for use with all busses on the system.
carma::canbus::Message getMessage()
Wait and retrieve a CAN message.
void postMessage(const carma::canbus::Message &msg, carma::canbus::txPriorityType p=carma::canbus::NORMAL)
Post a message to a single or multiple CAN busses.
void echoAll(bool enable)
Echo all CAN messages.