feat: add device authentication, place gates support, and PiP navigation features
This commit is contained in:
@@ -349,4 +349,35 @@ class MapSaasRepository {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// Batch ingest multiple telemetry points in a single HTTP request (POST /api/telemetry/batch)
|
||||
Future<bool> sendTelemetryBatch({
|
||||
required List<Map<String, dynamic>> points,
|
||||
}) async {
|
||||
if (points.isEmpty) return true;
|
||||
final uri = Uri.parse(ApiConstants.mapSaasTelemetryBatch);
|
||||
try {
|
||||
final payload = {
|
||||
'points': points,
|
||||
};
|
||||
final response = await client.post(
|
||||
uri,
|
||||
headers: {
|
||||
..._baseHeaders,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: jsonEncode(payload),
|
||||
);
|
||||
final ok = response.statusCode == 200 || response.statusCode == 201;
|
||||
if (ok) {
|
||||
print("📦 [MapSaasRepo] Telemetry batch sent successfully: ${points.length} points");
|
||||
} else {
|
||||
print("⚠️ [MapSaasRepo] Telemetry batch HTTP ${response.statusCode}: ${response.body}");
|
||||
}
|
||||
return ok;
|
||||
} catch (e) {
|
||||
print("❌ [MapSaasRepo] sendTelemetryBatch error: $e");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user