Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get_powerstat/set_powerstat to remote control. #1335

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading