mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 08:20:36 +00:00
feat: Show self telemetry in device info sheet
Tapping signal/battery in header now also shows device's own telemetry (temperature, humidity, pressure, GPS) when available. Triggers a self telemetry request on sheet open. Data comes from the device contact's telemetry field.
This commit is contained in:
@@ -2363,6 +2363,24 @@ class ConnectionProvider with ChangeNotifier {
|
||||
/// - Total storage in KB (if available)
|
||||
///
|
||||
/// Results arrive via onBatteryAndStorage callback and update deviceInfo.
|
||||
/// Request the companion device's own telemetry (GPS, temp, sensors).
|
||||
/// The response arrives via onTelemetryReceived with the device's own key.
|
||||
Future<void> requestSelfTelemetry() async {
|
||||
if (!_activeService.isConnected) return;
|
||||
try {
|
||||
// Request own telemetry by sending telemetry req with zero-length key
|
||||
final deviceKey = _deviceInfo.publicKey;
|
||||
if (deviceKey != null) {
|
||||
await _activeService.requestTelemetry(
|
||||
Uint8List.fromList(deviceKey),
|
||||
zeroHop: true,
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('⚠️ [Provider] requestSelfTelemetry failed: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getBatteryAndStorage() async {
|
||||
if (!_activeService.isConnected) {
|
||||
_error = 'Not connected to device';
|
||||
|
||||
Reference in New Issue
Block a user