Consistent naming fixes in our usage tables enumerations.
1.1 --- a/HidDevice.cs Sun Feb 15 22:57:38 2015 +0100
1.2 +++ b/HidDevice.cs Sun Feb 15 23:06:54 2015 +0100
1.3 @@ -280,7 +280,7 @@
1.4 {
1.5 get
1.6 {
1.7 - return ((UsagePage)iCapabilities.UsagePage == UsagePage.GenericDesktopControls && (UsageCollectionGenericDesktop)iCapabilities.Usage == UsageCollectionGenericDesktop.GamePad);
1.8 + return ((UsagePage)iCapabilities.UsagePage == UsagePage.GenericDesktopControls && (UsageCollection.GenericDesktop)iCapabilities.Usage == UsageCollection.GenericDesktop.GamePad);
1.9 }
1.10 }
1.11
2.1 --- a/HidEvent.cs Sun Feb 15 22:57:38 2015 +0100
2.2 +++ b/HidEvent.cs Sun Feb 15 23:06:54 2015 +0100
2.3 @@ -321,11 +321,11 @@
2.4 switch (usagePage)
2.5 {
2.6 case Hid.UsagePage.Consumer:
2.7 - usageText += ((Hid.UsageTables.ConsumerControl)usage).ToString();
2.8 + usageText += ((Hid.Usage.ConsumerControl)usage).ToString();
2.9 break;
2.10
2.11 case Hid.UsagePage.WindowsMediaCenterRemoteControl:
2.12 - usageText += ((Hid.UsageTables.WindowsMediaCenterRemoteControl)usage).ToString();
2.13 + usageText += ((Hid.Usage.WindowsMediaCenterRemoteControl)usage).ToString();
2.14 break;
2.15
2.16 default:
3.1 --- a/HidUsageTables.cs Sun Feb 15 22:57:38 2015 +0100
3.2 +++ b/HidUsageTables.cs Sun Feb 15 23:06:54 2015 +0100
3.3 @@ -49,62 +49,70 @@
3.4 }
3.5
3.6 /// <summary>
3.7 - /// Usage Collection for usage page GenericDesktopControls.
3.8 + /// Usage Collections are special values from our Usage enumeration.
3.9 + /// Thus they are also part of the corresponding Usage enumeration.
3.10 /// </summary>
3.11 - public enum UsageCollectionGenericDesktop : ushort
3.12 + namespace UsageCollection
3.13 {
3.14 - Pointer = 0x01,
3.15 - Mouse = 0x02,
3.16 - Joystick = 0x04,
3.17 - GamePad = 0x05,
3.18 - Keyboard = 0x06,
3.19 - KeyPad = 0x07,
3.20 - MultiAxisController = 0x08,
3.21 - TabletPCSystemControls = 0x09,
3.22 - SystemControl = 0x80
3.23 + /// <summary>
3.24 + /// Usage Collection for usage page GenericDesktopControls.
3.25 + /// </summary>
3.26 + public enum GenericDesktop : ushort
3.27 + {
3.28 + Pointer = 0x01,
3.29 + Mouse = 0x02,
3.30 + Joystick = 0x04,
3.31 + GamePad = 0x05,
3.32 + Keyboard = 0x06,
3.33 + KeyPad = 0x07,
3.34 + MultiAxisController = 0x08,
3.35 + TabletPCSystemControls = 0x09,
3.36 + SystemControl = 0x80
3.37 + }
3.38 +
3.39 + /// <summary>
3.40 + /// Usage Collection for usage page Consumer.
3.41 + /// </summary>
3.42 + public enum Consumer : ushort
3.43 + {
3.44 + ConsumerControl = 0x01,
3.45 + NumericKeyPad = 0x02,
3.46 + ProgrammableButtons = 0x03,
3.47 + Microphone = 0x04,
3.48 + Headphone = 0x05,
3.49 + GraphicEqualizer = 0x06,
3.50 + FunctionButtons = 0x36,
3.51 + Selection = 0x80,
3.52 + MediaSelection = 0x0087,
3.53 + SelectDisc = 0x00BA,
3.54 + PlaybackSpeed = 0x00F1,
3.55 + Proximity = 0x0109,
3.56 + SpeakerSystem = 0x0160,
3.57 + ChannelLeft = 0x0161,
3.58 + ChannelRight = 0x0162,
3.59 + ChannelCenter = 0x0163,
3.60 + ChannelFront = 0x0164,
3.61 + ChannelCenterFront = 0x0165,
3.62 + ChannelSide = 0x0166,
3.63 + ChannelSurrond = 0x0167,
3.64 + ChannelLowFrequencyEnhancement = 0x0168,
3.65 + ChannelTop = 0x0169,
3.66 + ChannelUnknown = 0x016A,
3.67 + ApplicationLaunchButtons = 0x016A,
3.68 + GenericGuiApplicationControls = 0x0200,
3.69 + }
3.70 +
3.71 +
3.72 + public enum WindowsMediaCenter : ushort
3.73 + {
3.74 + WindowsMediaCenterRemoteControl = 0x88
3.75 + }
3.76 +
3.77 }
3.78
3.79 - /// <summary>
3.80 - /// Usage Collection for usage page Consumer.
3.81 - /// </summary>
3.82 - public enum UsageCollectionConsumer : ushort
3.83 - {
3.84 - ConsumerControl = 0x01,
3.85 - NumericKeyPad = 0x02,
3.86 - ProgrammableButtons = 0x03,
3.87 - Microphone = 0x04,
3.88 - Headphone = 0x05,
3.89 - GraphicEqualizer = 0x06,
3.90 - FunctionButtons = 0x36,
3.91 - Selection = 0x80,
3.92 - MediaSelection = 0x0087,
3.93 - SelectDisc = 0x00BA,
3.94 - PlaybackSpeed = 0x00F1,
3.95 - Proximity = 0x0109,
3.96 - SpeakerSystem = 0x0160,
3.97 - ChannelLeft = 0x0161,
3.98 - ChannelRight = 0x0162,
3.99 - ChannelCenter = 0x0163,
3.100 - ChannelFront = 0x0164,
3.101 - ChannelCenterFront = 0x0165,
3.102 - ChannelSide = 0x0166,
3.103 - ChannelSurrond = 0x0167,
3.104 - ChannelLowFrequencyEnhancement = 0x0168,
3.105 - ChannelTop = 0x0169,
3.106 - ChannelUnknown = 0x016A,
3.107 - ApplicationLaunchButtons = 0x016A,
3.108 - GenericGuiApplicationControls = 0x0200,
3.109 - }
3.110
3.111
3.112 - public enum UsageCollectionWindowsMediaCenter : ushort
3.113 - {
3.114 - WindowsMediaCenterRemoteControl = 0x88
3.115 - }
3.116 -
3.117 -
3.118 -
3.119 - namespace UsageTables
3.120 + namespace Usage
3.121 {
3.122 /// <summary>
3.123 ///
4.1 --- a/HidUtils.cs Sun Feb 15 22:57:38 2015 +0100
4.2 +++ b/HidUtils.cs Sun Feb 15 23:06:54 2015 +0100
4.3 @@ -16,13 +16,13 @@
4.4 switch (aUsagePage)
4.5 {
4.6 case UsagePage.GenericDesktopControls:
4.7 - return typeof(UsageCollectionGenericDesktop);
4.8 + return typeof(UsageCollection.GenericDesktop);
4.9
4.10 case UsagePage.Consumer:
4.11 - return typeof(UsageCollectionConsumer);
4.12 + return typeof(UsageCollection.Consumer);
4.13
4.14 case UsagePage.WindowsMediaCenterRemoteControl:
4.15 - return typeof(UsageCollectionWindowsMediaCenter);
4.16 + return typeof(UsageCollection.WindowsMediaCenter);
4.17
4.18 default:
4.19 return null;
4.20 @@ -39,22 +39,22 @@
4.21 switch (aUsagePage)
4.22 {
4.23 case UsagePage.GenericDesktopControls:
4.24 - return typeof(UsageTables.GenericDesktop);
4.25 + return typeof(Usage.GenericDesktop);
4.26
4.27 case UsagePage.Consumer:
4.28 - return typeof(UsageTables.ConsumerControl);
4.29 + return typeof(Usage.ConsumerControl);
4.30
4.31 case UsagePage.WindowsMediaCenterRemoteControl:
4.32 - return typeof(UsageTables.WindowsMediaCenterRemoteControl);
4.33 + return typeof(Usage.WindowsMediaCenterRemoteControl);
4.34
4.35 case UsagePage.Telephony:
4.36 - return typeof(UsageTables.TelephonyDevice);
4.37 + return typeof(Usage.TelephonyDevice);
4.38
4.39 case UsagePage.SimulationControls:
4.40 - return typeof(UsageTables.SimulationControl);
4.41 + return typeof(Usage.SimulationControl);
4.42
4.43 case UsagePage.GameControls:
4.44 - return typeof(UsageTables.GameControl);
4.45 + return typeof(Usage.GameControl);
4.46
4.47 default:
4.48 return null;
5.1 --- a/MainForm.cs Sun Feb 15 22:57:38 2015 +0100
5.2 +++ b/MainForm.cs Sun Feb 15 23:06:54 2015 +0100
5.3 @@ -127,12 +127,12 @@
5.4 //labelButtonName.Text = e.Button.ToString();
5.5 processed = true;
5.6 }
5.7 - else if (e.MceButton != Hid.UsageTables.WindowsMediaCenterRemoteControl.Null)
5.8 + else if (e.MceButton != Hid.Usage.WindowsMediaCenterRemoteControl.Null)
5.9 {
5.10 //Display MCE button name
5.11 //labelButtonName.Text = e.MceButton.ToString();
5.12 //Check if this is an HP extension
5.13 - if (Enum.IsDefined(typeof(Hid.UsageTables.HpWindowsMediaCenterRemoteControl), (ushort)e.MceButton))
5.14 + if (Enum.IsDefined(typeof(Hid.Usage.HpWindowsMediaCenterRemoteControl), (ushort)e.MceButton))
5.15 {
5.16 //Also display HP button name
5.17 //labelButtonName.Text += " / HP:" + ((Hid.UsageTables.HpWindowsMediaCenterRemoteControl)e.MceButton).ToString();
5.18 @@ -140,7 +140,7 @@
5.19
5.20 processed = true;
5.21 }
5.22 - else if (e.ConsumerControl != Hid.UsageTables.ConsumerControl.Null)
5.23 + else if (e.ConsumerControl != Hid.Usage.ConsumerControl.Null)
5.24 {
5.25 //Display consumer control name
5.26 //labelButtonName.Text = e.ConsumerControl.ToString();
6.1 --- a/RemoteControlDevice.cs Sun Feb 15 22:57:38 2015 +0100
6.2 +++ b/RemoteControlDevice.cs Sun Feb 15 23:06:54 2015 +0100
6.3 @@ -5,7 +5,7 @@
6.4 using System.Text;
6.5 using Microsoft.Win32.SafeHandles;
6.6
6.7 -using Hid.UsageTables;
6.8 +using Hid.Usage;
6.9 using Win32;
6.10
6.11
6.12 @@ -183,31 +183,31 @@
6.13
6.14 int i = 0;
6.15 rid[i].usUsagePage = (ushort)Hid.UsagePage.WindowsMediaCenterRemoteControl;
6.16 - rid[i].usUsage = (ushort)Hid.UsageCollectionWindowsMediaCenter.WindowsMediaCenterRemoteControl;
6.17 + rid[i].usUsage = (ushort)Hid.UsageCollection.WindowsMediaCenter.WindowsMediaCenterRemoteControl;
6.18 rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
6.19 rid[i].hwndTarget = aHWND;
6.20
6.21 i++;
6.22 rid[i].usUsagePage = (ushort)Hid.UsagePage.Consumer;
6.23 - rid[i].usUsage = (ushort)Hid.UsageCollectionConsumer.ConsumerControl;
6.24 + rid[i].usUsage = (ushort)Hid.UsageCollection.Consumer.ConsumerControl;
6.25 rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
6.26 rid[i].hwndTarget = aHWND;
6.27
6.28 i++;
6.29 rid[i].usUsagePage = (ushort)Hid.UsagePage.Consumer;
6.30 - rid[i].usUsage = (ushort)Hid.UsageCollectionConsumer.Selection;
6.31 + rid[i].usUsage = (ushort)Hid.UsageCollection.Consumer.Selection;
6.32 rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
6.33 rid[i].hwndTarget = aHWND;
6.34
6.35 i++;
6.36 rid[i].usUsagePage = (ushort)Hid.UsagePage.GenericDesktopControls;
6.37 - rid[i].usUsage = (ushort)Hid.UsageCollectionGenericDesktop.SystemControl;
6.38 + rid[i].usUsage = (ushort)Hid.UsageCollection.GenericDesktop.SystemControl;
6.39 rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
6.40 rid[i].hwndTarget = aHWND;
6.41
6.42 //i++;
6.43 rid[i].usUsagePage = (ushort)Hid.UsagePage.GenericDesktopControls;
6.44 - rid[i].usUsage = (ushort)Hid.UsageCollectionGenericDesktop.GamePad;
6.45 + rid[i].usUsage = (ushort)Hid.UsageCollection.GenericDesktop.GamePad;
6.46 rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
6.47 rid[i].hwndTarget = aHWND;
6.48
6.49 @@ -400,12 +400,12 @@
6.50 HidUsageHandler usagePageHandler = null;
6.51
6.52 //Check if this an MCE remote HID message
6.53 - if (aHidEvent.UsagePage == (ushort)Hid.UsagePage.WindowsMediaCenterRemoteControl && aHidEvent.UsageCollection == (ushort)Hid.UsageCollectionWindowsMediaCenter.WindowsMediaCenterRemoteControl)
6.54 + if (aHidEvent.UsagePage == (ushort)Hid.UsagePage.WindowsMediaCenterRemoteControl && aHidEvent.UsageCollection == (ushort)Hid.UsageCollection.WindowsMediaCenter.WindowsMediaCenterRemoteControl)
6.55 {
6.56 usagePageHandler = HidMceRemoteHandler;
6.57 }
6.58 //Check if this is a consumer control HID message
6.59 - else if (aHidEvent.UsagePage == (ushort)Hid.UsagePage.Consumer && aHidEvent.UsageCollection == (ushort)Hid.UsageCollectionConsumer.ConsumerControl)
6.60 + else if (aHidEvent.UsagePage == (ushort)Hid.UsagePage.Consumer && aHidEvent.UsageCollection == (ushort)Hid.UsageCollection.Consumer.ConsumerControl)
6.61 {
6.62 usagePageHandler = HidConsumerDeviceHandler;
6.63 }