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.
StephaneLenclud@62
     1
using System;
StephaneLenclud@62
     2
using System.Collections.Generic;
StephaneLenclud@62
     3
using System.Text;
StephaneLenclud@62
     4
StephaneLenclud@62
     5
namespace Hid
StephaneLenclud@62
     6
{
StephaneLenclud@62
     7
    static class Utils
StephaneLenclud@62
     8
    {
StephaneLenclud@62
     9
        /// <summary>
StephaneLenclud@62
    10
        /// Provide the type for the usage collection corresponding to the given usage page.
StephaneLenclud@62
    11
        /// </summary>
StephaneLenclud@62
    12
        /// <param name="aUsagePage"></param>
StephaneLenclud@62
    13
        /// <returns></returns>
StephaneLenclud@62
    14
        public static Type UsageCollectionType(UsagePage aUsagePage)
StephaneLenclud@62
    15
        {
StephaneLenclud@62
    16
            switch (aUsagePage)
StephaneLenclud@62
    17
            {
StephaneLenclud@62
    18
                case UsagePage.GenericDesktopControls:
StephaneLenclud@66
    19
                    return typeof(UsageCollection.GenericDesktop);
StephaneLenclud@62
    20
StephaneLenclud@62
    21
                case UsagePage.Consumer:
StephaneLenclud@66
    22
                    return typeof(UsageCollection.Consumer);
StephaneLenclud@62
    23
StephaneLenclud@62
    24
                case UsagePage.WindowsMediaCenterRemoteControl:
StephaneLenclud@66
    25
                    return typeof(UsageCollection.WindowsMediaCenter);
StephaneLenclud@62
    26
StephaneLenclud@62
    27
                default:
StephaneLenclud@62
    28
                    return null;
StephaneLenclud@62
    29
            }
StephaneLenclud@62
    30
        }
StephaneLenclud@65
    31
StephaneLenclud@65
    32
        /// <summary>
StephaneLenclud@65
    33
        /// Provide the type for the usage corresponding to the given usage page.
StephaneLenclud@65
    34
        /// </summary>
StephaneLenclud@65
    35
        /// <param name="aUsagePage"></param>
StephaneLenclud@65
    36
        /// <returns></returns>
StephaneLenclud@65
    37
        public static Type UsageType(UsagePage aUsagePage)
StephaneLenclud@65
    38
        {
StephaneLenclud@65
    39
            switch (aUsagePage)
StephaneLenclud@65
    40
            {
StephaneLenclud@65
    41
                case UsagePage.GenericDesktopControls:
StephaneLenclud@66
    42
                    return typeof(Usage.GenericDesktop);
StephaneLenclud@65
    43
StephaneLenclud@65
    44
                case UsagePage.Consumer:
StephaneLenclud@66
    45
                    return typeof(Usage.ConsumerControl);
StephaneLenclud@65
    46
StephaneLenclud@65
    47
                case UsagePage.WindowsMediaCenterRemoteControl:
StephaneLenclud@66
    48
                    return typeof(Usage.WindowsMediaCenterRemoteControl);
StephaneLenclud@65
    49
StephaneLenclud@65
    50
                case UsagePage.Telephony:
StephaneLenclud@66
    51
                    return typeof(Usage.TelephonyDevice);
StephaneLenclud@65
    52
StephaneLenclud@65
    53
                case UsagePage.SimulationControls:
StephaneLenclud@66
    54
                    return typeof(Usage.SimulationControl);
StephaneLenclud@65
    55
StephaneLenclud@65
    56
                case UsagePage.GameControls:
StephaneLenclud@66
    57
                    return typeof(Usage.GameControl);
StephaneLenclud@65
    58
StephaneLenclud@65
    59
                default:
StephaneLenclud@65
    60
                    return null;
StephaneLenclud@65
    61
            }
StephaneLenclud@65
    62
        }
StephaneLenclud@65
    63
StephaneLenclud@62
    64
    }
StephaneLenclud@62
    65
}