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