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

Function section10

tests/rigctld_test.cpp:1494–1531  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1492// ═════════════════════════════════════════════════════════════════════════════
1493
1494void section10(RigctlClient& c, Runner& r)
1495{
1496 r.section(QStringLiteral("Section 10 — Antenna"));
1497
1498 QStringList lines = c.send(QStringLiteral("\\get_ant"));
1499 const QString ant = c.field(lines, QStringLiteral("Ant"));
1500 r.check(QStringLiteral("10.1 get_ant returns antenna mask (1=ANT1, 2=ANT2, 4=ANT3, 8=XVTR)"),
1501 c.ok(lines) && isInt(ant) && ant.toInt() > 0, ant);
1502
1503 const QString origAnt = ant;
1504 const QString target = (ant == QLatin1String("2"))
1505 ? QStringLiteral("1") : QStringLiteral("2");
1506
1507 lines = c.send(QStringLiteral("\\set_ant ") + target);
1508 r.check(QStringLiteral("10.2 set_ant %1 returns RPRT 0").arg(target), c.ok(lines));
1509 QThread::msleep(100);
1510
1511 lines = c.send(QStringLiteral("\\get_ant"));
1512 const QString newAnt = c.field(lines, QStringLiteral("Ant"));
1513 r.check(QStringLiteral("10.3 get_ant confirms switch to antenna %1").arg(target),
1514 c.ok(lines) && newAnt == target, newAnt);
1515
1516 // Restore to ANT1 (dummy load) and confirm
1517 QThread::msleep(100);
1518 c.send(QStringLiteral("\\set_ant 1"));
1519 QThread::msleep(100);
1520 lines = c.send(QStringLiteral("\\get_ant"));
1521 const QString restored = c.field(lines, QStringLiteral("Ant"));
1522 r.check(QStringLiteral("10.4 set_ant 1 restores to ANT1"),
1523 c.ok(lines) && restored == QLatin1String("1"), restored);
1524
1525 // 10.5 set_ant ? capability probe
1526 lines = c.send(QStringLiteral("\\set_ant ?"));
1527 const bool hasAnts = std::any_of(lines.cbegin(), lines.cend(),
1528 [](const QString& l){ return l.contains(QLatin1String("Ants")); });
1529 r.check(QStringLiteral("10.5 set_ant ? returns Ants capability list"),
1530 c.ok(lines) && hasAnts, lines.join(QStringLiteral(" | ")));
1531}
1532
1533// ═════════════════════════════════════════════════════════════════════════════
1534// Section 11 — CW / Morse (optional — requires PTT and CW mode)

Callers 1

mainFunction · 0.70

Calls 7

isIntFunction · 0.85
containsMethod · 0.80
sectionMethod · 0.45
sendMethod · 0.45
fieldMethod · 0.45
checkMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected