| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace GasConcentrations_Yt95h.MessageEntity.Incoming
- {
- public class ReadRegisters_Response : MessageBase
- {
- private Dictionary<byte, string> unitMapper = new Dictionary<byte, string>();
- public ReadRegisters_Response()
- {
- unitMapper[0] = "PPM";
- unitMapper[1] = "PPB";
- unitMapper[2] = "%";
- unitMapper[3] = "%LEL";
- unitMapper[4] = "Mg/m3";
- unitMapper[5] = "℃";
- unitMapper[6] = "RH%";
- unitMapper[7] = "Kpa";
- }
- public int DataNumber
- {
- get
- {
- return RawDataField.First();
- }
- }
- public float Concentration
- {
- get
- {
- return BitConverter.ToSingle(RawDataField.GetRange(1, 4).ToArray(), 0);
- }
- }
- public GasTypeEnum GasType
- {
- get
- {
- return (GasTypeEnum)RawDataField[5];
- }
- }
- public string Unit
- {
- get
- {
- return unitMapper[RawDataField[6]];
- }
- }
- public AlarmTypeEnum AlarmType
- {
- get
- {
- return (AlarmTypeEnum)RawDataField[7];
- }
- }
- public override string ToLogString()
- {
- return base.ToLogString();
- }
- }
- public enum GasTypeEnum : byte
- {
- //可燃气体
- FuelGas = 7
- }
- public enum AlarmTypeEnum : byte
- {
- Normal = 1,
- LowAlarm = 2,
- HighAlarm = 3
- }
- }
|