Public Member Functions | Private Member Functions | Private Attributes
USB2_F_7001 Class Reference

C++ class the CAN USB adapter USB2-F-7001. More...

#include <inc/USB2_F_7001.h>

List of all members.

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.

Detailed Description

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

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.

Clear buffers.

Clears the USB2-F-7001 buffers.

Returns:
True is succesful, false if otherwise.

Definition at line 208 of file USB2_F_7001.cpp.

Close the CAN bus.

This call closes the CAN bus.

Parameters:
bit_rateBit rate of the serial port.

Definition at line 123 of file USB2_F_7001.cpp.

Get the current bit rate.

Definition at line 124 of file USB2_F_7001.h.

Get the serial number.

Definition at line 283 of file USB2_F_7001.cpp.

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.

Parameters:
frameData frame to receive.

Definition at line 290 of file USB2_F_7001.cpp.

Open the CAN bus.

This opens the CAN bus with the desired baud rate.

Parameters:
bit_rateBit rate of the serial port.

Definition at line 73 of file USB2_F_7001.cpp.

Reset.

Resets the USB2-F-7001.

Returns:
True is succesful, false if otherwise.

Definition at line 155 of file USB2_F_7001.cpp.

Set the bit rate.

Sets the USB2-F-7001 bit rate. Values are 10Kbp2 20Kbps 50Kbps 100Kbps 125Kbps 250Kbps 500Kbps 800Kbps 1000Kbps

Returns:
True is succesful, false if otherwise.

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.

Parameters:
frameExtended data frame to send.
Returns:
True is succesful, false if otherwise.

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.

Parameters:
frameStandard data frame to send.
Returns:
True is succesful, false if otherwise.

Definition at line 232 of file USB2_F_7001.cpp.


Member Data Documentation

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.

Serial port.

Definition at line 177 of file USB2_F_7001.h.


The documentation for this class was generated from the following files:


can_usb_adapters
Author(s): Gonçalo Cabrita
autogenerated on Mon Jan 6 2014 11:25:18