コード例 #1
0
        public static HidpButtonCapsRange FromBytes(byte[] bytes, int offset, out int nextByteOffset)
        {
            var hbc = new HidpButtonCapsRange()
            {
                UsageMin      = (ushort)(((ushort)bytes[offset + 1] << 8) | (ushort)(bytes[offset + 0])),
                UsageMax      = (ushort)(((ushort)bytes[offset + 3] << 8) | (ushort)(bytes[offset + 2])),
                StringMin     = (ushort)(((ushort)bytes[offset + 5] << 8) | (ushort)(bytes[offset + 4])),
                StringMax     = (ushort)(((ushort)bytes[offset + 7] << 8) | (ushort)(bytes[offset + 6])),
                DesignatorMin = (ushort)(((ushort)bytes[offset + 9] << 8) | (ushort)(bytes[offset + 8])),
                DesignatorMax = (ushort)(((ushort)bytes[offset + 11] << 8) | (ushort)(bytes[offset + 10])),
                DataIndexMin  = (ushort)(((ushort)bytes[offset + 13] << 8) | (ushort)(bytes[offset + 12])),
                DataIndexMax  = (ushort)(((ushort)bytes[offset + 15] << 8) | (ushort)(bytes[offset + 14])),
            };

            nextByteOffset = offset + 15 + 1;

            return(hbc);
        }
コード例 #2
0
        public static HidpButtonCaps FromBytes(byte[] bytes, int offset, out int nextByteOffset)
        {
            int nextOffset;

            var hbc = new HidpButtonCaps()
            {
                UsagePage         = (ushort)(((ushort)bytes[offset + 1] << 8) | (ushort)(bytes[offset])),
                ReportID          = bytes[offset + 2],
                IsAlias           = bytes[offset + 3] > 0 ? true : false,
                BitField          = (ushort)(((ushort)bytes[offset + 5] << 8) | (ushort)(bytes[offset + 4])),
                LinkCollection    = (ushort)(((ushort)bytes[offset + 7] << 8) | (ushort)(bytes[offset + 6])),
                LinkUsage         = (ushort)(((ushort)bytes[offset + 9] << 8) | (ushort)(bytes[offset + 8])),
                IsRange           = bytes[offset + 10] > 0 ? true : false,
                IsStringRange     = bytes[offset + 11] > 0 ? true : false,
                IsDesignatorRange = bytes[offset + 12] > 0 ? true : false,
                IsAbsolute        = bytes[offset + 13] > 0 ? true : false,
                ///// skip reserved
                Range = HidpButtonCapsRange.FromBytes(bytes, offset + 56, out nextOffset),
            };

            nextByteOffset = nextOffset;

            return(hbc);
        }