35 #ifndef _DATASPEED_CAN_USB_CAN_USB_H 36 #define _DATASPEED_CAN_USB_CAN_USB_H 40 #include <boost/bind.hpp> 41 #include <boost/function.hpp> 57 static const int USB_DEFAULT_TIMEOUT = 10;
58 static const unsigned int MAX_CHANNELS = 4;
59 static const unsigned int MAX_FILTERS = 32;
64 std::string version()
const;
73 bool open(
const std::string &mac = std::string());
79 bool setBitrate(
unsigned int channel, uint32_t bitrate, uint8_t mode = 0);
80 bool addFilter(
unsigned int channel, uint32_t mask, uint32_t match);
81 bool getStats(std::vector<uint32_t> &rx_drops, std::vector<uint32_t> &tx_drops,
82 std::vector<uint8_t> &rx_errors, std::vector<uint8_t> &tx_errors,
bool clear =
false);
83 bool getTimeStamp(uint32_t ×tamp);
85 void sendMessage(
unsigned int channel, uint32_t
id,
bool extended, uint8_t dlc,
const uint8_t data[8],
bool flush =
true);
88 typedef boost::function<void(unsigned int channel, uint32_t id, bool extended, uint8_t dlc, const uint8_t data[8])>
Callback;
90 recv_callback_ = callback;
95 bool getNumChannels();
96 bool configure(
const std::string &mac = std::string());
98 void recvStream(
const void *data,
int size);
100 bool writeConfig(
const void * data,
int size);
101 int readConfig(
void * data,
int size);
102 bool writeConfig(
const void * data,
int size,
int timeout);
103 int readConfig(
void * data,
int size,
int timeout);
105 bool writeStream(
const void * data,
int size);
106 int readStream(
void * data,
int size);
125 #endif // _DATASPEED_CAN_USB_CAN_USB_H unsigned int numChannels() const
unsigned int num_channels_
uint32_t serialNumber() const
void setRecvCallback(const Callback &callback)
uint16_t versionBuild() const
boost::function< void(unsigned int channel, uint32_t id, bool extended, uint8_t dlc, const uint8_t data[8])> Callback
uint16_t versionMinor() const
uint16_t versionMajor() const
uint16_t versionComms() const