1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #if !defined(DSI_SERIAL_GENERIC_HPP)
- #define DSI_SERIAL_GENERIC_HPP
- #include "types.h"
- #include "dsi_thread.h"
- #include "dsi_serial.hpp"
- #include "usb_device.hpp"
- #include "usb_device_handle.hpp"
- #include "usb_device_list.hpp"
- class DSISerialGeneric : public DSISerial
- {
- private:
- DSI_THREAD_ID hReceiveThread;
- DSI_MUTEX stMutexCriticalSection;
- DSI_CONDITION_VAR stEventReceiveThreadExit;
- BOOL bStopReceiveThread;
- USBDeviceHandle* pclDeviceHandle;
- const USBDevice* pclDevice;
- UCHAR ucDeviceNumber;
- ULONG ulBaud;
- static time_t lastUsbResetTime;
-
- void ReceiveThread();
- static DSI_THREAD_RETURN ProcessThread(void *pvParameter_);
- public:
- DSISerialGeneric();
- ~DSISerialGeneric();
- BOOL Init(ULONG ulBaud_, UCHAR ucDeviceNumber_);
- BOOL Init(ULONG ulBaud_, const USBDevice& clDevice_, UCHAR ucDeviceNumber_);
- void USBReset();
- UCHAR GetNumberOfDevices();
-
- BOOL AutoInit();
- ULONG GetDeviceSerialNumber();
- BOOL Open();
- void Close(BOOL bReset = FALSE);
- BOOL WriteBytes(void *pvData_, USHORT usSize_);
- UCHAR GetDeviceNumber();
- BOOL GetDeviceUSBInfo(UCHAR ucDevice_, UCHAR* pucProductString_, UCHAR* pucSerialString_, USHORT usBufferSize_);
- BOOL GetDevicePID(USHORT& usPid_);
- BOOL GetDeviceVID(USHORT& usVid_);
- BOOL GetDeviceSerialString(UCHAR* pucSerialString_, USHORT usBufferSize_);
- };
- #endif
|