/// <summary> /// Create discoverer event /// </summary> /// <param name="type"></param> /// <param name="context"></param> /// <param name="discovererId"></param> /// <param name="discoverer"></param> /// <returns></returns> private static DiscovererEventModel Wrap(DiscovererEventType type, RegistryOperationContextModel context, string discovererId, DiscovererModel discoverer) { return(new DiscovererEventModel { EventType = type, Context = context, Id = discovererId, Discoverer = discoverer }); }
/// <summary> /// Create api model /// </summary> /// <param name="model"></param> /// <returns></returns> public static DiscovererApiModel ToApiModel( this DiscovererModel model) { if (model == null) { return(null); } return(new DiscovererApiModel { Id = model.Id, SiteId = model.SiteId, LogLevel = (IIoT.OpcUa.Api.Registry.Models.TraceLogLevel?)model.LogLevel, Discovery = (IIoT.OpcUa.Api.Registry.Models.DiscoveryMode?)model.Discovery, DiscoveryConfig = model.DiscoveryConfig.ToApiModel(), OutOfSync = model.OutOfSync, Connected = model.Connected }); }
/// <inheritdoc/> public Task OnDiscovererUpdatedAsync(RegistryOperationContextModel context, DiscovererModel discoverer) { return(_bus.PublishAsync(Wrap(DiscovererEventType.Updated, context, discoverer.Id, discoverer))); }