mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-12 00:40: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
|
final contact = contactsProvider
|
||||||
.findContactByKey(message.senderPublicKeyPrefix!);
|
.findContactByKey(message.senderPublicKeyPrefix!);
|
||||||
if (contact != null) {
|
if (contact != null) {
|
||||||
final updatedMessage = message.copyWith(senderName: contact.advName);
|
// Note: Message sender name could be updated here if needed
|
||||||
// Note: You might want to update the message in the list
|
// final updatedMessage = message.copyWith(senderName: contact.advName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ class _DeviceConfigScreenState extends State<DeviceConfigScreen> {
|
|||||||
late TextEditingController _txPowerController;
|
late TextEditingController _txPowerController;
|
||||||
|
|
||||||
bool _telemetryEnabled = false;
|
bool _telemetryEnabled = false;
|
||||||
bool _isBroadcasting = false;
|
|
||||||
String _selectedBandwidth = '62.5 kHz';
|
String _selectedBandwidth = '62.5 kHz';
|
||||||
int _selectedSpreadingFactor = 8;
|
int _selectedSpreadingFactor = 8;
|
||||||
int _selectedCodingRate = 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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final deviceInfo = context.watch<ConnectionProvider>().deviceInfo;
|
final deviceInfo = context.watch<ConnectionProvider>().deviceInfo;
|
||||||
|
|||||||
@@ -281,11 +281,10 @@ class MeshCoreBleService {
|
|||||||
// STEP 2: Send app start to initialize the app session
|
// STEP 2: Send app start to initialize the app session
|
||||||
// This is the first command after connection per protocol documentation
|
// This is the first command after connection per protocol documentation
|
||||||
debugPrint('🚀 [Service] Sending app start (CMD_APP_START)...');
|
debugPrint('🚀 [Service] Sending app start (CMD_APP_START)...');
|
||||||
final selfInfo = await _commandSender
|
await _commandSender.writeDataAndWaitForResponse<Map<String, dynamic>>(
|
||||||
.writeDataAndWaitForResponse<Map<String, dynamic>>(
|
FrameBuilder.buildAppStart(),
|
||||||
FrameBuilder.buildAppStart(),
|
MeshCoreConstants.respSelfInfo,
|
||||||
MeshCoreConstants.respSelfInfo,
|
);
|
||||||
);
|
|
||||||
debugPrint('✅ [Service] Self info received: node initialized');
|
debugPrint('✅ [Service] Self info received: node initialized');
|
||||||
|
|
||||||
// STEP 3: Set device clock AFTER initialization
|
// STEP 3: Set device clock AFTER initialization
|
||||||
|
|||||||
@@ -229,9 +229,9 @@ class FrameParser {
|
|||||||
final advLon = ByteData.sublistView(Uint8List.fromList(advLonBytes))
|
final advLon = ByteData.sublistView(Uint8List.fromList(advLonBytes))
|
||||||
.getInt32(0, Endian.little);
|
.getInt32(0, Endian.little);
|
||||||
|
|
||||||
final multiAcks = reader.readByte();
|
reader.readByte(); // multiAcks (reserved for future use)
|
||||||
final advertLocPolicy = reader.readByte();
|
reader.readByte(); // advertLocPolicy (reserved for future use)
|
||||||
final telemetryModes = reader.readByte();
|
reader.readByte(); // telemetryModes (reserved for future use)
|
||||||
final manualAddContacts = reader.readByte();
|
final manualAddContacts = reader.readByte();
|
||||||
|
|
||||||
final radioFreqBytes = reader.readBytes(4);
|
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