typedef struct _HID_DEVICE {
PCHAR DevicePath;
HANDLE HidDevice; // A file handle to the hid device.
HIDP_CAPS Caps; // The Capabilities of this hid device.
HIDD_ATTRIBUTES Attributes;
} HID_DEVICE, *PHID_DEVICE;
class MCDHid
{
public:
static MCDHid & getInstance(){
static MCDHid mcdHid;
return mcdHid;
}
MCDHid(MCDHid & mcdHid);
MCDHid & operator=(MCDHid &mcdHid);
~MCDHid();
unsigned long openMCDHid();
void closeMCDHid();
void startComm(void * pParam);
int writeToHid();
int readFromHid();
char * getHidDeviceName()
{
return _hidDeviceName;
}
bool findMCDHid();
HID_DEVICE* getHidDevice(){
return & _hidDevice;
}
bool getUsbCommRunning(){
return _fUsbCommRunning;
}
bool getOffHookSignal(){
return _offHookSignal;
}
unsigned long getDataWaitProcess(){
return _dataWaitProcess;
}
void setUsbCommRunning(bool usbCommRunning)
{
_fUsbCommRunning = usbCommRunning;
}
unsigned char _inputReportBuffer[9];
unsigned char _outputReportBuffer[2];
private:
MCDHid();
void copy(MCDHid & mcdHid);
char *_hidDeviceName;
HANDLE _hEventObject;
OVERLAPPED _hIDOverlapped;
HID_DEVICE _hidDevice;
bool _fUsbCommRunning;
bool _offHookSignal;
unsigned long _dataWaitProcess;
unsigned long _inputReportByteLength;
unsigned long _outputReportByteLength;
};
#endif // MCDHID_H_INCLUDED |