mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
refactor: Clean up unused variables and comments in AppProvider and DeviceConfigScreen
This commit is contained in:
@@ -186,8 +186,8 @@ class AppProvider with ChangeNotifier {
|
||||
final contact = contactsProvider
|
||||
.findContactByKey(message.senderPublicKeyPrefix!);
|
||||
if (contact != null) {
|
||||
final updatedMessage = message.copyWith(senderName: contact.advName);
|
||||
// Note: You might want to update the message in the list
|
||||
// Note: Message sender name could be updated here if needed
|
||||
// final updatedMessage = message.copyWith(senderName: contact.advName);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,6 @@ class _DeviceConfigScreenState extends State<DeviceConfigScreen> {
|
||||
late TextEditingController _txPowerController;
|
||||
|
||||
bool _telemetryEnabled = false;
|
||||
bool _isBroadcasting = false;
|
||||
String _selectedBandwidth = '62.5 kHz';
|
||||
int _selectedSpreadingFactor = 8;
|
||||
int _selectedCodingRate = 8;
|
||||
@@ -380,62 +379,6 @@ class _DeviceConfigScreenState extends State<DeviceConfigScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _broadcastNow() async {
|
||||
final connectionProvider = context.read<ConnectionProvider>();
|
||||
|
||||
if (!connectionProvider.deviceInfo.isConnected) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(AppLocalizations.of(context)!.deviceNotConnected),
|
||||
backgroundColor: Colors.orange,
|
||||
),
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() => _isBroadcasting = true);
|
||||
|
||||
try {
|
||||
// Send self advertisement to mesh network
|
||||
await connectionProvider.sendSelfAdvert(floodMode: true);
|
||||
|
||||
if (context.mounted) {
|
||||
final deviceInfo = connectionProvider.deviceInfo;
|
||||
final lat = deviceInfo.advLat != null
|
||||
? (deviceInfo.advLat! / 1000000).toStringAsFixed(6)
|
||||
: '0.0';
|
||||
final lon = deviceInfo.advLon != null
|
||||
? (deviceInfo.advLon! / 1000000).toStringAsFixed(6)
|
||||
: '0.0';
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
AppLocalizations.of(context)!.advertisedAtLocation(lat, lon),
|
||||
),
|
||||
backgroundColor: Colors.green,
|
||||
),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
AppLocalizations.of(context)!.failedToAdvertise(e.toString()),
|
||||
),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() => _isBroadcasting = false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final deviceInfo = context.watch<ConnectionProvider>().deviceInfo;
|
||||
|
||||
@@ -281,11 +281,10 @@ class MeshCoreBleService {
|
||||
// STEP 2: Send app start to initialize the app session
|
||||
// This is the first command after connection per protocol documentation
|
||||
debugPrint('🚀 [Service] Sending app start (CMD_APP_START)...');
|
||||
final selfInfo = await _commandSender
|
||||
.writeDataAndWaitForResponse<Map<String, dynamic>>(
|
||||
FrameBuilder.buildAppStart(),
|
||||
MeshCoreConstants.respSelfInfo,
|
||||
);
|
||||
await _commandSender.writeDataAndWaitForResponse<Map<String, dynamic>>(
|
||||
FrameBuilder.buildAppStart(),
|
||||
MeshCoreConstants.respSelfInfo,
|
||||
);
|
||||
debugPrint('✅ [Service] Self info received: node initialized');
|
||||
|
||||
// STEP 3: Set device clock AFTER initialization
|
||||
|
||||
@@ -229,9 +229,9 @@ class FrameParser {
|
||||
final advLon = ByteData.sublistView(Uint8List.fromList(advLonBytes))
|
||||
.getInt32(0, Endian.little);
|
||||
|
||||
final multiAcks = reader.readByte();
|
||||
final advertLocPolicy = reader.readByte();
|
||||
final telemetryModes = reader.readByte();
|
||||
reader.readByte(); // multiAcks (reserved for future use)
|
||||
reader.readByte(); // advertLocPolicy (reserved for future use)
|
||||
reader.readByte(); // telemetryModes (reserved for future use)
|
||||
final manualAddContacts = reader.readByte();
|
||||
|
||||
final radioFreqBytes = reader.readBytes(4);
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import 'package:integration_test/integration_test_driver.dart';
|
||||
|
||||
Future<void> main() => integrationDriver();
|
||||
Reference in New Issue
Block a user