# HG changeset patch # User StephaneLenclud # Date 1426434991 -3600 # Node ID 72885c950813b72c889d43b1933ce9a0b8d9f9c5 # Parent fb9ea5ad8c2d2bb94c4653c0216768ef70f3c48c Removing legacy remote control stuff. diff -r fb9ea5ad8c2d -r 72885c950813 HidDemo.csproj --- a/HidDemo.csproj Sun Mar 15 14:45:40 2015 +0100 +++ b/HidDemo.csproj Sun Mar 15 16:56:31 2015 +0100 @@ -130,9 +130,6 @@ MainForm.cs - - Code - diff -r fb9ea5ad8c2d -r 72885c950813 HidHandler.cs --- a/HidHandler.cs Sun Mar 15 14:45:40 2015 +0100 +++ b/HidHandler.cs Sun Mar 15 16:56:31 2015 +0100 @@ -48,8 +48,18 @@ IsRegistered = Function.RegisterRawInputDevices(aRawInputDevices, (uint)aRawInputDevices.Length, (uint)Marshal.SizeOf(aRawInputDevices[0])); } - public void ProcessInput(Message aMessage) + /// + /// Process a WM_INPUT message. + /// + /// + public void ProcessInput(ref Message aMessage) { + if (aMessage.Msg != Const.WM_INPUT) + { + //We only process WM_INPUT messages + return; + } + HidEvent hidEvent = new HidEvent(aMessage, OnHidEventRepeat); hidEvent.DebugWrite(); diff -r fb9ea5ad8c2d -r 72885c950813 MainForm.Designer.cs --- a/MainForm.Designer.cs Sun Mar 15 14:45:40 2015 +0100 +++ b/MainForm.Designer.cs Sun Mar 15 16:56:31 2015 +0100 @@ -21,7 +21,7 @@ using System.Collections.Generic; using System.Text; -namespace RemoteControlSample +namespace HidDemo { public partial class MainForm { @@ -32,8 +32,6 @@ /// private void InitializeComponent() { - this.labelButtonName = new System.Windows.Forms.Label(); - this.labelDeviceName = new System.Windows.Forms.Label(); this.buttonClear = new System.Windows.Forms.Button(); this.tabControl = new System.Windows.Forms.TabControl(); this.tabPageMessages = new System.Windows.Forms.TabPage(); @@ -60,26 +58,6 @@ this.statusStrip.SuspendLayout(); this.SuspendLayout(); // - // labelButtonName - // - this.labelButtonName.AutoSize = true; - this.labelButtonName.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.labelButtonName.Location = new System.Drawing.Point(785, 53); - this.labelButtonName.Name = "labelButtonName"; - this.labelButtonName.Size = new System.Drawing.Size(103, 20); - this.labelButtonName.TabIndex = 0; - this.labelButtonName.Text = "Button Name"; - // - // labelDeviceName - // - this.labelDeviceName.AutoSize = true; - this.labelDeviceName.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.labelDeviceName.Location = new System.Drawing.Point(785, 33); - this.labelDeviceName.Name = "labelDeviceName"; - this.labelDeviceName.Size = new System.Drawing.Size(103, 20); - this.labelDeviceName.TabIndex = 1; - this.labelDeviceName.Text = "Device Name"; - // // buttonClear // this.buttonClear.Location = new System.Drawing.Point(813, 6); @@ -107,8 +85,6 @@ // this.tabPageMessages.Controls.Add(this.listViewEvents); this.tabPageMessages.Controls.Add(this.buttonClear); - this.tabPageMessages.Controls.Add(this.labelDeviceName); - this.tabPageMessages.Controls.Add(this.labelButtonName); this.tabPageMessages.Location = new System.Drawing.Point(4, 22); this.tabPageMessages.Name = "tabPageMessages"; this.tabPageMessages.Padding = new System.Windows.Forms.Padding(3); @@ -267,7 +243,6 @@ this.Load += new System.EventHandler(this.MainForm_Load); this.tabControl.ResumeLayout(false); this.tabPageMessages.ResumeLayout(false); - this.tabPageMessages.PerformLayout(); this.tabPageDevices.ResumeLayout(false); this.tabPageTests.ResumeLayout(false); this.tabPageTests.PerformLayout(); @@ -279,6 +254,18 @@ } #endregion Windows Form Designer generated code + private System.Windows.Forms.Button buttonClear; + private System.Windows.Forms.TabControl tabControl; + private System.Windows.Forms.TabPage tabPageMessages; + private System.Windows.Forms.ListView listViewEvents; + private System.Windows.Forms.ColumnHeader columnHeaderUsages; + private System.Windows.Forms.ColumnHeader columnHeaderInputReport; + private System.Windows.Forms.ColumnHeader columnHeaderUsagePage; + private System.Windows.Forms.ColumnHeader columnHeaderUsageCollection; + private System.Windows.Forms.ColumnHeader columnHeaderRepeat; + private System.Windows.Forms.ColumnHeader columnHeaderTime; + private System.Windows.Forms.TabPage tabPageDevices; + private System.Windows.Forms.TreeView treeViewDevices; private System.Windows.Forms.Button buttonTreeViewExpandAll; private System.Windows.Forms.Button buttonTreeViewCollapseAll; private System.Windows.Forms.StatusStrip statusStrip; diff -r fb9ea5ad8c2d -r 72885c950813 MainForm.cs --- a/MainForm.cs Sun Mar 15 14:45:40 2015 +0100 +++ b/MainForm.cs Sun Mar 15 16:56:31 2015 +0100 @@ -23,64 +23,26 @@ using System.ComponentModel; using System.Windows.Forms; using System.Data; -using Devices.RemoteControl; +using System.Diagnostics; +using System.Runtime.InteropServices; +using SharpLib.Hid; +using SharpLib.Win32; -namespace RemoteControlSample +namespace HidDemo { /// /// Summary description for Form1. /// public partial class MainForm : System.Windows.Forms.Form { - /// - /// Required designer variable. - /// - private System.ComponentModel.Container components = null; - private RemoteControlDevice _remote; - private Label labelButtonName; - private Label labelDeviceName; - private Button buttonClear; - private TabControl tabControl; - private TabPage tabPageMessages; - private ListView listViewEvents; - private ColumnHeader columnHeaderUsages; - private ColumnHeader columnHeaderInputReport; - private ColumnHeader columnHeaderUsagePage; - private ColumnHeader columnHeaderUsageCollection; - private ColumnHeader columnHeaderRepeat; - private ColumnHeader columnHeaderTime; - private TabPage tabPageDevices; - private TreeView treeViewDevices; - private Timer _timer; + private HidHandler iHidHandler; public delegate void OnHidEventDelegate(object aSender, SharpLib.Hid.HidEvent aHidEvent); public MainForm() { - // // Required for Windows Form Designer support - // - InitializeComponent(); - - _timer = new Timer(); - _timer.Interval = 3000; - _timer.Enabled = false; - _timer.Tick +=new EventHandler(_timer_Tick); - } - - /// - /// Clean up any resources being used. - /// - protected override void Dispose( bool disposing ) - { - if( disposing ) - { - if (components != null) - { - components.Dispose(); - } - } - base.Dispose( disposing ); + InitializeComponent(); } @@ -95,15 +57,70 @@ } private void MainForm_Load(object sender, System.EventArgs e) - { - _remote = new RemoteControlDevice(this.Handle); - _remote.ButtonPressed += new Devices.RemoteControl.RemoteControlDevice.RemoteControlDeviceEventHandler(_remote_ButtonPressed); - _remote.iHidHandler.OnHidEvent += HandleHidEventThreadSafe; - - // + { + RegisterHidDevices(); + //Create our list of HID devices SharpLib.Win32.RawInput.PopulateDeviceList(treeViewDevices); + } - } + void RegisterHidDevices() + { + // Register the input device to receive the commands from the + // remote device. See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwmt/html/remote_control.asp + // for the vendor defined usage page. + + RAWINPUTDEVICE[] rid = new RAWINPUTDEVICE[6]; + + int i = 0; + rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.WindowsMediaCenterRemoteControl; + rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.WindowsMediaCenter.WindowsMediaCenterRemoteControl; + rid[i].dwFlags = Const.RIDEV_EXINPUTSINK; + rid[i].hwndTarget = Handle; + + i++; + rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.Consumer; + rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.Consumer.ConsumerControl; + rid[i].dwFlags = Const.RIDEV_EXINPUTSINK; + rid[i].hwndTarget = Handle; + + i++; + rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.Consumer; + rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.Consumer.Selection; + rid[i].dwFlags = Const.RIDEV_EXINPUTSINK; + rid[i].hwndTarget = Handle; + + i++; + rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.GenericDesktopControls; + rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.GenericDesktop.SystemControl; + rid[i].dwFlags = Const.RIDEV_EXINPUTSINK; + rid[i].hwndTarget = Handle; + + i++; + rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.GenericDesktopControls; + rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.GenericDesktop.GamePad; + rid[i].dwFlags = Const.RIDEV_EXINPUTSINK; + rid[i].hwndTarget = Handle; + + i++; + rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.GenericDesktopControls; + rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.GenericDesktop.Keyboard; + //rid[i].dwFlags = Const.RIDEV_EXINPUTSINK; + rid[i].hwndTarget = Handle; + + //i++; + //rid[i].usUsagePage = (ushort)Hid.UsagePage.GenericDesktopControls; + //rid[i].usUsage = (ushort)Hid.UsageCollection.GenericDesktop.Mouse; + //rid[i].dwFlags = Const.RIDEV_EXINPUTSINK; + //rid[i].hwndTarget = aHWND; + + + iHidHandler = new SharpLib.Hid.HidHandler(rid); + if (!iHidHandler.IsRegistered) + { + Debug.WriteLine("Failed to register raw input devices: " + Marshal.GetLastWin32Error().ToString()); + } + iHidHandler.OnHidEvent += HandleHidEventThreadSafe; + } public void HandleHidEventThreadSafe(object aSender, SharpLib.Hid.HidEvent aHidEvent) { @@ -129,58 +146,21 @@ protected override void WndProc(ref Message message) { - if (_remote != null) + switch (message.Msg) { - _remote.ProcessMessage(message); + case Const.WM_KEYDOWN: + //ProcessKeyDown(message.WParam); + break; + case Const.WM_INPUT: + //Returning zero means we processed that message. + message.Result = new IntPtr(0); + iHidHandler.ProcessInput(ref message); + break; } + //Is that needed? Check the docs. base.WndProc(ref message); } - private bool _remote_ButtonPressed(object sender, RemoteControlEventArgs e) - { - //Set text from here was disabled because of threading issues - //That whole thing should be removed anyway - bool processed = false; - _timer.Enabled = false; - if (e.Button != RemoteControlButton.Unknown) - { - //labelButtonName.Text = e.Button.ToString(); - processed = true; - } - else if (e.MceButton != SharpLib.Hid.Usage.WindowsMediaCenterRemoteControl.Null) - { - //Display MCE button name - //labelButtonName.Text = e.MceButton.ToString(); - //Check if this is an HP extension - if (Enum.IsDefined(typeof(SharpLib.Hid.Usage.HpWindowsMediaCenterRemoteControl), (ushort)e.MceButton)) - { - //Also display HP button name - //labelButtonName.Text += " / HP:" + ((Hid.UsageTables.HpWindowsMediaCenterRemoteControl)e.MceButton).ToString(); - } - - processed = true; - } - else if (e.ConsumerControl != SharpLib.Hid.Usage.ConsumerControl.Null) - { - //Display consumer control name - //labelButtonName.Text = e.ConsumerControl.ToString(); - processed = true; - } - else - { - //labelButtonName.Text = "Unknown"; - } - //labelDeviceName.Text = e.Device.ToString(); - _timer.Enabled = true; - return processed; - } - - private void _timer_Tick(object sender, EventArgs e) - { - _timer.Enabled = false; - labelButtonName.Text = "Ready..."; - } - private void buttonClear_Click(object sender, EventArgs e) { listViewEvents.Items.Clear(); diff -r fb9ea5ad8c2d -r 72885c950813 RemoteControlDevice.cs --- a/RemoteControlDevice.cs Sun Mar 15 14:45:40 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,445 +0,0 @@ -// -// Copyright (C) 2014-2015 Stéphane Lenclud. -// -// This file is part of SharpLibHid. -// -// SharpDisplayManager is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// SharpDisplayManager is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with SharpDisplayManager. If not, see . -// - -using System; -using System.Windows.Forms; -using System.Runtime.InteropServices; -using System.Diagnostics; -using System.Text; -using Microsoft.Win32.SafeHandles; - -using SharpLib.Hid.Usage; -using SharpLib.Win32; - - - -namespace Devices.RemoteControl -{ - - public enum InputDevice - { - Key, - Mouse, - OEM - } - - - public enum RemoteControlButton - { - Clear, - Down, - Left, - Digit0, - Digit1, - Digit2, - Digit3, - Digit4, - Digit5, - Digit6, - Digit7, - Digit8, - Digit9, - Enter, - Right, - Up, - - Back, - ChannelDown, - ChannelUp, - FastForward, - VolumeMute, - Pause, - Play, - PlayPause, - Record, - PreviousTrack, - Rewind, - NextTrack, - Stop, - VolumeDown, - VolumeUp, - - RecordedTV, - Guide, - LiveTV, - MoreInfo, - Print, - DVDMenu, - DVDAngle, - DVDAudio, - DVDSubtitle, - MyMusic, - MyPictures, - MyVideos, - MyTV, - OEM1, - OEM2, - StandBy, - TVJump, - - Unknown - } - - - #region RemoteControlEventArgs - - public class RemoteControlEventArgs : EventArgs - { - RemoteControlButton _rcb; - InputDevice _device; - WindowsMediaCenterRemoteControl iMceButton; - ConsumerControl iConsumerControl; - - public RemoteControlEventArgs(RemoteControlButton rcb, InputDevice device) - { - SetNullButtons(); - // - _rcb = rcb; - _device = device; - } - - public RemoteControlEventArgs(ConsumerControl aConsumerControl, InputDevice device) - { - SetNullButtons(); - // - iConsumerControl = aConsumerControl; - _device = device; - } - - - public RemoteControlEventArgs(WindowsMediaCenterRemoteControl mce, InputDevice device) - { - SetNullButtons(); - // - iMceButton = mce; - _device = device; - } - - private void SetNullButtons() - { - iConsumerControl = ConsumerControl.Null; - iMceButton = WindowsMediaCenterRemoteControl.Null; - _rcb = RemoteControlButton.Unknown; - } - - public RemoteControlEventArgs() - { - iMceButton = WindowsMediaCenterRemoteControl.Null; - _rcb = RemoteControlButton.Unknown; - _device = InputDevice.Key; - } - - public RemoteControlButton Button - { - get { return _rcb; } - set { _rcb = value; } - } - - public WindowsMediaCenterRemoteControl MceButton - { - get { return iMceButton; } - set { iMceButton = value; } - } - - public ConsumerControl ConsumerControl - { - get { return iConsumerControl; } - set { iConsumerControl = value; } - } - - public InputDevice Device - { - get { return _device; } - set { _device = value; } - } - } - - #endregion RemoteControlEventArgs - - - public sealed class RemoteControlDevice - { - public delegate bool RemoteControlDeviceEventHandler(object sender, RemoteControlEventArgs e); - public event RemoteControlDeviceEventHandler ButtonPressed; - - /// - /// Return true if the usage was processed. - /// - /// - /// - public delegate bool HidUsageHandler(ushort aUsage); - - public SharpLib.Hid.HidHandler iHidHandler; - - - //------------------------------------------------------------- - // constructors - //------------------------------------------------------------- - - public RemoteControlDevice(IntPtr aHWND) - { - // Register the input device to receive the commands from the - // remote device. See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwmt/html/remote_control.asp - // for the vendor defined usage page. - - RAWINPUTDEVICE[] rid = new RAWINPUTDEVICE[6]; - - int i = 0; - rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.WindowsMediaCenterRemoteControl; - rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.WindowsMediaCenter.WindowsMediaCenterRemoteControl; - rid[i].dwFlags = Const.RIDEV_EXINPUTSINK; - rid[i].hwndTarget = aHWND; - - i++; - rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.Consumer; - rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.Consumer.ConsumerControl; - rid[i].dwFlags = Const.RIDEV_EXINPUTSINK; - rid[i].hwndTarget = aHWND; - - i++; - rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.Consumer; - rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.Consumer.Selection; - rid[i].dwFlags = Const.RIDEV_EXINPUTSINK; - rid[i].hwndTarget = aHWND; - - i++; - rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.GenericDesktopControls; - rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.GenericDesktop.SystemControl; - rid[i].dwFlags = Const.RIDEV_EXINPUTSINK; - rid[i].hwndTarget = aHWND; - - i++; - rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.GenericDesktopControls; - rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.GenericDesktop.GamePad; - rid[i].dwFlags = Const.RIDEV_EXINPUTSINK; - rid[i].hwndTarget = aHWND; - - i++; - rid[i].usUsagePage = (ushort)SharpLib.Hid.UsagePage.GenericDesktopControls; - rid[i].usUsage = (ushort)SharpLib.Hid.UsageCollection.GenericDesktop.Keyboard; - //rid[i].dwFlags = Const.RIDEV_EXINPUTSINK; - rid[i].hwndTarget = aHWND; - - //i++; - //rid[i].usUsagePage = (ushort)Hid.UsagePage.GenericDesktopControls; - //rid[i].usUsage = (ushort)Hid.UsageCollection.GenericDesktop.Mouse; - //rid[i].dwFlags = Const.RIDEV_EXINPUTSINK; - //rid[i].hwndTarget = aHWND; - - - iHidHandler = new SharpLib.Hid.HidHandler(rid); - if (!iHidHandler.IsRegistered) - { - Debug.WriteLine("Failed to register raw input devices: " + Marshal.GetLastWin32Error().ToString()); - } - iHidHandler.OnHidEvent += HandleHidEvent; - } - - - //------------------------------------------------------------- - // methods - //------------------------------------------------------------- - - public void ProcessMessage(Message message) - { - switch (message.Msg) - { - case Const.WM_KEYDOWN: - ProcessKeyDown(message.WParam); - break; - case Const.WM_INPUT: - //Returning zero means we processed that message. - message.Result = new IntPtr(0); - ProcessInputCommand(ref message); - break; - } - - } - - - //------------------------------------------------------------- - // methods (helpers) - //------------------------------------------------------------- - - private void ProcessKeyDown(IntPtr wParam) - { - RemoteControlButton rcb = RemoteControlButton.Unknown; - - switch (wParam.ToInt32()) - { - case (int)Keys.Escape: - rcb = RemoteControlButton.Clear; - break; - case (int)Keys.Up: - rcb = RemoteControlButton.Up; - break; - case (int)Keys.Down: - rcb = RemoteControlButton.Down; - break; - case (int)Keys.Left: - rcb = RemoteControlButton.Left; - break; - case (int)Keys.Right: - rcb = RemoteControlButton.Right; - break; - case (int)Keys.Enter: - rcb = RemoteControlButton.Enter; - break; - case (int)Keys.D0: - rcb = RemoteControlButton.Digit0; - break; - case (int)Keys.D1: - rcb = RemoteControlButton.Digit1; - break; - case (int)Keys.D2: - rcb = RemoteControlButton.Digit2; - break; - case (int)Keys.D3: - rcb = RemoteControlButton.Digit3; - break; - case (int)Keys.D4: - rcb = RemoteControlButton.Digit4; - break; - case (int)Keys.D5: - rcb = RemoteControlButton.Digit5; - break; - case (int)Keys.D6: - rcb = RemoteControlButton.Digit6; - break; - case (int)Keys.D7: - rcb = RemoteControlButton.Digit7; - break; - case (int)Keys.D8: - rcb = RemoteControlButton.Digit8; - break; - case (int)Keys.D9: - rcb = RemoteControlButton.Digit9; - break; - } - - if (this.ButtonPressed != null && rcb != RemoteControlButton.Unknown) - { - Debug.WriteLine("KeyDown: " + rcb.ToString()); - this.ButtonPressed(this, new RemoteControlEventArgs(rcb, InputDevice.Key)); - } - } - - - /// - /// - /// - /// - private bool HidConsumerDeviceHandler(ushort aUsage) - { - if (aUsage == 0) - { - //Just skip those - return false; - } - - if (Enum.IsDefined(typeof(ConsumerControl), aUsage) && aUsage != 0) //Our button is a known consumer control - { - if (this.ButtonPressed != null) - { - return this.ButtonPressed(this, new RemoteControlEventArgs((ConsumerControl)aUsage, InputDevice.OEM)); - } - return false; - } - else - { - Debug.WriteLine("Unknown Consumer Control!"); - return false; - } - } - - /// - /// - /// - /// - private bool HidMceRemoteHandler(ushort aUsage) - { - if (aUsage == 0) - { - //Just skip those - return false; - } - - - if (Enum.IsDefined(typeof(WindowsMediaCenterRemoteControl), aUsage) && aUsage != 0) //Our button is a known MCE button - { - if (this.ButtonPressed != null) - { - return this.ButtonPressed(this, new RemoteControlEventArgs((WindowsMediaCenterRemoteControl)aUsage, InputDevice.OEM)); - } - return false; - } - else - { - Debug.WriteLine("Unknown MCE button!"); - return false; - } - } - - /// - /// - /// - /// - private void ProcessInputCommand(ref Message message) - { - //We received a WM_INPUT message - Debug.WriteLine("================WM_INPUT================"); - - iHidHandler.ProcessInput(message); - - } - - /// - /// - /// - /// - /// - void HandleHidEvent(object aSender, SharpLib.Hid.HidEvent aHidEvent) - { - HidUsageHandler usagePageHandler = null; - - //Check if this an MCE remote HID message - if (aHidEvent.UsagePage == (ushort)SharpLib.Hid.UsagePage.WindowsMediaCenterRemoteControl && aHidEvent.UsageCollection == (ushort)SharpLib.Hid.UsageCollection.WindowsMediaCenter.WindowsMediaCenterRemoteControl) - { - usagePageHandler = HidMceRemoteHandler; - } - //Check if this is a consumer control HID message - else if (aHidEvent.UsagePage == (ushort)SharpLib.Hid.UsagePage.Consumer && aHidEvent.UsageCollection == (ushort)SharpLib.Hid.UsageCollection.Consumer.ConsumerControl) - { - usagePageHandler = HidConsumerDeviceHandler; - } - //Unknown HID message - else - { - Debug.WriteLine("Unknown HID message."); - return; - } - - foreach (ushort usage in aHidEvent.Usages) - { - usagePageHandler(usage); - } - } - } -} -