예제 #1
0
        public PanTiltControlManager(CCTVDefaultInfoSync infoSync)
        {
            if (infoSync == null)
            {
                throw new ArgumentNullException("参数infoSync不能为空值null");
            }
            ClientHub = infoSync;
            _control  = new CameraControlManager(ClientHub, CCTV1Info);

            if (!ClientHub.HasRegisteredDefault(CCTVInfoType.StaticInfo))
            {
                ClientHub.RegisterDefault(CCTVInfoType.StaticInfo, TimeSpan.FromSeconds(60));
            }
            if (!ClientHub.HasRegisteredDefault(CCTVInfoType.ControlConfig))
            {
                ClientHub.RegisterDefault(CCTVInfoType.ControlConfig, TimeSpan.FromSeconds(60));
            }

            if (!ClientHub.HasRegisteredDefault(CCTVInfoType.GlobalInfo))
            {
                ClientHub.RegisterDefault(CCTVInfoType.GlobalInfo, TimeSpan.Zero, onGlobalInfoUpdate);
            }
            else
            {
                ClientHub.AddUpdateHandler(CCTVInfoType.GlobalInfo, onGlobalInfoUpdate);
                onGlobalInfoUpdate(null); //手动触发一次。
            }
        }
예제 #2
0
        public PanTiltControlManager(string webApiBaseUri)
        {
            ClientHub = new CCTVDefaultInfoSync(webApiBaseUri);
            _control  = new CameraControlManager(ClientHub, CCTV1Info);

            ClientHub.RegisterDefault(CCTVInfoType.GlobalInfo, TimeSpan.Zero, onGlobalInfoUpdate);
            ClientHub.RegisterDefault(CCTVInfoType.StaticInfo, TimeSpan.FromSeconds(60));
            ClientHub.RegisterDefault(CCTVInfoType.ControlConfig, TimeSpan.FromSeconds(60));
            ClientHub.UpdateAllDefault();
        }
예제 #3
0
        private void init()
        {
            string webApiBaseUri = ConfigHandler.GetValue <VideoInfoPlugin>("WebApiBaseUri");

            ClientHub = new CCTVDefaultInfoSync(webApiBaseUri);
            ClientHub.RegisterDefault(CCTVInfoType.GlobalInfo, TimeSpan.Zero, onGlobalInfoUpdate);
            ClientHub.RegisterDefaultWithoutUpdate(CCTVInfoType.StaticInfo);
            ClientHub.RegisterDefaultWithoutUpdate(CCTVInfoType.ControlConfig);
            _lastSITick = _lastCCTick = Environment.TickCount;
            ClientHub.UpdateAllDefault();
        }
예제 #4
0
        private void UpdateWebApiUrl(string ip)
        {
            string url = $"http://{ip}:{ConfigReader.Instance.WebApiPort}";

            if (ClientHub != null)
            {
                ClientHub.Dispose();
            }
            if (ThumbnailMgr != null)
            {
                ThumbnailMgr.Dispose();
            }

            ClientHub    = new CCTVDefaultInfoSync(url);
            ThumbnailMgr = new ThumbnailManager(url, ConstSettings.ThumbnailPath);
            //集中存储配置信息获取。
            SyncParams <StorageSource> param = new SyncParams <StorageSource>("CenterStorage", Timeout.InfiniteTimeSpan);

            ClientHub.RegisterDefault(CCTVInfoType.HierarchyInfo, TimeSpan.Zero);
            ClientHub.RegisterDefault(CCTVInfoType.StaticInfo, TimeSpan.Zero);
            ClientHub.RegisterDefault(CCTVInfoType.OnlineStatus, TimeSpan.FromSeconds(5));
            ClientHub.RegisterDefault(CCTVInfoType.DynamicInfo, TimeSpan.FromSeconds(5));
            ClientHub.RegisterSynchronizer(param);
        }
예제 #5
0
        private void init()
        {
            if (string.IsNullOrEmpty(WebApiBaseUri))
            {
                return;
            }
            Console.WriteLine(WebApiBaseUri);
            ClientHub = new CCTVDefaultInfoSync(WebApiBaseUri);
            ClientHub.RegisterDefaultWithoutUpdate(CCTVInfoType.GlobalInfo);
            ClientHub.RegisterDefault(CCTVInfoType.HierarchyInfo, TimeSpan.FromSeconds(5));
            ClientHub.RegisterDefault(CCTVInfoType.StaticInfo, TimeSpan.FromSeconds(10));
            ClientHub.RegisterDefault(CCTVInfoType.OnlineStatus, TimeSpan.FromSeconds(5));
            ClientHub.RegisterDefault(CCTVInfoType.DynamicInfo, TimeSpan.FromSeconds(5));
            ClientHub.RegisterDefault(CCTVInfoType.ControlConfig, TimeSpan.FromSeconds(15));
            ClientHub.RegisterDefault(CCTVInfoType.VideoTrackInfo, TimeSpan.FromSeconds(10));
            ClientHub.RegisterDefaultWithoutUpdate(CCTVInfoType.UserPrivilege);
            if (_fromConfig)
            {
                UserManager.Instance.SubscribeLongin(userLogin);
            }

            CameraControl = new PanTiltControlManager(ClientHub);
        }