1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 13:47:01 -04:00

Reverse API: RTL-SDR input changes (2)

This commit is contained in:
f4exb
2018-12-17 15:00:13 +01:00
parent b29c3b5db8
commit 082fcc000d
2 changed files with 21 additions and 2 deletions
+20 -2
View File
@@ -333,8 +333,7 @@ bool RTLSDRInput::handleMessage(const Message& message)
if (cmd.getStartStop())
{
if (m_deviceAPI->initAcquisition())
{
if (m_deviceAPI->initAcquisition()) {
m_deviceAPI->startAcquisition();
}
}
@@ -343,6 +342,10 @@ bool RTLSDRInput::handleMessage(const Message& message)
m_deviceAPI->stopAcquisition();
}
if (m_settings.m_useReverseAPI) {
webapiReverseSendStartStop(cmd.getStartStop());
}
return true;
}
else
@@ -812,6 +815,21 @@ void RTLSDRInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys,
delete swgDeviceSettings;
}
void RTLSDRInput::webapiReverseSendStartStop(bool start)
{
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/run")
.arg(m_settings.m_reverseAPIAddress)
.arg(m_settings.m_reverseAPIPort)
.arg(m_settings.m_reverseAPIDeviceIndex);
m_networkRequest.setUrl(QUrl(channelSettingsURL));
if (start) {
m_networkManager->sendCustomRequest(m_networkRequest, "POST");
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE");
}
}
void RTLSDRInput::networkManagerFinished(QNetworkReply *reply)
{
if (reply->error())