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

C++ class the CAN USB adapter CANUSB. More...

#include <inc/CANUSB.h>

List of all members.

Public Member Functions

bool CANBusOpen ()
 Check whether the CAN bus is open or not.
 CANUSB (std::string *serial_port_name, boost::function< void(std::string *)> f)
 Constructor.
bool closeCANBus ()
 Close the CAN bus.
CANUSB_BitRate getCANBitRate ()
 Get the current bit rate.
int getSerialNumber ()
 Get the serial number.
int getVersion ()
 Get the version.
bool openCANBus (CANUSB_BitRate bit_rate)
 Open the CAN bus.
bool reset ()
 Reset.
bool setCANBitRate (CANUSB_BitRate bit_rate)
 Set the bit rate.
bool transmitExtendedFrame (std::string *frame)
 Transmit extended frame.
bool transmitStandardFrame (std::string *frame)
 Transmit standard frame.
 ~CANUSB ()
 Destructor.

Private Member Functions

void newFrameCallback (std::string *frame)
 New CAN frame callback.

Private Attributes

CANUSB_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 CANUSB.

Definition at line 68 of file CANUSB.h.


Constructor & Destructor Documentation

CANUSB::CANUSB ( std::string *  serial_port_name,
boost::function< void(std::string *)>  f 
)

Constructor.

Definition at line 52 of file CANUSB.cpp.

Destructor.

Definition at line 66 of file CANUSB.cpp.


Member Function Documentation

bool CANUSB::CANBusOpen ( ) [inline]

Check whether the CAN bus is open or not.

Definition at line 96 of file CANUSB.h.

Close the CAN bus.

This call closes the CAN bus.

Parameters:
bit_rateBit rate of the serial port.

Definition at line 123 of file CANUSB.cpp.

Get the current bit rate.

Definition at line 123 of file CANUSB.h.

Get the serial number.

Definition at line 259 of file CANUSB.cpp.

Get the version.

Definition at line 251 of file CANUSB.cpp.

void CANUSB::newFrameCallback ( std::string *  frame) [private]

New CAN frame callback.

This function allows to receive CAn frames.

Parameters:
frameData frame to receive.

Definition at line 266 of file CANUSB.cpp.

bool CANUSB::openCANBus ( CANUSB_BitRate  bit_rate)

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 CANUSB.cpp.

bool CANUSB::reset ( )

Reset.

Resets the CANUSB.

Returns:
True is succesful, false if otherwise.

Definition at line 155 of file CANUSB.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 CANUSB.cpp.

bool CANUSB::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 243 of file CANUSB.cpp.

bool CANUSB::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 208 of file CANUSB.cpp.


Member Data Documentation

Bit rate.

Definition at line 162 of file CANUSB.h.

bool CANUSB::open_ [private]

CAN bus state.

Definition at line 165 of file CANUSB.h.

boost::function<void(std::string*) CANUSB::receivedFrameCallback) [private]

Callback function.

Definition at line 171 of file CANUSB.h.

Serial port.

Definition at line 168 of file CANUSB.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