/// <summary> /// 解析数据 /// </summary> /// <param name="bGps"></param> /// <remarks></remarks> public void JXJTData(byte[] bGps) { if (bGps.Length > 11 && CheckHelper.CheckXOR(bGps, 0, bGps.Length - 1) == bGps[bGps.Length - 1])//效验通过 { var head = JTHeader.NewEntity(bGps); var item = GetChejiFromList(head.Sim); if (item == null) { item = JTCheji.NewCheji(this, Channel.RemoteHost + ":" + Channel.RemotePort, head, bGps);//1、记录车辆上线** if (item.IsAuthority) { LastSuccessTime = DateTime.Now; //if (!item.IsTest) //{ #region 移除已有连接(防止多次登录) var oldcj = MyTask.GetChejiByClientPool(item.SimKey); if (oldcj != null) { oldcj.cl.RemoveCheji(oldcj, LogOutReason.Relogin, true);//2、此时在数据库记录车辆下线 } #endregion AddChejiToList(head.Sim, item); MyTask.OnChejiAdd(item); } else { item.Dispose(); } } else { item.JXData(head, bGps); } } }
/// <summary> /// /// </summary> /// <param name="FirstHead"></param> /// <param name="OrderSendId">命令发送ID(-1表示非命令数据)</param> /// <param name="ExtendedProperties"></param> /// <param name="SendByMonitor"></param> public ActiveSendOrder(JTHeader FirstHead, long OrderSendId, Dictionary <string, object> ExtendedProperties, bool SendByMonitor) { CreateTime = DateTime.Now; if (ExtendedProperties == null) { ExtendedProperties = new Dictionary <string, object>(); } this.ExtendedProperties = ExtendedProperties; this.FirstHead = FirstHead; this.OrderSendId = OrderSendId; this.SendByMonitor = SendByMonitor; SData = new List <ActiveSendData>(); }
private bool JXJT1077(JTHeader head, byte[] bGps) { switch (head.MsgId) { case 0x1003: var avp = JTRTAVParametersUpload.NewEntity(bGps); var he = new HashEntry[] { new HashEntry("AudioChannels", (int)avp.AudioChannels), new HashEntry("AudioMaxChannels", (int)avp.AudioMaxChannels), new HashEntry("AudioCodeType", (int)avp.AudioCodeType), new HashEntry("AudioFrameLength", (int)avp.AudioFrameLength), new HashEntry("AudioOut", (int)avp.AudioOut), new HashEntry("AudioSamplingDigit", (int)avp.AudioSamplingDigit), new HashEntry("AudioSamplingRate", (int)avp.AudioSamplingRate), new HashEntry("VideoCodeType", (int)avp.VideoCodeType), new HashEntry("VideoMaxChannels", (int)avp.VideoMaxChannels) }; cl.MyTask.schRedis.Add(new HashSetAllWorker("AVParameters:" + head.Sim, he)); return(true); case 0x1005: SendDefaultAnswer(head); return(true); case 0x1205: var videolist = JTVideoListInfo.NewEntity(bGps); if (AllSendOrder.ContainsKey(videolist.SerialNumber)) { var so = AllSendOrder[videolist.SerialNumber]; var sd = AllSendData[videolist.SerialNumber]; sd.Answer = SendDataState.Success; CheckSendOrderByAnswer(sd.Head); VideoOrderAck ack = new VideoOrderAck() { Status = 1, VideoList = videolist }; cl.MyTask.schRedis.Add(new StringSetWorker <VideoOrderAck>("OCX_ORDERINFO_" + so.OrderId, ack, new TimeSpan(1, 0, 0))); } return(true); case 0x1206: SendDefaultAnswer(head); return(true); } return(false); }
public string Send1078ToDev(string Hex, bool IsSuperiorPlatformSend) { try { var bts = ByteHelper.HexStringToBytes(Hex); var head = JTHeader.NewEntity(bts); var cj = GetChejiByClientPool(head.Sim); if (cj == null) { return("0"); } var bGps = new byte[bts.Length - head.HeadLen]; Array.Copy(bts, head.HeadLen, bGps, 0, bGps.Length); return(cj.Send1078ToDev(IsSuperiorPlatformSend, head, bGps)); } catch (Exception ex) { Log.WriteLog4Ex("Send1078ToDev", ex); return("-1"); } }
public string Send1078ToDev(bool IsSuperiorPlatformSend, JTHeader head, byte[] bGps) { var jtpd = jtdata.Package(head.MsgId, SimKey, bGps); if (head.MsgId == 0x9206) { SendData_Active(jtpd); return(jtpd.FirstHead.SerialNumber.ToString()); } else if (head.MsgId == 0x9201 || head.MsgId == 0x9205) { var orderid = cl.MyTask.GetOrderID(); SendData_Active(jtpd, OrderId: orderid); return(orderid.ToString()); } else { SendAnswer(jtpd); return("1"); } }