C++ class the CAN USB adapter USB2-F-7001. More...
#include <inc/USB2_F_7001.h>
Public Member Functions | |
bool | CANBusOpen () |
Check whether the CAN bus is open or not. | |
bool | clearBuffers () |
Clear buffers. | |
bool | closeCANBus () |
Close the CAN bus. | |
USB2_F_7001_BitRate | getCANBitRate () |
Get the current bit rate. | |
int | getSerialNumber () |
Get the serial number. | |
int | getVersion () |
Get the version. | |
bool | openCANBus (USB2_F_7001_BitRate bit_rate) |
Open the CAN bus. | |
bool | reset () |
Reset. | |
bool | setCANBitRate (USB2_F_7001_BitRate bit_rate) |
Set the bit rate. | |
bool | transmitExtendedFrame (std::string *frame) |
Transmit extended frame. | |
bool | transmitStandardFrame (std::string *frame) |
Transmit standard frame. | |
USB2_F_7001 (std::string *serial_port_name, boost::function< void(std::string *)> f) | |
Constructor. | |
~USB2_F_7001 () | |
Destructor. | |
Private Member Functions | |
void | newFrameCallback (std::string *frame) |
New CAN frame callback. | |
Private Attributes | |
USB2_F_7001_BitRate | bit_rate_ |
Bit rate. | |
bool | open_ |
CAN bus state. | |
boost::function< void(std::string *) | receivedFrameCallback ) |
Callback function. | |
cereal::CerealPort | serial_port_ |
Serial port. |
C++ class the CAN USB adapter USB2-F-7001.
This class was based on the serial port code found on the hokuyo_node as suggested by Blaise Gassend on the ros-users mailling list.
Definition at line 69 of file USB2_F_7001.h.
USB2_F_7001::USB2_F_7001 | ( | std::string * | serial_port_name, |
boost::function< void(std::string *)> | f | ||
) |
Constructor.
Definition at line 52 of file USB2_F_7001.cpp.
Destructor.
Definition at line 66 of file USB2_F_7001.cpp.
bool USB2_F_7001::CANBusOpen | ( | ) | [inline] |
Check whether the CAN bus is open or not.
Definition at line 97 of file USB2_F_7001.h.
bool USB2_F_7001::clearBuffers | ( | ) |
Clear buffers.
Clears the USB2-F-7001 buffers.
Definition at line 208 of file USB2_F_7001.cpp.
bool USB2_F_7001::closeCANBus | ( | ) |
Close the CAN bus.
This call closes the CAN bus.
bit_rate | Bit rate of the serial port. |
Definition at line 123 of file USB2_F_7001.cpp.
USB2_F_7001_BitRate USB2_F_7001::getCANBitRate | ( | ) | [inline] |
Get the current bit rate.
Definition at line 124 of file USB2_F_7001.h.
int USB2_F_7001::getSerialNumber | ( | ) |
Get the serial number.
Definition at line 283 of file USB2_F_7001.cpp.
int USB2_F_7001::getVersion | ( | ) |
Get the version.
Definition at line 275 of file USB2_F_7001.cpp.
void USB2_F_7001::newFrameCallback | ( | std::string * | frame | ) | [private] |
New CAN frame callback.
This function allows to receive CAn frames.
frame | Data frame to receive. |
Definition at line 290 of file USB2_F_7001.cpp.
bool USB2_F_7001::openCANBus | ( | USB2_F_7001_BitRate | bit_rate | ) |
Open the CAN bus.
This opens the CAN bus with the desired baud rate.
bit_rate | Bit rate of the serial port. |
Definition at line 73 of file USB2_F_7001.cpp.
bool USB2_F_7001::reset | ( | ) |
Reset.
Resets the USB2-F-7001.
Definition at line 155 of file USB2_F_7001.cpp.
bool USB2_F_7001::setCANBitRate | ( | USB2_F_7001_BitRate | bit_rate | ) |
Set the bit rate.
Sets the USB2-F-7001 bit rate. Values are 10Kbp2 20Kbps 50Kbps 100Kbps 125Kbps 250Kbps 500Kbps 800Kbps 1000Kbps
Definition at line 181 of file USB2_F_7001.cpp.
bool USB2_F_7001::transmitExtendedFrame | ( | std::string * | frame | ) |
Transmit extended frame.
This function allows to send an extended CAN frame.
frame | Extended data frame to send. |
Definition at line 267 of file USB2_F_7001.cpp.
bool USB2_F_7001::transmitStandardFrame | ( | std::string * | frame | ) |
Transmit standard frame.
This function allows to send a standard CAN frame.
frame | Standard data frame to send. |
Definition at line 232 of file USB2_F_7001.cpp.
USB2_F_7001_BitRate USB2_F_7001::bit_rate_ [private] |
Bit rate.
Definition at line 171 of file USB2_F_7001.h.
bool USB2_F_7001::open_ [private] |
CAN bus state.
Definition at line 174 of file USB2_F_7001.h.
boost::function<void(std::string*) USB2_F_7001::receivedFrameCallback) [private] |
Callback function.
Definition at line 180 of file USB2_F_7001.h.
cereal::CerealPort USB2_F_7001::serial_port_ [private] |
Serial port.
Definition at line 177 of file USB2_F_7001.h.