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

Packet Modulator: REST API: added missing settings - implementation

This commit is contained in:
f4exb 2020-09-24 22:39:39 +02:00
parent efdc8093c6
commit cc97dd15a9
2 changed files with 276 additions and 12 deletions

View File

@ -198,6 +198,30 @@ void PacketMod::applySettings(const PacketModSettings& settings, bool force)
reverseAPIKeys.append("repeatCount"); reverseAPIKeys.append("repeatCount");
} }
if ((settings.m_rampUpBits != m_settings.m_rampUpBits) || force) {
reverseAPIKeys.append("rampUpBits");
}
if ((settings.m_rampDownBits != m_settings.m_rampDownBits) || force) {
reverseAPIKeys.append("rampDownBits");
}
if ((settings.m_rampRange != m_settings.m_rampRange) || force) {
reverseAPIKeys.append("rampRange");
}
if ((settings.m_modulateWhileRamping != m_settings.m_modulateWhileRamping) || force) {
reverseAPIKeys.append("modulateWhileRamping");
}
if ((settings.m_markFrequency != m_settings.m_markFrequency) || force) {
reverseAPIKeys.append("markFrequency");
}
if ((settings.m_spaceFrequency != m_settings.m_spaceFrequency) || force) {
reverseAPIKeys.append("spaceFrequency");
}
if((settings.m_ax25PreFlags != m_settings.m_ax25PreFlags) || force) { if((settings.m_ax25PreFlags != m_settings.m_ax25PreFlags) || force) {
reverseAPIKeys.append("ax25PreFlags"); reverseAPIKeys.append("ax25PreFlags");
} }
@ -206,6 +230,14 @@ void PacketMod::applySettings(const PacketModSettings& settings, bool force)
reverseAPIKeys.append("ax25PostFlags"); reverseAPIKeys.append("ax25PostFlags");
} }
if((settings.m_ax25Control != m_settings.m_ax25Control) || force) {
reverseAPIKeys.append("ax25Control");
}
if((settings.m_ax25PID != m_settings.m_ax25PID) || force) {
reverseAPIKeys.append("ax25PID");
}
if((settings.m_preEmphasis != m_settings.m_preEmphasis) || force) { if((settings.m_preEmphasis != m_settings.m_preEmphasis) || force) {
reverseAPIKeys.append("preEmphasis"); reverseAPIKeys.append("preEmphasis");
} }
@ -218,6 +250,42 @@ void PacketMod::applySettings(const PacketModSettings& settings, bool force)
reverseAPIKeys.append("preEmphasisHighFreq"); reverseAPIKeys.append("preEmphasisHighFreq");
} }
if((settings.m_lpfTaps != m_settings.m_lpfTaps) || force) {
reverseAPIKeys.append("lpfTaps");
}
if((settings.m_bbNoise != m_settings.m_bbNoise) || force) {
reverseAPIKeys.append("bbNoise");
}
if((settings.m_rfNoise != m_settings.m_rfNoise) || force) {
reverseAPIKeys.append("rfNoise");
}
if((settings.m_writeToFile != m_settings.m_writeToFile) || force) {
reverseAPIKeys.append("writeToFile");
}
if((settings.m_spectrumRate != m_settings.m_spectrumRate) || force) {
reverseAPIKeys.append("spectrumRate");
}
if((settings.m_callsign != m_settings.m_callsign) || force) {
reverseAPIKeys.append("callsign");
}
if((settings.m_to != m_settings.m_to) || force) {
reverseAPIKeys.append("to");
}
if((settings.m_via != m_settings.m_via) || force) {
reverseAPIKeys.append("via");
}
if((settings.m_data != m_settings.m_data) || force) {
reverseAPIKeys.append("data");
}
if((settings.m_bpf != m_settings.m_bpf) || force) { if((settings.m_bpf != m_settings.m_bpf) || force) {
reverseAPIKeys.append("bpf"); reverseAPIKeys.append("bpf");
} }
@ -230,6 +298,26 @@ void PacketMod::applySettings(const PacketModSettings& settings, bool force)
reverseAPIKeys.append("bpfHighCutoff"); reverseAPIKeys.append("bpfHighCutoff");
} }
if((settings.m_bpfTaps != m_settings.m_bpfTaps) || force) {
reverseAPIKeys.append("bpfTaps");
}
if((settings.m_scramble != m_settings.m_scramble) || force) {
reverseAPIKeys.append("scramble");
}
if((settings.m_polynomial != m_settings.m_polynomial) || force) {
reverseAPIKeys.append("polynomial");
}
if((settings.m_beta != m_settings.m_beta) || force) {
reverseAPIKeys.append("beta");
}
if((settings.m_symbolSpan != m_settings.m_symbolSpan) || force) {
reverseAPIKeys.append("symbolSpan");
}
if (m_settings.m_streamIndex != settings.m_streamIndex) if (m_settings.m_streamIndex != settings.m_streamIndex)
{ {
if (m_deviceAPI->getSampleMIMO()) // change of stream is possible for MIMO devices only if (m_deviceAPI->getSampleMIMO()) // change of stream is possible for MIMO devices only
@ -348,12 +436,36 @@ void PacketMod::webapiUpdateChannelSettings(
if (channelSettingsKeys.contains("repeatCount")) { if (channelSettingsKeys.contains("repeatCount")) {
settings.m_repeatCount = response.getPacketModSettings()->getRepeatCount(); settings.m_repeatCount = response.getPacketModSettings()->getRepeatCount();
} }
if (channelSettingsKeys.contains("rampUpBits")) {
settings.m_rampUpBits = response.getPacketModSettings()->getRampUpBits();
}
if (channelSettingsKeys.contains("rampDownBits")) {
settings.m_rampDownBits = response.getPacketModSettings()->getRampDownBits();
}
if (channelSettingsKeys.contains("rampRange")) {
settings.m_rampRange = response.getPacketModSettings()->getRampRange();
}
if (channelSettingsKeys.contains("modulateWhileRamping")) {
settings.m_modulateWhileRamping = response.getPacketModSettings()->getModulateWhileRamping() != 0;
}
if (channelSettingsKeys.contains("markFrequency")) {
settings.m_markFrequency = response.getPacketModSettings()->getMarkFrequency();
}
if (channelSettingsKeys.contains("spaceFrequency")) {
settings.m_spaceFrequency = response.getPacketModSettings()->getSpaceFrequency();
}
if (channelSettingsKeys.contains("ax25PreFlags")) { if (channelSettingsKeys.contains("ax25PreFlags")) {
settings.m_ax25PreFlags = response.getPacketModSettings()->getAx25PreFlags(); settings.m_ax25PreFlags = response.getPacketModSettings()->getAx25PreFlags();
} }
if (channelSettingsKeys.contains("ax25PostFlags")) { if (channelSettingsKeys.contains("ax25PostFlags")) {
settings.m_ax25PostFlags = response.getPacketModSettings()->getAx25PostFlags(); settings.m_ax25PostFlags = response.getPacketModSettings()->getAx25PostFlags();
} }
if (channelSettingsKeys.contains("ax25Control")) {
settings.m_ax25Control = response.getPacketModSettings()->getAx25Control();
}
if (channelSettingsKeys.contains("ax25PID")) {
settings.m_ax25PID = response.getPacketModSettings()->getAx25Pid();
}
if (channelSettingsKeys.contains("preEmphasis")) { if (channelSettingsKeys.contains("preEmphasis")) {
settings.m_preEmphasis = response.getPacketModSettings()->getPreEmphasis() != 0; settings.m_preEmphasis = response.getPacketModSettings()->getPreEmphasis() != 0;
} }
@ -363,6 +475,33 @@ void PacketMod::webapiUpdateChannelSettings(
if (channelSettingsKeys.contains("preEmphasisHighFreq")) { if (channelSettingsKeys.contains("preEmphasisHighFreq")) {
settings.m_preEmphasisHighFreq = response.getPacketModSettings()->getPreEmphasisHighFreq(); settings.m_preEmphasisHighFreq = response.getPacketModSettings()->getPreEmphasisHighFreq();
} }
if (channelSettingsKeys.contains("lpfTaps")) {
settings.m_lpfTaps = response.getPacketModSettings()->getLpfTaps();
}
if (channelSettingsKeys.contains("bbNoise")) {
settings.m_bbNoise = response.getPacketModSettings()->getBbNoise() != 0;
}
if (channelSettingsKeys.contains("rfNoise")) {
settings.m_rfNoise = response.getPacketModSettings()->getRfNoise() != 0;
}
if (channelSettingsKeys.contains("writeToFile")) {
settings.m_writeToFile = response.getPacketModSettings()->getWriteToFile() != 0;
}
if (channelSettingsKeys.contains("spectrumRate")) {
settings.m_spectrumRate = response.getPacketModSettings()->getSpectrumRate();
}
if (channelSettingsKeys.contains("callsign")) {
settings.m_callsign = *response.getPacketModSettings()->getCallsign();
}
if (channelSettingsKeys.contains("to")) {
settings.m_to = *response.getPacketModSettings()->getTo();
}
if (channelSettingsKeys.contains("via")) {
settings.m_via = *response.getPacketModSettings()->getVia();
}
if (channelSettingsKeys.contains("data")) {
settings.m_data = *response.getPacketModSettings()->getData();
}
if (channelSettingsKeys.contains("bpf")) { if (channelSettingsKeys.contains("bpf")) {
settings.m_bpf = response.getPacketModSettings()->getBpf() != 0; settings.m_bpf = response.getPacketModSettings()->getBpf() != 0;
} }
@ -372,6 +511,21 @@ void PacketMod::webapiUpdateChannelSettings(
if (channelSettingsKeys.contains("bpfHighCutoff")) { if (channelSettingsKeys.contains("bpfHighCutoff")) {
settings.m_bpfHighCutoff = response.getPacketModSettings()->getBpfHighCutoff(); settings.m_bpfHighCutoff = response.getPacketModSettings()->getBpfHighCutoff();
} }
if (channelSettingsKeys.contains("bpfTaps")) {
settings.m_bpfTaps = response.getPacketModSettings()->getBpfTaps();
}
if (channelSettingsKeys.contains("scramble")) {
settings.m_scramble = response.getPacketModSettings()->getScramble() != 0;
}
if (channelSettingsKeys.contains("polynomial")) {
settings.m_polynomial = response.getPacketModSettings()->getPolynomial();
}
if (channelSettingsKeys.contains("beta")) {
settings.m_beta = response.getPacketModSettings()->getBeta();
}
if (channelSettingsKeys.contains("symbolSpan")) {
settings.m_symbolSpan = response.getPacketModSettings()->getSymbolSpan();
}
if (channelSettingsKeys.contains("rgbColor")) { if (channelSettingsKeys.contains("rgbColor")) {
settings.m_rgbColor = response.getPacketModSettings()->getRgbColor(); settings.m_rgbColor = response.getPacketModSettings()->getRgbColor();
} }
@ -450,14 +604,59 @@ void PacketMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& res
response.getPacketModSettings()->setRepeat(settings.m_repeat ? 1 : 0); response.getPacketModSettings()->setRepeat(settings.m_repeat ? 1 : 0);
response.getPacketModSettings()->setRepeatDelay(settings.m_repeatDelay); response.getPacketModSettings()->setRepeatDelay(settings.m_repeatDelay);
response.getPacketModSettings()->setRepeatCount(settings.m_repeatCount); response.getPacketModSettings()->setRepeatCount(settings.m_repeatCount);
response.getPacketModSettings()->setRampUpBits(settings.m_rampUpBits);
response.getPacketModSettings()->setRampDownBits(settings.m_rampDownBits);
response.getPacketModSettings()->setRampRange(settings.m_rampRange);
response.getPacketModSettings()->setModulateWhileRamping(settings.m_modulateWhileRamping ? 1 : 0);
response.getPacketModSettings()->setMarkFrequency(settings.m_markFrequency);
response.getPacketModSettings()->setSpaceFrequency(settings.m_spaceFrequency);
response.getPacketModSettings()->setAx25PreFlags(settings.m_ax25PreFlags); response.getPacketModSettings()->setAx25PreFlags(settings.m_ax25PreFlags);
response.getPacketModSettings()->setAx25PostFlags(settings.m_ax25PostFlags); response.getPacketModSettings()->setAx25PostFlags(settings.m_ax25PostFlags);
response.getPacketModSettings()->setAx25Control(settings.m_ax25Control);
response.getPacketModSettings()->setAx25Pid(settings.m_ax25PID);
response.getPacketModSettings()->setPreEmphasis(settings.m_preEmphasis ? 1 : 0); response.getPacketModSettings()->setPreEmphasis(settings.m_preEmphasis ? 1 : 0);
response.getPacketModSettings()->setPreEmphasisTau(settings.m_preEmphasisTau); response.getPacketModSettings()->setPreEmphasisTau(settings.m_preEmphasisTau);
response.getPacketModSettings()->setPreEmphasisHighFreq(settings.m_preEmphasisHighFreq); response.getPacketModSettings()->setPreEmphasisHighFreq(settings.m_preEmphasisHighFreq);
response.getPacketModSettings()->setLpfTaps(settings.m_lpfTaps);
response.getPacketModSettings()->setBbNoise(settings.m_bbNoise ? 1 : 0);
response.getPacketModSettings()->setRfNoise(settings.m_rfNoise ? 1 : 0);
response.getPacketModSettings()->setWriteToFile(settings.m_writeToFile ? 1 : 0);
response.getPacketModSettings()->setSpectrumRate(settings.m_spectrumRate);
if (response.getPacketModSettings()->getCallsign()) {
*response.getPacketModSettings()->getCallsign() = settings.m_callsign;
} else {
response.getPacketModSettings()->setCallsign(new QString(settings.m_callsign));
}
if (response.getPacketModSettings()->getTo()) {
*response.getPacketModSettings()->getTo() = settings.m_to;
} else {
response.getPacketModSettings()->setTo(new QString(settings.m_to));
}
if (response.getPacketModSettings()->getVia()) {
*response.getPacketModSettings()->getVia() = settings.m_via;
} else {
response.getPacketModSettings()->setVia(new QString(settings.m_via));
}
if (response.getPacketModSettings()->getData()) {
*response.getPacketModSettings()->getData() = settings.m_data;
} else {
response.getPacketModSettings()->setData(new QString(settings.m_data));
}
response.getPacketModSettings()->setBpf(settings.m_bpf ? 1 : 0); response.getPacketModSettings()->setBpf(settings.m_bpf ? 1 : 0);
response.getPacketModSettings()->setBpfLowCutoff(settings.m_bpfLowCutoff); response.getPacketModSettings()->setBpfLowCutoff(settings.m_bpfLowCutoff);
response.getPacketModSettings()->setBpfHighCutoff(settings.m_bpfHighCutoff); response.getPacketModSettings()->setBpfHighCutoff(settings.m_bpfHighCutoff);
response.getPacketModSettings()->setBpfTaps(settings.m_bpfTaps);
response.getPacketModSettings()->setScramble(settings.m_scramble ? 1 : 0);
response.getPacketModSettings()->setPolynomial(settings.m_polynomial);
response.getPacketModSettings()->setPulseShaping(settings.m_pulseShaping ? 1 : 0);
response.getPacketModSettings()->setBeta(settings.m_beta);
response.getPacketModSettings()->setSymbolSpan(settings.m_symbolSpan);
response.getPacketModSettings()->setRgbColor(settings.m_rgbColor); response.getPacketModSettings()->setRgbColor(settings.m_rgbColor);
if (response.getPacketModSettings()->getTitle()) { if (response.getPacketModSettings()->getTitle()) {
@ -521,14 +720,38 @@ void PacketMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, c
if (channelSettingsKeys.contains("repeatCount") || force) { if (channelSettingsKeys.contains("repeatCount") || force) {
swgPacketModSettings->setRepeatCount(settings.m_repeatCount); swgPacketModSettings->setRepeatCount(settings.m_repeatCount);
} }
if (channelSettingsKeys.contains("rampUpBits")) {
swgPacketModSettings->setRampUpBits(settings.m_rampUpBits);
}
if (channelSettingsKeys.contains("rampDownBits")) {
swgPacketModSettings->setRampDownBits(settings.m_rampDownBits);
}
if (channelSettingsKeys.contains("rampRange")) {
swgPacketModSettings->setRampRange(settings.m_rampRange);
}
if (channelSettingsKeys.contains("modulateWhileRamping")) {
swgPacketModSettings->setRampRange(settings.m_modulateWhileRamping ? 1 : 0);
}
if (channelSettingsKeys.contains("markFrequency")) {
swgPacketModSettings->setMarkFrequency(settings.m_markFrequency);
}
if (channelSettingsKeys.contains("spaceFrequency")) {
swgPacketModSettings->setSpaceFrequency(settings.m_spaceFrequency);
}
if (channelSettingsKeys.contains("ax25PreFlags") || force) { if (channelSettingsKeys.contains("ax25PreFlags") || force) {
swgPacketModSettings->setAx25PreFlags(settings.m_ax25PreFlags); swgPacketModSettings->setAx25PreFlags(settings.m_ax25PreFlags);
} }
if (channelSettingsKeys.contains("ax25PostFlags") || force) { if (channelSettingsKeys.contains("ax25PostFlags") || force) {
swgPacketModSettings->setAx25PostFlags(settings.m_ax25PostFlags); swgPacketModSettings->setAx25PostFlags(settings.m_ax25PostFlags);
} }
if (channelSettingsKeys.contains("ax25Control")) {
swgPacketModSettings->setAx25Control(settings.m_ax25Control);
}
if (channelSettingsKeys.contains("ax25PID")) {
swgPacketModSettings->setAx25Pid(settings.m_ax25PID);
}
if (channelSettingsKeys.contains("preEmphasis") || force) { if (channelSettingsKeys.contains("preEmphasis") || force) {
swgPacketModSettings->setPreEmphasis(settings.m_preEmphasis); swgPacketModSettings->setPreEmphasis(settings.m_preEmphasis ? 1 : 0);
} }
if (channelSettingsKeys.contains("preEmphasisTau") || force) { if (channelSettingsKeys.contains("preEmphasisTau") || force) {
swgPacketModSettings->setPreEmphasisTau(settings.m_preEmphasisTau); swgPacketModSettings->setPreEmphasisTau(settings.m_preEmphasisTau);
@ -536,8 +759,35 @@ void PacketMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, c
if (channelSettingsKeys.contains("preEmphasisHighFreq") || force) { if (channelSettingsKeys.contains("preEmphasisHighFreq") || force) {
swgPacketModSettings->setPreEmphasisHighFreq(settings.m_preEmphasisHighFreq); swgPacketModSettings->setPreEmphasisHighFreq(settings.m_preEmphasisHighFreq);
} }
if (channelSettingsKeys.contains("lpfTaps")) {
swgPacketModSettings->setLpfTaps(settings.m_lpfTaps);
}
if (channelSettingsKeys.contains("bbNoise")) {
swgPacketModSettings->setBbNoise(settings.m_bbNoise ? 1 : 0);
}
if (channelSettingsKeys.contains("rfNoise")) {
swgPacketModSettings->setRfNoise(settings.m_rfNoise ? 1 : 0);
}
if (channelSettingsKeys.contains("writeToFile")) {
swgPacketModSettings->setWriteToFile(settings.m_writeToFile ? 1 : 0);
}
if (channelSettingsKeys.contains("spectrumRate")) {
swgPacketModSettings->setSpectrumRate(settings.m_spectrumRate);
}
if (channelSettingsKeys.contains("callsign")) {
swgPacketModSettings->setCallsign(new QString(settings.m_callsign));
}
if (channelSettingsKeys.contains("to")) {
swgPacketModSettings->setTo(new QString(settings.m_to));
}
if (channelSettingsKeys.contains("via")) {
swgPacketModSettings->setVia(new QString(settings.m_via));
}
if (channelSettingsKeys.contains("data")) {
swgPacketModSettings->setData(new QString(settings.m_data));
}
if (channelSettingsKeys.contains("bpf") || force) { if (channelSettingsKeys.contains("bpf") || force) {
swgPacketModSettings->setBpf(settings.m_preEmphasis); swgPacketModSettings->setBpf(settings.m_preEmphasis ? 1 : 0);
} }
if (channelSettingsKeys.contains("bpfLowCutoff") || force) { if (channelSettingsKeys.contains("bpfLowCutoff") || force) {
swgPacketModSettings->setBpfLowCutoff(settings.m_bpfLowCutoff); swgPacketModSettings->setBpfLowCutoff(settings.m_bpfLowCutoff);
@ -545,6 +795,21 @@ void PacketMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, c
if (channelSettingsKeys.contains("bpfHighCutoff") || force) { if (channelSettingsKeys.contains("bpfHighCutoff") || force) {
swgPacketModSettings->setBpfHighCutoff(settings.m_bpfHighCutoff); swgPacketModSettings->setBpfHighCutoff(settings.m_bpfHighCutoff);
} }
if (channelSettingsKeys.contains("bpfTaps")) {
swgPacketModSettings->setBpfTaps(settings.m_bpfTaps);
}
if (channelSettingsKeys.contains("scramble")) {
swgPacketModSettings->setScramble(settings.m_scramble ? 1 : 0);
}
if (channelSettingsKeys.contains("polynomial")) {
swgPacketModSettings->setPolynomial(settings.m_polynomial);
}
if (channelSettingsKeys.contains("beta")) {
swgPacketModSettings->setBeta(settings.m_beta);
}
if (channelSettingsKeys.contains("symbolSpan")) {
swgPacketModSettings->setSymbolSpan(settings.m_symbolSpan);
}
if (channelSettingsKeys.contains("rgbColor") || force) { if (channelSettingsKeys.contains("rgbColor") || force) {
swgPacketModSettings->setRgbColor(settings.m_rgbColor); swgPacketModSettings->setRgbColor(settings.m_rgbColor);
} }
@ -610,4 +875,3 @@ uint32_t PacketMod::getNumberOfDeviceStreams() const
{ {
return m_deviceAPI->getNbSinkStreams(); return m_deviceAPI->getNbSinkStreams();
} }

View File

@ -61,15 +61,6 @@ struct PacketModSettings
QString m_to; QString m_to;
QString m_via; QString m_via;
QString m_data; QString m_data;
quint32 m_rgbColor;
QString m_title;
Serializable *m_channelMarker;
int m_streamIndex;
bool m_useReverseAPI;
QString m_reverseAPIAddress;
uint16_t m_reverseAPIPort;
uint16_t m_reverseAPIDeviceIndex;
uint16_t m_reverseAPIChannelIndex;
bool m_bpf; bool m_bpf;
Real m_bpfLowCutoff; Real m_bpfLowCutoff;
Real m_bpfHighCutoff; Real m_bpfHighCutoff;
@ -79,6 +70,15 @@ struct PacketModSettings
bool m_pulseShaping; bool m_pulseShaping;
float m_beta; float m_beta;
int m_symbolSpan; int m_symbolSpan;
quint32 m_rgbColor;
QString m_title;
Serializable *m_channelMarker;
int m_streamIndex;
bool m_useReverseAPI;
QString m_reverseAPIAddress;
uint16_t m_reverseAPIPort;
uint16_t m_reverseAPIDeviceIndex;
uint16_t m_reverseAPIChannelIndex;
PacketModSettings(); PacketModSettings();
void resetToDefaults(); void resetToDefaults();