using System; using System.Collections.Generic; using System.Linq; namespace PressureGage_3051.MessageEntity.Incoming { public class ReadUnit_Response : MessageBase { private Dictionary unitMapper = new Dictionary(); private Dictionary rangeMapper = new Dictionary(); public ReadUnit_Response() { unitMapper[11] = "Pa"; unitMapper[12] = "KPa"; unitMapper[237] = "MPa"; rangeMapper[0] = "1KPa"; rangeMapper[1] = "6KPa"; rangeMapper[2] = "40KPa"; } public int DataNumber { get { return RawDataField.First(); } } public string PressureUnit { get { return unitMapper[RawDataField[2]]; } } public string StaticPressureUnit { get { return unitMapper[RawDataField[4]]; } } public DeviceTypeEnum DeviceType { get { return (DeviceTypeEnum)RawDataField[6]; } } public SensorTypeEnum SensorType { get { return (SensorTypeEnum)RawDataField[8]; } } public string MeasuringRange { get { return rangeMapper[RawDataField[10]]; } } public override string ToLogString() { return base.ToLogString(); } } public enum DeviceTypeEnum : byte { Pressure = 0, Temperature = 1, Flow = 2 } public enum SensorTypeEnum : byte { DifferentialPressure = 0, GaugePressure = 3, AbsolutPressure = 6 } }