Public Member Functions | |
CANSocket () | |
CANSocket (int port) throw (std::runtime_error) | |
virtual thread::RealTimeMutex & | getMutex () const |
virtual void | open (int port) throw (std::logic_error, std::runtime_error) |
virtual void | close () |
virtual bool | isOpen () const |
virtual int | send (int busId, const unsigned char *data, size_t len) const |
virtual int | receiveRaw (int &busId, unsigned char *data, size_t &len, bool blocking=true) const |
Static Public Attributes | |
static const size_t | MAX_MESSAGE_LEN = 8 |
Protected Attributes | |
thread::RealTimeMutex | mutex |
detail::can_handle * | handle |
The maximum length of a CANbus message. Make sure to update CommunicationsBus::MAX_MESSAGE_LEN! CANSocket() Constructors
void barrett::bus::CANSocket::close | ( | ) | [virtual] |
close() method destorys socket communication port.
Implements barrett::bus::CommunicationsBus.
virtual thread::RealTimeMutex& barrett::bus::CANSocket::getMutex | ( | ) | const [inline, virtual] |
getMutex() method gets and locks interthread data exchange assuring nothing critical is happening in either thread.
Implements barrett::bus::CommunicationsBus.
bool barrett::bus::CANSocket::isOpen | ( | ) | const [virtual] |
isOpen() method returns a flag signifying socket Communication is open.
Implements barrett::bus::CommunicationsBus.
void barrett::bus::CANSocket::open | ( | int | port | ) | throw (std::logic_error, std::runtime_error) [virtual] |
open() method creates socket communication on a specific port.
Implements barrett::bus::CommunicationsBus.
int barrett::bus::CANSocket::receiveRaw | ( | int & | busId, |
unsigned char * | data, | ||
size_t & | len, | ||
bool | blocking = true |
||
) | const [virtual] |
receiveRaw() method loads data from socket buffer in a realtime safe manner.
Implements barrett::bus::CommunicationsBus.
int barrett::bus::CANSocket::send | ( | int | busId, |
const unsigned char * | data, | ||
size_t | len | ||
) | const [virtual] |
send() method pushes data onto socket.
Implements barrett::bus::CommunicationsBus.