getDataStream method
Retrieve all data points in dataStream
that fall within the inclusive range
defined by fromSequenceId
and toSequenceIdInclusive
.
If toSequenceIdInclusive
is null, all data points starting fromSequenceId
are returned.
In case no data for dataStream
is stored in this repository, or is
available for the specified range, an empty list is returned.
Throws IllegalArgumentException if:
dataStream
has never been opened- the
dataStream
does not exist (i.e, that the combination ofdataStream.deviceRoleName
anddataStream.dataType
is correct for the protocol used in thedataStream.studyDeploymentId
deployment.) fromSequenceId
is negative ortoSequenceIdInclusive
is smaller thanfromSequenceId
Implementation
@override
Future<List<DataStreamBatch>> getDataStream(
DataStreamId dataStream,
int fromSequenceId, [
int? toSequenceIdInclusive,
]) async {
Map<String, dynamic> responseJson = await _rpc(GetDataStream(
dataStream,
fromSequenceId,
toSequenceIdInclusive,
));
// we expect a list of 'items'
List<dynamic> items = responseJson['items'] as List<dynamic>;
return (items.isEmpty)
? []
: items
.map((item) =>
DataStreamBatch.fromJson(item as Map<String, dynamic>))
.toList();
}