createLogDataSource static method
DataSource?
createLogDataSource(
- String logPath, {
- ImproveMode improveMode = ImproveMode.sensorFusionWithMapMatching,
Create a log-based data source from a log file.
Opens the specified log file for playback as a DataSource. Supported formats
include GPX and other common trace formats; .gm proprietary log files are not supported here.
Parameters
logPath: Path to the log file to use for playback.improveMode: Specifies how raw sensor data is processed to generate an improved position estimate (e.g., sensor fusion or dead reckoning). The selected mode affects the internal processing pipeline applied on incoming data. Defaults to ImproveMode.sensorFusionWithMapMatching.
Returns
- DataSource: The created playback source, owned by the caller: drive it with start and
stop, and release it with
dispose. null: The log atlogPathcould not be opened, i.e. the path is empty, missing or holds an unsupported format. The underlying GemError is not surfaced.
Implementation
static DataSource? createLogDataSource(
String logPath, {
ImproveMode improveMode = ImproveMode.sensorFusionWithMapMatching,
}) {
final String resultString = GemKitPlatform.instance.callCreateObject(
jsonEncode(<String, Object>{
'class': 'DataSourceContainer',
'args': <String, Object>{
'type': 'log',
'path': logPath,
'improveMode': improveMode.id,
},
}),
);
final dynamic decodedVal = jsonDecode(resultString);
final int gemApiError = decodedVal['gemApiError'];
if (GemErrorExtension.isErrorCode(gemApiError)) {
return null;
}
final DataSource retVal = DataSource.init(decodedVal['result']);
return retVal;
}