29 #ifndef CInterfaceFTDI_H
30 #define CInterfaceFTDI_H
32 #include <mrpt/config.h>
57 #if defined(MRPT_OS_LINUX) || defined(MRPT_OS_APPLE)
59 void *usb_device_struct;
116 void OpenBySerialNumber(
const std::string &serialNumber );
120 void OpenByDescription(
const std::string &description );
132 void SetLatencyTimer (
unsigned char latency_ms);
135 void SetTimeouts(
unsigned long dwReadTimeout_ms,
unsigned long dwWriteTimeout_ms);
144 size_t ReadSync(
void *Buffer,
size_t Count)
146 return Read(Buffer,Count);
151 size_t WriteSync(
const void *Buffer,
size_t Count)
153 return Write(Buffer,Count);
160 virtual size_t ReadBufferImmediate(
void *Buffer,
size_t Count);
166 size_t Read(
void *Buffer,
size_t Count);
173 size_t Write(
const void *Buffer,
size_t Count);
181 uint64_t getTotalBytesCount();
185 uint64_t getPosition();
188 void ftdi_read(
void *lpvBuffer,
unsigned long dwBuffSize,
unsigned long *lpdwBytesRead);
189 void ftdi_write(
const void *lpvBuffer,
unsigned long dwBuffSize,
unsigned long *lpdwBytes);
191 #if defined(MRPT_OS_WINDOWS)
193 void checkErrorAndRaise(
int errorCode);
195 void ftdi_open(
void* pvDevice);
196 void ftdi_openEx(
void* pArg1,
unsigned long dwFlags);
197 void ftdi_listDevices(
void *pArg1,
void *pArg2,
unsigned long dwFlags);
198 void ftdi_getQueueStatus(
unsigned long *lpdwAmountInRxQueue);
201 unsigned long m_ftHandle;
210 typedef FT_STATUS (__stdcall *PtrToOpen)(
void*,
unsigned long *);
213 typedef FT_STATUS (__stdcall *PtrToOpenEx)(
void*,
unsigned long,
unsigned long *);
214 PtrToOpenEx m_pOpenEx;
216 typedef FT_STATUS (__stdcall *PtrToListDevices)(
void*,
void*,
unsigned long);
217 PtrToListDevices m_pListDevices;
219 typedef FT_STATUS (__stdcall *PtrToClose)(
unsigned long );
222 typedef FT_STATUS (__stdcall *PtrToRead)(
unsigned long ,
void *,
unsigned long,
unsigned long *);
225 typedef FT_STATUS (__stdcall *PtrToWrite)(
unsigned long ,
const void *,
unsigned long,
unsigned long *);
228 typedef FT_STATUS (__stdcall *PtrToResetDevice)(
unsigned long );
229 PtrToResetDevice m_pResetDevice;
231 typedef FT_STATUS (__stdcall *PtrToPurge)(
unsigned long ,
unsigned long);
234 typedef FT_STATUS (__stdcall *PtrToSetTimeouts)(
unsigned long ,
unsigned long,
unsigned long);
235 PtrToSetTimeouts m_pSetTimeouts;
237 typedef FT_STATUS (__stdcall *PtrToGetQueueStatus)(
unsigned long ,
unsigned long *);
238 PtrToGetQueueStatus m_pGetQueueStatus;
240 typedef FT_STATUS (__stdcall *PtrToSetLatencyTimer )(
unsigned long ,
unsigned char);
241 PtrToSetLatencyTimer m_pSetLatencyTimer;
248 void recursive_fill_list_devices(
void *usb_device_structure ,
TFTDIDeviceList &outList );