1.1 --- a/RemoteControlDevice.cs Sun Mar 15 14:07:17 2015 +0100
1.2 +++ b/RemoteControlDevice.cs Sun Mar 15 14:39:21 2015 +0100
1.3 @@ -1,3 +1,22 @@
1.4 +//
1.5 +// Copyright (C) 2014-2015 Stéphane Lenclud.
1.6 +//
1.7 +// This file is part of SharpLibHid.
1.8 +//
1.9 +// SharpDisplayManager is free software: you can redistribute it and/or modify
1.10 +// it under the terms of the GNU General Public License as published by
1.11 +// the Free Software Foundation, either version 3 of the License, or
1.12 +// (at your option) any later version.
1.13 +//
1.14 +// SharpDisplayManager is distributed in the hope that it will be useful,
1.15 +// but WITHOUT ANY WARRANTY; without even the implied warranty of
1.16 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.17 +// GNU General Public License for more details.
1.18 +//
1.19 +// You should have received a copy of the GNU General Public License
1.20 +// along with SharpDisplayManager. If not, see <http://www.gnu.org/licenses/>.
1.21 +//
1.22 +
1.23 using System;
1.24 using System.Windows.Forms;
1.25 using System.Runtime.InteropServices;
1.26 @@ -5,7 +24,7 @@
1.27 using System.Text;
1.28 using Microsoft.Win32.SafeHandles;
1.29
1.30 -using Hid.Usage;
1.31 +using SharpLibHid.Usage;
1.32 using Win32;
1.33
1.34
1.35 @@ -166,7 +185,7 @@
1.36 /// <returns></returns>
1.37 public delegate bool HidUsageHandler(ushort aUsage);
1.38
1.39 - public Hid.HidHandler iHidHandler;
1.40 + public SharpLibHid.HidHandler iHidHandler;
1.41
1.42
1.43 //-------------------------------------------------------------
1.44 @@ -182,38 +201,38 @@
1.45 RAWINPUTDEVICE[] rid = new RAWINPUTDEVICE[6];
1.46
1.47 int i = 0;
1.48 - rid[i].usUsagePage = (ushort)Hid.UsagePage.WindowsMediaCenterRemoteControl;
1.49 - rid[i].usUsage = (ushort)Hid.UsageCollection.WindowsMediaCenter.WindowsMediaCenterRemoteControl;
1.50 + rid[i].usUsagePage = (ushort)SharpLibHid.UsagePage.WindowsMediaCenterRemoteControl;
1.51 + rid[i].usUsage = (ushort)SharpLibHid.UsageCollection.WindowsMediaCenter.WindowsMediaCenterRemoteControl;
1.52 rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
1.53 rid[i].hwndTarget = aHWND;
1.54
1.55 i++;
1.56 - rid[i].usUsagePage = (ushort)Hid.UsagePage.Consumer;
1.57 - rid[i].usUsage = (ushort)Hid.UsageCollection.Consumer.ConsumerControl;
1.58 + rid[i].usUsagePage = (ushort)SharpLibHid.UsagePage.Consumer;
1.59 + rid[i].usUsage = (ushort)SharpLibHid.UsageCollection.Consumer.ConsumerControl;
1.60 rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
1.61 rid[i].hwndTarget = aHWND;
1.62
1.63 i++;
1.64 - rid[i].usUsagePage = (ushort)Hid.UsagePage.Consumer;
1.65 - rid[i].usUsage = (ushort)Hid.UsageCollection.Consumer.Selection;
1.66 + rid[i].usUsagePage = (ushort)SharpLibHid.UsagePage.Consumer;
1.67 + rid[i].usUsage = (ushort)SharpLibHid.UsageCollection.Consumer.Selection;
1.68 rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
1.69 rid[i].hwndTarget = aHWND;
1.70
1.71 i++;
1.72 - rid[i].usUsagePage = (ushort)Hid.UsagePage.GenericDesktopControls;
1.73 - rid[i].usUsage = (ushort)Hid.UsageCollection.GenericDesktop.SystemControl;
1.74 + rid[i].usUsagePage = (ushort)SharpLibHid.UsagePage.GenericDesktopControls;
1.75 + rid[i].usUsage = (ushort)SharpLibHid.UsageCollection.GenericDesktop.SystemControl;
1.76 rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
1.77 rid[i].hwndTarget = aHWND;
1.78
1.79 i++;
1.80 - rid[i].usUsagePage = (ushort)Hid.UsagePage.GenericDesktopControls;
1.81 - rid[i].usUsage = (ushort)Hid.UsageCollection.GenericDesktop.GamePad;
1.82 + rid[i].usUsagePage = (ushort)SharpLibHid.UsagePage.GenericDesktopControls;
1.83 + rid[i].usUsage = (ushort)SharpLibHid.UsageCollection.GenericDesktop.GamePad;
1.84 rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
1.85 rid[i].hwndTarget = aHWND;
1.86
1.87 i++;
1.88 - rid[i].usUsagePage = (ushort)Hid.UsagePage.GenericDesktopControls;
1.89 - rid[i].usUsage = (ushort)Hid.UsageCollection.GenericDesktop.Keyboard;
1.90 + rid[i].usUsagePage = (ushort)SharpLibHid.UsagePage.GenericDesktopControls;
1.91 + rid[i].usUsage = (ushort)SharpLibHid.UsageCollection.GenericDesktop.Keyboard;
1.92 //rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
1.93 rid[i].hwndTarget = aHWND;
1.94
1.95 @@ -224,7 +243,7 @@
1.96 //rid[i].hwndTarget = aHWND;
1.97
1.98
1.99 - iHidHandler = new Hid.HidHandler(rid);
1.100 + iHidHandler = new SharpLibHid.HidHandler(rid);
1.101 if (!iHidHandler.IsRegistered)
1.102 {
1.103 Debug.WriteLine("Failed to register raw input devices: " + Marshal.GetLastWin32Error().ToString());
1.104 @@ -395,17 +414,17 @@
1.105 /// </summary>
1.106 /// <param name="aSender"></param>
1.107 /// <param name="aHidEvent"></param>
1.108 - void HandleHidEvent(object aSender, Hid.HidEvent aHidEvent)
1.109 + void HandleHidEvent(object aSender, SharpLibHid.HidEvent aHidEvent)
1.110 {
1.111 HidUsageHandler usagePageHandler = null;
1.112
1.113 //Check if this an MCE remote HID message
1.114 - if (aHidEvent.UsagePage == (ushort)Hid.UsagePage.WindowsMediaCenterRemoteControl && aHidEvent.UsageCollection == (ushort)Hid.UsageCollection.WindowsMediaCenter.WindowsMediaCenterRemoteControl)
1.115 + if (aHidEvent.UsagePage == (ushort)SharpLibHid.UsagePage.WindowsMediaCenterRemoteControl && aHidEvent.UsageCollection == (ushort)SharpLibHid.UsageCollection.WindowsMediaCenter.WindowsMediaCenterRemoteControl)
1.116 {
1.117 usagePageHandler = HidMceRemoteHandler;
1.118 }
1.119 //Check if this is a consumer control HID message
1.120 - else if (aHidEvent.UsagePage == (ushort)Hid.UsagePage.Consumer && aHidEvent.UsageCollection == (ushort)Hid.UsageCollection.Consumer.ConsumerControl)
1.121 + else if (aHidEvent.UsagePage == (ushort)SharpLibHid.UsagePage.Consumer && aHidEvent.UsageCollection == (ushort)SharpLibHid.UsageCollection.Consumer.ConsumerControl)
1.122 {
1.123 usagePageHandler = HidConsumerDeviceHandler;
1.124 }