예제 #1
0
        public ResponseAppResult AppGetOBDDriverResult(Dictionary <string, string> inparams)
        {
            ResponseAppResult Result = null;

            if (!inparams.Keys.Contains("cid") || inparams["cid"] == "")
            {
                Result = new ResponseAppResult(ResState.ParamsImperfect, "缺少cid或cid为空!", null);
                return(Result);
            }


            try
            {
                string         sysflag = inparams["sysflag"];
                long           cid     = GetCarCIDBySimCode(sysflag, inparams["cid"]);
                AlertorResolve ar      = new AlertorResolve();
                RDSConfigModel rc      = RDSConfig.GetRDS(WebProc.GetAppSysflagKey(sysflag));
                RealtimeDataServer.WCFServiceClient df = new RealtimeDataServer.WCFServiceClient();
                df.Endpoint.Address = new System.ServiceModel.EndpointAddress(rc.WCFUrl);
                RealtimeDataServer.CarTransmissionProtocolInfo ctf = df.GetCarTransData(WebProc.GetAppSysflagKey(sysflag), cid);
                byte[] spai = null;

                if (ctf != null && ctf.TransData != null && ctf.TransData.ContainsKey(0x0FC8))
                {
                    spai = ctf.TransData[0x0FC8];// date[0].TransmissionProtocolInfo;
                    List <OBDDriver> res = ar.analyzeOBDDriver(spai);

                    Result = new ResponseAppResult(ResState.Success, "操作成功", res);
                }

                else
                {
                    Result = new ResponseAppResult(ResState.RetryAfter, "未收到ODB行车数据,请稍候重试!", "");
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("AppGetOBDDriverResult调用异常", ex);
                Result = new ResponseAppResult(ResState.OperationFailed, ex.Message, null);
            }
            return(Result);
        }
예제 #2
0
        public WebGIS.RealtimeDataServer.CarRealData[] CarRealDataByCids(string sysflag, long[] cids)
        {
            RDSConfigModel rc = RDSConfig.GetRDS(sysflag);

            WebGIS.RealtimeDataServer.WCFServiceClient wc = new WebGIS.RealtimeDataServer.WCFServiceClient();
            //调用WebGIS实时数据服务接口查询车辆轨迹数据
            if (souflag == "RDS" && rc != null && rc.RunFlag)
            {
                wc.Endpoint.Address = new System.ServiceModel.EndpointAddress(rc.WCFUrl);
                List <CarRealData> tempres = new List <CarRealData>();
                int reqlength = 500;

                List <long> tempp = new List <long>();
                for (int i = 0; i < cids.Length; i++)
                {
                    tempp.Add(cids[i]);
                    if (tempp.Count == reqlength || i == cids.Length - 1)
                    {
                        try
                        {
                            tempres.AddRange(wc.GetCarsData(sysflag, tempp.ToArray()));
                        }
                        catch (Exception ex)
                        {
                            LogHelper.WriteError("远程车辆实时数据请求异常", ex, false);
                        }
                        tempp.Clear();
                    }
                }
                return(tempres.ToArray());
            }
            else
            {     //从数据库查询车辆最后轨迹信息并转化处理
                string   OldSplitDate = System.Configuration.ConfigurationManager.AppSettings[sysflag + "_OldSplitDate"];
                DateTime olddate      = DateTime.MinValue;
                if (!string.IsNullOrEmpty(OldSplitDate) && DateTime.TryParse(OldSplitDate, out olddate))
                {
                }
                string strcids = string.Join(",", cids);
                return(CarDataConvent(GetCarsLastTrackForDB(sysflag, strcids), olddate));
            }
        }
예제 #3
0
        public ResponseAppResult AppGetOBDDiagnResult(Dictionary <string, string> inparams)
        {
            ResponseAppResult Result = null;

            if (!inparams.Keys.Contains("cid") || inparams["cid"] == "")
            {
                Result = new ResponseAppResult(ResState.ParamsImperfect, "缺少cid或cid为空!", null);
                return(Result);
            }


            try
            {
                string         sysflag = inparams["sysflag"];
                long           cid     = GetCarCIDBySimCode(sysflag, inparams["cid"]);
                AlertorResolve ar      = new AlertorResolve();
                RDSConfigModel rc      = RDSConfig.GetRDS(WebProc.GetAppSysflagKey(sysflag));
                RealtimeDataServer.WCFServiceClient df = new RealtimeDataServer.WCFServiceClient();
                df.Endpoint.Address = new System.ServiceModel.EndpointAddress(rc.WCFUrl);
                RealtimeDataServer.CarTransmissionProtocolInfo ctf = df.GetCarTransData(WebProc.GetAppSysflagKey(sysflag), cid);
                byte[] spai = null;

                //OBDDiagn res = new OBDDiagn();
                //res.VIN = "aa12345678935";
                //res.NormalUnitCount = 2;
                //res.FaultyUnitList = new List<OBDDiagn.diagn>();
                //OBDDiagn.diagn rrr = new OBDDiagn.diagn();
                //rrr.FaultyCodes = "12412";
                //rrr.UnitCode = 0x5;
                //rrr.UnitName = "允许进入/启动";
                //rrr.AsmName = "车身系统";
                //res.FaultyUnitList.Add(rrr);
                //OBDDiagn.diagn rrr2 = new OBDDiagn.diagn();
                //rrr2.FaultyCodes = "27452";
                //rrr2.UnitCode = 0x16;
                //rrr2.UnitName = "方向盘";
                //rrr2.AsmName = "车身系统";
                //res.FaultyUnitList.Add(rrr2);
                //res.NormalUnitList = new List<OBDDiagn.diagn>();
                //OBDDiagn.diagn rrr3 = new OBDDiagn.diagn();
                //rrr3.FaultyCodes = "00000";
                //rrr3.UnitCode = 0x1;
                //rrr3.UnitName = "发动机";
                //rrr3.AsmName = "动力总成系统";
                //res.NormalUnitList.Add(rrr3);
                //OBDDiagn.diagn rrr4 = new OBDDiagn.diagn();
                //rrr4.FaultyCodes = "00000";
                //rrr4.UnitCode = 0x3;
                //rrr3.AsmName = "底盘系统";
                // rrr4.UnitName = "ABS制动";
                //res.NormalUnitList.Add(rrr4);
                //Result = new ResponseAppResult(ResState.Success, "操作成功", res);


                if (ctf != null && ctf.TransData != null && ctf.TransData.ContainsKey(0x0FC7))
                {
                    spai = ctf.TransData[0x0FC7];// date[0].TransmissionProtocolInfo;
                    OBDDiagn res = ar.analyzeOBDDiagn(spai);
                    if (res != null)
                    {
                        Result = new ResponseAppResult(ResState.Success, "操作成功", res);
                    }
                    else
                    {
                        Result = new ResponseAppResult(ResState.RetryAfter, "未收到OBD诊断数据,请稍候重试!", "");
                    }
                }

                else
                {
                    Result = new ResponseAppResult(ResState.RetryAfter, "未收到OBD诊断数据,请稍候重试!", "");
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("AppSendOBDDiagn调用异常", ex);
                Result = new ResponseAppResult(ResState.OperationFailed, ex.Message, null);
            }
            return(Result);
        }