Esempio n. 1
0
 /// <summary>
 /// 判断是否进出区域/线路报警,并取得附加信息
 /// </summary>
 /// <param name="AlarmStatus"></param>
 /// <param name="AdditionMsg"></param>
 /// <param name="type"></param>
 /// <param name="AddItem"></param>
 /// <returns></returns>
 public static bool GetAlarmMsg(UInt32 AlarmStatus, string AdditionMsg, AlarmType type, ref InOutAreaAdditionItem AddItem)
 {
     bool bIsAlarm = IsAlarm(AlarmStatus, type);
     switch (type)
     {
         case AlarmType.InOutLine:
         case AlarmType.InOutArea:
             List<AdditionMsgItem> addList = new List<AdditionMsgItem>();
             byte[] AdditionMsgByte = Encoding.ASCII.GetBytes(AdditionMsg);
             LocationReport LR = new LocationReport();
             LR.ParseAdditionMsg(AdditionMsgByte, 0, AdditionMsgByte.Length, ref addList);
             if (addList.Exists(o => o.MsgID == AdditionMsgIDType.InOutAreaAddition))
             {
                 AdditionMsgItem item = addList.Find(o => o.MsgID == AdditionMsgIDType.InOutAreaAddition);
                 item.ParseItem(ref AddItem);
             }
             break;
         default:
             break;
     }
     return bIsAlarm;
 }
Esempio n. 2
0
 /// <summary>
 /// 解析位置附加信息项
 /// </summary>
 public void ParseItem(ref InOutAreaAdditionItem IOAItem)
 {
     //位置类型
     IOAItem.LocationType = MsgValue[0];
     //区域或线路ID
     IOAItem.AreaOrLineIDByte = new byte[4];
     Array.Copy(MsgValue, 1, IOAItem.AreaOrLineIDByte, 0, 4);
     IOAItem.AreaOrLineID = BitConverter.ToUInt32(BuBiaoData.LocalByteToNetByteOrder(IOAItem.AreaOrLineIDByte), 0);
     //方向
     IOAItem.Direction = MsgValue[5];
 }