#include <FalconCommLibUSB.h>
Inherits libnifalcon::FalconComm.
Public Member Functions | |
FalconCommLibUSB () | |
~FalconCommLibUSB () | |
virtual bool | getDeviceCount (unsigned int &count) |
virtual bool | open (unsigned int index) |
virtual bool | close () |
virtual bool | read (uint8_t *str, unsigned int size) |
virtual bool | write (uint8_t *str, unsigned int size) |
virtual bool | readBlocking (uint8_t *str, unsigned int size) |
virtual bool | writeBlocking (uint8_t *str, unsigned int size) |
virtual bool | setFirmwareMode () |
virtual bool | setNormalMode () |
virtual void | setBytesAvailable (uint32_t b) |
void | setHasBytesAvailable (bool v) |
void | setSent () |
void | setReceived () |
bool | initLibUSB () |
void | poll () |
void | reset () |
void | issueRead () |
Static Public Member Functions | |
static void | cb_in (struct libusb_transfer *transfer) |
static void | cb_out (struct libusb_transfer *transfer) |
Protected Attributes | |
bool | m_isWriteAllocated |
bool | m_isReadAllocated |
struct timeval * | m_tv |
libusb_device_handle * | m_falconDevice |
unsigned char | input [128] |
unsigned char | output [128] |
struct libusb_transfer * | in_transfer |
struct libusb_transfer * | out_transfer |
struct libusb_context * | m_usbContext |
Private Member Functions | |
DECLARE_LOGGER () |
http://www.intra2net.com/en/developer/libftdi/
However, due to our need to access the falcon at as close to a sustained 1khz rate as possible, we needed to use a non-blocking communications layer.
FalconCommLibUSB is built directly into the libnifalcon core library, as is chosen for the user by default by the FalconDevice constructor, so it is usually not needed. However, it is left here for code compatibility for code that already used comm behavior setting, which was required before libnifalcon v1.0
libnifalcon::FalconCommLibUSB::FalconCommLibUSB | ( | ) |
Constructor
libnifalcon::FalconCommLibUSB::~FalconCommLibUSB | ( | ) |
Destructor
void libnifalcon::FalconCommLibUSB::cb_in | ( | struct libusb_transfer * | transfer | ) | [static] |
Callback for result of reading data
void libnifalcon::FalconCommLibUSB::cb_out | ( | struct libusb_transfer * | transfer | ) | [static] |
Callback for result of writing data
bool libnifalcon::FalconCommLibUSB::close | ( | ) | [virtual] |
Closes the device, if open
Implements libnifalcon::FalconComm.
libnifalcon::FalconCommLibUSB::DECLARE_LOGGER | ( | ) | [private] |
bool libnifalcon::FalconCommLibUSB::getDeviceCount | ( | unsigned int & | count | ) | [virtual] |
Returns the number of devices connected to the system
[out] | count | The number of devices available |
Implements libnifalcon::FalconComm.
bool libnifalcon::FalconCommLibUSB::initLibUSB | ( | ) |
Initializes libusb core
void libnifalcon::FalconCommLibUSB::issueRead | ( | ) |
Causes a read to be queued
bool libnifalcon::FalconCommLibUSB::open | ( | unsigned int | index | ) | [virtual] |
Opens the device at the specified index
[in] | index | Index of the device to open |
Implements libnifalcon::FalconComm.
void libnifalcon::FalconCommLibUSB::poll | ( | ) | [virtual] |
Polls the object for confirmation of write/read return
Reimplemented from libnifalcon::FalconComm.
bool libnifalcon::FalconCommLibUSB::read | ( | uint8_t * | str, | |
unsigned int | size | |||
) | [virtual] |
Read a specified number of bytes from the device
[out] | str | Buffer to read data into |
[in] | size | Amount of bytes to read |
Implements libnifalcon::FalconComm.
bool libnifalcon::FalconCommLibUSB::readBlocking | ( | uint8_t * | str, | |
unsigned int | size | |||
) | [virtual] |
Read a specified number of bytes from the device
[out] | str | Buffer to read data into |
[in] | size | Amount of bytes to read |
Implements libnifalcon::FalconComm.
void libnifalcon::FalconCommLibUSB::reset | ( | ) | [virtual] |
Reset the internal state of the communications object (bytes read/written, etc...)
Reimplemented from libnifalcon::FalconComm.
void libnifalcon::FalconCommLibUSB::setBytesAvailable | ( | uint32_t | b | ) | [virtual] |
Sets the number of bytes that are ready for reading
bool libnifalcon::FalconCommLibUSB::setFirmwareMode | ( | ) | [virtual] |
Sets the communications mode and initializes the device to load firmware
Implements libnifalcon::FalconComm.
void libnifalcon::FalconCommLibUSB::setHasBytesAvailable | ( | bool | v | ) |
Mutator function needed by static callbacks for class updates
bool libnifalcon::FalconCommLibUSB::setNormalMode | ( | ) | [virtual] |
Sets the communications mode and initializes the device to run in normal operation
Implements libnifalcon::FalconComm.
void libnifalcon::FalconCommLibUSB::setReceived | ( | ) | [inline] |
Mutator function needed by static callbacks for class updates
void libnifalcon::FalconCommLibUSB::setSent | ( | ) | [inline] |
Mutator function needed by static callbacks for class updates
bool libnifalcon::FalconCommLibUSB::write | ( | uint8_t * | str, | |
unsigned int | size | |||
) | [virtual] |
Write a specified number of bytes to the device
[in] | str | Buffer to write data from |
[in] | size | Amount of bytes to write |
Implements libnifalcon::FalconComm.
bool libnifalcon::FalconCommLibUSB::writeBlocking | ( | uint8_t * | str, | |
unsigned int | size | |||
) | [virtual] |
Write a specified number of bytes to the device
[in] | str | Buffer to write data from |
[in] | size | Amount of bytes to write |
Implements libnifalcon::FalconComm.
struct libusb_transfer* libnifalcon::FalconCommLibUSB::in_transfer [read, protected] |
Transfer for reading
unsigned char libnifalcon::FalconCommLibUSB::input[128] [protected] |
Buffers for I/O
libusb_device_handle* libnifalcon::FalconCommLibUSB::m_falconDevice [protected] |
libusb device handle struct
bool libnifalcon::FalconCommLibUSB::m_isReadAllocated [protected] |
True if we currently have a read queued
bool libnifalcon::FalconCommLibUSB::m_isWriteAllocated [protected] |
True if we currently have a write queued
struct timeval* libnifalcon::FalconCommLibUSB::m_tv [read, protected] |
Used for setting timeouts
struct libusb_context* libnifalcon::FalconCommLibUSB::m_usbContext [read, protected] |
Transfer for control messages
struct libusb_transfer* libnifalcon::FalconCommLibUSB::out_transfer [read, protected] |
Transfer for writing
unsigned char libnifalcon::FalconCommLibUSB::output[128] [protected] |