Ejemplo n.º 1
0
        /// <summary>
        /// Reads an event message from the reader.
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="targetDeviceId"></param>
        /// <param name="sourceDeviceId"></param>
        /// <returns></returns>
        internal static RnetSetDataMessage Read(RnetMessageBodyReader reader, RnetDeviceId targetDeviceId, RnetDeviceId sourceDeviceId)
        {
            Contract.Requires<ArgumentNullException>(reader != null);

            var targetPath = RnetPath.Read(reader);
            var sourcePath = RnetPath.Read(reader);
            var packetNumber = reader.ReadUInt16();
            var packetCount = reader.ReadUInt16();
            var data = RnetData.Read(reader);

            return new RnetSetDataMessage(
                targetDeviceId, sourceDeviceId,
                targetPath,
                sourcePath,
                packetNumber,
                packetCount,
                data);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Reads an event message from the reader.
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="targetDeviceId"></param>
        /// <param name="sourceDeviceId"></param>
        /// <returns></returns>
        internal static RnetEventMessage Read(RnetMessageBodyReader reader, RnetDeviceId targetDeviceId, RnetDeviceId sourceDeviceId)
        {
            Contract.Requires<ArgumentNullException>(reader != null);

            return new RnetEventMessage(
                targetDeviceId, sourceDeviceId,
                RnetPath.Read(reader),
                RnetPath.Read(reader),
                (RnetEvent)reader.ReadUInt16(),
                reader.ReadUInt16(),
                reader.ReadUInt16(),
                (RnetPriority)reader.ReadByte());
        }