Skip to content

Commit

Permalink
DsClient | Retrieved initial cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Minyewoo committed Mar 7, 2024
1 parent da8e6ad commit 0020cd8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/src/core/ds_client/ds_client_real.dart
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,20 @@ class DsClientReal implements DsClient {
/// что бы сервер прочитал и прислал значения всех точек в потоке.
/// Данные не ждем, они прийдут в потоке
@override
Future<ResultF<void>> requestAll() {
return _line.requestAll();
Future<ResultF<void>> requestAll() async {
if (_cache == null) {
return _line.requestAll();
} else {
for(final entry in _receivers.entries) {
final pointName = entry.key;
final cachedPoint = await _cache?.get(pointName);
if (cachedPoint != null) {
final controller = entry.value;
controller.add(cachedPoint);
}
}
return const Ok(null);
}
}
///
/// Делает запрос на S7 DataServer в виде списка имен точек данных
Expand Down

0 comments on commit 0020cd8

Please sign in to comment.