#include <CanUsb.h>
Public Types | |
typedef boost::function< void(unsigned int channel, uint32_t id, bool extended, uint8_t dlc, const uint8_t data[8])> | Callback |
Public Member Functions | |
bool | addFilter (unsigned int channel, uint32_t mask, uint32_t match) |
CanUsb (lusb::UsbDevice *dev=NULL) | |
void | closeDevice () |
void | flushMessages () |
bool | getStats (std::vector< uint32_t > &rx_drops, std::vector< uint32_t > &tx_drops, std::vector< uint8_t > &rx_errors, std::vector< uint8_t > &tx_errors, bool clear=false) |
bool | getTimeStamp (uint32_t ×tamp) |
bool | isOpen () |
MacAddr | macAddr () const |
unsigned int | numChannels () const |
bool | open (const std::string &mac=std::string()) |
bool | reboot () |
bool | reset () |
void | sendMessage (unsigned int channel, uint32_t id, bool extended, uint8_t dlc, const uint8_t data[8], bool flush=true) |
uint32_t | serialNumber () const |
bool | setBitrate (unsigned int channel, uint32_t bitrate, uint8_t mode=0) |
void | setRecvCallback (const Callback &callback) |
std::string | version () const |
uint16_t | versionBuild () const |
uint16_t | versionComms () const |
uint16_t | versionMajor () const |
uint16_t | versionMinor () const |
~CanUsb () | |
Static Public Attributes | |
static const unsigned int | MAX_CHANNELS = 4 |
static const unsigned int | MAX_FILTERS = 32 |
static const int | USB_DEFAULT_TIMEOUT = 10 |
Private Member Functions | |
bool | configure (const std::string &mac=std::string()) |
bool | getNumChannels () |
int | readConfig (void *data, int size) |
int | readConfig (void *data, int size, int timeout) |
int | readStream (void *data, int size) |
bool | readVersion () |
void | recvStream (const void *data, int size) |
bool | writeConfig (const void *data, int size) |
bool | writeConfig (const void *data, int size, int timeout) |
bool | writeStream (const void *data, int size) |
Private Attributes | |
lusb::UsbDevice * | dev_ |
bool | heap_dev_ |
MacAddr | mac_addr_ |
unsigned int | num_channels_ |
TxQueue * | queue_ |
bool | ready_ |
Callback | recv_callback_ |
uint32_t | serial_number_ |
uint16_t | version_build_ |
uint16_t | version_comms_ |
uint16_t | version_major_ |
uint16_t | version_minor_ |
typedef boost::function<void(unsigned int channel, uint32_t id, bool extended, uint8_t dlc, const uint8_t data[8])> dataspeed_can_usb::CanUsb::Callback |
dataspeed_can_usb::CanUsb::CanUsb | ( | lusb::UsbDevice * | dev = NULL | ) |
Definition at line 72 of file CanUsb.cpp.
Definition at line 80 of file CanUsb.cpp.
bool dataspeed_can_usb::CanUsb::addFilter | ( | unsigned int | channel, |
uint32_t | mask, | ||
uint32_t | match | ||
) |
Definition at line 245 of file CanUsb.cpp.
Definition at line 153 of file CanUsb.cpp.
bool dataspeed_can_usb::CanUsb::configure | ( | const std::string & | mac = std::string() | ) | [private] |
Definition at line 98 of file CanUsb.cpp.
Definition at line 318 of file CanUsb.cpp.
bool dataspeed_can_usb::CanUsb::getNumChannels | ( | ) | [private] |
Definition at line 179 of file CanUsb.cpp.
bool dataspeed_can_usb::CanUsb::getStats | ( | std::vector< uint32_t > & | rx_drops, |
std::vector< uint32_t > & | tx_drops, | ||
std::vector< uint8_t > & | rx_errors, | ||
std::vector< uint8_t > & | tx_errors, | ||
bool | clear = false |
||
) |
Definition at line 263 of file CanUsb.cpp.
bool dataspeed_can_usb::CanUsb::getTimeStamp | ( | uint32_t & | timestamp | ) |
Definition at line 289 of file CanUsb.cpp.
bool dataspeed_can_usb::CanUsb::isOpen | ( | ) |
Definition at line 142 of file CanUsb.cpp.
MacAddr dataspeed_can_usb::CanUsb::macAddr | ( | ) | const [inline] |
unsigned int dataspeed_can_usb::CanUsb::numChannels | ( | ) | const [inline] |
bool dataspeed_can_usb::CanUsb::open | ( | const std::string & | mac = std::string() | ) |
Definition at line 111 of file CanUsb.cpp.
int dataspeed_can_usb::CanUsb::readConfig | ( | void * | data, |
int | size | ||
) | [private] |
Definition at line 334 of file CanUsb.cpp.
int dataspeed_can_usb::CanUsb::readConfig | ( | void * | data, |
int | size, | ||
int | timeout | ||
) | [private] |
Definition at line 345 of file CanUsb.cpp.
int dataspeed_can_usb::CanUsb::readStream | ( | void * | data, |
int | size | ||
) | [private] |
Definition at line 361 of file CanUsb.cpp.
bool dataspeed_can_usb::CanUsb::readVersion | ( | ) | [private] |
Definition at line 160 of file CanUsb.cpp.
bool dataspeed_can_usb::CanUsb::reboot | ( | ) |
Definition at line 205 of file CanUsb.cpp.
void dataspeed_can_usb::CanUsb::recvStream | ( | const void * | data, |
int | size | ||
) | [private] |
Definition at line 193 of file CanUsb.cpp.
bool dataspeed_can_usb::CanUsb::reset | ( | ) |
Definition at line 216 of file CanUsb.cpp.
void dataspeed_can_usb::CanUsb::sendMessage | ( | unsigned int | channel, |
uint32_t | id, | ||
bool | extended, | ||
uint8_t | dlc, | ||
const uint8_t | data[8], | ||
bool | flush = true |
||
) |
Definition at line 303 of file CanUsb.cpp.
uint32_t dataspeed_can_usb::CanUsb::serialNumber | ( | ) | const [inline] |
bool dataspeed_can_usb::CanUsb::setBitrate | ( | unsigned int | channel, |
uint32_t | bitrate, | ||
uint8_t | mode = 0 |
||
) |
Definition at line 229 of file CanUsb.cpp.
void dataspeed_can_usb::CanUsb::setRecvCallback | ( | const Callback & | callback | ) | [inline] |
std::string dataspeed_can_usb::CanUsb::version | ( | ) | const |
Definition at line 370 of file CanUsb.cpp.
uint16_t dataspeed_can_usb::CanUsb::versionBuild | ( | ) | const [inline] |
uint16_t dataspeed_can_usb::CanUsb::versionComms | ( | ) | const [inline] |
uint16_t dataspeed_can_usb::CanUsb::versionMajor | ( | ) | const [inline] |
uint16_t dataspeed_can_usb::CanUsb::versionMinor | ( | ) | const [inline] |
bool dataspeed_can_usb::CanUsb::writeConfig | ( | const void * | data, |
int | size | ||
) | [private] |
Definition at line 330 of file CanUsb.cpp.
bool dataspeed_can_usb::CanUsb::writeConfig | ( | const void * | data, |
int | size, | ||
int | timeout | ||
) | [private] |
Definition at line 338 of file CanUsb.cpp.
bool dataspeed_can_usb::CanUsb::writeStream | ( | const void * | data, |
int | size | ||
) | [private] |
Definition at line 354 of file CanUsb.cpp.
lusb::UsbDevice* dataspeed_can_usb::CanUsb::dev_ [private] |
bool dataspeed_can_usb::CanUsb::heap_dev_ [private] |
MacAddr dataspeed_can_usb::CanUsb::mac_addr_ [private] |
const unsigned int dataspeed_can_usb::CanUsb::MAX_CHANNELS = 4 [static] |
const unsigned int dataspeed_can_usb::CanUsb::MAX_FILTERS = 32 [static] |
unsigned int dataspeed_can_usb::CanUsb::num_channels_ [private] |
TxQueue* dataspeed_can_usb::CanUsb::queue_ [private] |
bool dataspeed_can_usb::CanUsb::ready_ [private] |
uint32_t dataspeed_can_usb::CanUsb::serial_number_ [private] |
const int dataspeed_can_usb::CanUsb::USB_DEFAULT_TIMEOUT = 10 [static] |
uint16_t dataspeed_can_usb::CanUsb::version_build_ [private] |
uint16_t dataspeed_can_usb::CanUsb::version_comms_ [private] |
uint16_t dataspeed_can_usb::CanUsb::version_major_ [private] |
uint16_t dataspeed_can_usb::CanUsb::version_minor_ [private] |