Ejemplo n.º 1
0
        protected void btnReadTerParam_Click(object sender, EventArgs e)
        {
            getData();
            string df  = DropDownList1.SelectedItem.ToString().Replace("0x", "");
            uint   cmd = uint.Parse(df);

            SendOrderHander.Send_CTS_DriveRecordDataCollectionRequest(sysflag, token, cid, tno, cmd);
        }
Ejemplo n.º 2
0
        public ResponseAppResult AppGetCarStatues(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"]);
                monitor mon = new monitor();
                WebGIS.RealtimeDataServer.CarRealData[] RealData = mon.CarRealDataByCids(WebProc.GetAppSysflagKey(sysflag), new long[] { cid });
                if (RealData.Length > 0)
                {
                    alarmcarstatuesalarm wd = new alarmcarstatuesalarm();
                    wd.cid          = RealData[0].Carid.ToString();
                    wd.lat          = RealData[0].Lati.ToString();
                    wd.longt        = RealData[0].Long.ToString();
                    wd.onlinestatus = RealData[0].OnlineStatus.ToString();
                    wd.tdatetime    = RealData[0].TDateTime.ToString("yyyy-MM-dd HH:mm:ss");
                    wd.tno          = RealData[0].TNO.ToString();


                    if (RealData[0].sPositionAdditionalInfo != null)
                    {
                        wd = analyzeStatues(wd, RealData[0].sPositionAdditionalInfo);

                        Result = new ResponseAppResult(ResState.Success, "操作成功", wd);
                    }
                    else
                    {
                        SendOrderHander.Send_CTS_TermSearchRequest(WebProc.GetAppSysflagKey(sysflag), "", cid, long.Parse(wd.tno));
                        Result = new ResponseAppResult(ResState.Success, "操作失败,无车辆状态数据!", null);
                    }
                }

                else
                {
                    Result = new ResponseAppResult(ResState.Success, "操作失败,车辆不在线!", null);
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("AppGetCarLastTrack调用异常", ex);
                Result = new ResponseAppResult(ResState.OperationFailed, ex.Message, null);
            }
            return(Result);
        }
Ejemplo n.º 3
0
        protected void btnOverSpeed_Click(object sender, EventArgs e)
        {
            getData();
            List <CTS_SetTermParamDown.TerminalParamItem> paramlist = new List <CTS_SetTermParamDown.TerminalParamItem>();

            CTS_SetTermParamDown.TerminalParamItem tp = new CTS_SetTermParamDown.TerminalParamItem();
            tp.nParamID  = 0x0055;
            tp.nValue    = uint.Parse(txtmaxSpeed.Text);
            tp.nParamLen = 4;
            paramlist.Add(tp);
            SendOrderHander.Send_CTS_SetTermParamDown(sysflag, token, cid, tno, paramlist);
        }
Ejemplo n.º 4
0
        public ResponseAppResult AppSendOBDDriver(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"];
                monitor mon     = new monitor();
                long    cid     = GetCarCIDBySimCode(sysflag, inparams["cid"]);
                WebGIS.RealtimeDataServer.CarRealData[] RealData = mon.CarRealDataByCids(WebProc.GetAppSysflagKey(sysflag), new long[] { cid });
                if (RealData.Length > 0)
                {
                    if (RealData[0].OnlineStatus == 1 && RealData[0].sPositionAdditionalInfo != null && RealData[0].sPositionAdditionalInfo.Length > 0)
                    {
                        alarmcarstatuesalarm act = new alarmcarstatuesalarm();
                        act = analyzeStatues(act, RealData[0].sPositionAdditionalInfo);


                        KeyValuePair <int, int> accstates = (KeyValuePair <int, int>)act.carstatues.GetValue(13);
                        if (accstates.Value == 1)
                        {
                            long tno = GetCarTNO(WebProc.GetAppSysflagKey(sysflag), cid.ToString());

                            AlertorResolve ar   = new AlertorResolve();
                            byte[]         data = new byte[0];
                            bool           w    = SendOrderHander.Send_CTS_TransmissionProtocol(WebProc.GetAppSysflagKey(sysflag), "", cid, tno, 0x8fc8, data);
                            if (w)
                            {
                                Result = new ResponseAppResult(ResState.Success, "操作成功", "");
                            }
                            else
                            {
                                Result = new ResponseAppResult(ResState.OperationFailed, "操作失败,后台服务中断!", "");
                            }
                        }
                        else
                        {
                            Result = new ResponseAppResult(ResState.OperationFailed, "操作失败,请将钥匙置为ON档!", null);
                        }
                    }
                    else
                    {
                        Result = new ResponseAppResult(ResState.OperationFailed, "车辆已经离线,无法发送指令!", null);
                        return(Result);
                    }
                }
                else
                {
                    Result = new ResponseAppResult(ResState.OperationFailed, "车辆已经离线,无法发送指令!", null);
                    return(Result);
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("AppSendOBDDriver调用异常", ex);
                Result = new ResponseAppResult(ResState.OperationFailed, ex.Message, null);
            }
            return(Result);
        }
Ejemplo n.º 5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string strRes = "";

            TextBox1.Text = "";
            List <OrderResultModel> orms = SendOrderHander.GetOrderResults(token);

            foreach (OrderResultModel orm in orms)
            {
                if (orm == null)
                {
                    return;
                }
                if (orm.dwPackageType == 30)
                {
                    if (orm.dwOperation1 == 10)
                    {
                        MemoryStream       ms       = new MemoryStream(orm.ResData.byteContext);
                        COM_TimeResponseUp Response = ProtoBuf.Serializer.Deserialize <COM_TimeResponseUp>(ms);
                        ms.Close();
                        strRes += JsonConvert.SerializeObject(Response) + "\n";
                        //TextBox1.Text = strRes;
                    }
                    else if (orm.dwOperation1 == 33)
                    {
                        MemoryStream    ms            = new MemoryStream(orm.ResData.byteContext);
                        CTS_MediaDataUp mediaResponse = ProtoBuf.Serializer.Deserialize <CTS_MediaDataUp>(ms);
                        if (mediaResponse.nMediaType == 0)
                        {
                            MemoryStream ms3 = new MemoryStream(mediaResponse.sMediaData, 0, mediaResponse.sMediaData.Length);
                            //Image returnImage = Image.FromStream(ms3);
                            System.Drawing.Image i = Bitmap.FromStream(ms3, true);
                            string bpath           = HttpRuntime.AppDomainAppPath.ToString();
                            string path            = @"TempImage\" + "temp" + mediaResponse.dwTNO + "t" + DateTime.Now.Minute + DateTime.Now.Second + ".png";
                            i.Save(bpath + path);
                            Image1.ImageUrl = path;
                        }
                        ms.Close();
                    }
                    else if (orm.dwOperation1 == 41)
                    {
                        MemoryStream ms = new MemoryStream(orm.ResData.byteContext);
                        CTS_DriveRecordDataUpResponse Response = ProtoBuf.Serializer.Deserialize <CTS_DriveRecordDataUpResponse>(ms);
                        ms.Close();
                        MemoryStream ms2     = new MemoryStream(Response.sDataBlock);
                        object       subdata = null;
                        switch (Response.nCMD)
                        {
                        case 0x00:    //命令字0x00  采集记录仪执行标准版本
                        {
                            subdata = ProtoBuf.Serializer.Deserialize <CTS_DrivingRecorderVersionUp>(ms2);
                            break;
                        }

                        case 0x01:    //命令字0x01  采集当前驾驶人信息(机动车驾驶证号码)
                        {
                            subdata = ProtoBuf.Serializer.Deserialize <CTS_DriverCodeDrivingLicUp>(ms2);
                            break;
                        }

                        case 0x02:    //命令字0x02  采集记录仪的实时时钟
                        {
                            subdata = ProtoBuf.Serializer.Deserialize <CTS_CurrentTimeDataUp>(ms2);
                            break;
                        }

                        case 0x03:    //命令字0x03  采集累计行程里程
                        {
                            subdata = ProtoBuf.Serializer.Deserialize <CTS_CarSumMilesUp>(ms2);
                            break;
                        }

                        case 0x04:    //命令字0x04  采集记录仪脉冲系数
                        {
                            subdata = ProtoBuf.Serializer.Deserialize <CTS_CarCharacterQuotientUp>(ms2);
                            break;
                        }

                        case 0x05:    //命令字0x05  采集车辆信息(车辆识别代号、机动车号牌号码、机动车号牌分类)
                        {
                            subdata = ProtoBuf.Serializer.Deserialize <CTS_CarRecorderVinPlateAndTypeUp>(ms2);
                            break;
                        }

                        case 0x06:    //命令字0x06  采集记录仪状态信号配置信息
                        {
                            subdata = ProtoBuf.Serializer.Deserialize <CTS_DrivingRecorderStatusConfigUp>(ms2);
                            break;
                        }

                        case 0x07:    //命令字0x07  采集记录仪唯一性编号
                        {
                            subdata = ProtoBuf.Serializer.Deserialize <CTS_DrivingRecorderIdentifierUp>(ms2);
                            break;
                        }

                        case 0x08:    //命令字0x08  采集指定的行驶速度记录
                        {
                            subdata = ProtoBuf.Serializer.Deserialize <CTS_DrivingRecorderSpeedRecordUp>(ms2);
                            break;
                        }

                        case 0x09:    //命令字0x09  采集指定的位置信息记录
                        {
                            subdata = ProtoBuf.Serializer.Deserialize <CTS_DrivingRecorderPositionRecordUp>(ms2);
                            break;
                        }

                        case 0x10:    //命令字0x00  采集记录仪执行标准版本
                        {
                            subdata = ProtoBuf.Serializer.Deserialize <CTS_AccidentDoubtRecordUp>(ms2);
                            break;
                        }

                        case 0x11:    //命令字0x00  采集记录仪执行标准版本
                        {
                            subdata = ProtoBuf.Serializer.Deserialize <CTS_OverTimeDrivedRecordUp>(ms2);
                            break;
                        }

                        case 0x12:    //命令字0x00  采集记录仪执行标准版本
                        {
                            subdata = ProtoBuf.Serializer.Deserialize <CTS_DriverLoginRecordUp>(ms2);
                            break;
                        }

                        case 0x13:    //命令字0x00  采集记录仪执行标准版本
                        {
                            subdata = ProtoBuf.Serializer.Deserialize <CTS_PowerSupplyRecordUp>(ms2);
                            break;
                        }

                        case 0x14:    //命令字0x00  采集记录仪执行标准版本
                        {
                            subdata = ProtoBuf.Serializer.Deserialize <CTS_ParamModifyRecordUp>(ms2);
                            break;
                        }

                        case 0x15:    //命令字0x00  采集记录仪执行标准版本
                        {
                            subdata = ProtoBuf.Serializer.Deserialize <CTS_SpeedStatusLogUp>(ms2);
                            break;
                        }

                        default:
                        {
                            break;
                        }
                        }


                        strRes += JsonConvert.SerializeObject(subdata);
                    }
                }
            }
            TextBox1.Text = strRes;
        }
Ejemplo n.º 6
0
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     getData();
     SendOrderHander.Send_CTS_TermSearchRequest(sysflag, token, cid, tno);
 }
Ejemplo n.º 7
0
 protected void btnSendPhoto_Click(object sender, EventArgs e)
 {
     getData();
     SendOrderHander.Send_CTS_ImageRequestDown(sysflag, token, cid, tno);
 }