Пример #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 LineSectionDriverTimeLessOrMoreAdditionItem AddItem)
 {
     bool bIsAlarm = IsAlarm(AlarmStatus, type);
     switch (type)
     {
         case AlarmType.LineSectionDriverTimeLessOrMore:
             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.LineSectionDriverTimeLessOrMoreAddition))
             {
                 AdditionMsgItem item = addList.Find(o => o.MsgID == AdditionMsgIDType.LineSectionDriverTimeLessOrMoreAddition);
                 item.ParseItem(ref AddItem);
             }
             break;
         default:
             break;
     }
     return bIsAlarm;
 }
Пример #2
0
 /// <summary>
 /// 解析位置附加信息项
 /// </summary>
 public void ParseItem(ref LineSectionDriverTimeLessOrMoreAdditionItem LTLMItem)
 {
     //路段ID
     LTLMItem.LineSectionIDByte = new byte[4];
     Array.Copy(MsgValue, 0, LTLMItem.LineSectionIDByte, 0, 4);
     LTLMItem.LineSectionID = BitConverter.ToUInt32(BuBiaoData.LocalByteToNetByteOrder(LTLMItem.LineSectionIDByte), 0);
     //路段行驶时间
     LTLMItem.LineSectionDriveTimeByte = new byte[2];
     Array.Copy(MsgValue, 4, LTLMItem.LineSectionDriveTimeByte, 0, 2);
     LTLMItem.LineSectionDriveTime = BitConverter.ToUInt16(BuBiaoData.LocalByteToNetByteOrder(LTLMItem.LineSectionDriveTimeByte), 0);
     //结果
     LTLMItem.Result = MsgValue[5];
 }