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

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())

View File

@ -168,6 +168,7 @@ private:
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const RTLSDRSettings& settings);
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const RTLSDRSettings& settings, bool force);
void webapiReverseSendStartStop(bool start);
private slots:
void networkManagerFinished(QNetworkReply *reply);