Skip to content

Commit 6f06346

Browse files
committed
Add pubkeyFull to ApiQueueItem and related services for enhanced data tracking
1 parent b5c7add commit 6f06346

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

lib/models/api_queue_item.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,12 @@ class ApiQueueItem extends HiveObject {
102102
required double localSnr,
103103
required int localRssi,
104104
required double remoteSnr,
105+
required String pubkeyFull,
105106
required int timestamp,
106107
int? noiseFloor,
107108
}) {
108-
// Format: "repeaterId:nodeType:localSnr:localRssi:remoteSnr"
109-
final heardRepeats = '$repeaterId:$nodeType:${localSnr.toStringAsFixed(2)}:$localRssi:${remoteSnr.toStringAsFixed(2)}';
109+
// Format: "repeaterId:nodeType:localSnr:localRssi:remoteSnr:pubkeyFull"
110+
final heardRepeats = '$repeaterId:$nodeType:${localSnr.toStringAsFixed(2)}:$localRssi:${remoteSnr.toStringAsFixed(2)}:$pubkeyFull';
110111
return ApiQueueItem(
111112
type: 'DISC',
112113
latitude: latitude,
@@ -121,7 +122,7 @@ class ApiQueueItem extends HiveObject {
121122
Map<String, dynamic> toApiJson() {
122123
// For DISC type, parse the heardRepeats field to extract individual values
123124
if (type == 'DISC') {
124-
// Format: "repeaterId:nodeType:localSnr:localRssi:remoteSnr"
125+
// Format: "repeaterId:nodeType:localSnr:localRssi:remoteSnr:pubkeyFull"
125126
final parts = heardRepeats.split(':');
126127
return {
127128
'type': type,
@@ -133,6 +134,7 @@ class ApiQueueItem extends HiveObject {
133134
'local_snr': parts.length > 2 ? double.tryParse(parts[2]) ?? 0.0 : 0.0,
134135
'local_rssi': parts.length > 3 ? int.tryParse(parts[3]) ?? 0 : 0,
135136
'remote_snr': parts.length > 4 ? double.tryParse(parts[4]) ?? 0.0 : 0.0,
137+
'public_key': parts.length > 5 ? parts[5] : '',
136138
'timestamp': timestamp.millisecondsSinceEpoch ~/ 1000, // Unix timestamp in seconds
137139
};
138140
}

lib/services/api_queue_service.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ class ApiQueueService {
147147
required double localSnr,
148148
required int localRssi,
149149
required double remoteSnr,
150+
required String pubkeyFull,
150151
required int timestamp,
151152
int? noiseFloor,
152153
}) async {
@@ -158,6 +159,7 @@ class ApiQueueService {
158159
localSnr: localSnr,
159160
localRssi: localRssi,
160161
remoteSnr: remoteSnr,
162+
pubkeyFull: pubkeyFull,
161163
timestamp: timestamp,
162164
noiseFloor: noiseFloor,
163165
);

lib/services/background_service.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import '../utils/debug_logger_io.dart';
1818
/// Web: No-op (Web Bluetooth requires active tab).
1919
///
2020
/// Reference: Option A from background execution plan
21+
@pragma('vm:entry-point')
2122
class BackgroundServiceManager {
2223
static const String _notificationChannelId = 'meshmapper_wardriving';
2324
static const String _notificationChannelName = 'MeshMapper Wardriving';

lib/services/ping_service.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,7 @@ class PingService {
894894
localSnr: node.localSnr,
895895
localRssi: node.localRssi,
896896
remoteSnr: node.remoteSnr,
897+
pubkeyFull: node.pubkeyFull,
897898
timestamp: DateTime.now().millisecondsSinceEpoch ~/ 1000,
898899
noiseFloor: _pendingTxNoiseFloor,
899900
);

0 commit comments

Comments
 (0)