Fixed InitialTranfer after connected

This commit is contained in:
Federico Barresi
2020-01-17 15:29:34 +01:00
parent 6d69eca9e6
commit 412a460261
2 changed files with 7 additions and 5 deletions

View File

@@ -2,6 +2,7 @@
using System.Reactive;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using System.Threading.Tasks;
using Sharp7.Rx.Enums;
using Sharp7.Rx.Interfaces;
@@ -23,6 +24,7 @@ namespace Sharp7.Rx.Extensions
if (initialTransfer)
{
await plc.ConnectionState.FirstAsync(state => state == ConnectionState.Connected).ToTask();
var initialValue = await ReadData(plc, readData);
observer.OnNext(initialValue);
}