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

Packet modulator: API changes

This commit is contained in:
f4exb 2021-11-14 22:26:02 +01:00
parent d785694c87
commit 8fb31a147b
15 changed files with 254 additions and 172 deletions

View File

@ -60,7 +60,6 @@ struct PacketDemodSettings
int m_columnIndexes[PACKETDEMOD_COLUMNS];//!< How the columns are ordered in the table int m_columnIndexes[PACKETDEMOD_COLUMNS];//!< How the columns are ordered in the table
int m_columnSizes[PACKETDEMOD_COLUMNS]; //!< Size of the columns in the table int m_columnSizes[PACKETDEMOD_COLUMNS]; //!< Size of the columns in the table
static const int PACKETDEMOD_CHANNEL_BANDWIDTH = 9600;
static const int PACKETDEMOD_CHANNEL_SAMPLE_RATE = 38400; // Must be integer multiple of baud rate (x32, x4) static const int PACKETDEMOD_CHANNEL_SAMPLE_RATE = 38400; // Must be integer multiple of baud rate (x32, x4)
PacketDemodSettings(); PacketDemodSettings();

View File

@ -49,7 +49,8 @@
#include "packetmod.h" #include "packetmod.h"
MESSAGE_CLASS_DEFINITION(PacketMod::MsgConfigurePacketMod, Message) MESSAGE_CLASS_DEFINITION(PacketMod::MsgConfigurePacketMod, Message)
MESSAGE_CLASS_DEFINITION(PacketMod::MsgTXPacketMod, Message) MESSAGE_CLASS_DEFINITION(PacketMod::MsgTx, Message)
MESSAGE_CLASS_DEFINITION(PacketMod::MsgReportTx, Message)
MESSAGE_CLASS_DEFINITION(PacketMod::MsgTXPacketBytes, Message) MESSAGE_CLASS_DEFINITION(PacketMod::MsgTXPacketBytes, Message)
const char* const PacketMod::m_channelIdURI = "sdrangel.channeltx.modpacket"; const char* const PacketMod::m_channelIdURI = "sdrangel.channeltx.modpacket";
@ -122,12 +123,10 @@ bool PacketMod::handleMessage(const Message& cmd)
return true; return true;
} }
else if (MsgTXPacketMod::match(cmd)) if (MsgTx::match(cmd))
{ {
// Forward a copy to baseband MsgTx *msg = new MsgTx((const MsgTx&) cmd);
MsgTXPacketMod* rep = new MsgTXPacketMod((MsgTXPacketMod&)cmd); m_basebandSource->getInputMessageQueue()->push(msg);
qDebug() << "PacketMod::handleMessage: MsgTXPacketMod";
m_basebandSource->getInputMessageQueue()->push(rep);
return true; return true;
} }
@ -158,6 +157,8 @@ void PacketMod::applySettings(const PacketModSettings& settings, bool force)
{ {
qDebug() << "PacketMod::applySettings:" qDebug() << "PacketMod::applySettings:"
<< " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset << " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset
<< " m_modulation: " << settings.m_modulation
<< " m_baud: " << settings.m_baud
<< " m_rfBandwidth: " << settings.m_rfBandwidth << " m_rfBandwidth: " << settings.m_rfBandwidth
<< " m_fmDeviation: " << settings.m_fmDeviation << " m_fmDeviation: " << settings.m_fmDeviation
<< " m_gain: " << settings.m_gain << " m_gain: " << settings.m_gain
@ -186,6 +187,14 @@ void PacketMod::applySettings(const PacketModSettings& settings, bool force)
reverseAPIKeys.append("inputFrequencyOffset"); reverseAPIKeys.append("inputFrequencyOffset");
} }
if ((settings.m_modulation != m_settings.m_modulation) || force) {
reverseAPIKeys.append("modulation");
}
if ((settings.m_baud != m_settings.m_baud) || force) {
reverseAPIKeys.append("baud");
}
if ((settings.m_rfBandwidth != m_settings.m_rfBandwidth) || force) { if ((settings.m_rfBandwidth != m_settings.m_rfBandwidth) || force) {
reverseAPIKeys.append("rfBandwidth"); reverseAPIKeys.append("rfBandwidth");
} }
@ -476,8 +485,11 @@ void PacketMod::webapiUpdateChannelSettings(
if (channelSettingsKeys.contains("inputFrequencyOffset")) { if (channelSettingsKeys.contains("inputFrequencyOffset")) {
settings.m_inputFrequencyOffset = response.getPacketModSettings()->getInputFrequencyOffset(); settings.m_inputFrequencyOffset = response.getPacketModSettings()->getInputFrequencyOffset();
} }
if (channelSettingsKeys.contains("mode")) { if (channelSettingsKeys.contains("modulation")) {
settings.setMode(*response.getPacketModSettings()->getMode()); settings.m_modulation = (PacketModSettings::Modulation) response.getPacketModSettings()->getModulation();
}
if (channelSettingsKeys.contains("baud")) {
settings.m_baud = response.getPacketModSettings()->getBaud();
} }
if (channelSettingsKeys.contains("rfBandwidth")) { if (channelSettingsKeys.contains("rfBandwidth")) {
settings.m_rfBandwidth = response.getPacketModSettings()->getRfBandwidth(); settings.m_rfBandwidth = response.getPacketModSettings()->getRfBandwidth();
@ -647,25 +659,22 @@ int PacketMod::webapiActionsPost(
{ {
if (channelActionsKeys.contains("tx")) if (channelActionsKeys.contains("tx"))
{ {
SWGSDRangel::SWGPacketModActions_tx* tx = swgPacketModActions->getTx(); if (swgPacketModActions->getTx() != 0)
QString *callsignP = tx->getCallsign();
QString *toP = tx->getTo();
QString *viaP = tx->getVia();
QString *dataP = tx->getData();
if (callsignP && toP && viaP && dataP)
{ {
QString callsign(*callsignP); MsgTx *msg = MsgTx::create();
QString to(*toP);
QString via(*viaP);
QString data(*dataP);
PacketMod::MsgTXPacketMod *msg = PacketMod::MsgTXPacketMod::create(callsign, to, via, data);
m_basebandSource->getInputMessageQueue()->push(msg); m_basebandSource->getInputMessageQueue()->push(msg);
if (getMessageQueueToGUI())
{
MsgReportTx *msg = MsgReportTx::create();
getMessageQueueToGUI()->push(msg);
}
return 202; return 202;
} }
else else
{ {
errorMessage = "Packet must contain callsign, to, via and data"; errorMessage = "Packet must contain tx action";
return 400; return 400;
} }
} }
@ -685,7 +694,8 @@ int PacketMod::webapiActionsPost(
void PacketMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const PacketModSettings& settings) void PacketMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const PacketModSettings& settings)
{ {
response.getPacketModSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset); response.getPacketModSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
response.getPacketModSettings()->setMode(new QString(settings.getMode())); response.getPacketModSettings()->setModulation((int) settings.m_modulation);
response.getPacketModSettings()->setBaud(settings.m_baud);
response.getPacketModSettings()->setRfBandwidth(settings.m_rfBandwidth); response.getPacketModSettings()->setRfBandwidth(settings.m_rfBandwidth);
response.getPacketModSettings()->setFmDeviation(settings.m_fmDeviation); response.getPacketModSettings()->setFmDeviation(settings.m_fmDeviation);
response.getPacketModSettings()->setGain(settings.m_gain); response.getPacketModSettings()->setGain(settings.m_gain);
@ -842,6 +852,12 @@ void PacketMod::webapiFormatChannelSettings(
if (channelSettingsKeys.contains("inputFrequencyOffset") || force) { if (channelSettingsKeys.contains("inputFrequencyOffset") || force) {
swgPacketModSettings->setInputFrequencyOffset(settings.m_inputFrequencyOffset); swgPacketModSettings->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
} }
if (channelSettingsKeys.contains("modulation") || force) {
swgPacketModSettings->setModulation((int) settings.m_modulation);
}
if (channelSettingsKeys.contains("baud") || force) {
swgPacketModSettings->setBaud((int) settings.m_baud);
}
if (channelSettingsKeys.contains("rfBandwidth") || force) { if (channelSettingsKeys.contains("rfBandwidth") || force) {
swgPacketModSettings->setRfBandwidth(settings.m_rfBandwidth); swgPacketModSettings->setRfBandwidth(settings.m_rfBandwidth);
} }

View File

@ -67,28 +67,31 @@ public:
{ } { }
}; };
class MsgTXPacketMod : public Message { class MsgTx : public Message {
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION
public: public:
static MsgTXPacketMod* create(QString callsign, QString to, QString via, QString data) static MsgTx* create() {
{ return new MsgTx();
return new MsgTXPacketMod(callsign, to, via, data);
} }
QString m_callsign; private:
QString m_to; MsgTx() :
QString m_via; Message()
QString m_data; { }
};
class MsgReportTx : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgReportTx* create() {
return new MsgReportTx();
}
private: private:
MsgReportTx() :
MsgTXPacketMod(QString callsign, QString to, QString via, QString data) : Message()
Message(),
m_callsign(callsign),
m_to(to),
m_via(via),
m_data(data)
{ } { }
}; };
@ -96,8 +99,7 @@ public:
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION
public: public:
static MsgTXPacketBytes* create(QByteArray data) static MsgTXPacketBytes* create(QByteArray data) {
{
return new MsgTXPacketBytes(data); return new MsgTXPacketBytes(data);
} }

View File

@ -150,10 +150,10 @@ bool PacketModBaseband::handleMessage(const Message& cmd)
return true; return true;
} }
else if (PacketMod::MsgTXPacketMod::match(cmd)) else if (PacketMod::MsgTx::match(cmd))
{ {
PacketMod::MsgTXPacketMod& tx = (PacketMod::MsgTXPacketMod&) cmd; qDebug() << "PacketModBaseband::handleMessage: MsgTx";
m_source.addTXPacket(tx.m_callsign, tx.m_to, tx.m_via, tx.m_data); m_source.addTXPacket(m_settings.m_callsign, m_settings.m_to, m_settings.m_via, m_settings.m_data);
return true; return true;
} }

View File

@ -88,6 +88,12 @@ bool PacketModGUI::handleMessage(const Message& message)
blockApplySettings(false); blockApplySettings(false);
return true; return true;
} }
else if (PacketMod::MsgReportTx::match(message))
{
QString str = m_settings.m_callsign + ">" + m_settings.m_to + "," + m_settings.m_via + ":" + m_settings.m_data;
ui->transmittedText->appendPlainText(str);
return true;
}
else else
{ {
return false; return false;
@ -489,14 +495,10 @@ PacketModGUI::~PacketModGUI()
void PacketModGUI::transmit() void PacketModGUI::transmit()
{ {
QString callsign = ui->callsign->text();
QString to = ui->to->currentText();
QString via = ui->via->currentText();
QString data = ui->packet->text();
// TODO: Any validation? // TODO: Any validation?
QString str = callsign + ">" + to + "," + via + ":" + data; QString str = m_settings.m_callsign + ">" + m_settings.m_to + "," + m_settings.m_via + ":" + m_settings.m_data;
ui->transmittedText->appendPlainText(str + "\n"); ui->transmittedText->appendPlainText(str);
PacketMod::MsgTXPacketMod *msg = PacketMod::MsgTXPacketMod::create(callsign, to, via, data); PacketMod::MsgTx *msg = PacketMod::MsgTx::create();
m_packetMod->getInputMessageQueue()->push(msg); m_packetMod->getInputMessageQueue()->push(msg);
} }

View File

@ -89,11 +89,14 @@ bool PacketModSettings::setMode(QString mode)
{ {
int baud; int baud;
bool valid; bool valid;
bool setCommon = false;
// First part of mode string should give baud rate // First part of mode string should give baud rate
baud = mode.split(" ")[0].toInt(&valid); baud = mode.split(" ")[0].toInt(&valid);
if (!valid)
if (!valid) {
return false; return false;
}
if (mode.endsWith("AFSK")) if (mode.endsWith("AFSK"))
{ {
@ -102,22 +105,56 @@ bool PacketModSettings::setMode(QString mode)
m_scramble = false; m_scramble = false;
m_rfBandwidth = 12500.0f; m_rfBandwidth = 12500.0f;
m_fmDeviation = 2500.0f; m_fmDeviation = 2500.0f;
m_spectrumRate = 8000;
m_modulation = PacketModSettings::AFSK; m_modulation = PacketModSettings::AFSK;
m_markFrequency = 2200;
m_spaceFrequency = 1200;
setCommon = true;
} }
else if (mode.endsWith("FSK")) else if (mode.endsWith("FSK"))
{ {
// G3RUH - http://www.jrmiller.demon.co.uk/products/figs/man9k6.pdf // G3RUH - http://www.jrmiller.demon.co.uk/products/figs/man9k6.pdf
m_baud = baud; m_baud = baud;
m_scramble = true; m_scramble = true;
m_polynomial = 0x10800;
m_rfBandwidth = 20000.0f; m_rfBandwidth = 20000.0f;
m_fmDeviation = 3000.0f; m_fmDeviation = 3000.0f;
m_spectrumRate = 24000;
m_bpf = false;
m_modulation = PacketModSettings::FSK; m_modulation = PacketModSettings::FSK;
m_beta = 0.5f;
m_symbolSpan = 6;
setCommon = true;
} }
else else
{
return false; return false;
}
if (baud <= 2400) {
m_spectrumRate = 8000;
} else {
m_spectrumRate = 24000;
}
if (setCommon)
{
m_ax25PreFlags = 5;
m_ax25PostFlags = 4;
m_ax25PID = 0xf0;
m_ax25Control = 3;
m_preEmphasis = false;
m_preEmphasisTau = 531e-6f; // Narrowband FM
m_preEmphasisHighFreq = 3000.0f;
m_lpfTaps = 301;
m_rampUpBits = 8;
m_rampDownBits = 8;
m_rampRange = 60;
m_modulateWhileRamping = true;
m_bpf = false;
m_bpfLowCutoff = m_spaceFrequency - 400.0f;
m_bpfHighCutoff = m_markFrequency + 400.0f;
m_bpfTaps = 301;
m_pulseShaping = true;
}
return true; return true;
} }

View File

@ -8222,27 +8222,11 @@ margin-bottom: 20px;
defs.PacketModActions = { defs.PacketModActions = {
"properties" : { "properties" : {
"tx" : { "tx" : {
"$ref" : "#/definitions/PacketModActions_tx" "type" : "integer",
"description" : "Transmit with current data\n * 0 - Do nothing\n * 1 - Transmit\n"
} }
}, },
"description" : "PacketMod" "description" : "PacketMod"
};
defs.PacketModActions_tx = {
"properties" : {
"callsign" : {
"type" : "string"
},
"to" : {
"type" : "string"
},
"via" : {
"type" : "string"
},
"data" : {
"type" : "string"
}
},
"description" : "Transmit a packet\n"
}; };
defs.PacketModReport = { defs.PacketModReport = {
"properties" : { "properties" : {
@ -8266,9 +8250,13 @@ margin-bottom: 20px;
"type" : "integer", "type" : "integer",
"format" : "int64" "format" : "int64"
}, },
"mode" : { "modulation" : {
"type" : "string", "type" : "integer",
"description" : "Transmission mode\n * \"1200 AFSK\"\n * \"9600 FSK\".\n" "description" : "Modulation mode\n * 0 - AFSK\n * 1 - FSK\n"
},
"baud" : {
"type" : "integer",
"description" : "Baud rate"
}, },
"rfBandwidth" : { "rfBandwidth" : {
"type" : "number", "type" : "number",
@ -8333,6 +8321,10 @@ margin-bottom: 20px;
"type" : "number", "type" : "number",
"format" : "float" "format" : "float"
}, },
"preEmphasisLowFreq" : {
"type" : "number",
"format" : "float"
},
"preEmphasisHighFreq" : { "preEmphasisHighFreq" : {
"type" : "number", "type" : "number",
"format" : "float" "format" : "float"
@ -51298,7 +51290,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2021-11-11T23:23:22.877+01:00 Generated 2021-11-13T22:32:53.016+01:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -4,12 +4,15 @@ PacketModSettings:
inputFrequencyOffset: inputFrequencyOffset:
type: integer type: integer
format: int64 format: int64
mode: modulation:
type: string type: integer
description: > description: >
Transmission mode Modulation mode
* "1200 AFSK" * 0 - AFSK
* "9600 FSK". * 1 - FSK
baud:
type: integer
description: Baud rate
rfBandwidth: rfBandwidth:
type: number type: number
format: float format: float
@ -57,6 +60,9 @@ PacketModSettings:
preEmphasisTau: preEmphasisTau:
type: number type: number
format: float format: float
preEmphasisLowFreq:
type: number
format: float
preEmphasisHighFreq: preEmphasisHighFreq:
type: number type: number
format: float format: float
@ -163,15 +169,8 @@ PacketModActions:
description: PacketMod description: PacketMod
properties: properties:
tx: tx:
type: object type: integer
properties:
callsign:
type: string
to:
type: string
via:
type: string
data:
type: string
description: > description: >
Transmit a packet Transmit with current data
* 0 - Do nothing
* 1 - Transmit

View File

@ -4,12 +4,15 @@ PacketModSettings:
inputFrequencyOffset: inputFrequencyOffset:
type: integer type: integer
format: int64 format: int64
mode: modulation:
type: string type: integer
description: > description: >
Transmission mode Modulation mode
* "1200 AFSK" * 0 - AFSK
* "9600 FSK". * 1 - FSK
baud:
type: integer
description: Baud rate
rfBandwidth: rfBandwidth:
type: number type: number
format: float format: float
@ -163,15 +166,8 @@ PacketModActions:
description: PacketMod description: PacketMod
properties: properties:
tx: tx:
type: object type: integer
properties:
callsign:
type: string
to:
type: string
via:
type: string
data:
type: string
description: > description: >
Transmit a packet Transmit with current data
* 0 - Do nothing
* 1 - Transmit

View File

@ -8222,27 +8222,11 @@ margin-bottom: 20px;
defs.PacketModActions = { defs.PacketModActions = {
"properties" : { "properties" : {
"tx" : { "tx" : {
"$ref" : "#/definitions/PacketModActions_tx" "type" : "integer",
"description" : "Transmit with current data\n * 0 - Do nothing\n * 1 - Transmit\n"
} }
}, },
"description" : "PacketMod" "description" : "PacketMod"
};
defs.PacketModActions_tx = {
"properties" : {
"callsign" : {
"type" : "string"
},
"to" : {
"type" : "string"
},
"via" : {
"type" : "string"
},
"data" : {
"type" : "string"
}
},
"description" : "Transmit a packet\n"
}; };
defs.PacketModReport = { defs.PacketModReport = {
"properties" : { "properties" : {
@ -8266,9 +8250,13 @@ margin-bottom: 20px;
"type" : "integer", "type" : "integer",
"format" : "int64" "format" : "int64"
}, },
"mode" : { "modulation" : {
"type" : "string", "type" : "integer",
"description" : "Transmission mode\n * \"1200 AFSK\"\n * \"9600 FSK\".\n" "description" : "Modulation mode\n * 0 - AFSK\n * 1 - FSK\n"
},
"baud" : {
"type" : "integer",
"description" : "Baud rate"
}, },
"rfBandwidth" : { "rfBandwidth" : {
"type" : "number", "type" : "number",
@ -8333,6 +8321,10 @@ margin-bottom: 20px;
"type" : "number", "type" : "number",
"format" : "float" "format" : "float"
}, },
"preEmphasisLowFreq" : {
"type" : "number",
"format" : "float"
},
"preEmphasisHighFreq" : { "preEmphasisHighFreq" : {
"type" : "number", "type" : "number",
"format" : "float" "format" : "float"
@ -51298,7 +51290,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2021-11-11T23:23:22.877+01:00 Generated 2021-11-13T22:32:53.016+01:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -189,7 +189,6 @@
#include "SWGPacketDemodReport.h" #include "SWGPacketDemodReport.h"
#include "SWGPacketDemodSettings.h" #include "SWGPacketDemodSettings.h"
#include "SWGPacketModActions.h" #include "SWGPacketModActions.h"
#include "SWGPacketModActions_tx.h"
#include "SWGPacketModReport.h" #include "SWGPacketModReport.h"
#include "SWGPacketModSettings.h" #include "SWGPacketModSettings.h"
#include "SWGPagerDemodReport.h" #include "SWGPagerDemodReport.h"
@ -1184,11 +1183,6 @@ namespace SWGSDRangel {
obj->init(); obj->init();
return obj; return obj;
} }
if(QString("SWGPacketModActions_tx").compare(type) == 0) {
SWGPacketModActions_tx *obj = new SWGPacketModActions_tx();
obj->init();
return obj;
}
if(QString("SWGPacketModReport").compare(type) == 0) { if(QString("SWGPacketModReport").compare(type) == 0) {
SWGPacketModReport *obj = new SWGPacketModReport(); SWGPacketModReport *obj = new SWGPacketModReport();
obj->init(); obj->init();

View File

@ -28,7 +28,7 @@ SWGPacketModActions::SWGPacketModActions(QString* json) {
} }
SWGPacketModActions::SWGPacketModActions() { SWGPacketModActions::SWGPacketModActions() {
tx = nullptr; tx = 0;
m_tx_isSet = false; m_tx_isSet = false;
} }
@ -38,15 +38,13 @@ SWGPacketModActions::~SWGPacketModActions() {
void void
SWGPacketModActions::init() { SWGPacketModActions::init() {
tx = new SWGPacketModActions_tx(); tx = 0;
m_tx_isSet = false; m_tx_isSet = false;
} }
void void
SWGPacketModActions::cleanup() { SWGPacketModActions::cleanup() {
if(tx != nullptr) {
delete tx;
}
} }
SWGPacketModActions* SWGPacketModActions*
@ -60,7 +58,7 @@ SWGPacketModActions::fromJson(QString &json) {
void void
SWGPacketModActions::fromJsonObject(QJsonObject &pJson) { SWGPacketModActions::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&tx, pJson["tx"], "SWGPacketModActions_tx", "SWGPacketModActions_tx"); ::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", "");
} }
@ -78,19 +76,19 @@ SWGPacketModActions::asJson ()
QJsonObject* QJsonObject*
SWGPacketModActions::asJsonObject() { SWGPacketModActions::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject* obj = new QJsonObject();
if((tx != nullptr) && (tx->isSet())){ if(m_tx_isSet){
toJsonValue(QString("tx"), tx, obj, QString("SWGPacketModActions_tx")); obj->insert("tx", QJsonValue(tx));
} }
return obj; return obj;
} }
SWGPacketModActions_tx* qint32
SWGPacketModActions::getTx() { SWGPacketModActions::getTx() {
return tx; return tx;
} }
void void
SWGPacketModActions::setTx(SWGPacketModActions_tx* tx) { SWGPacketModActions::setTx(qint32 tx) {
this->tx = tx; this->tx = tx;
this->m_tx_isSet = true; this->m_tx_isSet = true;
} }
@ -100,7 +98,7 @@ bool
SWGPacketModActions::isSet(){ SWGPacketModActions::isSet(){
bool isObjectUpdated = false; bool isObjectUpdated = false;
do{ do{
if(tx && tx->isSet()){ if(m_tx_isSet){
isObjectUpdated = true; break; isObjectUpdated = true; break;
} }
}while(false); }while(false);

View File

@ -22,7 +22,6 @@
#include <QJsonObject> #include <QJsonObject>
#include "SWGPacketModActions_tx.h"
#include "SWGObject.h" #include "SWGObject.h"
#include "export.h" #include "export.h"
@ -42,14 +41,14 @@ public:
virtual void fromJsonObject(QJsonObject &json) override; virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGPacketModActions* fromJson(QString &jsonString) override; virtual SWGPacketModActions* fromJson(QString &jsonString) override;
SWGPacketModActions_tx* getTx(); qint32 getTx();
void setTx(SWGPacketModActions_tx* tx); void setTx(qint32 tx);
virtual bool isSet() override; virtual bool isSet() override;
private: private:
SWGPacketModActions_tx* tx; qint32 tx;
bool m_tx_isSet; bool m_tx_isSet;
}; };

View File

@ -30,8 +30,10 @@ SWGPacketModSettings::SWGPacketModSettings(QString* json) {
SWGPacketModSettings::SWGPacketModSettings() { SWGPacketModSettings::SWGPacketModSettings() {
input_frequency_offset = 0L; input_frequency_offset = 0L;
m_input_frequency_offset_isSet = false; m_input_frequency_offset_isSet = false;
mode = nullptr; modulation = 0;
m_mode_isSet = false; m_modulation_isSet = false;
baud = 0;
m_baud_isSet = false;
rf_bandwidth = 0.0f; rf_bandwidth = 0.0f;
m_rf_bandwidth_isSet = false; m_rf_bandwidth_isSet = false;
fm_deviation = 0.0f; fm_deviation = 0.0f;
@ -70,6 +72,8 @@ SWGPacketModSettings::SWGPacketModSettings() {
m_pre_emphasis_isSet = false; m_pre_emphasis_isSet = false;
pre_emphasis_tau = 0.0f; pre_emphasis_tau = 0.0f;
m_pre_emphasis_tau_isSet = false; m_pre_emphasis_tau_isSet = false;
pre_emphasis_low_freq = 0.0f;
m_pre_emphasis_low_freq_isSet = false;
pre_emphasis_high_freq = 0.0f; pre_emphasis_high_freq = 0.0f;
m_pre_emphasis_high_freq_isSet = false; m_pre_emphasis_high_freq_isSet = false;
lpf_taps = 0; lpf_taps = 0;
@ -140,8 +144,10 @@ void
SWGPacketModSettings::init() { SWGPacketModSettings::init() {
input_frequency_offset = 0L; input_frequency_offset = 0L;
m_input_frequency_offset_isSet = false; m_input_frequency_offset_isSet = false;
mode = new QString(""); modulation = 0;
m_mode_isSet = false; m_modulation_isSet = false;
baud = 0;
m_baud_isSet = false;
rf_bandwidth = 0.0f; rf_bandwidth = 0.0f;
m_rf_bandwidth_isSet = false; m_rf_bandwidth_isSet = false;
fm_deviation = 0.0f; fm_deviation = 0.0f;
@ -180,6 +186,8 @@ SWGPacketModSettings::init() {
m_pre_emphasis_isSet = false; m_pre_emphasis_isSet = false;
pre_emphasis_tau = 0.0f; pre_emphasis_tau = 0.0f;
m_pre_emphasis_tau_isSet = false; m_pre_emphasis_tau_isSet = false;
pre_emphasis_low_freq = 0.0f;
m_pre_emphasis_low_freq_isSet = false;
pre_emphasis_high_freq = 0.0f; pre_emphasis_high_freq = 0.0f;
m_pre_emphasis_high_freq_isSet = false; m_pre_emphasis_high_freq_isSet = false;
lpf_taps = 0; lpf_taps = 0;
@ -245,9 +253,9 @@ SWGPacketModSettings::init() {
void void
SWGPacketModSettings::cleanup() { SWGPacketModSettings::cleanup() {
if(mode != nullptr) {
delete mode;
}
@ -326,7 +334,9 @@ void
SWGPacketModSettings::fromJsonObject(QJsonObject &pJson) { SWGPacketModSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", ""); ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
::SWGSDRangel::setValue(&mode, pJson["mode"], "QString", "QString"); ::SWGSDRangel::setValue(&modulation, pJson["modulation"], "qint32", "");
::SWGSDRangel::setValue(&baud, pJson["baud"], "qint32", "");
::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", ""); ::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", "");
@ -366,6 +376,8 @@ SWGPacketModSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&pre_emphasis_tau, pJson["preEmphasisTau"], "float", ""); ::SWGSDRangel::setValue(&pre_emphasis_tau, pJson["preEmphasisTau"], "float", "");
::SWGSDRangel::setValue(&pre_emphasis_low_freq, pJson["preEmphasisLowFreq"], "float", "");
::SWGSDRangel::setValue(&pre_emphasis_high_freq, pJson["preEmphasisHighFreq"], "float", ""); ::SWGSDRangel::setValue(&pre_emphasis_high_freq, pJson["preEmphasisHighFreq"], "float", "");
::SWGSDRangel::setValue(&lpf_taps, pJson["lpfTaps"], "qint32", ""); ::SWGSDRangel::setValue(&lpf_taps, pJson["lpfTaps"], "qint32", "");
@ -445,8 +457,11 @@ SWGPacketModSettings::asJsonObject() {
if(m_input_frequency_offset_isSet){ if(m_input_frequency_offset_isSet){
obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset)); obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
} }
if(mode != nullptr && *mode != QString("")){ if(m_modulation_isSet){
toJsonValue(QString("mode"), mode, obj, QString("QString")); obj->insert("modulation", QJsonValue(modulation));
}
if(m_baud_isSet){
obj->insert("baud", QJsonValue(baud));
} }
if(m_rf_bandwidth_isSet){ if(m_rf_bandwidth_isSet){
obj->insert("rfBandwidth", QJsonValue(rf_bandwidth)); obj->insert("rfBandwidth", QJsonValue(rf_bandwidth));
@ -505,6 +520,9 @@ SWGPacketModSettings::asJsonObject() {
if(m_pre_emphasis_tau_isSet){ if(m_pre_emphasis_tau_isSet){
obj->insert("preEmphasisTau", QJsonValue(pre_emphasis_tau)); obj->insert("preEmphasisTau", QJsonValue(pre_emphasis_tau));
} }
if(m_pre_emphasis_low_freq_isSet){
obj->insert("preEmphasisLowFreq", QJsonValue(pre_emphasis_low_freq));
}
if(m_pre_emphasis_high_freq_isSet){ if(m_pre_emphasis_high_freq_isSet){
obj->insert("preEmphasisHighFreq", QJsonValue(pre_emphasis_high_freq)); obj->insert("preEmphasisHighFreq", QJsonValue(pre_emphasis_high_freq));
} }
@ -609,14 +627,24 @@ SWGPacketModSettings::setInputFrequencyOffset(qint64 input_frequency_offset) {
this->m_input_frequency_offset_isSet = true; this->m_input_frequency_offset_isSet = true;
} }
QString* qint32
SWGPacketModSettings::getMode() { SWGPacketModSettings::getModulation() {
return mode; return modulation;
} }
void void
SWGPacketModSettings::setMode(QString* mode) { SWGPacketModSettings::setModulation(qint32 modulation) {
this->mode = mode; this->modulation = modulation;
this->m_mode_isSet = true; this->m_modulation_isSet = true;
}
qint32
SWGPacketModSettings::getBaud() {
return baud;
}
void
SWGPacketModSettings::setBaud(qint32 baud) {
this->baud = baud;
this->m_baud_isSet = true;
} }
float float
@ -809,6 +837,16 @@ SWGPacketModSettings::setPreEmphasisTau(float pre_emphasis_tau) {
this->m_pre_emphasis_tau_isSet = true; this->m_pre_emphasis_tau_isSet = true;
} }
float
SWGPacketModSettings::getPreEmphasisLowFreq() {
return pre_emphasis_low_freq;
}
void
SWGPacketModSettings::setPreEmphasisLowFreq(float pre_emphasis_low_freq) {
this->pre_emphasis_low_freq = pre_emphasis_low_freq;
this->m_pre_emphasis_low_freq_isSet = true;
}
float float
SWGPacketModSettings::getPreEmphasisHighFreq() { SWGPacketModSettings::getPreEmphasisHighFreq() {
return pre_emphasis_high_freq; return pre_emphasis_high_freq;
@ -1117,7 +1155,10 @@ SWGPacketModSettings::isSet(){
if(m_input_frequency_offset_isSet){ if(m_input_frequency_offset_isSet){
isObjectUpdated = true; break; isObjectUpdated = true; break;
} }
if(mode && *mode != QString("")){ if(m_modulation_isSet){
isObjectUpdated = true; break;
}
if(m_baud_isSet){
isObjectUpdated = true; break; isObjectUpdated = true; break;
} }
if(m_rf_bandwidth_isSet){ if(m_rf_bandwidth_isSet){
@ -1177,6 +1218,9 @@ SWGPacketModSettings::isSet(){
if(m_pre_emphasis_tau_isSet){ if(m_pre_emphasis_tau_isSet){
isObjectUpdated = true; break; isObjectUpdated = true; break;
} }
if(m_pre_emphasis_low_freq_isSet){
isObjectUpdated = true; break;
}
if(m_pre_emphasis_high_freq_isSet){ if(m_pre_emphasis_high_freq_isSet){
isObjectUpdated = true; break; isObjectUpdated = true; break;
} }

View File

@ -45,8 +45,11 @@ public:
qint64 getInputFrequencyOffset(); qint64 getInputFrequencyOffset();
void setInputFrequencyOffset(qint64 input_frequency_offset); void setInputFrequencyOffset(qint64 input_frequency_offset);
QString* getMode(); qint32 getModulation();
void setMode(QString* mode); void setModulation(qint32 modulation);
qint32 getBaud();
void setBaud(qint32 baud);
float getRfBandwidth(); float getRfBandwidth();
void setRfBandwidth(float rf_bandwidth); void setRfBandwidth(float rf_bandwidth);
@ -105,6 +108,9 @@ public:
float getPreEmphasisTau(); float getPreEmphasisTau();
void setPreEmphasisTau(float pre_emphasis_tau); void setPreEmphasisTau(float pre_emphasis_tau);
float getPreEmphasisLowFreq();
void setPreEmphasisLowFreq(float pre_emphasis_low_freq);
float getPreEmphasisHighFreq(); float getPreEmphasisHighFreq();
void setPreEmphasisHighFreq(float pre_emphasis_high_freq); void setPreEmphasisHighFreq(float pre_emphasis_high_freq);
@ -202,8 +208,11 @@ private:
qint64 input_frequency_offset; qint64 input_frequency_offset;
bool m_input_frequency_offset_isSet; bool m_input_frequency_offset_isSet;
QString* mode; qint32 modulation;
bool m_mode_isSet; bool m_modulation_isSet;
qint32 baud;
bool m_baud_isSet;
float rf_bandwidth; float rf_bandwidth;
bool m_rf_bandwidth_isSet; bool m_rf_bandwidth_isSet;
@ -262,6 +271,9 @@ private:
float pre_emphasis_tau; float pre_emphasis_tau;
bool m_pre_emphasis_tau_isSet; bool m_pre_emphasis_tau_isSet;
float pre_emphasis_low_freq;
bool m_pre_emphasis_low_freq_isSet;
float pre_emphasis_high_freq; float pre_emphasis_high_freq;
bool m_pre_emphasis_high_freq_isSet; bool m_pre_emphasis_high_freq_isSet;