11 #include <mrpt/config.h> 33 #if defined(MRPT_OS_LINUX) || defined(__APPLE__) 36 void* usb_device_struct;
120 unsigned long dwReadTimeout_ms,
unsigned long dwWriteTimeout_ms);
129 size_t ReadSync(
void* Buffer,
size_t Count) {
return Read(Buffer, Count); }
135 return Write(Buffer, Count);
152 size_t Read(
void* Buffer,
size_t Count);
158 size_t Write(
const void* Buffer,
size_t Count);
177 void* lpvBuffer,
unsigned long dwBuffSize,
178 unsigned long* lpdwBytesRead);
180 const void* lpvBuffer,
unsigned long dwBuffSize,
181 unsigned long* lpdwBytes);
188 void ftdi_openEx(
void* pArg1,
unsigned long dwFlags);
203 void*,
unsigned long,
unsigned long*);
213 unsigned long,
void*,
unsigned long,
unsigned long*);
217 unsigned long,
const void*,
unsigned long,
unsigned long*);
227 unsigned long,
unsigned long,
unsigned long);
231 unsigned long,
unsigned long*);
235 unsigned long,
unsigned char);
240 void* m_ftdi_context;
243 void recursive_fill_list_devices(
std::ostream & operator<<(std::ostream &o, const TFTDIDevice &d)
Print out all the information of a FTDI device in textual form.
PtrToResetDevice m_pResetDevice
FT_STATUS(__stdcall * PtrToPurge)(unsigned long, unsigned long)
bool isOpen()
Checks whether the chip has been successfully open.
virtual size_t ReadBufferImmediate(void *Buffer, size_t Count)
Reads a block of bytes from the stream into Buffer, and returns the amound of bytes actually read...
unsigned __int16 uint16_t
void ftdi_getQueueStatus(unsigned long *lpdwAmountInRxQueue)
FT_STATUS(__stdcall * PtrToRead)(unsigned long, void *, unsigned long, unsigned long *)
void ftdi_write(const void *lpvBuffer, unsigned long dwBuffSize, unsigned long *lpdwBytes)
FT_STATUS(__stdcall * PtrToOpenEx)(void *, unsigned long, unsigned long *)
PtrToSetLatencyTimer m_pSetLatencyTimer
uint64_t getPosition() const
This virtual method does nothing in this class.
PtrToListDevices m_pListDevices
size_t Write(const void *Buffer, size_t Count)
Introduces a pure virtual method responsible for writing to the stream.
std::deque< TFTDIDevice > TFTDIDeviceList
Used in CInterfaceFTDI::ListAllDevices.
FT_STATUS(__stdcall * PtrToClose)(unsigned long)
mrpt::containers::circular_buffer< uint8_t > m_readBuffer
Used in Read.
virtual ~CInterfaceFTDI()
Destructor, which closes the connection with the chip and unloads the driver interface.
FT_STATUS(__stdcall * PtrToSetLatencyTimer)(unsigned long, unsigned char)
CInterfaceFTDI()
Constructor, which loads driver interface (the DLL under Windows).
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
size_t ReadSync(void *Buffer, size_t Count)
Tries to read, raising no exception if not all the bytes are available, but raising one if there is s...
void ftdi_listDevices(void *pArg1, void *pArg2, unsigned long dwFlags)
void ListAllDevices(TFTDIDeviceList &outList)
Generates a list with all FTDI devices connected right now.
std::string ftdi_description
CInterfaceFTDI & operator=(const CInterfaceFTDI &o)=delete
This object cannot be copied.
void ftdi_openEx(void *pArg1, unsigned long dwFlags)
uint64_t getTotalBytesCount() const
This virtual method does nothing in this class.
void Close()
Close the USB device.
void SetTimeouts(unsigned long dwReadTimeout_ms, unsigned long dwWriteTimeout_ms)
Change read & write timeouts, in milliseconds.
PtrToSetTimeouts m_pSetTimeouts
FT_STATUS(__stdcall * PtrToSetTimeouts)(unsigned long, unsigned long, unsigned long)
FT_STATUS(__stdcall * PtrToWrite)(unsigned long, const void *, unsigned long, unsigned long *)
void OpenBySerialNumber(const std::string &serialNumber)
Open by device serial number.
GLsizei const GLchar ** string
size_t Read(void *Buffer, size_t Count)
Introduces a pure virtual method responsible for reading from the stream.
void ftdi_open(void *pvDevice)
void ResetDevice()
Reset the USB device.
FT_STATUS(__stdcall * PtrToResetDevice)(unsigned long)
FT_STATUS(__stdcall * PtrToOpen)(void *, unsigned long *)
size_t WriteSync(const void *Buffer, size_t Count)
Tries to write, raising no exception if not all the bytes are available, but raising one if there is ...
unsigned __int64 uint64_t
void ftdi_read(void *lpvBuffer, unsigned long dwBuffSize, unsigned long *lpdwBytesRead)
uint64_t Seek(int64_t Offset, CStream::TSeekOrigin Origin=sFromBeginning)
This virtual method does nothing in this class.
A definition of a CStream actually representing a USB connection to a FTDI chip.
FT_STATUS(__stdcall * PtrToListDevices)(void *, void *, unsigned long)
void checkErrorAndRaise(int errorCode)
Serial and networking devices and utilities.
PtrToGetQueueStatus m_pGetQueueStatus
std::string ftdi_manufacturer
A list of FTDI devices and their descriptors.
void SetLatencyTimer(unsigned char latency_ms)
Change the latency timer (in milliseconds) implemented on the FTDI chip: for a few ms...
void OpenByDescription(const std::string &description)
Open by device description.
FT_STATUS(__stdcall * PtrToGetQueueStatus)(unsigned long, unsigned long *)
void Purge()
Purge the I/O buffers.