/// <summary> /// Initializes a new instance. /// </summary> /// <param name="targetDeviceId"></param> /// <param name="sourceDeviceId"></param> /// <param name="messageType"></param> protected RnetMessage(RnetDeviceId targetDeviceId, RnetDeviceId sourceDeviceId, RnetMessageType messageType) : this() { MessageTimestamp = DateTime.UtcNow; TargetDeviceId = targetDeviceId; SourceDeviceId = sourceDeviceId; MessageType = messageType; }
/// <summary> /// Begins a new message. /// </summary> internal void BeginMessage(RnetDeviceId targetDeviceId, RnetDeviceId sourceDeviceId, RnetMessageType messageType) { if (len != -1 || sum != -1) throw new InvalidOperationException("A message is already in progress."); stm = new MemoryStream(); len = 0; sum = 0; WriteStart(); targetDeviceId.Write(this); sourceDeviceId.Write(this); WriteByte((byte)messageType); }
/// <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 RnetUnknownMessage Read(RnetMessageBodyReader reader, RnetDeviceId targetDeviceId, RnetDeviceId sourceDeviceId, RnetMessageType messageType) { return new RnetUnknownMessage( targetDeviceId, sourceDeviceId, messageType); }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="targetDeviceId"></param> /// <param name="sourceDeviceId"></param> /// <param name="messageType"></param> public RnetUnknownMessage(RnetDeviceId targetDeviceId, RnetDeviceId sourceDeviceId, RnetMessageType messageType) : base(targetDeviceId, sourceDeviceId, messageType) { }