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

Function section9

tests/rigctld_test.cpp:1435–1488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1433// ═════════════════════════════════════════════════════════════════════════════
1434
1435void section9(RigctlClient& c, Runner& r)
1436{
1437 r.section(QStringLiteral("Section 9 — RIT / XIT"));
1438
1439 struct RitCase {
1440 const char* name; const char* cmdGet; const char* cmdSet;
1441 const char* getId; const char* setId; const char* clrId;
1442 };
1443 static constexpr RitCase kTests[] = {
1444 {"RIT", "\\get_rit", "\\set_rit", "9.1", "9.2", "9.3"},
1445 {"XIT", "\\get_xit", "\\set_xit", "9.4", "9.5", nullptr},
1446 };
1447 for (const auto& t : kTests) {
1448 const QString cmdGet = QLatin1String(t.cmdGet);
1449 const QString cmdSet = QLatin1String(t.cmdSet);
1450 const QString nm = QLatin1String(t.name);
1451
1452 QStringList lines = c.send(cmdGet);
1453 const QString val = c.field(lines, nm);
1454 r.check(QStringLiteral("%1 %2 returns numeric offset in Hz")
1455 .arg(QLatin1String(t.getId), cmdGet),
1456 c.ok(lines) && isInt(val), val);
1457
1458 lines = c.send(cmdSet + QStringLiteral(" 500"));
1459 r.check(QStringLiteral("%1 %2 500 returns RPRT 0")
1460 .arg(QLatin1String(t.setId), cmdSet),
1461 c.ok(lines));
1462
1463 // Read-back: confirm 500 Hz was applied
1464 QThread::msleep(100);
1465 lines = c.send(cmdGet);
1466 const QString setConf = c.field(lines, nm);
1467 r.check(QStringLiteral("%1b %2 confirms 500 Hz after set")
1468 .arg(QLatin1String(t.setId), nm),
1469 c.ok(lines) && isInt(setConf) && setConf.toLongLong() == 500, setConf);
1470
1471 if (t.clrId) {
1472 lines = c.send(cmdSet + QStringLiteral(" 0"));
1473 r.check(QStringLiteral("%1 %2 0 clears %3")
1474 .arg(QLatin1String(t.clrId), cmdSet, nm),
1475 c.ok(lines));
1476
1477 // Read-back: confirm offset returned to 0
1478 QThread::msleep(100);
1479 lines = c.send(cmdGet);
1480 const QString clrConf = c.field(lines, nm);
1481 r.check(QStringLiteral("%1b %2 confirms 0 Hz after clear")
1482 .arg(QLatin1String(t.clrId), nm),
1483 c.ok(lines) && isInt(clrConf) && clrConf.toLongLong() == 0, clrConf);
1484 } else {
1485 c.send(cmdSet + QStringLiteral(" 0"));
1486 }
1487 }
1488}
1489
1490// ═════════════════════════════════════════════════════════════════════════════
1491// Section 10 — Antenna

Callers 1

mainFunction · 0.70

Calls 6

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

Tested by

no test coverage detected