Example #1
0
        public static void CloseVideoToWallForDVCS2(Camera camera)
        {
            if (PublicParams.arrayOpenedVideosDVCS2[0] == null)
            {
                return;
            }
            try
            {
                if (camera.Name == PublicParams.arrayOpenedVideosDVCS2[0].Name)
                {
                    if (PublicParams.arrayOpenedVideosDVCS2[0].WinID != 0)
                    {
                        int dvcs2WinID = PublicParams.arrayOpenedVideosDVCS2[0].WinID;
                        PublicParams.dvcsServer2.SendCMD(DVCSAgreement.CloseWin(dvcs2WinID));
                        PublicParams.arrayOpenedVideosDVCS2[0] = null;
                        //LogHelper.WriteLog(string.Format("已发送指令,关闭WinID:{0}的视频--{1}", dvcs2WinID.ToString(), PublicParams.dvcsServer2Name));
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog("关闭DVCS2视频出现错误--CloseVideoToWallForDVCS2--" + ex.Message);
            }


            RefreshOpenedVideos();
        }
Example #2
0
        public List <byte> GetOneWallVideoInBytes()
        {
            List <byte> cmd = new List <byte>();

            cmd.AddRange(DVCSAgreement.GetByteListByString(DVCSAgreement.GetHexStringByInt(GetTitleDigits()), true));
            cmd.AddRange(DVCSAgreement.GetByteListByString(DVCSAgreement.GetHexStringByInt(WinID), true)); //窗口ID
            cmd.AddRange(DVCSAgreement.GetByteListByString(DVCSAgreement.GetHexStringByInt(63), true));    //窗口信息掩码
            cmd.AddRange(DVCSAgreement.GetByteListByString(DVCSAgreement.GetHexStringByInt(SourceID), true));
            cmd.AddRange(DVCSAgreement.GetByteListByString(DVCSAgreement.GetHexStringByInt(Convert.ToInt32(X)), true));
            cmd.AddRange(DVCSAgreement.GetByteListByString(DVCSAgreement.GetHexStringByInt(Convert.ToInt32(Y)), true));
            cmd.AddRange(DVCSAgreement.GetByteListByString(DVCSAgreement.GetHexStringByInt(Convert.ToInt32(Width)), true));
            cmd.AddRange(DVCSAgreement.GetByteListByString(DVCSAgreement.GetHexStringByInt(Convert.ToInt32(Height)), true));
            cmd.AddRange(DVCSAgreement.GetByteListByString(DVCSAgreement.GetHexStringByInt(Zindex), true));
            cmd.AddRange(DVCSAgreement.GetByteListByString(DVCSAgreement.GetHexStringByInt(63), true));                                                        //标题边框信息掩码
            cmd.AddRange(DVCSAgreement.GetByteListByString(DVCSAgreement.GetHexStringByInt(DVCSAgreement.GetBytesFromString(Title).ToList().Count, 2), true)); //标题长度
            cmd.AddRange(DVCSAgreement.GetBytesFromString(Title).ToList <byte>());
            cmd.AddRange(DVCSAgreement.GetByteListByString(DVCSAgreement.GetHexStringByInt(FontFamilyID, 2), true));
            cmd.AddRange(DVCSAgreement.GetByteListByString(DVCSAgreement.GetHexStringByInt(FontSize, 2), true));
            cmd.Add(Foreground.R); cmd.Add(Foreground.G); cmd.Add(Foreground.B);
            cmd.AddRange(DVCSAgreement.GetByteListByString(DVCSAgreement.GetHexStringByInt(TitlePosition, 2), true));
            cmd.AddRange(DVCSAgreement.GetByteListByString(DVCSAgreement.GetHexStringByInt(TitleSize, 2), true));
            cmd.Add(TitleColor.R); cmd.Add(TitleColor.G); cmd.Add(TitleColor.B);
            cmd.AddRange(DVCSAgreement.GetByteListByString(DVCSAgreement.GetHexStringByInt(IsShow, 2), true));

            return(cmd);
        }
Example #3
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 #4
0
 /// <summary>
 /// 关闭大屏上的视频
 /// </summary>
 /// <param name="camera"></param>
 public static void ClosePoliceCarVideoToWall(Camera camera)
 {
     if (PublicParams.bigScreenCamera == null)
     {
         return;
     }
     PublicParams.dvcsServerMain.SendCMD(DVCSAgreement.CloseWin(camera.WinID));
     PublicParams.bigScreenCamera = null;
     CloseVideoToWallForDVCS2(camera);
 }
Example #5
0
 public void SendCMD(byte[] cmd)
 {
     try
     {
         if (socketDVCSServer != null)
         {
             socketDVCSServer.Send(cmd);
             LogHelper.WriteLog(string.Format("{1}-向{0}发送,IP:{2}", dvcsName, DVCSAgreement.GetStringFromBytes(cmd), dvcsServerIP));
         }
     }
     catch (Exception)
     {
         LogHelper.WriteLog("与DVCS服务器未连接!- DVCSServer.SendCMD()");
     }
 }
Example #6
0
        public static void OpenVideoToWallForDVCS2(Camera camera)
        {
            //add by LPY 开视频同时向第二DVCS服务器发送开视频指令
            if (PublicParams.arrayOpenedVideosDVCS2[0] != null)
            {
                if (PublicParams.arrayOpenedVideosDVCS2[0].WinID != 0)
                {
                    PublicParams.dvcsServer2.SendCMD(DVCSAgreement.CloseWin(PublicParams.arrayOpenedVideosDVCS2[0].WinID));
                }
            }
            PublicParams.arrayOpenedVideosDVCS2[0] = new Camera(camera);
            PublicParams.dvcsServer2.SendCMD(DVCSAgreement.OpenWin(PublicParams.dvcs2wallID, 0, DVCSAgreement.GetByteListByString(camera.MAC, false), camera.ChannelID, PublicParams.dvcs2x1, PublicParams.dvcs2y1, PublicParams.dvcs2w, PublicParams.dvcs2h, PublicParams.zindex));

            RefreshOpenedVideos();
        }
Example #7
0
        /// <summary>
        /// 移动大屏上的视频
        /// </summary>
        /// <param name="camera"></param>
        public static void MovePoliceCarVideoToWall(Camera camera)
        {
            if (PublicParams.bigScreenCamera == null)
            {
                return;
            }
            if (PublicParams.bigScreenCamera.WinID == -1)//已打开的视频ID可能还未回发回来
            {
                return;
            }

            int bigScrX = PublicParams.bigScreenX - PublicParams.w / 2;
            int bigScrY = PublicParams.bigScreenY - PublicParams.h;

            bigScrX = bigScrX > 0 ? bigScrX : 0;
            bigScrY = bigScrY > 0 ? bigScrY : 0;

            PublicParams.dvcsServerMain.SendCMD(DVCSAgreement.MoveWin(camera.WinID, 1, bigScrX, bigScrY, PublicParams.w, PublicParams.h, PublicParams.zindex));
        }
Example #8
0
        public static void OpenPoliceCarVideoToWall(Camera camera)
        {
            if (PublicParams.bigScreenCamera != null)
            {
                return;
            }

            int bigScrX = PublicParams.bigScreenX - PublicParams.w / 2;
            int bigScrY = PublicParams.bigScreenY - PublicParams.h;

            bigScrX = bigScrX > 0 ? bigScrX : 0;
            bigScrY = bigScrY > 0 ? bigScrY : 0;

            PublicParams.isPoliceCarVideoSend = 1;//视频上墙标示,接收winid用
            camera.MAC       = PublicParams.MACPoliceCarVideo1;
            camera.ChannelID = PublicParams.channelPoliceCarVideo1;
            PublicParams.dvcsServerMain.SendCMD(DVCSAgreement.OpenWin(PublicParams.wallID, 0, DVCSAgreement.GetByteListByString(PublicParams.MACPoliceCarVideo1, false), PublicParams.channelPoliceCarVideo1, bigScrX, bigScrY, PublicParams.w, PublicParams.h, PublicParams.zindex));
            PublicParams.bigScreenCamera = camera;

            camera.Kind = PublicParams.dvcsServer2Name;//为了增加Kind标示,关闭的时候有用
            OpenVideoToWallForDVCS2(new Camera(camera));
        }
Example #9
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();
            }
        }