Пример #1
0
 public void logout(NVRDevice device)
 {
     if (device.userID > 0)
     {
         XMSDK.H264_DVR_Logout(device.userID);
         device.userID = -1;
     }
 }
Пример #2
0
        public void setMonitor(Monitor theMonitor)
        {
            GateInfoResponse gateInfoResponse = new GateInfoResponse();

            try {
                gateInfoResponse = server.getGateInfo(AppConfig.gateSensor, theMonitor.gateNo);
            }
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }

            if (gateInfoResponse.error_code != 0)
            {
                MessageBox.Show("获取监控信息失败:" + gateInfoResponse.error_msg);
                toolStripStatusLabel.Text = "获取监控信息失败:" + gateInfoResponse.error_msg;
            }
            else
            {
                NVRDevice device = new NVRDevice();
                device.IP            = gateInfoResponse.nvr_ip;
                device.password      = gateInfoResponse.nvr_passwd;
                device.port          = gateInfoResponse.nvr_port;
                device.username      = gateInfoResponse.nvr_username;
                theMonitor.nvrDevice = device;
                theMonitor.channel   = gateInfoResponse.nvr_channel;
                if (this.monitor != null)
                {
                    if (this.monitor.gateNo != theMonitor.gateNo)
                    {
                        toolStripStatusLabel.Text = "正在关闭现有视频!";
                        stopCurrentPreview();

                        if (this.monitor.nvrDevice != null && this.monitor.nvrDevice.IP != theMonitor.nvrDevice.IP)
                        {
                            //新监控和原监控的nvr不同,需要logout原nvr
                            toolStripStatusLabel.Text = "正在注销当前NVR!";
                            this.logout(this.monitor.nvrDevice);
                        }
                        toolStripStatusLabel.Text = "就绪!";
                    }
                    stop();
                }

                this.monitor = theMonitor;
            }
        }
Пример #3
0
        public void setMonitor(Monitor theMonitor)
        {
            GateInfoResponse gateInfoResponse = new GateInfoResponse();
            try {
                gateInfoResponse = server.getGateInfo(AppConfig.gateSensor, theMonitor.gateNo);
            }
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }

            if (gateInfoResponse.error_code != 0)
            {
                MessageBox.Show("获取监控信息失败:" + gateInfoResponse.error_msg);
                toolStripStatusLabel.Text = "获取监控信息失败:" + gateInfoResponse.error_msg;
            }
            else
            {
                NVRDevice device = new NVRDevice();
                device.IP = gateInfoResponse.nvr_ip;
                device.password = gateInfoResponse.nvr_passwd;
                device.port = gateInfoResponse.nvr_port;
                device.username = gateInfoResponse.nvr_username;
                theMonitor.nvrDevice = device;
                theMonitor.channel = gateInfoResponse.nvr_channel;
                if (this.monitor != null)
                {
                    if (this.monitor.gateNo != theMonitor.gateNo)
                    {
                        toolStripStatusLabel.Text = "正在关闭现有视频!";
                        stopCurrentPreview();

                        if (this.monitor.nvrDevice != null && this.monitor.nvrDevice.IP != theMonitor.nvrDevice.IP)
                        {
                            //新监控和原监控的nvr不同,需要logout原nvr
                            toolStripStatusLabel.Text = "正在注销当前NVR!";
                            this.logout(this.monitor.nvrDevice);
                        }
                        toolStripStatusLabel.Text = "就绪!";
                    }
                    stop();
                }

                this.monitor = theMonitor;
            }
        }
Пример #4
0
 public void logout(NVRDevice device)
 {
     if (device.userID > 0)
     {
         XMSDK.H264_DVR_Logout(device.userID);
         device.userID = -1;
     }
 }