libnifalcon  1.0.1
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
libnifalcon::FalconCommFTD2XX Class Reference

#include <FalconCommFTD2XX.h>

+ Inheritance diagram for libnifalcon::FalconCommFTD2XX:
+ Collaboration diagram for libnifalcon::FalconCommFTD2XX:

Public Member Functions

 FalconCommFTD2XX ()
 
virtual ~FalconCommFTD2XX ()
 
virtual bool getDeviceCount (unsigned int &count)
 
virtual void poll ()
 
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 ()
 
- Public Member Functions inherited from libnifalcon::FalconComm
 FalconComm ()
 
virtual ~FalconComm ()
 
int getLastBytesRead ()
 
int getLastBytesWritten ()
 
int getDeviceErrorCode ()
 
bool isCommOpen ()
 
virtual void reset ()
 
bool hasBytesAvailable ()
 
unsigned int getBytesAvailable ()
 
virtual void setBytesAvailable (unsigned int b)
 
- Public Member Functions inherited from libnifalcon::FalconCore
 FalconCore ()
 
virtual ~FalconCore ()
 
int getErrorCode ()
 

Protected Member Functions

int8_t openDeviceFTD2XX (unsigned int index, bool should_open)
 

Protected Attributes

void * m_falconDevice
 
- Protected Attributes inherited from libnifalcon::FalconComm
int m_deviceErrorCode
 
int m_lastBytesRead
 
int m_lastBytesWritten
 
bool m_isCommOpen
 
bool m_hasBytesAvailable
 
int m_bytesAvailable
 
- Protected Attributes inherited from libnifalcon::FalconCore
int m_errorCode
 

Static Protected Attributes

static const char * FALCON_DESCRIPTION = "FALCON HAPTIC"
 
- Static Protected Attributes inherited from libnifalcon::FalconComm
static const unsigned int MAX_DEVICES = 128
 
static const unsigned int FALCON_VENDOR_ID = 0x0403
 
static const unsigned int FALCON_PRODUCT_ID = 0xCB48
 

Additional Inherited Members

- Public Types inherited from libnifalcon::FalconComm
enum  {
  FALCON_COMM_DEVICE_ERROR = 2000, FALCON_COMM_NOT_INITIALIZED, FALCON_COMM_DEVICE_NOT_FOUND_ERROR, FALCON_COMM_DEVICE_NOT_VALID_ERROR,
  FALCON_COMM_DEVICE_INDEX_OUT_OF_RANGE_ERROR, FALCON_COMM_FIRMWARE_NOT_FOUND_ERROR, FALCON_COMM_WRITE_ERROR, FALCON_COMM_READ_ERROR
}
 

Detailed Description

FalconCommFTD2XX is the FTD2XX implementation of the falcon communications core. This core is meant to be used on Windows, where the FTD2XX driver is the factory standard driver for the falcon. This means that libnifalcon code can work alongside the regular HDAL drivers.

FalconCommFTD2XX 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

Constructor & Destructor Documentation

libnifalcon::FalconCommFTD2XX::FalconCommFTD2XX ( )
inline

Constructor

libnifalcon::FalconCommFTD2XX::~FalconCommFTD2XX ( )
virtual

Destructor

Member Function Documentation

bool libnifalcon::FalconCommFTD2XX::close ( )
virtual

Closes the device, if open

Returns
True if device is closed successfully, false otherwise. Error code set if false.

Implements libnifalcon::FalconComm.

bool libnifalcon::FalconCommFTD2XX::getDeviceCount ( unsigned int &  count)
virtual

Returns the number of devices connected to the system

Parameters
[out]countThe number of devices available
Returns
True if count was retreived correctly, false otherwise. Error code set if false.

Implements libnifalcon::FalconComm.

bool libnifalcon::FalconCommFTD2XX::open ( unsigned int  index)
virtual

Opens the device at the specified index

Parameters
[in]indexIndex of the device to open
Returns
True if device is opened successfully, false otherwise. Error code set if false.

Implements libnifalcon::FalconComm.

int8_t libnifalcon::FalconCommFTD2XX::openDeviceFTD2XX ( unsigned int  index,
bool  should_open 
)
protected

Internal device opening function

Parameters
[in]indexIndex of device to open
[in]should_openIf true, open. If false, return count
Returns
If should_open is true, non-zero if device opened. If should_open is false, device count or -1 if can't get count.
void libnifalcon::FalconCommFTD2XX::poll ( )
virtual

Polls the object for confirmation of write/read return

Reimplemented from libnifalcon::FalconComm.

bool libnifalcon::FalconCommFTD2XX::read ( uint8_t *  str,
unsigned int  size 
)
virtual

Read a specified number of bytes from the device

Parameters
[out]strBuffer to read data into
[in]sizeAmount of bytes to read
Returns
True if (size) amount of bytes is read successfully, false otherwise. Error code set if false.

Implements libnifalcon::FalconComm.

bool libnifalcon::FalconCommFTD2XX::readBlocking ( uint8_t *  str,
unsigned int  size 
)
virtual

Read a specified number of bytes from the device

Parameters
[out]strBuffer to read data into
[in]sizeAmount of bytes to read
Returns
True if (size) amount of bytes is read successfully, false otherwise. Error code set if false.

Implements libnifalcon::FalconComm.

bool libnifalcon::FalconCommFTD2XX::setFirmwareMode ( )
virtual

Sets the communications mode and initializes the device to load firmware

Returns
True if device is successfully set to load firwmare, false otherwise. Error code set if false.

Implements libnifalcon::FalconComm.

bool libnifalcon::FalconCommFTD2XX::setNormalMode ( )
virtual

Sets the communications mode and initializes the device to run in normal operation

Returns
True if device is successfully set to normal operation, false otherwise. Error code set if false.

Implements libnifalcon::FalconComm.

bool libnifalcon::FalconCommFTD2XX::write ( uint8_t *  str,
unsigned int  size 
)
virtual

Write a specified number of bytes to the device

Parameters
[in]strBuffer to write data from
[in]sizeAmount of bytes to write
Returns
True if (size) amount of bytes is written successfully, false otherwise. Error code set if false.

Implements libnifalcon::FalconComm.

virtual bool libnifalcon::FalconCommFTD2XX::writeBlocking ( uint8_t *  str,
unsigned int  size 
)
inlinevirtual

Write a specified number of bytes to the device

Parameters
[in]strBuffer to write data from
[in]sizeAmount of bytes to write
Returns
True if (size) amount of bytes is written successfully, false otherwise. Error code set if false.

Implements libnifalcon::FalconComm.

Member Data Documentation

const char * libnifalcon::FalconCommFTD2XX::FALCON_DESCRIPTION = "FALCON HAPTIC"
staticprotected

String describing the falcon (used for identification)

void* libnifalcon::FalconCommFTD2XX::m_falconDevice
protected

Internal pointer to ftdi device struct

This would usually be a FT_HANDLE, but FT_HANDLE is just a void*, so this saves us having to deal with the include at this level.


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