HidEvent.cs
changeset 53 e7831b781512
parent 52 2f34ceaf0692
child 54 7647691aa209
     1.1 --- a/HidEvent.cs	Sat Feb 14 23:23:41 2015 +0100
     1.2 +++ b/HidEvent.cs	Sat Feb 14 23:41:12 2015 +0100
     1.3 @@ -109,13 +109,6 @@
     1.4                      return;
     1.5                  }
     1.6  
     1.7 -                //TODO: move this into our device class
     1.8 -                //Fetch device info
     1.9 -                RID_DEVICE_INFO deviceInfo = new RID_DEVICE_INFO();
    1.10 -                if (!Win32.Utils.RawInput.GetDeviceInfo(rawInput.header.hDevice, ref deviceInfo))
    1.11 -                {
    1.12 -                    return;
    1.13 -                }
    1.14  
    1.15                  //Get various information about this HID device
    1.16                  Device = new Hid.HidDevice(rawInput.header.hDevice);                
    1.17 @@ -127,8 +120,8 @@
    1.18                      Debug.WriteLine("WM_INPUT source device is HID.");
    1.19                      //Get Usage Page and Usage
    1.20                      //Debug.WriteLine("Usage Page: 0x" + deviceInfo.hid.usUsagePage.ToString("X4") + " Usage ID: 0x" + deviceInfo.hid.usUsage.ToString("X4"));
    1.21 -                    UsagePage = deviceInfo.hid.usUsagePage;
    1.22 -                    UsageCollection = deviceInfo.hid.usUsage;
    1.23 +                    UsagePage = Device.Info.hid.usUsagePage;
    1.24 +                    UsageCollection = Device.Info.hid.usUsage;
    1.25  
    1.26                      if (!(rawInput.hid.dwSizeHid > 1     //Make sure our HID msg size more than 1. In fact the first ushort is irrelevant to us for now
    1.27                          && rawInput.hid.dwCount > 0))    //Check that we have at least one HID msg
    1.28 @@ -209,12 +202,12 @@
    1.29  
    1.30                      Debug.WriteLine("WM_INPUT source device is Keyboard.");
    1.31                      // do keyboard handling...
    1.32 -                    Debug.WriteLine("Type: " + deviceInfo.keyboard.dwType.ToString());
    1.33 -                    Debug.WriteLine("SubType: " + deviceInfo.keyboard.dwSubType.ToString());
    1.34 -                    Debug.WriteLine("Mode: " + deviceInfo.keyboard.dwKeyboardMode.ToString());
    1.35 -                    Debug.WriteLine("Number of function keys: " + deviceInfo.keyboard.dwNumberOfFunctionKeys.ToString());
    1.36 -                    Debug.WriteLine("Number of indicators: " + deviceInfo.keyboard.dwNumberOfIndicators.ToString());
    1.37 -                    Debug.WriteLine("Number of keys total: " + deviceInfo.keyboard.dwNumberOfKeysTotal.ToString());
    1.38 +                    Debug.WriteLine("Type: " + Device.Info.keyboard.dwType.ToString());
    1.39 +                    Debug.WriteLine("SubType: " + Device.Info.keyboard.dwSubType.ToString());
    1.40 +                    Debug.WriteLine("Mode: " + Device.Info.keyboard.dwKeyboardMode.ToString());
    1.41 +                    Debug.WriteLine("Number of function keys: " + Device.Info.keyboard.dwNumberOfFunctionKeys.ToString());
    1.42 +                    Debug.WriteLine("Number of indicators: " + Device.Info.keyboard.dwNumberOfIndicators.ToString());
    1.43 +                    Debug.WriteLine("Number of keys total: " + Device.Info.keyboard.dwNumberOfKeysTotal.ToString());
    1.44                  }
    1.45              }
    1.46              finally