1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

ChirpChat modulator: API changes and fixes

This commit is contained in:
f4exb 2021-11-21 22:49:27 +01:00
parent 748bb11a78
commit dea312898d
6 changed files with 54 additions and 4 deletions

View File

@ -330,6 +330,9 @@ void ChirpChatMod::applySettings(const ChirpChatModSettings& settings, bool forc
}
}
if ((settings.m_messageRepeat != m_settings.m_messageRepeat) || force) {
reverseAPIKeys.append("messageRepeat");
}
if ((settings.m_udpEnabled != m_settings.m_udpEnabled) || force) {
reverseAPIKeys.append("udpEnabled");
}
@ -549,13 +552,13 @@ void ChirpChatMod::webapiUpdateChannelSettings(
settings.m_messageRepeat = response.getChirpChatModSettings()->getMessageRepeat();
}
if (channelSettingsKeys.contains("udpEnabled")) {
settings.m_udpEnabled = response.getPacketDemodSettings()->getUdpEnabled();
settings.m_udpEnabled = response.getChirpChatModSettings()->getUdpEnabled();
}
if (channelSettingsKeys.contains("udpAddress")) {
settings.m_udpAddress = *response.getPacketDemodSettings()->getUdpAddress();
settings.m_udpAddress = *response.getChirpChatModSettings()->getUdpAddress();
}
if (channelSettingsKeys.contains("udpPort")) {
settings.m_udpPort = response.getPacketDemodSettings()->getUdpPort();
settings.m_udpPort = response.getChirpChatModSettings()->getUdpPort();
}
if (channelSettingsKeys.contains("rgbColor")) {
settings.m_rgbColor = response.getChirpChatModSettings()->getRgbColor();
@ -698,6 +701,7 @@ void ChirpChatMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings&
bytesStr->push_back(new QString(tr("%1").arg(b, 2, 16, QChar('0'))));
}
response.getChirpChatModSettings()->setMessageRepeat(settings.m_messageRepeat);
response.getChirpChatModSettings()->setUdpEnabled(settings.m_udpEnabled);
response.getChirpChatModSettings()->setUdpAddress(new QString(settings.m_udpAddress));
response.getChirpChatModSettings()->setUdpPort(settings.m_udpPort);
@ -732,6 +736,7 @@ void ChirpChatMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& resp
response.getChirpChatModReport()->setPayloadTimeMs(m_currentPayloadTime);
response.getChirpChatModReport()->setTotalTimeMs(m_currentPayloadTime + controlMs);
response.getChirpChatModReport()->setSymbolTimeMs(4.0 * fourthsMs);
response.getChirpChatModReport()->setPlaying(getModulatorActive() ? 1 : 0);
}
void ChirpChatMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const ChirpChatModSettings& settings, bool force)

View File

@ -3556,6 +3556,10 @@ margin-bottom: 20px;
"type" : "number",
"format" : "float",
"description" : "total message duration inc. preamble and SFD (ms)"
},
"playing" : {
"type" : "integer",
"description" : "Boolean - modulator is active (playing) including idle time\n * 0 - Modulator not active\n * 1 - Modulator active\n"
}
},
"description" : "ChirpChatMod"
@ -51367,7 +51371,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-11-21T00:20:10.840+01:00
Generated 2021-11-21T11:04:18.372+01:00
</div>
</div>
</div>

View File

@ -179,3 +179,9 @@ ChirpChatModReport:
description: total message duration inc. preamble and SFD (ms)
type: number
format: float
playing:
type: integer
description: >
Boolean - modulator is active (playing) including idle time
* 0 - Modulator not active
* 1 - Modulator active

View File

@ -179,3 +179,9 @@ ChirpChatModReport:
description: total message duration inc. preamble and SFD (ms)
type: number
format: float
playing:
type: integer
description: >
Boolean - modulator is active (playing) including idle time
* 0 - Modulator not active
* 1 - Modulator active

View File

@ -38,6 +38,8 @@ SWGChirpChatModReport::SWGChirpChatModReport() {
m_payload_time_ms_isSet = false;
total_time_ms = 0.0f;
m_total_time_ms_isSet = false;
playing = 0;
m_playing_isSet = false;
}
SWGChirpChatModReport::~SWGChirpChatModReport() {
@ -56,6 +58,8 @@ SWGChirpChatModReport::init() {
m_payload_time_ms_isSet = false;
total_time_ms = 0.0f;
m_total_time_ms_isSet = false;
playing = 0;
m_playing_isSet = false;
}
void
@ -65,6 +69,7 @@ SWGChirpChatModReport::cleanup() {
}
SWGChirpChatModReport*
@ -88,6 +93,8 @@ SWGChirpChatModReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&total_time_ms, pJson["totalTimeMs"], "float", "");
::SWGSDRangel::setValue(&playing, pJson["playing"], "qint32", "");
}
QString
@ -119,6 +126,9 @@ SWGChirpChatModReport::asJsonObject() {
if(m_total_time_ms_isSet){
obj->insert("totalTimeMs", QJsonValue(total_time_ms));
}
if(m_playing_isSet){
obj->insert("playing", QJsonValue(playing));
}
return obj;
}
@ -173,6 +183,16 @@ SWGChirpChatModReport::setTotalTimeMs(float total_time_ms) {
this->m_total_time_ms_isSet = true;
}
qint32
SWGChirpChatModReport::getPlaying() {
return playing;
}
void
SWGChirpChatModReport::setPlaying(qint32 playing) {
this->playing = playing;
this->m_playing_isSet = true;
}
bool
SWGChirpChatModReport::isSet(){
@ -193,6 +213,9 @@ SWGChirpChatModReport::isSet(){
if(m_total_time_ms_isSet){
isObjectUpdated = true; break;
}
if(m_playing_isSet){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}

View File

@ -56,6 +56,9 @@ public:
float getTotalTimeMs();
void setTotalTimeMs(float total_time_ms);
qint32 getPlaying();
void setPlaying(qint32 playing);
virtual bool isSet() override;
@ -75,6 +78,9 @@ private:
float total_time_ms;
bool m_total_time_ms_isSet;
qint32 playing;
bool m_playing_isSet;
};
}