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); //手动触发一次。 } }
/// <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(); }
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(); }
private NodesManager() { string baseAddress = System.Configuration.ConfigurationManager.AppSettings["StaticInfoAddress"]; _hub = new CCTVDefaultInfoSync(baseAddress); _hub.RegisterDefaultWithoutUpdate(CCTVInfoType.HierarchyInfo); SyncParams <StorageSource> param = new SyncParams <StorageSource>("CenterStorage", TimeSpan.FromSeconds(10)); _hub.RegisterSynchronizer(param); }
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(); }
private VideoSourceManager(string staticInfoBaseAddress) : this() { _clientHub = new CCTVDefaultInfoSync(staticInfoBaseAddress); _clientHub.RegisterDefaultWithoutUpdate(CCTVInfoType.GlobalInfo); _clientHub.RegisterDefaultWithoutUpdate(CCTVInfoType.StaticInfo); _clientHub.RegisterDefaultWithoutUpdate(CCTVInfoType.ServerInfo); _clientHub.RegisterDefaultWithoutUpdate(CCTVInfoType.DeviceInfo); _autoGenHub = true; findCurrentServer(); }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { _hub = new CCTVDefaultInfoSync(WebApiUrl); _hub.RegisterDefaultWithoutUpdate(CCTVInfoType.GlobalInfo); _hub.RegisterDefaultWithoutUpdate(CCTVInfoType.StaticInfo); _hub.RegisterDefaultWithoutUpdate(CCTVInfoType.DynamicInfo); _hub.RegisterDefaultWithoutUpdate(CCTVInfoType.OnlineStatus); _hub.RegisterDefaultWithoutUpdate(CCTVInfoType.HierarchyInfo); CCTVHierarchyNode[] root = _hub.GetAllHierarchyRoots(); Console.WriteLine(""); }
public InfoService() { ClientHub = new CCTVDefaultInfoSync(Configurations.Instance.InfoServiceAddress); SyncParams <Gateway> gwSP = new SyncParams <Gateway>("GBT28181/Gateway", Timeout.InfiniteTimeSpan); SyncParams <Platform> platSP = new SyncParams <Platform>("GBT28181/Platform", Timeout.InfiniteTimeSpan); SyncParams <SipIdMap> simSP = new SyncParams <SipIdMap>("GBT28181/DeviceIdMap", Timeout.InfiniteTimeSpan); ClientHub.RegisterSynchronizer <Gateway>(gwSP); ClientHub.RegisterSynchronizer <Platform>(platSP); ClientHub.RegisterSynchronizer <SipIdMap>(simSP); ClientHub.RegisterDefaultWithoutUpdate(CCTVInfoType.StaticInfo); ClientHub.RegisterDefaultWithoutUpdate(CCTVInfoType.ControlConfig); ClientHub.RegisterDefaultWithoutUpdate(CCTVInfoType.UserPrivilege); }
internal CCTV1VideoSource(CCTVDefaultInfoSync clientHub, CCTVInfo info, string videoId, string url) { _clientHub = clientHub; VideoId = videoId; Url = url; ulong id = 0; int stream = 1; if (getCctv1UrlInfo(Url, out id, out stream)) { //_flashback = VideoFlashbackManager.Instance.GetChannel(videoId); _video = new CCTVVideo(info, id, getStreamBandwidth(stream)); _video.VideoStreamEvent += video_VideoStreamEvent; _video.FFMPEGFormatEvent += video_FFMPEGFormatEvent; _video.FFMPEGFrameEvent += _video_FFMPEGFrameEvent; _video.UniviewDataEvent += _video_UniviewDataEvent; _video.VideoLevelEvent += video_VideoLevelEvent; } }
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); }
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); }
/// <summary> /// 创建一个视频数据统一管理对象实例,由外界传入同步服务实例。 /// </summary> /// <param name="clientHub"></param> /// <returns></returns> public static VideoSourceManager CreateInstance(CCTVDefaultInfoSync clientHub) { return(new VideoSourceManager(clientHub)); }
private void init() { ClientHub = new CCTVDefaultInfoSync(WebApiBaseUri); ClientHub.RegisterDefaultWithoutUpdate(CCTVInfoType.UserInfo); }
public CameraControlManager(CCTVDefaultInfoSync infoSync, CCTVInfo cctv1Info) { _infoSync = infoSync; CCTV1Info = cctv1Info; _cameraControls = new Dictionary <string, ICameraControl>(); }