From 0405dba3fc634659d9185cfddfca7929bfbe1e0b Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Tue, 1 Jan 2019 10:29:35 -0500 Subject: [PATCH] Added RIG.PTT status message to the API --- mainwindow.cpp | 18 ++++++++++++++++-- mainwindow.h | 1 + 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index a65fe7a..11718cb 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -4456,7 +4456,7 @@ void MainWindow::guiUpdate() g_iptt = 1; setRig (); setXIT (ui->TxFreqSpinBox->value ()); - Q_EMIT m_config.transceiver_ptt (true); //Assert the PTT + emitPTT(true); m_tx_when_ready = true; qDebug() << "start threshold" << fTR << lateThreshold; @@ -4910,7 +4910,7 @@ void MainWindow::stopTx() void MainWindow::stopTx2() { - Q_EMIT m_config.transceiver_ptt (false); //Lower PTT + emitPTT(false); } void MainWindow::ba2msg(QByteArray ba, char message[]) //ba2msg() @@ -10463,6 +10463,16 @@ void MainWindow::postWSPRDecode (bool is_new, QStringList parts) #endif } +void MainWindow::emitPTT(bool on){ + Q_EMIT m_config.transceiver_ptt(on); + + // emit to network + sendNetworkMessage("RIG.PTT", on ? "on" : "off", { + {"PTT", QVariant(on)}, + {"UTC", QVariant(DriftingDateTime::currentDateTimeUtc().toMSecsSinceEpoch())}, + }); +} + void MainWindow::networkMessage(Message const &message) { if(!m_config.accept_udp_requests()){ @@ -10478,8 +10488,12 @@ void MainWindow::networkMessage(Message const &message) // Inspired by FLDigi // TODO: MAIN.RX - Turn on RX // TODO: MAIN.TX - Transmit + // TODO: MAIN.PTT - PTT // TODO: MAIN.TUNE - Tune // TODO: MAIN.HALT - Halt + // TODO: MAIN.AUTO - Auto + // TODO: MAIN.SPOT - Spot + // TODO: MAIN.HB - HB // RIG.GET_FREQ - Get the current Frequency // RIG.SET_FREQ - Set the current Frequency diff --git a/mainwindow.h b/mainwindow.h index 023e61a..40d6fa6 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -377,6 +377,7 @@ private slots: void on_cbCQonly_toggled(bool b); void on_cbFirst_toggled(bool b); void on_cbAutoSeq_toggled(bool b); + void emitPTT(bool on); void networkMessage(Message const &message); void sendNetworkMessage(QString const &type, QString const &message); void sendNetworkMessage(QString const &type, QString const &message, const QMap ¶ms);