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

Function main

tests/rigctld_test.cpp:2224–2344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2222// ═════════════════════════════════════════════════════════════════════════════
2223
2224int main(int argc, char** argv)
2225{
2226 QCoreApplication app(argc, argv);
2227 QCoreApplication::setApplicationName(QStringLiteral("rigctld_test"));
2228
2229#if defined(Q_OS_UNIX)
2230 g_tty = isatty(STDOUT_FILENO);
2231#endif
2232
2233 QCommandLineParser parser;
2234 parser.setApplicationDescription(
2235 QStringLiteral("AetherSDR rigctld protocol integration test.\n"
2236 "Requires a running AetherSDR instance with rigctld enabled.\n"
2237 "\nPTT tests (section 6) and CW/Morse tests (section 11) are\n"
2238 "disabled by default — enable only when a dummy load or antenna\n"
2239 "is connected."));
2240 parser.addHelpOption();
2241
2242 QCommandLineOption hostOpt({QStringLiteral("host")},
2243 QStringLiteral("rigctld host (default: localhost)"),
2244 QStringLiteral("HOST"), QStringLiteral("localhost"));
2245 QCommandLineOption portOpt({QStringLiteral("port")},
2246 QStringLiteral("rigctld TCP port (default: 4532)"),
2247 QStringLiteral("PORT"), QStringLiteral("4532"));
2248 QCommandLineOption timeoutOpt({QStringLiteral("timeout")},
2249 QStringLiteral("socket read timeout in milliseconds (default: 3000)"),
2250 QStringLiteral("MS"), QStringLiteral("3000"));
2251 QCommandLineOption pttOpt({QStringLiteral("ptt")},
2252 QStringLiteral("enable PTT tests (section 6) — requires dummy load or antenna"));
2253 QCommandLineOption cwOpt({QStringLiteral("cw")},
2254 QStringLiteral("enable CW/Morse tests (section 11) — requires --ptt and CW mode"));
2255 const QString defaultPty0 = defaultPtyPath(0);
2256 QCommandLineOption ptyOpt({QStringLiteral("pty")},
2257 QStringLiteral("PTY device path for section 16 (default: %1)").arg(defaultPty0),
2258 QStringLiteral("PATH"), defaultPty0);
2259
2260 parser.addOption(hostOpt);
2261 parser.addOption(portOpt);
2262 parser.addOption(timeoutOpt);
2263 parser.addOption(pttOpt);
2264 parser.addOption(cwOpt);
2265 parser.addOption(ptyOpt);
2266 parser.process(app);
2267
2268 const QString host = parser.value(hostOpt);
2269 const quint16 port = static_cast<quint16>(parser.value(portOpt).toUShort());
2270 const int timeout = parser.value(timeoutOpt).toInt();
2271 const bool doPtt = parser.isSet(pttOpt);
2272 const bool doCw = parser.isSet(cwOpt);
2273 const QString ptyPath = parser.value(ptyOpt);
2274
2275 std::cout << '\n' << bold(QStringLiteral("AetherSDR rigctld Test Suite")).toStdString() << '\n'
2276 << "Connecting to " << host.toStdString() << ':' << port << " ...\n";
2277
2278 RigctlClient c(timeout);
2279 if (!c.connectToServer(host, port))
2280 return 1;
2281

Callers

nothing calls this directly

Calls 15

section1bFunction · 0.85
section6PttFunction · 0.85
section6SkipFunction · 0.85
section11CwFunction · 0.85
section11SkipFunction · 0.85
section14Function · 0.85
sectionEdgeFunction · 0.85
sectionPtyFunction · 0.85
defaultPtyPathFunction · 0.70
boldFunction · 0.70
greenFunction · 0.70
yellowFunction · 0.70

Tested by

no test coverage detected