| 412 | // ── Command dispatch ──────────────────────────────────────────────────────── |
| 413 | |
| 414 | QString RigctlProtocol::processCommand(const QString& cmd) |
| 415 | { |
| 416 | if (cmd.isEmpty()) |
| 417 | return {}; |
| 418 | |
| 419 | // Long form: \command_name [args] |
| 420 | if (cmd.startsWith('\\')) { |
| 421 | QString rest = cmd.mid(1); |
| 422 | int spaceIdx = rest.indexOf(' '); |
| 423 | QString name = (spaceIdx >= 0) ? rest.left(spaceIdx) : rest; |
| 424 | QString args = (spaceIdx >= 0) ? rest.mid(spaceIdx + 1).trimmed() : QString(); |
| 425 | |
| 426 | if (name == "get_freq") return cmdGetFreq(args); |
| 427 | if (name == "set_freq") return cmdSetFreq(args); |
| 428 | if (name == "get_mode") return cmdGetMode(args); |
| 429 | if (name == "set_mode") return cmdSetMode(args); |
| 430 | if (name == "get_vfo") return cmdGetVfo(); |
| 431 | if (name == "set_vfo") return cmdSetVfo(args); |
| 432 | if (name == "get_ptt") return cmdGetPtt(); |
| 433 | if (name == "set_ptt") return cmdSetPtt(args); |
| 434 | if (name == "get_info") return cmdGetInfo(); |
| 435 | if (name == "get_rig_info") return cmdGetRigInfo(); |
| 436 | if (name == "get_split_vfo") return cmdGetSplitVfo(); |
| 437 | if (name == "set_split_vfo") return cmdSetSplitVfo(args); |
| 438 | if (name == "get_split_freq") return cmdGetSplitFreq(); |
| 439 | if (name == "set_split_freq") return cmdSetSplitFreq(args); |
| 440 | if (name == "get_split_mode") return cmdGetSplitMode(); |
| 441 | if (name == "set_split_mode") return cmdSetSplitMode(args); |
| 442 | if (name == "get_level") return cmdGetLevel(args); |
| 443 | if (name == "set_level") return cmdSetLevel(args); |
| 444 | if (name == "get_func") return cmdGetFunc(args); |
| 445 | if (name == "set_func") return cmdSetFunc(args); |
| 446 | if (name == "get_rit") return cmdGetRit(); |
| 447 | if (name == "set_rit") return cmdSetRit(args); |
| 448 | if (name == "get_xit") return cmdGetXit(); |
| 449 | if (name == "set_xit") return cmdSetXit(args); |
| 450 | if (name == "get_ant") return cmdGetAnt(); |
| 451 | if (name == "set_ant") return cmdSetAnt(args); |
| 452 | if (name == "get_ts") return cmdGetTs(); |
| 453 | if (name == "set_ts") return cmdSetTs(args); |
| 454 | if (name == "get_dcd") return cmdGetDcd(); |
| 455 | if (name == "get_trn") return cmdGetTrn(); |
| 456 | if (name == "set_trn") return cmdSetTrn(args); |
| 457 | if (name == "vfo_op") return cmdVfoOp(args); |
| 458 | if (name == "get_vfo_info") return cmdGetVfoInfo(args); |
| 459 | if (name == "power2mW") return cmdPower2mW(args); |
| 460 | if (name == "mW2power") return cmdMW2power(args); |
| 461 | if (name == "dump_state") return cmdDumpState(); |
| 462 | if (name == "quit") return rprt(0); // ack so Hamlib closes cleanly; socket closes on disconnected signal |
| 463 | if (name == "chk_vfo") { |
| 464 | if (m_extended) |
| 465 | return QStringLiteral("chk_vfo:\nVFO Mode: 1\n") + rprt(0); |
| 466 | return QStringLiteral("1\n"); |
| 467 | } |
| 468 | if (name == "send_morse") return cmdSendMorse(args); |
| 469 | if (name == "stop_morse") return cmdStopMorse(); |
| 470 | if (name == "wait_morse") return rprt(-4); // CWX queue depth not queryable; can't actually wait |
| 471 | if (name == "get_powerstat") { |
no test coverage detected