Beispiel #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);
        }
Beispiel #2
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);
        }