Example #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); //手动触发一次。
            }
        }
Example #2
0
 /// <summary>
 /// 生成视频数据统一管理对象,由外界传入同步服务实例。
 /// </summary>
 /// <param name="clientHub"></param>
 private VideoSourceManager(CCTVDefaultInfoSync clientHub)
     : this()
 {
     if (clientHub == null)
     {
         throw new ArgumentNullException("参数 " + nameof(clientHub) + " 不能为空值null");
     }
     _clientHub = clientHub;
     if (!clientHub.HasRegisteredDefault(CCTVInfoType.GlobalInfo))
     {
         _clientHub.RegisterDefaultWithoutUpdate(CCTVInfoType.GlobalInfo);
     }
     if (!clientHub.HasRegisteredDefault(CCTVInfoType.StaticInfo))
     {
         _clientHub.RegisterDefaultWithoutUpdate(CCTVInfoType.StaticInfo);
     }
     if (!clientHub.HasRegisteredDefault(CCTVInfoType.ServerInfo))
     {
         _clientHub.RegisterDefaultWithoutUpdate(CCTVInfoType.ServerInfo);
     }
     if (!clientHub.HasRegisteredDefault(CCTVInfoType.DeviceInfo))
     {
         _clientHub.RegisterDefaultWithoutUpdate(CCTVInfoType.DeviceInfo);
     }
     findCurrentServer();
 }