# HG changeset patch
# User StephaneLenclud
# Date 1424038014 -3600
# Node ID 3461ee6800e3470bb2d8ba2e04f4b883e4a51cce
# Parent  09f1435bfb9472f420c67dcb6327752e3e3e4523
Consistent naming fixes in our usage tables enumerations.
diff -r 09f1435bfb94 -r 3461ee6800e3 HidDevice.cs
--- a/HidDevice.cs	Sun Feb 15 22:57:38 2015 +0100
+++ b/HidDevice.cs	Sun Feb 15 23:06:54 2015 +0100
@@ -280,7 +280,7 @@
         {
             get
             {
-                return ((UsagePage)iCapabilities.UsagePage == UsagePage.GenericDesktopControls && (UsageCollectionGenericDesktop)iCapabilities.Usage == UsageCollectionGenericDesktop.GamePad);
+                return ((UsagePage)iCapabilities.UsagePage == UsagePage.GenericDesktopControls && (UsageCollection.GenericDesktop)iCapabilities.Usage == UsageCollection.GenericDesktop.GamePad);
             }
         }
 
diff -r 09f1435bfb94 -r 3461ee6800e3 HidEvent.cs
--- a/HidEvent.cs	Sun Feb 15 22:57:38 2015 +0100
+++ b/HidEvent.cs	Sun Feb 15 23:06:54 2015 +0100
@@ -321,11 +321,11 @@
                 switch (usagePage)
                 {
                     case Hid.UsagePage.Consumer:
-                        usageText += ((Hid.UsageTables.ConsumerControl)usage).ToString();
+                        usageText += ((Hid.Usage.ConsumerControl)usage).ToString();
                         break;
 
                     case Hid.UsagePage.WindowsMediaCenterRemoteControl:
-                        usageText += ((Hid.UsageTables.WindowsMediaCenterRemoteControl)usage).ToString();
+                        usageText += ((Hid.Usage.WindowsMediaCenterRemoteControl)usage).ToString();
                         break;
 
                     default:
diff -r 09f1435bfb94 -r 3461ee6800e3 HidUsageTables.cs
--- a/HidUsageTables.cs	Sun Feb 15 22:57:38 2015 +0100
+++ b/HidUsageTables.cs	Sun Feb 15 23:06:54 2015 +0100
@@ -49,62 +49,70 @@
     }
 
     /// 
-    /// Usage Collection for usage page GenericDesktopControls.
+    /// Usage Collections are special values from our Usage enumeration.
+    /// Thus they are also part of the corresponding Usage enumeration.
     /// 
-    public enum UsageCollectionGenericDesktop : ushort
+    namespace UsageCollection
     {
-        Pointer = 0x01,
-        Mouse = 0x02,
-        Joystick = 0x04,
-        GamePad = 0x05,
-        Keyboard = 0x06,
-        KeyPad = 0x07,
-        MultiAxisController = 0x08,
-        TabletPCSystemControls = 0x09,
-        SystemControl = 0x80
+        /// 
+        /// Usage Collection for usage page GenericDesktopControls.
+        /// 
+        public enum GenericDesktop : ushort
+        {
+            Pointer = 0x01,
+            Mouse = 0x02,
+            Joystick = 0x04,
+            GamePad = 0x05,
+            Keyboard = 0x06,
+            KeyPad = 0x07,
+            MultiAxisController = 0x08,
+            TabletPCSystemControls = 0x09,
+            SystemControl = 0x80
+        }
+
+        /// 
+        /// Usage Collection for usage page Consumer.
+        /// 
+        public enum Consumer : ushort
+        {
+            ConsumerControl = 0x01,
+            NumericKeyPad = 0x02,
+            ProgrammableButtons = 0x03,
+            Microphone = 0x04,
+            Headphone = 0x05,
+            GraphicEqualizer = 0x06,
+            FunctionButtons = 0x36,
+            Selection = 0x80,
+            MediaSelection = 0x0087,
+            SelectDisc = 0x00BA,
+            PlaybackSpeed = 0x00F1,
+            Proximity = 0x0109,
+            SpeakerSystem = 0x0160,
+            ChannelLeft = 0x0161,
+            ChannelRight = 0x0162,
+            ChannelCenter = 0x0163,
+            ChannelFront = 0x0164,
+            ChannelCenterFront = 0x0165,
+            ChannelSide = 0x0166,
+            ChannelSurrond = 0x0167,
+            ChannelLowFrequencyEnhancement = 0x0168,
+            ChannelTop = 0x0169,
+            ChannelUnknown = 0x016A,
+            ApplicationLaunchButtons = 0x016A,
+            GenericGuiApplicationControls = 0x0200,
+        }
+
+
+        public enum WindowsMediaCenter : ushort
+        {
+            WindowsMediaCenterRemoteControl = 0x88
+        }
+
     }
 
-    /// 
-    /// Usage Collection for usage page Consumer.
-    /// 
-    public enum UsageCollectionConsumer : ushort
-    {
-        ConsumerControl = 0x01,
-        NumericKeyPad = 0x02,
-        ProgrammableButtons = 0x03,
-        Microphone = 0x04,
-        Headphone = 0x05,
-        GraphicEqualizer = 0x06,
-        FunctionButtons = 0x36,
-        Selection = 0x80,
-        MediaSelection = 0x0087,
-        SelectDisc = 0x00BA,
-        PlaybackSpeed = 0x00F1,
-        Proximity = 0x0109,
-        SpeakerSystem = 0x0160,
-        ChannelLeft = 0x0161,
-        ChannelRight = 0x0162,
-        ChannelCenter = 0x0163,
-        ChannelFront = 0x0164,
-        ChannelCenterFront = 0x0165,
-        ChannelSide = 0x0166,
-        ChannelSurrond = 0x0167,
-        ChannelLowFrequencyEnhancement = 0x0168,
-        ChannelTop = 0x0169,
-        ChannelUnknown = 0x016A,
-        ApplicationLaunchButtons = 0x016A,
-        GenericGuiApplicationControls = 0x0200,
-    }
 
 
-    public enum UsageCollectionWindowsMediaCenter : ushort
-    {
-        WindowsMediaCenterRemoteControl = 0x88
-    }
-
-
-
-    namespace UsageTables
+    namespace Usage
     {
         /// 
         ///
diff -r 09f1435bfb94 -r 3461ee6800e3 HidUtils.cs
--- a/HidUtils.cs	Sun Feb 15 22:57:38 2015 +0100
+++ b/HidUtils.cs	Sun Feb 15 23:06:54 2015 +0100
@@ -16,13 +16,13 @@
             switch (aUsagePage)
             {
                 case UsagePage.GenericDesktopControls:
-                    return typeof(UsageCollectionGenericDesktop);
+                    return typeof(UsageCollection.GenericDesktop);
 
                 case UsagePage.Consumer:
-                    return typeof(UsageCollectionConsumer);
+                    return typeof(UsageCollection.Consumer);
 
                 case UsagePage.WindowsMediaCenterRemoteControl:
-                    return typeof(UsageCollectionWindowsMediaCenter);
+                    return typeof(UsageCollection.WindowsMediaCenter);
 
                 default:
                     return null;
@@ -39,22 +39,22 @@
             switch (aUsagePage)
             {
                 case UsagePage.GenericDesktopControls:
-                    return typeof(UsageTables.GenericDesktop);
+                    return typeof(Usage.GenericDesktop);
 
                 case UsagePage.Consumer:
-                    return typeof(UsageTables.ConsumerControl);
+                    return typeof(Usage.ConsumerControl);
 
                 case UsagePage.WindowsMediaCenterRemoteControl:
-                    return typeof(UsageTables.WindowsMediaCenterRemoteControl);
+                    return typeof(Usage.WindowsMediaCenterRemoteControl);
 
                 case UsagePage.Telephony:
-                    return typeof(UsageTables.TelephonyDevice);
+                    return typeof(Usage.TelephonyDevice);
 
                 case UsagePage.SimulationControls:
-                    return typeof(UsageTables.SimulationControl);
+                    return typeof(Usage.SimulationControl);
 
                 case UsagePage.GameControls:
-                    return typeof(UsageTables.GameControl);
+                    return typeof(Usage.GameControl);
 
                 default:
                     return null;
diff -r 09f1435bfb94 -r 3461ee6800e3 MainForm.cs
--- a/MainForm.cs	Sun Feb 15 22:57:38 2015 +0100
+++ b/MainForm.cs	Sun Feb 15 23:06:54 2015 +0100
@@ -127,12 +127,12 @@
                 //labelButtonName.Text = e.Button.ToString();
                 processed = true;
             }
-            else if (e.MceButton != Hid.UsageTables.WindowsMediaCenterRemoteControl.Null)
+            else if (e.MceButton != Hid.Usage.WindowsMediaCenterRemoteControl.Null)
             {
                 //Display MCE button name
                 //labelButtonName.Text = e.MceButton.ToString();
                 //Check if this is an HP extension
-                if (Enum.IsDefined(typeof(Hid.UsageTables.HpWindowsMediaCenterRemoteControl), (ushort)e.MceButton))
+                if (Enum.IsDefined(typeof(Hid.Usage.HpWindowsMediaCenterRemoteControl), (ushort)e.MceButton))
                 {
                     //Also display HP button name
                     //labelButtonName.Text += " / HP:" + ((Hid.UsageTables.HpWindowsMediaCenterRemoteControl)e.MceButton).ToString();
@@ -140,7 +140,7 @@
 
                 processed = true;                
             }
-            else if (e.ConsumerControl != Hid.UsageTables.ConsumerControl.Null)
+            else if (e.ConsumerControl != Hid.Usage.ConsumerControl.Null)
             {
                 //Display consumer control name
                 //labelButtonName.Text = e.ConsumerControl.ToString();
diff -r 09f1435bfb94 -r 3461ee6800e3 RemoteControlDevice.cs
--- a/RemoteControlDevice.cs	Sun Feb 15 22:57:38 2015 +0100
+++ b/RemoteControlDevice.cs	Sun Feb 15 23:06:54 2015 +0100
@@ -5,7 +5,7 @@
 using System.Text;
 using Microsoft.Win32.SafeHandles;
 
-using Hid.UsageTables;
+using Hid.Usage;
 using Win32;
 
 
@@ -183,31 +183,31 @@
 
             int i = 0;
             rid[i].usUsagePage = (ushort)Hid.UsagePage.WindowsMediaCenterRemoteControl;
-            rid[i].usUsage = (ushort)Hid.UsageCollectionWindowsMediaCenter.WindowsMediaCenterRemoteControl;
+            rid[i].usUsage = (ushort)Hid.UsageCollection.WindowsMediaCenter.WindowsMediaCenterRemoteControl;
             rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
             rid[i].hwndTarget = aHWND;
 
             i++;
             rid[i].usUsagePage = (ushort)Hid.UsagePage.Consumer;
-            rid[i].usUsage = (ushort)Hid.UsageCollectionConsumer.ConsumerControl;
+            rid[i].usUsage = (ushort)Hid.UsageCollection.Consumer.ConsumerControl;
             rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
             rid[i].hwndTarget = aHWND;
 
             i++;
             rid[i].usUsagePage = (ushort)Hid.UsagePage.Consumer;
-            rid[i].usUsage = (ushort)Hid.UsageCollectionConsumer.Selection;
+            rid[i].usUsage = (ushort)Hid.UsageCollection.Consumer.Selection;
             rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
             rid[i].hwndTarget = aHWND;
 
             i++;
             rid[i].usUsagePage = (ushort)Hid.UsagePage.GenericDesktopControls;
-            rid[i].usUsage = (ushort)Hid.UsageCollectionGenericDesktop.SystemControl;
+            rid[i].usUsage = (ushort)Hid.UsageCollection.GenericDesktop.SystemControl;
             rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
             rid[i].hwndTarget = aHWND;
 
 			//i++;
 			rid[i].usUsagePage = (ushort)Hid.UsagePage.GenericDesktopControls;
-			rid[i].usUsage = (ushort)Hid.UsageCollectionGenericDesktop.GamePad;
+			rid[i].usUsage = (ushort)Hid.UsageCollection.GenericDesktop.GamePad;
 			rid[i].dwFlags = Const.RIDEV_EXINPUTSINK;
 			rid[i].hwndTarget = aHWND;
 
@@ -400,12 +400,12 @@
             HidUsageHandler usagePageHandler = null;
 
             //Check if this an MCE remote HID message
-            if (aHidEvent.UsagePage == (ushort)Hid.UsagePage.WindowsMediaCenterRemoteControl && aHidEvent.UsageCollection == (ushort)Hid.UsageCollectionWindowsMediaCenter.WindowsMediaCenterRemoteControl)
+            if (aHidEvent.UsagePage == (ushort)Hid.UsagePage.WindowsMediaCenterRemoteControl && aHidEvent.UsageCollection == (ushort)Hid.UsageCollection.WindowsMediaCenter.WindowsMediaCenterRemoteControl)
             {
                 usagePageHandler = HidMceRemoteHandler;
             }
             //Check if this is a consumer control HID message
-            else if (aHidEvent.UsagePage == (ushort)Hid.UsagePage.Consumer && aHidEvent.UsageCollection == (ushort)Hid.UsageCollectionConsumer.ConsumerControl)
+            else if (aHidEvent.UsagePage == (ushort)Hid.UsagePage.Consumer && aHidEvent.UsageCollection == (ushort)Hid.UsageCollection.Consumer.ConsumerControl)
             {
                 usagePageHandler = HidConsumerDeviceHandler;
             }