mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
Add transmission timing details
This commit is contained in:
27
test/models/message_reception_details_test.dart
Normal file
27
test/models/message_reception_details_test.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:meshcore_sar_app/models/message_reception_details.dart';
|
||||
|
||||
void main() {
|
||||
test('round trips reception details json', () {
|
||||
final details = MessageReceptionDetails(
|
||||
capturedAt: DateTime.fromMillisecondsSinceEpoch(1700000000000),
|
||||
packetLoggedAt: DateTime.fromMillisecondsSinceEpoch(1700000000500),
|
||||
rssiDbm: -92,
|
||||
snrDb: 7.5,
|
||||
pathBytes: const [0xAA, 0xBB, 0xCC],
|
||||
senderToReceiptMs: 4200,
|
||||
estimatedTransmitMs: 1800,
|
||||
postTransmitDelayMs: 2400,
|
||||
);
|
||||
|
||||
final decoded = MessageReceptionDetails.fromJson(details.toJson());
|
||||
|
||||
expect(decoded, isNotNull);
|
||||
expect(decoded!.rssiDbm, -92);
|
||||
expect(decoded.snrDb, 7.5);
|
||||
expect(decoded.pathBytesHex, 'aa:bb:cc');
|
||||
expect(decoded.senderToReceiptMs, 4200);
|
||||
expect(decoded.estimatedTransmitMs, 1800);
|
||||
expect(decoded.postTransmitDelayMs, 2400);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user