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

Add additional settings to yaml

This commit is contained in:
srcejon 2023-09-01 18:49:57 +01:00
parent 55ccfcd98c
commit 48300d3d00
12 changed files with 60 additions and 31 deletions

View File

@ -102,12 +102,12 @@ Full details of the API can be found in the Swagger documentation. Below are a f
To transmit the current text simply send a "tx" action:
curl -X POST "http://127.0.0.1:8091/sdrangel/deviceset/1/channel/0/actions" -d '{"channelType": "RttyMod", "direction": 1, "RttyModActions": { "tx": 1}}'
curl -X POST "http://127.0.0.1:8091/sdrangel/deviceset/0/channel/0/actions" -d '{"channelType": "RTTYMod", "direction": 1, "RTTYModActions": { "tx": 1}}'
To transmit a packet from the command line:
curl -X POST "http://127.0.0.1:8091/sdrangel/deviceset/1/channel/0/actions" -d '{"channelType": "RttyMod", "direction": 1, "RttyModActions": { "tx": 1, "payload": {"text": "CQ CQ CQ anyone using SDRangel" }}}'
curl -X POST "http://127.0.0.1:8091/sdrangel/deviceset/0/channel/0/actions" -d '{"channelType": "RTTYMod", "direction": 1, "RTTYModActions": { "tx": 1, "payload": {"text": "CQ CQ CQ anyone using SDRangel" }}}'
To set the baud rate and frequency shift:
curl -X PATCH "http://127.0.0.1:8091/sdrangel/deviceset/1/channel/0/settings" -d '{"channelType": "RttyMod", "direction": 1, "RttyModSettings": {"baud": 45.45; "frequencyShift": 170 }}'
curl -X PATCH "http://127.0.0.1:8091/sdrangel/deviceset/0/channel/0/settings" -d '{"channelType": "RTTYMod", "direction": 1, "RTTYModSettings": {"baud": 45.45; "frequencyShift": 170 }}'

View File

@ -55,7 +55,7 @@ MESSAGE_CLASS_DEFINITION(RttyMod::MsgTXPacketBytes, Message)
MESSAGE_CLASS_DEFINITION(RttyMod::MsgTXPacketData, Message)
const char* const RttyMod::m_channelIdURI = "sdrangel.channeltx.modrtty";
const char* const RttyMod::m_channelId = "RttyMod";
const char* const RttyMod::m_channelId = "RTTYMod";
RttyMod::RttyMod(DeviceAPI *deviceAPI) :
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource),
@ -262,8 +262,8 @@ void RttyMod::applySettings(const RttyModSettings& settings, bool force)
reverseAPIKeys.append("rfNoise");
}
if ((settings.m_data != m_settings.m_data) || force) {
reverseAPIKeys.append("data");
if ((settings.m_text != m_settings.m_text) || force) {
reverseAPIKeys.append("text");
}
if ((settings.m_beta != m_settings.m_beta) || force) {
@ -456,8 +456,8 @@ void RttyMod::webapiUpdateChannelSettings(
if (channelSettingsKeys.contains("rfNoise")) {
settings.m_rfNoise = response.getRttyModSettings()->getRfNoise() != 0;
}
if (channelSettingsKeys.contains("data")) {
settings.m_data = *response.getRttyModSettings()->getData();
if (channelSettingsKeys.contains("text")) {
settings.m_text = *response.getRttyModSettings()->getData();
}
if (channelSettingsKeys.contains("beta")) {
settings.m_beta = response.getRttyModSettings()->getBeta();
@ -581,9 +581,9 @@ void RttyMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respo
response.getRttyModSettings()->setRfNoise(settings.m_rfNoise ? 1 : 0);
if (response.getRttyModSettings()->getData()) {
*response.getRttyModSettings()->getData() = settings.m_data;
*response.getRttyModSettings()->getData() = settings.m_text;
} else {
response.getRttyModSettings()->setData(new QString(settings.m_data));
response.getRttyModSettings()->setData(new QString(settings.m_text));
}
response.getRttyModSettings()->setPulseShaping(settings.m_pulseShaping ? 1 : 0);
@ -747,8 +747,8 @@ void RttyMod::webapiFormatChannelSettings(
if (channelSettingsKeys.contains("rfNoise")) {
swgRttyModSettings->setRfNoise(settings.m_rfNoise ? 1 : 0);
}
if (channelSettingsKeys.contains("data")) {
swgRttyModSettings->setData(new QString(settings.m_data));
if (channelSettingsKeys.contains("text")) {
swgRttyModSettings->setData(new QString(settings.m_text));
}
if (channelSettingsKeys.contains("beta")) {
swgRttyModSettings->setBeta(settings.m_beta);

View File

@ -152,7 +152,7 @@ bool RttyModBaseband::handleMessage(const Message& cmd)
else if (RttyMod::MsgTx::match(cmd))
{
qDebug() << "RttyModBaseband::handleMessage: MsgTx";
m_source.addTXPacket(m_settings.m_data);
m_source.addTXPacket(m_settings.m_text);
return true;
}

View File

@ -296,7 +296,7 @@ void RttyModGUI::on_text_returnPressed()
void RttyModGUI::on_text_editingFinished()
{
m_settings.m_data = ui->text->currentText();
m_settings.m_text = ui->text->currentText();
applySettings();
}
@ -609,7 +609,7 @@ void RttyModGUI::displaySettings()
for (const auto& text : m_settings.m_predefinedTexts) {
ui->text->addItem(substitute(text));
}
ui->text->setCurrentText(m_settings.m_data);
ui->text->setCurrentText(m_settings.m_text);
getRollupContents()->restoreState(m_rollupState);
updateAbsoluteCenterFrequency();

View File

@ -46,7 +46,7 @@ void RttyModSettings::resetToDefaults()
m_bbNoise = false;
m_rfNoise = false;
m_writeToFile = false;
m_data = "CQ CQ CQ DE SDRangel CQ";
m_text = "CQ CQ CQ DE SDRangel CQ";
m_characterSet = Baudot::ITA2;
m_msbFirst = false;
m_spaceHigh = false;
@ -97,7 +97,7 @@ QByteArray RttyModSettings::serialize() const
s.writeBool(24, m_bbNoise);
s.writeBool(25, m_rfNoise);
s.writeBool(26, m_writeToFile);
s.writeString(30, m_data);
s.writeString(30, m_text);
s.writeS32(60, (int)m_characterSet);
s.writeBool(61, m_unshiftOnSpace);
@ -168,7 +168,7 @@ bool RttyModSettings::deserialize(const QByteArray& data)
d.readBool(24, &m_bbNoise, false);
d.readBool(25, &m_rfNoise, false);
d.readBool(26, &m_writeToFile, false);
d.readString(30, &m_data, "CQ CQ CQ anyone using SDRangel");
d.readString(30, &m_text, "CQ CQ CQ anyone using SDRangel");
d.readS32(60, (int*)&m_characterSet, (int)Baudot::ITA2);
d.readBool(61, &m_unshiftOnSpace, false);

View File

@ -40,7 +40,7 @@ struct RttyModSettings
bool m_bbNoise;
bool m_rfNoise;
bool m_writeToFile;
QString m_data; // Text to send
QString m_text; // Text to send
bool m_pulseShaping;
float m_beta;
int m_symbolSpan;

View File

@ -125,11 +125,11 @@ void RttyModSource::modulateSample()
{
if (m_bitCount == 0)
{
if (!m_dataToTransmit.isEmpty())
if (!m_textToTransmit.isEmpty())
{
// Encode a character at a time, so we get a TxReport after each character
QString s = m_dataToTransmit.left(1);
m_dataToTransmit = m_dataToTransmit.mid(1);
QString s = m_textToTransmit.left(1);
m_textToTransmit = m_textToTransmit.mid(1);
encodePacket(s);
}
else
@ -390,7 +390,7 @@ void RttyModSource::addTXPacket(QString data)
int count = m_settings.m_repeat ? m_settings.m_repeatCount : 1;
for (int i = 0; i < count; i++) {
m_dataToTransmit.append(data);
m_textToTransmit.append(data);
}
}
@ -399,7 +399,7 @@ void RttyModSource::addTXPacket(QByteArray data)
int count = m_settings.m_repeat ? m_settings.m_repeatCount : 1;
for (int i = 0; i < count; i++) {
m_dataToTransmit.append(QString(data));
m_textToTransmit.append(QString(data));
}
}
@ -432,7 +432,7 @@ void RttyModSource::encodePacket(const QString& text)
if (getMessageQueueToGUI())
{
RttyMod::MsgReportTx* msg = RttyMod::MsgReportTx::create(s, m_dataToTransmit.size());
RttyMod::MsgReportTx* msg = RttyMod::MsgReportTx::create(s, m_textToTransmit.size());
getMessageQueueToGUI()->push(msg);
}
}

View File

@ -104,7 +104,7 @@ private:
int m_sampleIdx; // Sample index in to symbol
int m_samplesPerSymbol; // Number of samples per symbol
QString m_dataToTransmit; // Transmit data buffer (before RTTY encoding)
QString m_textToTransmit; // Transmit buffer (before RTTY encoding)
BaudotEncoder m_rttyEncoder;

View File

@ -17,7 +17,7 @@
</font>
</property>
<property name="windowTitle">
<string>Packet TX Extra Settings</string>
<string>Transmit Settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>

View File

@ -4643,7 +4643,12 @@ bool WebAPIRequestMapper::getChannelSettings(
{
channelSettings->setRttyDemodSettings(new SWGSDRangel::SWGRTTYDemodSettings());
channelSettings->getRttyDemodSettings()->fromJsonObject(settingsJsonObject);
}
}
else if (channelSettingsKey == "RTTYModSettings")
{
channelSettings->setRttyModSettings(new SWGSDRangel::SWGRTTYModSettings());
channelSettings->getRttyModSettings()->fromJsonObject(settingsJsonObject);
}
else if (channelSettingsKey == "SigMFFileSinkSettings")
{
channelSettings->setSigMfFileSinkSettings(new SWGSDRangel::SWGSigMFFileSinkSettings());
@ -4751,6 +4756,11 @@ bool WebAPIRequestMapper::getChannelActions(
channelActions->setPacketModActions(new SWGSDRangel::SWGPacketModActions());
channelActions->getPacketModActions()->fromJsonObject(actionsJsonObject);
}
else if (channelActionsKey == "RTTYModActions")
{
channelActions->setRttyModActions(new SWGSDRangel::SWGRTTYModActions());
channelActions->getRttyModActions()->fromJsonObject(actionsJsonObject);
}
else if (channelActionsKey == "SigMFFileSinkActions")
{
channelActions->setSigMfFileSinkActions(new SWGSDRangel::SWGSigMFFileSinkActions());
@ -5432,6 +5442,7 @@ void WebAPIRequestMapper::resetChannelSettings(SWGSDRangel::SWGChannelSettings&
channelSettings.setRemoteSourceSettings(nullptr);
channelSettings.setRemoteTcpSinkSettings(nullptr);
channelSettings.setRttyDemodSettings(nullptr);
channelSettings.setRttyModSettings(nullptr);
channelSettings.setSsbDemodSettings(nullptr);
channelSettings.setSsbModSettings(nullptr);
channelSettings.setUdpSourceSettings(nullptr);
@ -5468,6 +5479,7 @@ void WebAPIRequestMapper::resetChannelReport(SWGSDRangel::SWGChannelReport& chan
channelReport.setRadiosondeDemodReport(nullptr);
channelReport.setRemoteSourceReport(nullptr);
channelReport.setRttyDemodReport(nullptr);
channelReport.setRttyModReport(nullptr);
channelReport.setSsbDemodReport(nullptr);
channelReport.setSsbModReport(nullptr);
channelReport.setUdpSourceReport(nullptr);
@ -5488,6 +5500,7 @@ void WebAPIRequestMapper::resetChannelActions(SWGSDRangel::SWGChannelActions& ch
channelActions.setIeee802154ModActions(nullptr);
channelActions.setRadioAstronomyActions(nullptr);
channelActions.setPacketModActions(nullptr);
channelActions.setRttyModActions(nullptr);
}
void WebAPIRequestMapper::resetAudioInputDevice(SWGSDRangel::SWGAudioInputDevice& audioInputDevice)

View File

@ -70,6 +70,7 @@ const QMap<QString, QString> WebAPIUtils::m_channelURIToSettingsKey = {
{"sdrangel.demod.remotetcpsink", "RemoteTCPSinkSettings"},
{"sdrangel.channeltx.remotesource", "RemoteSourceSettings"},
{"sdrangel.channel.rttydemod", "RTTYDemodSettings"},
{"sdrangel.channel.rttymod", "RTTYModSettings"},
{"sdrangel.channeltx.modssb", "SSBModSettings"},
{"sdrangel.channel.ssbdemod", "SSBDemodSettings"},
{"sdrangel.channel.ft8demod", "FT8DemodSettings"},
@ -185,7 +186,8 @@ const QMap<QString, QString> WebAPIUtils::m_channelTypeToSettingsKey = {
{"RemoteSink", "RemoteSinkSettings"},
{"RemoteSource", "RemoteSourceSettings"},
{"RemoteTCPSink", "RemoteTCPSinkSettings"},
{"RTTYDemodSettings", "RTTYDemodSettings"},
{"RTTYDemod", "RTTYDemodSettings"},
{"RTTYMod", "RTTYModSettings"},
{"SSBMod", "SSBModSettings"},
{"SSBDemod", "SSBDemodSettings"},
{"FT8Demod", "FT8DemodSettings"},
@ -208,7 +210,8 @@ const QMap<QString, QString> WebAPIUtils::m_channelTypeToActionsKey = {
{"SigMFFileSink", "SigMFFileSinkActions"},
{"IEEE_802_15_4_Mod", "IEEE_802_15_4_ModActions"},
{"RadioAstronomy", "RadioAstronomyActions"},
{"PacketMod", "PacketModActions"}
{"PacketMod", "PacketModActions"},
{"RTTYMod", "RTTYModActions"}
};
const QMap<QString, QString> WebAPIUtils::m_sourceDeviceHwIdToSettingsKey = {

View File

@ -35,8 +35,9 @@ RTTYModSettings:
Boolean
* 0 - off
* 1 - on
data:
text:
type: string
description: Text to transmit
pulseShaping:
type: integer
description: >
@ -48,6 +49,18 @@ RTTYModSettings:
format: float
symbolSpan:
type: integer
characterSet:
type: integer
unshiftOnSpace:
type: integer
msbFirst:
type: integer
spaceHigh:
type: integer
prefixCRLF:
type: integer
postfixCRLF:
type: integer
udpEnabled:
description: "Whether to receive text to transmit on specified UDP port"
type: integer