HidUtils.cs
author StephaneLenclud
Sun, 15 Mar 2015 14:07:17 +0100
changeset 75 e8bb372ae58b
parent 65 09f1435bfb94
child 76 831ebeeecfdf
permissions -rw-r--r--
Renaming demo application to HID Demo.
     1 using System;
     2 using System.Collections.Generic;
     3 using System.Text;
     4 
     5 namespace Hid
     6 {
     7     static class Utils
     8     {
     9         /// <summary>
    10         /// Provide the type for the usage collection corresponding to the given usage page.
    11         /// </summary>
    12         /// <param name="aUsagePage"></param>
    13         /// <returns></returns>
    14         public static Type UsageCollectionType(UsagePage aUsagePage)
    15         {
    16             switch (aUsagePage)
    17             {
    18                 case UsagePage.GenericDesktopControls:
    19                     return typeof(UsageCollection.GenericDesktop);
    20 
    21                 case UsagePage.Consumer:
    22                     return typeof(UsageCollection.Consumer);
    23 
    24                 case UsagePage.WindowsMediaCenterRemoteControl:
    25                     return typeof(UsageCollection.WindowsMediaCenter);
    26 
    27                 default:
    28                     return null;
    29             }
    30         }
    31 
    32         /// <summary>
    33         /// Provide the type for the usage corresponding to the given usage page.
    34         /// </summary>
    35         /// <param name="aUsagePage"></param>
    36         /// <returns></returns>
    37         public static Type UsageType(UsagePage aUsagePage)
    38         {
    39             switch (aUsagePage)
    40             {
    41                 case UsagePage.GenericDesktopControls:
    42                     return typeof(Usage.GenericDesktop);
    43 
    44                 case UsagePage.Consumer:
    45                     return typeof(Usage.ConsumerControl);
    46 
    47                 case UsagePage.WindowsMediaCenterRemoteControl:
    48                     return typeof(Usage.WindowsMediaCenterRemoteControl);
    49 
    50                 case UsagePage.Telephony:
    51                     return typeof(Usage.TelephonyDevice);
    52 
    53                 case UsagePage.SimulationControls:
    54                     return typeof(Usage.SimulationControl);
    55 
    56                 case UsagePage.GameControls:
    57                     return typeof(Usage.GameControl);
    58 
    59                 default:
    60                     return null;
    61             }
    62         }
    63 
    64     }
    65 }