MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / testKissTxFromFrameLoopbackDecodes

Function testKissTxFromFrameLoopbackDecodes

tests/ax25_libmodem_shim_test.cpp:700–734  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

698}
699
700void testKissTxFromFrameLoopbackDecodes()
701{
702 AetherAx25LibmodemShim txShim;
703 txShim.configure(ax25DemodConfigForProfile(Ax25ModemProfile::Vhf1200));
704
705 // A KISS data frame carries a raw AX.25 frame with no FCS: encode a packet
706 // and drop the trailing 2-byte FCS to simulate what a host app would send.
707 const std::vector<uint8_t> frameWithFcs = lm::ax25::encode_frame(fixedVhf1200AprsTestPacket());
708 const QByteArray ax25NoFcs(reinterpret_cast<const char*>(frameWithFcs.data()),
709 static_cast<qsizetype>(frameWithFcs.size() - 2));
710
711 const Ax25TransmitResult tx = txShim.buildTransmitAudioFromFrame(ax25NoFcs);
712 report("KISS TX-from-frame packetizes", tx.ok);
713 if (!tx.ok)
714 return;
715 report("KISS TX-from-frame is 1200 baud", tx.baud == 1200);
716 report("KISS TX-from-frame appended FCS", tx.frameBytes == ax25NoFcs.size() + 2);
717
718 const std::vector<float> mono = monoFromStereoFloat32(tx.stereoFloat32Pcm);
719 AetherAx25LibmodemShim rxShim;
720 rxShim.configure(ax25DemodConfigForProfile(Ax25ModemProfile::Vhf1200));
721 const auto frames = rxShim.processMonoFloat(mono.data(),
722 static_cast<int>(mono.size()),
723 tx.sampleRate);
724 report("KISS TX-from-frame loopback decodes one frame", frames.size() == 1);
725 if (frames.isEmpty())
726 return;
727 report("KISS TX loopback source", frames.first().source == QStringLiteral("KK7GWY-9"));
728 report("KISS TX loopback payload",
729 frames.first().payloadText
730 == QStringLiteral("!4742.00N/12217.00W>2m APRS via AetherModem 1200 baud"));
731 // RX raw-frame capture must round-trip back to exactly what we keyed.
732 report("KISS RX raw frame bytes match the keyed frame",
733 frames.first().ax25FrameNoFcs == ax25NoFcs);
734}
735
736void testMalformedTransmitMonitorSyntaxIsRejected()
737{

Callers 1

mainFunction · 0.85

Calls 10

monoFromStereoFloat32Function · 0.85
processMonoFloatMethod · 0.80
reportFunction · 0.70
configureMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected