public DigitalstromEventsHostedService(ILogger <DigitalstromEventsHostedService> logger, IOptions <DigitalstromEventProcessingConfig> config, IServiceScopeFactory serviceScopeFactory) { _logger = logger; _config = config; _serviceScopeFactory = serviceScopeFactory; _serviceScope = _serviceScopeFactory.CreateScope(); _connProvider = _serviceScope.ServiceProvider.GetRequiredService <IDigitalstromConnectionProvider>(); _plugins = _serviceScope.ServiceProvider.GetServices <IDigitalstromEventProcessorPlugin>(); }
/// <summary> /// Provides fundamental functionality to request the Digitalstrom DSS REST webservice /// and parse the response JSON wireframe structure as well as selecting the first reachable /// uri from the UriPriorityList in the given connection provider. /// </summary> internal DigitalstromClientBase(IDigitalstromConnectionProvider connectionProvider) { _baseUris = connectionProvider.Uris.DeepClone(); _client = connectionProvider.HttpClient; foreach (var converter in _jsonConverters) { _jsonSerializerOptions.Converters.Add(converter); } _initializeTask = Initialize(); }
public DigitalstromDssTwin(IDigitalstromConnectionProvider connectionProvider) { _dssClient = connectionProvider is null ? null : new DigitalstromDssClient(connectionProvider); _subscriber = _dssClient is null ? null : new DssEventSubscriber(_dssClient, SubscribedEventNames); _changeAggregator = _subscriber is null ? null : new TwinChangeAggregator(this); if (_subscriber is null || _changeAggregator is null) { return; } _subscriber.ApiEventRaised += HandleDssApiEvent; _changeAggregator.SceneChangedInternal += (s, e) => CallScene(e.Zone, e.Group, e.Scene); // init by loading all current values for all zones LoadApartmentScenes(); LoadApartmentSensors(); }
public DigitalstromLongPollingConnectionProvider(IDigitalstromConnectionProvider inner) => this.inner = inner;
/// <summary> /// Connects to the Digitalstrom DSS REST webservice with the given connection /// provider uris and credentials. /// </summary> /// <param name="connectionProvider">All necessary connection infos like uris and /// authentication data needed to use for the webservice or to perform a new or /// renewed authentication</param> public DigitalstromDssClient(IDigitalstromConnectionProvider connectionProvider) : base(connectionProvider) { }
/// <summary> /// Connects to the Digitalstrom DSS REST webservice at the given uri with the given /// app and user credentials given via the IDigitalstromConnectionProvider object. If /// a valid application token is given in the auth data, it is used directly. /// This abstract base class handles the authentication flow including fetching and /// activating the application token, obtaining a session token as well as deserializing /// responses and unpacking the wiremessage. /// </summary> /// <param name="connectionProvider">All necessary connection infos like uris and /// authentication data needed to use for the webservice or to perform a new or /// renewed authentication</param> public DigitalstromAuthenticatingClientBase(IDigitalstromConnectionProvider connectionProvider) : base(connectionProvider) { _authData = connectionProvider.AuthData; }