mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-12 08:50:30 +00:00
feat: Update project version to 11 and enhance BLE packet logging with RSSI and SNR information
This commit is contained in:
@@ -9,6 +9,8 @@ class LogRxDataInfo {
|
||||
final List<String> embeddedStrings;
|
||||
final double entropy;
|
||||
final bool isLikelyEncrypted;
|
||||
final double? snrDb; // Signal-to-Noise Ratio in dB
|
||||
final int? rssiDbm; // Received Signal Strength Indicator in dBm
|
||||
|
||||
LogRxDataInfo({
|
||||
this.airtimeMs,
|
||||
@@ -17,6 +19,8 @@ class LogRxDataInfo {
|
||||
this.embeddedStrings = const [],
|
||||
required this.entropy,
|
||||
required this.isLikelyEncrypted,
|
||||
this.snrDb,
|
||||
this.rssiDbm,
|
||||
});
|
||||
|
||||
/// Get sender public key as hex string (short)
|
||||
@@ -30,6 +34,9 @@ class LogRxDataInfo {
|
||||
|
||||
String get summary {
|
||||
final parts = <String>[];
|
||||
if (rssiDbm != null) parts.add('RSSI:${rssiDbm}dBm');
|
||||
final snr = snrDb;
|
||||
if (snr != null) parts.add('SNR:${snr.toStringAsFixed(1)}dB');
|
||||
if (airtimeMs != null) parts.add('airtime:${airtimeMs}ms');
|
||||
if (ackCode != null) parts.add('ACK:$ackCode');
|
||||
if (senderKeyShort != null) parts.add('from:$senderKeyShort');
|
||||
|
||||
@@ -587,7 +587,7 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
Text(
|
||||
'${deviceInfo.signalRssi}dBm',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontSize: 14,
|
||||
color: _getSignalColor(deviceInfo.signalRssi!),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
|
||||
@@ -515,6 +515,17 @@ class _PacketLogCard extends StatelessWidget {
|
||||
icon: Icons.tag,
|
||||
label: log.opcodeDescription,
|
||||
),
|
||||
// Show RSSI and SNR for LOG_RX_DATA packets
|
||||
if (log.logRxDataInfo?.rssiDbm != null)
|
||||
_InfoChip(
|
||||
icon: Icons.signal_cellular_alt,
|
||||
label: 'RSSI: ${log.logRxDataInfo!.rssiDbm} dBm',
|
||||
),
|
||||
if (log.logRxDataInfo?.snrDb != null)
|
||||
_InfoChip(
|
||||
icon: Icons.waves,
|
||||
label: 'SNR: ${log.logRxDataInfo!.snrDb!.toStringAsFixed(1)} dB',
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -392,10 +392,12 @@ class BleResponseHandler {
|
||||
final entropy = uniqueBytes / rawPacketData.length;
|
||||
final isLikelyEncrypted = entropy > 0.7;
|
||||
|
||||
// Create decoded info for packet log
|
||||
// Create decoded info for packet log (includes SNR and RSSI)
|
||||
final logRxDataInfo = LogRxDataInfo(
|
||||
entropy: entropy,
|
||||
isLikelyEncrypted: isLikelyEncrypted,
|
||||
snrDb: snrDb,
|
||||
rssiDbm: rssiDbm,
|
||||
);
|
||||
|
||||
// Update the most recent packet log entry
|
||||
|
||||
Reference in New Issue
Block a user