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

Function main

tests/transmit_model_test.cpp:21–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19} // namespace
20
21int main(int argc, char** argv)
22{
23 QCoreApplication app(argc, argv);
24
25 TransmitModel tx;
26 QStringList commands;
27 QStringList blockedMessages;
28 QObject::connect(&tx, &TransmitModel::commandReady,
29 [&commands](const QString& cmd) { commands.append(cmd); });
30 QObject::connect(&tx, &TransmitModel::pttBlocked,
31 [&blockedMessages](const QString& message) { blockedMessages.append(message); });
32
33 bool ok = true;
34
35 tx.startTwoToneTune();
36 ok &= expect(commands == QStringList({
37 "transmit set tune_mode=two_tone",
38 "transmit tune 1",
39 }),
40 "two-tone tune sets mode before starting tune");
41
42 tx.applyTransmitStatus({{"tune", "1"}});
43 commands.clear();
44 tx.toggleTwoToneTune();
45 ok &= expect(commands == QStringList({
46 "transmit tune 0",
47 "transmit set tune_mode=single_tone",
48 }),
49 "two-tone tune toggle stops and restores single-tone mode");
50
51 tx.applyTransmitStatus({{"tune", "0"}});
52 commands.clear();
53 tx.toggleTwoToneTune();
54 ok &= expect(commands == QStringList({
55 "transmit set tune_mode=two_tone",
56 "transmit tune 1",
57 }),
58 "two-tone tune toggle starts two-tone when not tuning");
59
60 commands.clear();
61 tx.setTuneMode("single_tone");
62 ok &= expect(commands == QStringList({"transmit set tune_mode=single_tone"}),
63 "single-tone tune mode command is accepted");
64
65 commands.clear();
66 tx.setTuneMode("invalid");
67 ok &= expect(commands.isEmpty(),
68 "invalid tune mode is ignored");
69
70 commands.clear();
71 tx.setDexp(true);
72 ok &= expect(commands == QStringList({"transmit set compander=1"})
73 && tx.dexpOn()
74 && tx.companderOn(),
75 "DEXP toggle sends compander command and updates local state");
76
77 commands.clear();
78 tx.setDexpLevel(42);

Callers

nothing calls this directly

Calls 15

startTwoToneTuneMethod · 0.80
applyTransmitStatusMethod · 0.80
toggleTwoToneTuneMethod · 0.80
setTuneModeMethod · 0.80
setDexpMethod · 0.80
dexpOnMethod · 0.80
companderOnMethod · 0.80
setDexpLevelMethod · 0.80
dexpLevelMethod · 0.80
companderLevelMethod · 0.80
setPttPreflightMethod · 0.80
startTuneMethod · 0.80

Tested by

no test coverage detected