private void ReadZ9Message() { this.ReadNBytes(2); int length = this.buffer[0] | this.buffer[1] << 8; // ZeoTimestamp is used as an index to update ZeoMessage in the list this.ReadNBytes(4); uint zeoTimestamp = (uint)this.GetInt32(); ZeoMessage zeoMessage = this.GetZeoMessage(zeoTimestamp); Z9DataType dataType = (Z9DataType)this.ReadByte(); this.ReadNBytes(length); switch (dataType) { case Z9DataType.SoundAlarmVolume: zeoMessage.SoundAlarmVolume = this.GetInt32(); break; case Z9DataType.SoundAlarmEnabled: this.SoundAlarmEnabled = this.buffer[0] != 0; break; } }
private void WriteZ9Message(ZeoMessage zeoMessage, Z9DataType dataType) { short[] lengths = new short[] { 4, 1 }; if (this.binFile != null && this.binFile.CanWrite == true) { byte[] bytes = new byte[] { (byte)'Z', (byte)'9' }; this.binFile.Write(bytes, 0, bytes.Length); this.WriteInt16(lengths[(int)dataType]); this.WriteInt32(zeoMessage.ZeoTimestamp); this.binFile.WriteByte((byte)dataType); switch (dataType) { case Z9DataType.SoundAlarmVolume: { this.WriteInt32(zeoMessage.SoundAlarmVolume); break; } case Z9DataType.SoundAlarmEnabled: { this.binFile.WriteByte(1); break; } } } }
private void WriteZ9Message(ZeoMessage zeoMessage, Z9DataType dataType) { short[] lengths = new short[] { 4, 1 }; if (this.binFile != null && this.binFile.CanWrite == true) { byte[] bytes = new byte[] { (byte)'Z', (byte)'9' }; this.binFile.Write(bytes, 0, bytes.Length); this.WriteInt16(lengths[(int)dataType]); this.WriteInt32(zeoMessage.ZeoTimestamp); this.binFile.WriteByte((byte)dataType); switch (dataType) { case Z9DataType.SoundAlarmVolume: { this.WriteInt32(zeoMessage.SoundAlarmVolume); break; } case Z9DataType.SoundAlarmEnabled: { this.binFile.WriteByte(1); break; } } } }