コード例 #1
0
        public static void EncodeRotationSourceValue(byte[] buffer, ref int index, RotationSensorSource source)
        {
            // Encode header
            PacketHeader header = new PacketHeader(PacketTypeCode.RotationSourceValue);

            SerializePacket(buffer, ref index, header);

            // Encode payload
            RotationSourcePacket packet = EncodeRotationSource(source);

            SerializePacket(buffer, ref index, packet);

            // Encode footer
            SerializePacket(buffer, ref index, _footer);
        }
コード例 #2
0
        /// <summary>
        /// Read the <see cref="RotationSensorSource"/> from a <see cref="RotationSourcePacket"/>
        /// </summary>
        /// <param name="buffer"></param>
        /// <param name="index"></param>
        /// <returns></returns>
        protected static RotationSensorSource DecodeRotationSource(byte[] buffer, ref int index)
        {
            RotationSourcePacket packet = DeserializePacket <RotationSourcePacket>(buffer, ref index);

            return((RotationSensorSource)packet.value);
        }