mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-04-20 22:13:48 +00:00
- Companion radio stats: poll and display noise floor, RSSI, SNR, airtime with dedicated ValueNotifier and ref-counted polling - Adaptive RF-aware TX backoff based on radio conditions instead of fixed 5s - Variable-width path hash support (1-3 bytes per hop) - Air activity dot indicator in app bar with tap to open stats screen - Jump to oldest unread setting for chat screens - 1s send cooldown on DM and channel messages - Link style: theme-aware orange, added EmailLinkifier - New languages: Hungarian, Japanese, Korean - Remove dead DeviceScreen and BatteryIndicatorChip - Remove wakelock_plus dependency - TX power fields now read as signed int8
39 lines
1,013 B
Dart
39 lines
1,013 B
Dart
import 'dart:typed_data';
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:meshcore_open/connector/meshcore_protocol.dart';
|
|
import 'package:meshcore_open/models/companion_radio_stats.dart';
|
|
|
|
void main() {
|
|
test('CompanionRadioStats.tryParse golden 14-byte radio frame', () {
|
|
// noise -90 (0xA6FF LE), rssi -70 (0xBA), snr raw 8 -> 2.0 dB,
|
|
// tx_air 1000 LE, rx_air 2000 LE
|
|
final frame = Uint8List.fromList([
|
|
respCodeStats,
|
|
statsTypeRadio,
|
|
0xA6,
|
|
0xFF,
|
|
0xBA,
|
|
0x08,
|
|
0xE8,
|
|
0x03,
|
|
0x00,
|
|
0x00,
|
|
0xD0,
|
|
0x07,
|
|
0x00,
|
|
0x00,
|
|
]);
|
|
final s = CompanionRadioStats.tryParse(frame);
|
|
expect(s, isNotNull);
|
|
expect(s!.noiseFloorDbm, -90);
|
|
expect(s.lastRssiDbm, -70);
|
|
expect(s.lastSnrDb, 2.0);
|
|
expect(s.txAirSecs, 1000);
|
|
expect(s.rxAirSecs, 2000);
|
|
});
|
|
|
|
test('CompanionRadioStats.tryParse rejects short frame', () {
|
|
expect(CompanionRadioStats.tryParse(Uint8List(10)), isNull);
|
|
});
|
|
}
|