1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

Simple PTT updates

This commit is contained in:
f4exb 2020-09-28 00:13:53 +02:00
parent cd5a4db876
commit c28ddf2624
6 changed files with 34 additions and 22 deletions

View File

@ -184,8 +184,8 @@ void SimplePTT::applySettings(const SimplePTTSettings& settings, bool force)
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
(m_settings.m_reverseAPIAddress != settings.m_reverseAPIAddress) ||
(m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) ||
(m_settings.m_reverseAPIDeviceIndex != settings.m_reverseAPIDeviceIndex) ||
(m_settings.m_reverseAPIChannelIndex != settings.m_reverseAPIChannelIndex);
(m_settings.m_reverseAPIFeatureSetIndex != settings.m_reverseAPIFeatureSetIndex) ||
(m_settings.m_reverseAPIFeatureIndex != settings.m_reverseAPIFeatureIndex);
webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
}
@ -306,8 +306,8 @@ void SimplePTT::webapiFormatFeatureSettings(
}
response.getSimplePttSettings()->setReverseApiPort(settings.m_reverseAPIPort);
response.getSimplePttSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex);
response.getSimplePttSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex);
response.getSimplePttSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIFeatureSetIndex);
response.getSimplePttSettings()->setReverseApiChannelIndex(settings.m_reverseAPIFeatureIndex);
}
void SimplePTT::webapiUpdateFeatureSettings(
@ -333,6 +333,21 @@ void SimplePTT::webapiUpdateFeatureSettings(
if (featureSettingsKeys.contains("tx2RxDelayMs")) {
settings.m_tx2RxDelayMs = response.getSimplePttSettings()->getTx2RxDelayMs();
}
if (featureSettingsKeys.contains("useReverseAPI")) {
settings.m_useReverseAPI = response.getSimplePttSettings()->getUseReverseApi() != 0;
}
if (featureSettingsKeys.contains("reverseAPIAddress")) {
settings.m_reverseAPIAddress = *response.getSimplePttSettings()->getReverseApiAddress();
}
if (featureSettingsKeys.contains("reverseAPIPort")) {
settings.m_reverseAPIPort = response.getSimplePttSettings()->getReverseApiPort();
}
if (featureSettingsKeys.contains("reverseAPIDeviceIndex")) {
settings.m_reverseAPIFeatureSetIndex = response.getSimplePttSettings()->getReverseApiDeviceIndex();
}
if (featureSettingsKeys.contains("reverseAPIChannelIndex")) {
settings.m_reverseAPIFeatureIndex = response.getSimplePttSettings()->getReverseApiChannelIndex();
}
}
void SimplePTT::webapiFormatFeatureReport(SWGSDRangel::SWGFeatureReport& response)
@ -373,8 +388,8 @@ void SimplePTT::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, c
QString channelSettingsURL = QString("http://%1:%2/sdrangel/featureset/%3/feature/%4/settings")
.arg(settings.m_reverseAPIAddress)
.arg(settings.m_reverseAPIPort)
.arg(settings.m_reverseAPIDeviceIndex)
.arg(settings.m_reverseAPIChannelIndex);
.arg(settings.m_reverseAPIFeatureSetIndex)
.arg(settings.m_reverseAPIFeatureIndex);
m_networkRequest.setUrl(QUrl(channelSettingsURL));
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");

View File

@ -288,8 +288,8 @@ void SimplePTTGUI::onMenuDialogCalled(const QPoint &p)
dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress);
dialog.setReverseAPIPort(m_settings.m_reverseAPIPort);
dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex);
dialog.setReverseAPIChannelIndex(m_settings.m_reverseAPIChannelIndex);
dialog.setReverseAPIFeatureSetIndex(m_settings.m_reverseAPIFeatureSetIndex);
dialog.setReverseAPIFeatureIndex(m_settings.m_reverseAPIFeatureIndex);
dialog.move(p);
dialog.exec();
@ -299,8 +299,8 @@ void SimplePTTGUI::onMenuDialogCalled(const QPoint &p)
m_settings.m_useReverseAPI = dialog.useReverseAPI();
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
m_settings.m_reverseAPIChannelIndex = dialog.getReverseAPIChannelIndex();
m_settings.m_reverseAPIFeatureSetIndex = dialog.getReverseAPIFeatureSetIndex();
m_settings.m_reverseAPIFeatureIndex = dialog.getReverseAPIFeatureIndex();
setWindowTitle(m_settings.m_title);
setTitleColor(m_settings.m_rgbColor);

View File

@ -37,9 +37,6 @@
<property name="windowTitle">
<string>Simple PTT</string>
</property>
<property name="statusTip">
<string>Local Sink</string>
</property>
<widget class="QWidget" name="settingsContainer" native="true">
<property name="geometry">
<rect>

View File

@ -38,8 +38,8 @@ void SimplePTTSettings::resetToDefaults()
m_useReverseAPI = false;
m_reverseAPIAddress = "127.0.0.1";
m_reverseAPIPort = 8888;
m_reverseAPIDeviceIndex = 0;
m_reverseAPIChannelIndex = 0;
m_reverseAPIFeatureSetIndex = 0;
m_reverseAPIFeatureIndex = 0;
}
QByteArray SimplePTTSettings::serialize() const
@ -55,8 +55,8 @@ QByteArray SimplePTTSettings::serialize() const
s.writeBool(7, m_useReverseAPI);
s.writeString(8, m_reverseAPIAddress);
s.writeU32(9, m_reverseAPIPort);
s.writeU32(10, m_reverseAPIDeviceIndex);
s.writeU32(11, m_reverseAPIChannelIndex);
s.writeU32(10, m_reverseAPIFeatureSetIndex);
s.writeU32(11, m_reverseAPIFeatureIndex);
return s.final();
}
@ -95,9 +95,9 @@ bool SimplePTTSettings::deserialize(const QByteArray& data)
}
d.readU32(10, &utmp, 0);
m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp;
m_reverseAPIFeatureSetIndex = utmp > 99 ? 99 : utmp;
d.readU32(11, &utmp, 0);
m_reverseAPIChannelIndex = utmp > 99 ? 99 : utmp;
m_reverseAPIFeatureIndex = utmp > 99 ? 99 : utmp;
return true;
}

View File

@ -34,8 +34,8 @@ struct SimplePTTSettings
bool m_useReverseAPI;
QString m_reverseAPIAddress;
uint16_t m_reverseAPIPort;
uint16_t m_reverseAPIDeviceIndex;
uint16_t m_reverseAPIChannelIndex;
uint16_t m_reverseAPIFeatureSetIndex;
uint16_t m_reverseAPIFeatureIndex;
SimplePTTSettings();
void resetToDefaults();

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
// Copyright (C) 2020 Edouard Griffiths, F4EXB. //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //