/// <summary> /// /// </summary> /// <param name="bs"></param> /// <returns></returns> static internal LYR001StatusData Parse(byte[] bs) { if (bs == null) { throw new ArgumentNullException("bs"); } if (bs.Length < 3) { throw new ArgumentException("bs.Length must >= 3"); } BitArray list = new BitArray(bs); PumpStatus cm1 = GetPumpStatus(list, 0, 3); PumpStatus cm2 = GetPumpStatus(list, 1, 4); PumpStatus cm3 = GetPumpStatus(list, 2, 5); PumpStatus rm1 = GetPumpStatus(list, 6, 8); PumpStatus rm2 = GetPumpStatus(list, 7, 9); ManualAutomatic ma = GetManualAutomatic(list, 10); List <string> alarmList = GetAlarmList(list, 12); //BitArray list LYR001StatusData r = new LYR001StatusData(cm1, cm2, cm3, rm1, rm2, ma, alarmList); return(r); }
/// <summary> /// /// </summary> /// <param name="cm1"></param> /// <param name="cm2"></param> /// <param name="cm3"></param> /// <param name="rm1"></param> /// <param name="rm2"></param> /// <param name="rm3"></param> /// <param name="manOrAuto"></param> /// <param name="alarmList"></param> public LYR001StatusData(PumpStatus cm1, PumpStatus cm2, PumpStatus cm3, PumpStatus rm1, PumpStatus rm2, ManualAutomatic manOrAuto, List <string> alarmList ) { _cM1 = cm1; _cM2 = cm2; _cM3 = cm3; _rM1 = rm1; _rM2 = rm2; _manualAutomatic = manOrAuto; _alarmList = alarmList; }