Go to the documentation of this file.
10 #ifndef CInterfaceFTDI_H
11 #define CInterfaceFTDI_H
13 #include <mrpt/config.h>
39 #if defined(MRPT_OS_LINUX) || defined(MRPT_OS_APPLE)
41 void *usb_device_struct;
117 void SetTimeouts(
unsigned long dwReadTimeout_ms,
unsigned long dwWriteTimeout_ms);
128 return Read(Buffer,Count);
135 return Write(Buffer,Count);
148 size_t Read(
void *Buffer,
size_t Count);
155 size_t Write(
const void *Buffer,
size_t Count);
159 uint64_t
Seek(uint64_t Offset, CStream::TSeekOrigin Origin = sFromBeginning);
170 void ftdi_read(
void *lpvBuffer,
unsigned long dwBuffSize,
unsigned long *lpdwBytesRead);
171 void ftdi_write(
const void *lpvBuffer,
unsigned long dwBuffSize,
unsigned long *lpdwBytes);
173 #if defined(MRPT_OS_WINDOWS)
175 void checkErrorAndRaise(
int errorCode);
177 void ftdi_open(
void* pvDevice);
178 void ftdi_openEx(
void* pArg1,
unsigned long dwFlags);
179 void ftdi_listDevices(
void *pArg1,
void *pArg2,
unsigned long dwFlags);
180 void ftdi_getQueueStatus(
unsigned long *lpdwAmountInRxQueue);
183 unsigned long m_ftHandle;
192 typedef FT_STATUS (__stdcall *PtrToOpen)(
void*,
unsigned long *);
195 typedef FT_STATUS (__stdcall *PtrToOpenEx)(
void*,
unsigned long,
unsigned long *);
196 PtrToOpenEx m_pOpenEx;
198 typedef FT_STATUS (__stdcall *PtrToListDevices)(
void*,
void*,
unsigned long);
199 PtrToListDevices m_pListDevices;
201 typedef FT_STATUS (__stdcall *PtrToClose)(
unsigned long );
204 typedef FT_STATUS (__stdcall *PtrToRead)(
unsigned long ,
void *,
unsigned long,
unsigned long *);
207 typedef FT_STATUS (__stdcall *PtrToWrite)(
unsigned long ,
const void *,
unsigned long,
unsigned long *);
210 typedef FT_STATUS (__stdcall *PtrToResetDevice)(
unsigned long );
211 PtrToResetDevice m_pResetDevice;
213 typedef FT_STATUS (__stdcall *PtrToPurge)(
unsigned long ,
unsigned long);
216 typedef FT_STATUS (__stdcall *PtrToSetTimeouts)(
unsigned long ,
unsigned long,
unsigned long);
217 PtrToSetTimeouts m_pSetTimeouts;
219 typedef FT_STATUS (__stdcall *PtrToGetQueueStatus)(
unsigned long ,
unsigned long *);
220 PtrToGetQueueStatus m_pGetQueueStatus;
222 typedef FT_STATUS (__stdcall *PtrToSetLatencyTimer )(
unsigned long ,
unsigned char);
223 PtrToSetLatencyTimer m_pSetLatencyTimer;
void ftdi_write(const void *lpvBuffer, unsigned long dwBuffSize, unsigned long *lpdwBytes)
A definition of a CStream actually representing a USB connection to a FTDI chip.
void OpenBySerialNumber(const std::string &serialNumber)
Open by device serial number.
void SetTimeouts(unsigned long dwReadTimeout_ms, unsigned long dwWriteTimeout_ms)
Change read & write timeouts, in milliseconds.
uint64_t getTotalBytesCount()
This virtual method does nothing in this class.
std::string ftdi_description
A list of FTDI devices and their descriptors.
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,...
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 ...
bool isOpen()
Checks whether the chip has been successfully open.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void Purge()
Purge the I/O buffers.
std::string ftdi_manufacturer
CInterfaceFTDI()
Constructor, which loads driver interface (the DLL under Windows).
std::ostream HWDRIVERS_IMPEXP & operator<<(std::ostream &o, const TFTDIDevice &d)
Print out all the information of a FTDI device in textual form.
uint64_t Seek(uint64_t Offset, CStream::TSeekOrigin Origin=sFromBeginning)
This virtual method does nothing in this class.
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...
CInterfaceFTDI(const CInterfaceFTDI &o)
This object cannot be copied.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
size_t Write(const void *Buffer, size_t Count)
Introduces a pure virtual method responsible for writing to the stream.
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.
void ftdi_read(void *lpvBuffer, unsigned long dwBuffSize, unsigned long *lpdwBytesRead)
void ListAllDevices(TFTDIDeviceList &outList)
Generates a list with all FTDI devices connected right now.
void recursive_fill_list_devices(void *usb_device_structure, TFTDIDeviceList &outList)
Process recursively a USB device and its children:
uint64_t getPosition()
This virtual method does nothing in this class.
mrpt::utils::circular_buffer< uint8_t > m_readBuffer
Used in Read.
void Close()
Close the USB device.
void ResetDevice()
Reset the USB device.
virtual ~CInterfaceFTDI()
Destructor, which closes the connection with the chip and unloads the driver interface.
std::deque< TFTDIDevice > TFTDIDeviceList
Used in CInterfaceFTDI::ListAllDevices.
size_t Read(void *Buffer, size_t Count)
Introduces a pure virtual method responsible for reading from the stream.
Page generated by Doxygen 1.8.20 for MRPT 1.4.0 SVN: at Thu Aug 27 02:40:23 UTC 2020 | | |