1*c2c66affSColin Finck #ifndef _FBT_HW_H_
2*c2c66affSColin Finck #define _FBT_HW_H_
3*c2c66affSColin Finck 
4*c2c66affSColin Finck #include <winioctl.h>
5*c2c66affSColin Finck 
6*c2c66affSColin Finck // HW Driver Abstraction layer
7*c2c66affSColin Finck class CBTHW
8*c2c66affSColin Finck {
9*c2c66affSColin Finck public:
10*c2c66affSColin Finck 	// The driver is opened for OVERLAPPED I/O
11*c2c66affSColin Finck     CBTHW();
12*c2c66affSColin Finck     virtual ~CBTHW();
13*c2c66affSColin Finck 
14*c2c66affSColin Finck 	// Set the driver instances symbolic name
15*c2c66affSColin Finck     void    SetDeviceName(LPCTSTR szDeviceName);
16*c2c66affSColin Finck     DWORD	GetDeviceName(LPTSTR szBuffer, DWORD dwBufferSize);
17*c2c66affSColin Finck 
18*c2c66affSColin Finck 	// Open a handle to the driver instance
19*c2c66affSColin Finck     virtual DWORD   Attach(LPCSTR szDeviceName);
20*c2c66affSColin Finck     virtual DWORD   Detach();
21*c2c66affSColin Finck     HANDLE  GetDriverHandle();
IsAttached()22*c2c66affSColin Finck     BOOL    IsAttached() {return GetDriverHandle()!=INVALID_HANDLE_VALUE;}
23*c2c66affSColin Finck 
24*c2c66affSColin Finck 	// Send a command to the driver
25*c2c66affSColin Finck     DWORD	SendCommand(DWORD dwCommand, LPVOID lpInBuffer=NULL, DWORD dwInBufferSize=0, LPVOID lpOutBuffer=NULL, DWORD dwOutBufferSize=0, OVERLAPPED *pOverlapped=NULL);
26*c2c66affSColin Finck 	DWORD	SendData(LPVOID lpBuffer, DWORD dwBufferSize, DWORD *dwBytesSent, OVERLAPPED *pOverlapped);
27*c2c66affSColin Finck 	DWORD	GetData(LPVOID lpBuffer, DWORD dwBufferSize, DWORD *dwBytesRead, OVERLAPPED *pOverlapped);
28*c2c66affSColin Finck 
29*c2c66affSColin Finck protected:
30*c2c66affSColin Finck     HANDLE  m_hDriver;
31*c2c66affSColin Finck     TCHAR   m_szDeviceName[1024];
32*c2c66affSColin Finck 
33*c2c66affSColin Finck };
34*c2c66affSColin Finck 
35*c2c66affSColin Finck 
36*c2c66affSColin Finck #endif // _FBT_HW_H_
37