| 309 | // ═════════════════════════════════════════════════════════════════════════════ |
| 310 | |
| 311 | void section1b(RigctlClient& c, Runner& r) |
| 312 | { |
| 313 | r.section(QStringLiteral("Section 1b — Hamlib Init Probe Commands (WSJT-X compatibility)")); |
| 314 | |
| 315 | // 1b.1 / 1b.2 get/set_powerstat — was RPRT -4 before fix; WSJT-X checks this on init |
| 316 | QStringList lines = c.send(QStringLiteral("\\get_powerstat")); |
| 317 | const QString pwr = c.field(lines, QStringLiteral("Power Status")); |
| 318 | r.check(QStringLiteral("1b.1 get_powerstat returns Power Status: 1"), |
| 319 | c.ok(lines) && pwr == QLatin1String("1"), pwr); |
| 320 | |
| 321 | lines = c.send(QStringLiteral("\\set_powerstat 1")); |
| 322 | r.check(QStringLiteral("1b.2 set_powerstat 1 accepted (RPRT 0)"), c.ok(lines)); |
| 323 | lines = c.send(QStringLiteral("\\set_powerstat 0")); |
| 324 | r.check(QStringLiteral("1b.2b set_powerstat 0 (power off) rejected (RPRT -1)"), |
| 325 | c.rprt(lines) == -1, lines.join(QStringLiteral(" | "))); |
| 326 | |
| 327 | // 1b.3 / 1b.4 get/set_lock_mode — was RPRT -4; WSJT-X interprets -4 as "locked" |
| 328 | lines = c.send(QStringLiteral("\\get_lock_mode")); |
| 329 | const QString lock = c.field(lines, QStringLiteral("Lock Mode")); |
| 330 | r.check(QStringLiteral("1b.3 get_lock_mode returns Lock Mode: 0 (not locked)"), |
| 331 | c.ok(lines) && lock == QLatin1String("0"), lock); |
| 332 | |
| 333 | lines = c.send(QStringLiteral("\\set_lock_mode 0")); |
| 334 | r.check(QStringLiteral("1b.4 set_lock_mode 0 (unlock) accepted (RPRT 0)"), c.ok(lines)); |
| 335 | lines = c.send(QStringLiteral("\\set_lock_mode 1")); |
| 336 | r.check(QStringLiteral("1b.4b set_lock_mode 1 (lock) rejected (RPRT -1)"), |
| 337 | c.rprt(lines) == -1, lines.join(QStringLiteral(" | "))); |
| 338 | |
| 339 | // 1b.5 chk_vfo — must return 1 (VFO mode always active) |
| 340 | lines = c.send(QStringLiteral("\\chk_vfo")); |
| 341 | const QString vfoMode = c.field(lines, QStringLiteral("VFO Mode")); |
| 342 | r.check(QStringLiteral("1b.5 chk_vfo returns VFO Mode: 1"), |
| 343 | c.ok(lines) && vfoMode == QLatin1String("1"), vfoMode); |
| 344 | |
| 345 | // 1b.5b set_vfo_opt — accepted as no-op (VFO mode always active) |
| 346 | lines = c.send(QStringLiteral("\\set_vfo_opt 0")); |
| 347 | r.check(QStringLiteral("1b.5b set_vfo_opt 0 returns RPRT 0"), c.ok(lines)); |
| 348 | |
| 349 | // 1b.6 hamlib_version — version info string |
| 350 | lines = c.send(QStringLiteral("\\hamlib_version")); |
| 351 | const QString hv = c.field(lines, QStringLiteral("Hamlib Version")); |
| 352 | r.check(QStringLiteral("1b.6 hamlib_version returns Hamlib Version field"), |
| 353 | c.ok(lines) && !hv.isEmpty(), hv); |
| 354 | |
| 355 | // 1b.7 get_vfo_list — no split active, so must contain VFOA only |
| 356 | lines = c.send(QStringLiteral("\\get_vfo_list")); |
| 357 | const QString vfoList = c.field(lines, QStringLiteral("VFO List")); |
| 358 | r.check(QStringLiteral("1b.7 get_vfo_list (no split) contains VFOA only"), |
| 359 | c.ok(lines) |
| 360 | && vfoList.contains(QLatin1String("VFOA")) |
| 361 | && !vfoList.contains(QLatin1String("VFOB")), |
| 362 | vfoList); |
| 363 | |
| 364 | // 1b.8 get_modes — must contain USB and LSB |
| 365 | lines = c.send(QStringLiteral("\\get_modes")); |
| 366 | const QString modeList = c.field(lines, QStringLiteral("Modes")); |
| 367 | r.check(QStringLiteral("1b.8 get_modes contains USB and LSB"), |
| 368 | c.ok(lines) |