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)
override;
158 size_t Write(
const void* Buffer,
size_t Count)
override;
163 int64_t Offset, CStream::TSeekOrigin Origin =
sFromBeginning)
override;
178 void* lpvBuffer,
unsigned long dwBuffSize,
179 unsigned long* lpdwBytesRead);
181 const void* lpvBuffer,
unsigned long dwBuffSize,
182 unsigned long* lpdwBytes);
189 void ftdi_openEx(
void* pArg1,
unsigned long dwFlags);
204 void*,
unsigned long,
unsigned long*);
214 unsigned long,
void*,
unsigned long,
unsigned long*);
218 unsigned long,
const void*,
unsigned long,
unsigned long*);
228 unsigned long,
unsigned long,
unsigned long);
232 unsigned long,
unsigned long*);
236 unsigned long,
unsigned char);
241 void* m_ftdi_context;
244 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.
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
PtrToListDevices m_pListDevices
std::deque< TFTDIDevice > TFTDIDeviceList
Used in CInterfaceFTDI::ListAllDevices.
size_t Write(const void *Buffer, size_t Count) override
Introduces a pure virtual method responsible for writing to the stream.
FT_STATUS(__stdcall * PtrToClose)(unsigned long)
mrpt::containers::circular_buffer< uint8_t > m_readBuffer
Used in Read.
uint64_t Seek(int64_t Offset, CStream::TSeekOrigin Origin=sFromBeginning) override
This virtual method does nothing in this class.
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.
size_t Read(void *Buffer, size_t Count) override
Introduces a pure virtual method responsible for reading from the stream.
void ftdi_openEx(void *pArg1, unsigned long dwFlags)
void Close()
Close the USB device.
void SetTimeouts(unsigned long dwReadTimeout_ms, unsigned long dwWriteTimeout_ms)
Change read & write timeouts, in milliseconds.
uint64_t getPosition() const override
This virtual method does nothing in this class.
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.
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 ...
void ftdi_read(void *lpvBuffer, unsigned long dwBuffSize, unsigned long *lpdwBytesRead)
size_t ReadBufferImmediate(void *Buffer, size_t Count) override
Reads a block of bytes from the stream into Buffer, and returns the amound of bytes actually read...
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)
uint64_t getTotalBytesCount() const override
This virtual method does nothing in this class.
Serial and networking devices and utilities.
PtrToGetQueueStatus m_pGetQueueStatus
std::string ftdi_manufacturer
~CInterfaceFTDI() override
Destructor, which closes the connection with the chip and unloads the driver interface.
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.