diff --git a/plugins/channeltx/modrtty/readme.md b/plugins/channeltx/modrtty/readme.md index 9e6dd7dc9..7465089bc 100644 --- a/plugins/channeltx/modrtty/readme.md +++ b/plugins/channeltx/modrtty/readme.md @@ -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 }}' diff --git a/plugins/channeltx/modrtty/rttymod.cpp b/plugins/channeltx/modrtty/rttymod.cpp index 3faf11046..582519f89 100644 --- a/plugins/channeltx/modrtty/rttymod.cpp +++ b/plugins/channeltx/modrtty/rttymod.cpp @@ -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); diff --git a/plugins/channeltx/modrtty/rttymodbaseband.cpp b/plugins/channeltx/modrtty/rttymodbaseband.cpp index 326109663..466cf533a 100644 --- a/plugins/channeltx/modrtty/rttymodbaseband.cpp +++ b/plugins/channeltx/modrtty/rttymodbaseband.cpp @@ -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; } diff --git a/plugins/channeltx/modrtty/rttymodgui.cpp b/plugins/channeltx/modrtty/rttymodgui.cpp index f9f14370d..80636f9bc 100644 --- a/plugins/channeltx/modrtty/rttymodgui.cpp +++ b/plugins/channeltx/modrtty/rttymodgui.cpp @@ -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(); diff --git a/plugins/channeltx/modrtty/rttymodsettings.cpp b/plugins/channeltx/modrtty/rttymodsettings.cpp index fcfcf2914..8724afa9a 100644 --- a/plugins/channeltx/modrtty/rttymodsettings.cpp +++ b/plugins/channeltx/modrtty/rttymodsettings.cpp @@ -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); diff --git a/plugins/channeltx/modrtty/rttymodsettings.h b/plugins/channeltx/modrtty/rttymodsettings.h index 3786ae98c..369f121ad 100644 --- a/plugins/channeltx/modrtty/rttymodsettings.h +++ b/plugins/channeltx/modrtty/rttymodsettings.h @@ -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; diff --git a/plugins/channeltx/modrtty/rttymodsource.cpp b/plugins/channeltx/modrtty/rttymodsource.cpp index 481ed4737..2959dfa1b 100644 --- a/plugins/channeltx/modrtty/rttymodsource.cpp +++ b/plugins/channeltx/modrtty/rttymodsource.cpp @@ -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); } } diff --git a/plugins/channeltx/modrtty/rttymodsource.h b/plugins/channeltx/modrtty/rttymodsource.h index cd7421548..d85bb3cda 100644 --- a/plugins/channeltx/modrtty/rttymodsource.h +++ b/plugins/channeltx/modrtty/rttymodsource.h @@ -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; diff --git a/plugins/channeltx/modrtty/rttymodtxsettingsdialog.ui b/plugins/channeltx/modrtty/rttymodtxsettingsdialog.ui index 1f38cc3ea..1f1408bf8 100644 --- a/plugins/channeltx/modrtty/rttymodtxsettingsdialog.ui +++ b/plugins/channeltx/modrtty/rttymodtxsettingsdialog.ui @@ -17,7 +17,7 @@ - Packet TX Extra Settings + Transmit Settings diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index 4febce713..7670da009 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -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) diff --git a/sdrbase/webapi/webapiutils.cpp b/sdrbase/webapi/webapiutils.cpp index 8860ec507..e9fa38d31 100644 --- a/sdrbase/webapi/webapiutils.cpp +++ b/sdrbase/webapi/webapiutils.cpp @@ -70,6 +70,7 @@ const QMap 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 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 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 WebAPIUtils::m_sourceDeviceHwIdToSettingsKey = { diff --git a/swagger/sdrangel/api/swagger/include/RTTYMod.yaml b/swagger/sdrangel/api/swagger/include/RTTYMod.yaml index b61650740..b46f0ff01 100644 --- a/swagger/sdrangel/api/swagger/include/RTTYMod.yaml +++ b/swagger/sdrangel/api/swagger/include/RTTYMod.yaml @@ -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