Skip to content

Commit

Permalink
Add get_powerstat/set_powerstat to remote control.
Browse files Browse the repository at this point in the history
  • Loading branch information
kukabu committed Feb 6, 2024
1 parent ef84e43 commit 446323b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
8 changes: 6 additions & 2 deletions resources/remote-control.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ Supported commands:
U RECORD <status>
Set status of audio recorder to <status>
u DSP
Get DSP (SDR receiver) status
Get DSP (SDR receiver) status. The command is deprecated, use '\get_powerstat' instead.
U DSP <status>
Set DSP (SDR receiver) status to <status>
Set DSP (SDR receiver) status to <status>. The command is deprecated, use '\set_powerstat' instead.
u RDS
Get RDS decoder to <status>. Only functions in WFM mode.
U RDS <status>
Expand All @@ -60,6 +60,10 @@ Supported commands:
Get 'Split' mode (only usable for hamlib compatibility)
S
Set 'Split' mode (only usable for hamlib compatibility)
\set_powerstat <status>
Set DSP (SDR receiver) status to <status> ‘0’ = Off, ‘1’ = On
\get_powerstat
Get DSP (SDR receiver) status
_
Get version

Expand Down
34 changes: 33 additions & 1 deletion src/applications/gqrx/remote_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ void RemoteControl::startRead()
answer = cmd_get_split_vfo();
else if (cmd == "S")
answer = cmd_set_split_vfo();
else if (cmd == "\\get_powerstat")
answer = cmd_get_powerstat();
else if (cmd == "\\set_powerstat")
answer = cmd_set_powerstat(cmdlist);
else if (cmd == "p")
answer = cmd_get_param(cmdlist);
else if (cmd == "_")
Expand All @@ -261,7 +265,6 @@ void RemoteControl::startRead()
qWarning() << "Unknown remote command:" << cmdlist;
answer = QString("RPRT 1\n");
}

rc_socket->write(answer.toLatin1());
}

Expand Down Expand Up @@ -848,6 +851,35 @@ QString RemoteControl::cmd_set_split_vfo()
return QString("RPRT 1\n");
}

/* Get DSP status */
QString RemoteControl::cmd_get_powerstat() const
{
return QString("%1\n").arg(receiver_running);
};

/* Start/stop DSP */
QString RemoteControl::cmd_set_powerstat(QStringList cmdlist)
{
bool ok;
int cmd_arg = cmdlist.value(1, "").toInt(&ok);
QString answer;

if ((cmd_arg == 0) && ok)
{
emit dspChanged(false);
answer = QString("RPRT 0\n");
}
if ((cmd_arg > 0) && ok)
{
emit dspChanged(true);
answer = QString("RPRT 0\n");
}
else
answer = QString("RPRT 1\n");

return answer;
};

/* Get info */
QString RemoteControl::cmd_get_info() const
{
Expand Down
2 changes: 2 additions & 0 deletions src/applications/gqrx/remote_control.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ private slots:
QString cmd_set_vfo(QStringList cmdlist);
QString cmd_get_split_vfo() const;
QString cmd_set_split_vfo();
QString cmd_get_powerstat() const;
QString cmd_set_powerstat(QStringList cmdlist);
QString cmd_get_info() const;
QString cmd_get_param(QStringList cmdlist);
QString cmd_AOS();
Expand Down

0 comments on commit 446323b

Please sign in to comment.