コード例 #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();
        }