HidUtils.cs
author StephaneLenclud
Sun, 15 Feb 2015 22:57:38 +0100
changeset 65 09f1435bfb94
parent 62 bc92e2648220
child 66 3461ee6800e3
permissions -rw-r--r--
Device list now displaying input value description, those are basically your
gamepad axis.
Adding collapse and expand buttons.
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@62
    19
                    return typeof(UsageCollectionGenericDesktop);
StephaneLenclud@62
    20
StephaneLenclud@62
    21
                case UsagePage.Consumer:
StephaneLenclud@62
    22
                    return typeof(UsageCollectionConsumer);
StephaneLenclud@62
    23
StephaneLenclud@62
    24
                case UsagePage.WindowsMediaCenterRemoteControl:
StephaneLenclud@62
    25
                    return typeof(UsageCollectionWindowsMediaCenter);
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@65
    42
                    return typeof(UsageTables.GenericDesktop);
StephaneLenclud@65
    43
StephaneLenclud@65
    44
                case UsagePage.Consumer:
StephaneLenclud@65
    45
                    return typeof(UsageTables.ConsumerControl);
StephaneLenclud@65
    46
StephaneLenclud@65
    47
                case UsagePage.WindowsMediaCenterRemoteControl:
StephaneLenclud@65
    48
                    return typeof(UsageTables.WindowsMediaCenterRemoteControl);
StephaneLenclud@65
    49
StephaneLenclud@65
    50
                case UsagePage.Telephony:
StephaneLenclud@65
    51
                    return typeof(UsageTables.TelephonyDevice);
StephaneLenclud@65
    52
StephaneLenclud@65
    53
                case UsagePage.SimulationControls:
StephaneLenclud@65
    54
                    return typeof(UsageTables.SimulationControl);
StephaneLenclud@65
    55
StephaneLenclud@65
    56
                case UsagePage.GameControls:
StephaneLenclud@65
    57
                    return typeof(UsageTables.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
}