Exemple #1
0
 internal static extern int HidP_GetCaps(IntPtr lpData, out HidCaps oCaps);
Exemple #2
0
        /// <summary>
        /// The read capabilities.
        /// </summary>
        /// <param name="caps">
        /// The caps.
        /// </param>
        /// <param name="pointer">
        /// The pointer.
        /// </param>
        /// <param name="hidInformation">
        /// The Device Information.
        /// </param>
        internal static void ReadDeviceCapabilities(HidCaps caps, IntPtr pointer, ref HidInformation hidInformation)
        {
            if (caps.NumberOutputValueCaps > 0)
            {
                hidInformation.OutputValues.ValueCaps = new HidValueCaps[caps.NumberOutputValueCaps];
                HidP_GetValueCaps(
                    HidReportType.Output,
                    hidInformation.OutputValues.ValueCaps,
                    ref caps.NumberOutputValueCaps,
                    pointer);
            }

            if (caps.NumberOutputButtonCaps > 0)
            {
                hidInformation.OutputValues.ValueButtons = new HidButtonCaps[caps.NumberOutputButtonCaps];
                HidP_GetButtonCaps(
                    HidReportType.Output,
                    hidInformation.OutputValues.ValueButtons,
                    ref caps.NumberOutputButtonCaps,
                    pointer);
            }

            if (caps.NumberInputValueCaps > 0)
            {
                hidInformation.InputValues.ValueCaps = new HidValueCaps[caps.NumberInputValueCaps];
                HidP_GetValueCaps(
                    HidReportType.Input,
                    hidInformation.InputValues.ValueCaps,
                    ref caps.NumberInputValueCaps,
                    pointer);
            }

            if (caps.NumberInputButtonCaps > 0)
            {
                hidInformation.InputValues.ValueButtons = new HidButtonCaps[caps.NumberInputButtonCaps];
                HidP_GetButtonCaps(
                    HidReportType.Input,
                    hidInformation.InputValues.ValueButtons,
                    ref caps.NumberInputButtonCaps,
                    pointer);
            }

            if (caps.NumberFeatureValueCaps > 0)
            {
                hidInformation.FeatureValues.ValueCaps = new HidValueCaps[caps.NumberFeatureValueCaps];
                HidP_GetValueCaps(
                    HidReportType.Feature,
                    hidInformation.FeatureValues.ValueCaps,
                    ref caps.NumberFeatureValueCaps,
                    pointer);
            }

            if (caps.NumberFeatureButtonCaps <= 0)
            {
                return;
            }

            hidInformation.FeatureValues.ValueButtons = new HidButtonCaps[caps.NumberFeatureButtonCaps];
            HidP_GetButtonCaps(
                HidReportType.Feature,
                hidInformation.FeatureValues.ValueButtons,
                ref caps.NumberFeatureButtonCaps,
                pointer);
        }