Data Streams
Collected data is streamed back to a CARP Web Service using the Data subsystem.
This is done using the CarpDataStreamService like this:
// Configure a [CarpDataStreamService] from an existing CAWS service.CarpDataStreamService().configureFrom(CarpService());
// Create a (very simple) data batch with one measurement to uploadvar measurement = Measurement( sensorStartTime: 1642505144000000, data: Geolocation( latitude: 55.680802203873114, longitude: 12.581802212861367));
var batch = [ DataStreamBatch( dataStream: DataStreamId( studyDeploymentId: CarpDataStreamService().app.studyDeploymentId ?? '', deviceRoleName: 'smartphone', dataType: Geolocation.dataType), firstSequenceId: 0, measurements: [measurement], triggerIds: {0}),];
// Get a data stream and append the batchCarpDataStreamService().dataStream(studyDeploymentId).append(batch);However, you would rarely need to use these endpoints in your app, since the carp_backend would handle this when you use a CarpDataEndPoint as the data endpoint in the study protocol.