/// <summary> /// Resources the values. /// </summary> /// <param name="resourcePaths">The resource paths.</param> /// <param name="immediacy">The immediacy.</param> /// <returns>ResourceValueObserver</returns> public async Task <ResourceValuesObserver> ResourceValuesAsync(List <string> resourcePaths, FirstValueImmediacy immediacy = FirstValueImmediacy.OnValueUpdate) { var observer = new ResourceValuesObserver("*", resourcePaths); return(await ResourceValuesCoreAsync(observer, immediacy)); }
/// <summary> /// Resources the values. /// </summary> /// <param name="deviceId">The device identifier.</param> /// <param name="immediacy">The immediacy.</param> /// <returns>ResourceValueObserver</returns> public async Task <ResourceValuesObserver> ResourceValuesAsync(string deviceId, FirstValueImmediacy immediacy = FirstValueImmediacy.OnValueUpdate) { var observer = new ResourceValuesObserver(deviceId, Enumerable.Empty <string>()); return(await ResourceValuesCoreAsync(observer, immediacy)); }
/// <summary> /// Resources the values core asynchronous. /// </summary> /// <param name="observer">The observer.</param> /// <param name="immediacy">The immediacy.</param> /// <returns>Resource value observer</returns> protected virtual async Task <ResourceValuesObserver> ResourceValuesCoreAsync(ResourceValuesObserver observer, FirstValueImmediacy immediacy) { Immediacy = immediacy; observer.OnFilterAdded += (id) => ConstructPresubscriptionArray(id); observer.OnUnsubscribed += (id) => UnsubscribeSubscriptions(id); ResourceValueObservers.Add(observer); ConstructPresubscriptionArray(observer.Id); await StartNotificationsAsync(); return(observer); }
/// <summary> /// Resources the values. /// </summary> /// <param name="immediacy">The immediacy.</param> /// <returns>ResourceValueObserver</returns> public async Task <ResourceValuesObserver> ResourceValuesAsync(FirstValueImmediacy immediacy = FirstValueImmediacy.OnValueUpdate) { var observer = new ResourceValuesObserver(); return(await ResourceValuesCoreAsync(observer, immediacy)); }
/// <summary> /// Resources the values. /// </summary> /// <param name="deviceId">The device identifier.</param> /// <param name="resourcePath">The resource path.</param> /// <param name="immediacy">The immediacy.</param> /// <returns>ResourceValueObserver</returns> public async Task <ResourceValuesObserver> ResourceValuesAsync(string deviceId, string resourcePath, FirstValueImmediacy immediacy = FirstValueImmediacy.OnValueUpdate) { var observer = new ResourceValuesObserver(deviceId, resourcePath); return(await ResourceValuesCoreAsync(observer, immediacy)); }