Example #1
0
        private void HandleDVCSCommands(byte[] bytes)
        {
            try
            {
                LogHelper.WriteLog(string.Format("{1}-从{0}收到", dvcsName, DVCSAgreement.GetStringFromBytes(bytes)));
                if (bytes.Length <= 0)
                {
                    return;
                }
                switch (bytes[7])                                                 //回复代码第八位为动作指示,如:开窗结果回复,关窗结果回复,移窗结果回复等。
                {
                case 0x87:                                                        //开窗回复
                    if (bytes.Length == 0x13)                                     //开窗成功的指令长度,截取其第
                    {
                        List <byte> bytesWinID = bytes.Skip(13).Take(4).ToList(); //第13位开始的4位为winid
                        int         winID      = DVCSAgreement.GetIntFromBytesList(bytesWinID, true);
                        if (dvcsName == PublicParams.dvcsServerMainName)
                        {
                            if (PublicParams.isPoliceCarVideoSend == 1)
                            {
                                PublicParams.isPoliceCarVideoSend  = 0;
                                PublicParams.bigScreenCamera.WinID = winID;
                                break;
                            }
                            PublicParams.arrayOpenedVideos[PublicParams.currentVideoFlag].WinID = winID;    //设置其已打开窗口所返回的winid

                            //LogHelper.WriteLog(string.Format("已将PublicParams.arrayOpenedVideos-{0}处的camera的winID设置为:{1}", PublicParams.currentVideoFlag.ToString(), winID.ToString()));
                            WallVideosHelper.RefreshOpenedVideos();
                            //LogHelper.WriteLog(string.Format("收到服务器返回的WinID:{0}--{1}", winID.ToString(), PublicParams.dvcsServerMainName));
                            break;
                        }
                        else if (dvcsName == PublicParams.dvcsServer2Name)
                        {
                            //LogHelper.WriteLog("在HandleDVCSCommands中打印,执行PublicParams.arrayOpenedVideosDVCS2[0].WinID = winID前-------------------------------" + PublicParams.dvcsServer2Name);
                            //WallVideosHelper.ShowKeyMessage();//mark by LPY 打印关键信息-调试用
                            PublicParams.arrayOpenedVideosDVCS2[0].WinID = winID;
                            WallVideosHelper.RefreshOpenedVideos();
                            //LogHelper.WriteLog("在HandleDVCSCommands中打印,执行PublicParams.arrayOpenedVideosDVCS2[0].WinID = winID后-------------------------------" + PublicParams.dvcsServer2Name);
                            //WallVideosHelper.ShowKeyMessage();//mark by LPY 打印关键信息-调试用
                            //LogHelper.WriteLog(string.Format("收到服务器返回的WinID:{0}--{1}", winID.ToString(), PublicParams.dvcsServer2Name));
                            break;
                        }
                    }
                    break;

                case 0x89:    //关窗回复

                    break;

                default:
                    break;
                }
                //LogHelper.WriteLog(dvcsName + "------------------------------------------------------------------------------------------------");
            }
            catch (Exception)
            {
            }
        }
Example #2
0
        private static void HandleCommands(JObject rejson)
        {
            switch (rejson["CMD"].ToString())
            {
            case "SYNCR":
                MapMethods.MoveAndZoomMapByJson(rejson);
                break;

            case "PoliceCarPositon":
                //LogHelper.WriteLog(PublicParams.type, rejson["TITLE"].ToString() + "   " + rejson["X"].ToString() + "   " + rejson["Y"].ToString());
                PublicParams.bigScreenX = Convert.ToInt32(rejson["X"].ToString());
                PublicParams.bigScreenY = Convert.ToInt32(rejson["Y"].ToString());
                WallVideosHelper.MovePoliceCarVideoToWall(PublicParams.bigScreenCamera);
                break;

            default:
                break;
            }
        }
Example #3
0
        public static void OpenVideoToWall(Camera camera)
        {
            /*
             * for (int i = 0; i < PublicParams.arrayWallVideo.Length; i++)
             * {
             *  if (PublicParams.arrayWallVideo[i]!=null)
             *  {
             *      continue;
             *  }
             *  switch (i)
             *  {
             *      case 0:
             *          DVCSServer.SendCMD(DVCSAgreement.OpenWin(1, 0, DVCSAgreement.GetByteListByString(MAC,false), 0, x2, y1, w, h, zindex));
             *          WallVideo wv0 = new WallVideo("XXXXX", 0);
             *          PublicParams.listWallVideos.Add(wv0);
             *          PublicParams.arrayWallVideo[i] = wv0;
             *          MapMethods.SendOpenPadVideos();
             *          break;
             *
             *      case 1:
             *          DVCSServer.SendCMD(DVCSAgreement.OpenWin(1, 0, DVCSAgreement.GetByteListByString(MAC, false), 1, x2, y2, w, h, zindex));
             *          WallVideo wv1 = new WallVideo("XXXXX", 0);
             *          PublicParams.listWallVideos.Add(wv1);
             *          PublicParams.arrayWallVideo[i] = wv1;
             *          break;
             *      case 2:
             *          DVCSServer.SendCMD(DVCSAgreement.OpenWin(1, 0, DVCSAgreement.GetByteListByString(MAC, false), 2, x1, y1, w, h, zindex));
             *          WallVideo wv2 = new WallVideo("XXXXX", 0);
             *          PublicParams.listWallVideos.Add(wv2);
             *          PublicParams.arrayWallVideo[i] = wv2;
             *          break;
             *      case 3:
             *          DVCSServer.SendCMD(DVCSAgreement.OpenWin(1, 0, DVCSAgreement.GetByteListByString(MAC, false), 3, x1, y2, w, h, zindex));
             *          WallVideo wv3 = new WallVideo("XXXXX", 0);
             *          PublicParams.listWallVideos.Add(wv3);
             *          PublicParams.arrayWallVideo[i] = wv3;
             *          break;
             *      default:
             *          break;
             *  }
             *  break;
             *
             * }
             */
            int    id        = GetEmptyWallVideo();
            string mac       = string.Empty;
            int    channelID = 0;

            if (id != -1)
            {
                int xp = 0; int yp = 0;
                switch (id)
                {
                case 0:
                    xp = PublicParams.x2; yp = PublicParams.y1; mac = PublicParams.MAC1; channelID = PublicParams.channel1;
                    break;

                case 1:
                    xp = PublicParams.x2; yp = PublicParams.y2; mac = PublicParams.MAC2; channelID = PublicParams.channel2;
                    break;

                case 2:
                    xp = PublicParams.x1; yp = PublicParams.y1; mac = PublicParams.MAC3; channelID = PublicParams.channel3;
                    break;

                case 3:
                    xp = PublicParams.x1; yp = PublicParams.y2; mac = PublicParams.MAC4; channelID = PublicParams.channel4;
                    break;

                default:
                    break;
                }
                camera.ID = id; camera.MAC = mac; camera.ChannelID = channelID; camera.Kind = PublicParams.dvcsServerMainName;
                PublicParams.currentVideoFlag      = id;
                PublicParams.arrayOpenedVideos[id] = new Camera(camera);//把已打开的视频保存到已打开视频列表中,并等待更新已打开视频列表中该项的Camera.WinID,因为关闭窗口的时候要用到WinID

                PublicParams.dvcsServerMain.SendCMD(DVCSAgreement.OpenWin(PublicParams.wallID, 0, DVCSAgreement.GetByteListByString(mac, false), channelID, xp, yp, PublicParams.w, PublicParams.h, PublicParams.zindex));
                MapMethods.SendShowHidePadVideosTextByID(camera.Name, id + 1, "1");

                //LogHelper.WriteLog("在OpenVideoToWall中打印,执行OpenVideoToWallForDVCS2前-------------------------------");
                //WallVideosHelper.ShowKeyMessage();//mark by LPY 打印关键信息-调试用

                WallVideosHelper.RefreshOpenedVideos();
                camera.Kind = PublicParams.dvcsServer2Name;
                OpenVideoToWallForDVCS2(camera);
                //LogHelper.WriteLog("在OpenVideoToWall中打印,执行OpenVideoToWallForDVCS2后-------------------------------");
                //WallVideosHelper.ShowKeyMessage();//mark by LPY 打印关键信息-调试用

                ////LPY 2016-3-29 添加该段代码 但是由于中达新接口不打算启用,注释掉
                //WallVideo wv = new WallVideo(camera.Name, camera.SourceID, xp, yp, PublicParams.w, PublicParams.h, PublicParams.zindex, 1);
                //DVCSServer.SendCMD(DVCSAgreement.OpenWinWithTitle(PublicParams.wallID, wv));
                //camera.ID = id;
                //PublicParams.currentVideoFlag = id;
                //PublicParams.currentCamera = camera;
                //PublicParams.arrayOpenedVideos[id] = camera;
                //PadOpenedVideos.RefreshOpenedVideos();
            }
        }