1 #ifndef RKSCAN_HEADER 2 #define RKSCAN_HEADER 3 #include "DefineHeader.h" 4 #include "RKLog.h" 5 6 typedef struct { 7 USHORT usVid; 8 USHORT usPid; 9 ENUM_RKDEVICE_TYPE emDeviceType; 10 } STRUCT_DEVICE_CONFIG, *PSTRUCT_DEVICE_CONFIG; 11 12 typedef vector<STRUCT_DEVICE_CONFIG> RKDEVICE_CONFIG_SET; 13 class CRKScan 14 { 15 public: 16 UINT GetMSC_TIMEOUT(); 17 void SetMSC_TIMEOUT(UINT value); 18 property<CRKScan, UINT, READ_WRITE> MSC_TIMEOUT; 19 20 UINT GetRKUSB_TIMEOUT(); 21 void SetRKUSB_TIMEOUT(UINT value); 22 property<CRKScan, UINT, READ_WRITE> RKUSB_TIMEOUT; 23 24 int GetDEVICE_COUNTS(); 25 property<CRKScan, int, READ_ONLY> DEVICE_COUNTS; 26 27 CRKScan(UINT uiMscTimeout = 30, UINT uiRKusbTimeout = 20); 28 void SetVidPid(USHORT mscVid = 0, USHORT mscPid = 0); 29 void AddRockusbVidPid(USHORT newVid, USHORT newPid, USHORT oldVid, USHORT oldPid); 30 bool FindRockusbVidPid(ENUM_RKDEVICE_TYPE type, USHORT &usVid, USHORT &usPid); 31 int Search(UINT type); 32 bool Wait(STRUCT_RKDEVICE_DESC &device, ENUM_RKUSB_TYPE usbType, USHORT usVid = 0, USHORT usPid = 0); 33 bool MutexWaitPrepare(UINT_VECTOR &vecExistedDevice, DWORD uiOfflineDevice); 34 bool MutexWait(UINT_VECTOR &vecExistedDevice, STRUCT_RKDEVICE_DESC &device, ENUM_RKUSB_TYPE usbType, USHORT usVid = 0, USHORT usPid = 0); 35 int GetPos(UINT locationID); 36 bool GetDevice(STRUCT_RKDEVICE_DESC &device, int pos); 37 bool SetLogObject(CRKLog *pLog); 38 ~CRKScan(); 39 private: 40 UINT m_waitRKusbSecond; 41 UINT m_waitMscSecond; 42 CRKLog *m_log; 43 RKDEVICE_DESC_SET m_list; 44 RKDEVICE_CONFIG_SET m_deviceConfigSet; 45 RKDEVICE_CONFIG_SET m_deviceMscConfigSet; 46 int FindConfigSetPos(RKDEVICE_CONFIG_SET &devConfigSet, USHORT vid, USHORT pid); 47 int FindWaitSetPos(const RKDEVICE_CONFIG_SET &waitDeviceSet, USHORT vid, USHORT pid); 48 void EnumerateUsbDevice(RKDEVICE_DESC_SET &list, UINT &uiTotalMatchDevices); 49 void FreeDeviceList(RKDEVICE_DESC_SET &list); 50 bool IsRockusbDevice(ENUM_RKDEVICE_TYPE &type, USHORT vid, USHORT pid); 51 }; 52 #endif