| 1490 | // ═════════════════════════════════════════════════════════════════════════════ |
| 1491 | |
| 1492 | int main(int argc, char* argv[]) |
| 1493 | { |
| 1494 | QCoreApplication app(argc, argv); |
| 1495 | QCoreApplication::setApplicationName(QStringLiteral("smartcat_flexcat_test")); |
| 1496 | |
| 1497 | #if defined(Q_OS_UNIX) |
| 1498 | g_tty = isatty(STDOUT_FILENO); |
| 1499 | #endif |
| 1500 | |
| 1501 | QCommandLineParser parser; |
| 1502 | parser.setApplicationDescription( |
| 1503 | QStringLiteral("AetherSDR FlexCAT (ZZ-extension) dialect CAT integration test")); |
| 1504 | parser.addHelpOption(); |
| 1505 | parser.addOption({ QStringLiteral("host"), QStringLiteral("CAT host"), QStringLiteral("HOST"), QStringLiteral("localhost") }); |
| 1506 | parser.addOption({ QStringLiteral("port"), QStringLiteral("FlexCAT port"), QStringLiteral("PORT"), QStringLiteral("5001") }); |
| 1507 | parser.addOption({ QStringLiteral("timeout"), QStringLiteral("Read timeout (ms)"), QStringLiteral("MS"), QStringLiteral("3000") }); |
| 1508 | parser.addOption({ QStringLiteral("ptt"), QStringLiteral("Enable PTT tests (needs dummy load)") }); |
| 1509 | parser.addOption({ QStringLiteral("cw"), QStringLiteral("Enable CW keyer tests (needs antenna/dummy load)") }); |
| 1510 | const QString defaultPty1 = defaultPtyPath(1); |
| 1511 | parser.addOption({ QStringLiteral("pty"), QStringLiteral("PTY device path for PTY round-trip test (default: %1)").arg(defaultPty1), |
| 1512 | QStringLiteral("PATH"), defaultPty1 }); |
| 1513 | parser.process(app); |
| 1514 | |
| 1515 | const QString host = parser.value(QStringLiteral("host")); |
| 1516 | const quint16 port = static_cast<quint16>(parser.value(QStringLiteral("port")).toUInt()); |
| 1517 | const int timeout = parser.value(QStringLiteral("timeout")).toInt(); |
| 1518 | const bool doPtt = parser.isSet(QStringLiteral("ptt")); |
| 1519 | const bool doCw = parser.isSet(QStringLiteral("cw")); |
| 1520 | const bool doPty = parser.isSet(QStringLiteral("pty")); |
| 1521 | |
| 1522 | std::cout << '\n' << bold(QStringLiteral("AetherSDR FlexCAT (ZZ-extension) Test Suite")).toStdString() << '\n' |
| 1523 | << "Connecting to " << host.toStdString() << ':' << port << " ...\n"; |
| 1524 | |
| 1525 | CatClient c(timeout); |
| 1526 | if (!c.connectToServer(host, port)) { |
| 1527 | std::cerr << red(QStringLiteral("Connection failed.")).toStdString() << '\n' |
| 1528 | << yellow(QStringLiteral("Ensure AetherSDR is running with a FlexCAT port at the given port.")).toStdString() << '\n'; |
| 1529 | return EXIT_FAILURE; |
| 1530 | } |
| 1531 | std::cout << green(QStringLiteral("Connected.")).toStdString() << '\n'; |
| 1532 | if (doPtt) |
| 1533 | std::cout << yellow(QStringLiteral("⚠ PTT tests enabled — ensure a dummy load or antenna is connected")).toStdString() << '\n'; |
| 1534 | if (doCw) |
| 1535 | std::cout << yellow(QStringLiteral("⚠ CW tests enabled — radio will transmit")).toStdString() << '\n'; |
| 1536 | |
| 1537 | Runner r; |
| 1538 | |
| 1539 | qint64 origHz = 14'225'000; |
| 1540 | QString origMode = QStringLiteral("2"); |
| 1541 | { |
| 1542 | QString faResp = c.query(QStringLiteral("FA")); |
| 1543 | if (faResp.startsWith(QLatin1String("FA")) && isDigits(faResp.mid(2), 11)) |
| 1544 | origHz = faResp.mid(2).toLongLong(); |
| 1545 | QString mdResp = c.query(QStringLiteral("MD")); |
| 1546 | if (mdResp.startsWith(QLatin1String("MD"))) |
| 1547 | origMode = mdResp.mid(2); |
| 1548 | } |
| 1549 |
nothing calls this directly
no test coverage detected