diff --git a/plugins/channelrx/demodnfm/CMakeLists.txt b/plugins/channelrx/demodnfm/CMakeLists.txt index e90f874af..3efccfd31 100644 --- a/plugins/channelrx/demodnfm/CMakeLists.txt +++ b/plugins/channelrx/demodnfm/CMakeLists.txt @@ -1,5 +1,7 @@ project(nfm) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(nfm_SOURCES nfmdemod.cpp nfmdemodgui.cpp @@ -21,6 +23,7 @@ set(nfm_FORMS include_directories( . ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client ) #include(${QT_USE_FILE}) @@ -41,6 +44,7 @@ target_link_libraries(demodnfm ${QT_LIBRARIES} sdrbase sdrgui + swagger ) qt5_use_modules(demodnfm Core Widgets) diff --git a/plugins/channelrx/demodnfm/demodnfm.pro b/plugins/channelrx/demodnfm/demodnfm.pro index ab9a447aa..f3f274eb8 100644 --- a/plugins/channelrx/demodnfm/demodnfm.pro +++ b/plugins/channelrx/demodnfm/demodnfm.pro @@ -20,6 +20,7 @@ QMAKE_CXXFLAGS += -std=c++11 INCLUDEPATH += $$PWD INCLUDEPATH += ../../../sdrbase INCLUDEPATH += ../../../sdrgui +INCLUDEPATH += ../../../swagger/sdrangel/code/qt5/client CONFIG(Release):build_subdir = release CONFIG(Debug):build_subdir = debug @@ -38,5 +39,6 @@ FORMS += nfmdemodgui.ui LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase LIBS += -L../../../sdrgui/$${build_subdir} -lsdrgui +LIBS += -L../../../swagger/$${build_subdir} -lswagger RESOURCES = ../../../sdrgui/resources/res.qrc diff --git a/plugins/channelrx/demodnfm/nfmdemod.cpp b/plugins/channelrx/demodnfm/nfmdemod.cpp index f48cd7c55..2435eefed 100644 --- a/plugins/channelrx/demodnfm/nfmdemod.cpp +++ b/plugins/channelrx/demodnfm/nfmdemod.cpp @@ -20,6 +20,9 @@ #include #include +#include "SWGChannelSettings.h" +#include "SWGNFMDemodSettings.h" + #include #include "util/stepfunctions.h" #include "audio/audiooutput.h" @@ -451,3 +454,29 @@ void NFMDemod::applySettings(const NFMDemodSettings& settings, bool force) m_settings = settings; } + +int NFMDemod::webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage __attribute__((unused))) +{ + response.setNfmDemodSettings(new SWGSDRangel::SWGNFMDemodSettings()); + response.getNfmDemodSettings()->setAfBandwidth(m_settings.m_afBandwidth); + response.getNfmDemodSettings()->setAudioMute(m_settings.m_audioMute ? 1 : 0); + response.getNfmDemodSettings()->setAudioSampleRate(m_settings.m_audioSampleRate); + response.getNfmDemodSettings()->setCopyAudioToUdp(m_settings.m_copyAudioToUDP ? 1 : 0); + response.getNfmDemodSettings()->setCtcssIndex(m_settings.m_ctcssIndex); + response.getNfmDemodSettings()->setCtcssOn(m_settings.m_ctcssOn ? 1 : 0); + response.getNfmDemodSettings()->setDeltaSquelch(m_settings.m_deltaSquelch ? 1 : 0); + response.getNfmDemodSettings()->setFmDeviation(m_settings.m_fmDeviation); + response.getNfmDemodSettings()->setInputFrequencyOffset(m_settings.m_inputFrequencyOffset); + response.getNfmDemodSettings()->setInputSampleRate(m_settings.m_inputSampleRate); + response.getNfmDemodSettings()->setRfBandwidth(m_settings.m_rfBandwidth); + response.getNfmDemodSettings()->setRgbColor(m_settings.m_rgbColor); + response.getNfmDemodSettings()->setSquelch(m_settings.m_squelch); + response.getNfmDemodSettings()->setSquelchGate(m_settings.m_squelchGate); + *response.getNfmDemodSettings()->getTitle() = m_settings.m_title; + *response.getNfmDemodSettings()->getUdpAddress() = m_settings.m_udpAddress; + response.getNfmDemodSettings()->setUdpPort(m_settings.m_udpPort); + response.getNfmDemodSettings()->setVolume(m_settings.m_volume); + return 200; +} diff --git a/plugins/channelrx/demodnfm/nfmdemod.h b/plugins/channelrx/demodnfm/nfmdemod.h index 1ef2bff3d..9db09cd8c 100644 --- a/plugins/channelrx/demodnfm/nfmdemod.h +++ b/plugins/channelrx/demodnfm/nfmdemod.h @@ -121,6 +121,10 @@ public: virtual void getIdentifier(QString& id) { id = objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } + virtual int webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage); + const Real *getCtcssToneSet(int& nbTones) const { nbTones = m_ctcssDetector.getNTones(); return m_ctcssDetector.getToneSet(); diff --git a/plugins/channeltx/modam/ammod.cpp b/plugins/channeltx/modam/ammod.cpp index dd733a4c5..996e5d0c6 100644 --- a/plugins/channeltx/modam/ammod.cpp +++ b/plugins/channeltx/modam/ammod.cpp @@ -70,7 +70,7 @@ AMMod::AMMod(DeviceSinkAPI *deviceAPI) : // CW keyer m_cwKeyer.setSampleRate(m_settings.m_audioSampleRate); m_cwKeyer.setWPM(13); - m_cwKeyer.setMode(CWKeyer::CWNone); + m_cwKeyer.setMode(CWKeyerSettings::CWNone); m_channelizer = new UpChannelizer(this); m_threadedChannelizer = new ThreadedBasebandSampleSource(m_channelizer, this); diff --git a/plugins/channeltx/modnfm/CMakeLists.txt b/plugins/channeltx/modnfm/CMakeLists.txt index d9d2d6ecb..f7060fcd0 100644 --- a/plugins/channeltx/modnfm/CMakeLists.txt +++ b/plugins/channeltx/modnfm/CMakeLists.txt @@ -1,5 +1,7 @@ project(modnfm) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(modnfm_SOURCES nfmmod.cpp nfmmodgui.cpp @@ -21,6 +23,7 @@ set(modnfm_FORMS include_directories( . ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client ) add_definitions(${QT_DEFINITIONS}) @@ -39,6 +42,7 @@ target_link_libraries(modnfm ${QT_LIBRARIES} sdrbase sdrgui + swagger ) qt5_use_modules(modnfm Core Widgets) diff --git a/plugins/channeltx/modnfm/modnfm.pro b/plugins/channeltx/modnfm/modnfm.pro index f849c1f2b..073b23c34 100644 --- a/plugins/channeltx/modnfm/modnfm.pro +++ b/plugins/channeltx/modnfm/modnfm.pro @@ -20,6 +20,7 @@ QMAKE_CXXFLAGS += -std=c++11 INCLUDEPATH += $$PWD INCLUDEPATH += ../../../sdrbase INCLUDEPATH += ../../../sdrgui +INCLUDEPATH += ../../../swagger/sdrangel/code/qt5/client CONFIG(Release):build_subdir = release CONFIG(Debug):build_subdir = debug @@ -38,5 +39,6 @@ FORMS += nfmmodgui.ui LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase LIBS += -L../../../sdrgui/$${build_subdir} -lsdrgui +LIBS += -L../../../swagger/$${build_subdir} -lswagger RESOURCES = ../../../sdrgui/resources/res.qrc diff --git a/plugins/channeltx/modnfm/nfmmod.cpp b/plugins/channeltx/modnfm/nfmmod.cpp index d8cfad6e0..e50b80caa 100644 --- a/plugins/channeltx/modnfm/nfmmod.cpp +++ b/plugins/channeltx/modnfm/nfmmod.cpp @@ -18,6 +18,9 @@ #include #include +#include "SWGChannelSettings.h" +#include "SWGCWKeyerSettings.h" + #include #include #include @@ -75,7 +78,7 @@ NFMMod::NFMMod(DeviceSinkAPI *deviceAPI) : // CW keyer m_cwKeyer.setSampleRate(m_settings.m_audioSampleRate); m_cwKeyer.setWPM(13); - m_cwKeyer.setMode(CWKeyer::CWNone); + m_cwKeyer.setMode(CWKeyerSettings::CWNone); m_channelizer = new UpChannelizer(this); m_threadedChannelizer = new ThreadedBasebandSampleSource(m_channelizer, this); @@ -467,3 +470,32 @@ void NFMMod::applySettings(const NFMModSettings& settings, bool force) m_settings = settings; } +int NFMMod::webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage __attribute__((unused))) +{ + response.setNfmModSettings(new SWGSDRangel::SWGNFMModSettings()); + response.getNfmModSettings()->setAfBandwidth(m_settings.m_afBandwidth); + response.getNfmModSettings()->setAudioSampleRate(m_settings.m_audioSampleRate); + response.getNfmModSettings()->setBasebandSampleRate(m_settings.m_basebandSampleRate); + response.getNfmModSettings()->setChannelMute(m_settings.m_channelMute ? 1 : 0); + response.getNfmModSettings()->setCtcssIndex(m_settings.m_ctcssIndex); + response.getNfmModSettings()->setCtcssOn(m_settings.m_ctcssOn ? 1 : 0); + response.getNfmModSettings()->setFmDeviation(m_settings.m_fmDeviation); + response.getNfmModSettings()->setInputFrequencyOffset(m_settings.m_inputFrequencyOffset); + response.getNfmModSettings()->setOutputSampleRate(m_settings.m_outputSampleRate); + response.getNfmModSettings()->setPlayLoop(m_settings.m_playLoop ? 1 : 0); + response.getNfmModSettings()->setRfBandwidth(m_settings.m_rfBandwidth); + response.getNfmModSettings()->setRgbColor(m_settings.m_rgbColor); + *response.getNfmModSettings()->getTitle() = m_settings.m_title; + response.getNfmModSettings()->setToneFrequency(m_settings.m_toneFrequency); + response.getNfmModSettings()->setVolumeFactor(m_settings.m_volumeFactor); + SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getNfmModSettings()->getCwKeyer(); + const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings(); + apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0); + apiCwKeyerSettings->setMode((int) cwKeyerSettings.m_mode); + apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate); + apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text)); + apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm); + return 200; +} diff --git a/plugins/channeltx/modnfm/nfmmod.h b/plugins/channeltx/modnfm/nfmmod.h index 42070983d..fdc50566b 100644 --- a/plugins/channeltx/modnfm/nfmmod.h +++ b/plugins/channeltx/modnfm/nfmmod.h @@ -241,6 +241,10 @@ public: virtual void getIdentifier(QString& id) { id = objectName(); } virtual void getTitle(QString& title) { title = m_settings.m_title; } + virtual int webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response, + QString& errorMessage); + double getMagSq() const { return m_magsq; } CWKeyer *getCWKeyer() { return &m_cwKeyer; } diff --git a/plugins/channeltx/modssb/ssbmod.cpp b/plugins/channeltx/modssb/ssbmod.cpp index 10ed7070e..e21822dc1 100644 --- a/plugins/channeltx/modssb/ssbmod.cpp +++ b/plugins/channeltx/modssb/ssbmod.cpp @@ -90,7 +90,7 @@ SSBMod::SSBMod(DeviceSinkAPI *deviceAPI) : // CW keyer m_cwKeyer.setSampleRate(m_settings.m_audioSampleRate); m_cwKeyer.setWPM(13); - m_cwKeyer.setMode(CWKeyer::CWNone); + m_cwKeyer.setMode(CWKeyerSettings::CWNone); m_inAGC.setGate(m_settings.m_agcThresholdGate); m_inAGC.setStepDownDelay(m_settings.m_agcThresholdDelay); diff --git a/plugins/channeltx/modwfm/wfmmod.cpp b/plugins/channeltx/modwfm/wfmmod.cpp index 4fd4d5488..fb7e00e44 100644 --- a/plugins/channeltx/modwfm/wfmmod.cpp +++ b/plugins/channeltx/modwfm/wfmmod.cpp @@ -80,7 +80,7 @@ WFMMod::WFMMod(DeviceSinkAPI *deviceAPI) : // CW keyer m_cwKeyer.setSampleRate(m_settings.m_outputSampleRate); m_cwKeyer.setWPM(13); - m_cwKeyer.setMode(CWKeyer::CWNone); + m_cwKeyer.setMode(CWKeyerSettings::CWNone); m_cwKeyer.reset(); m_channelizer = new UpChannelizer(this); diff --git a/plugins/samplesink/bladerfoutput/bladerfoutput.cpp b/plugins/samplesink/bladerfoutput/bladerfoutput.cpp index fa4f5181a..0148dab1d 100644 --- a/plugins/samplesink/bladerfoutput/bladerfoutput.cpp +++ b/plugins/samplesink/bladerfoutput/bladerfoutput.cpp @@ -23,6 +23,7 @@ #include "util/simpleserializer.h" #include "dsp/dspcommands.h" +#include "dsp/dspengine.h" #include "device/devicesinkapi.h" #include "device/devicesourceapi.h" #include "bladerf/devicebladerfshared.h" @@ -490,6 +491,7 @@ int BladerfOutput::webapiRun( if (m_deviceAPI->initGeneration()) { m_deviceAPI->startGeneration(); + DSPEngine::instance()->startAudioInputImmediate(); } } else diff --git a/sdrbase/CMakeLists.txt b/sdrbase/CMakeLists.txt index 56a2849a7..0eef2ca69 100644 --- a/sdrbase/CMakeLists.txt +++ b/sdrbase/CMakeLists.txt @@ -16,6 +16,7 @@ set(sdrbase_SOURCES dsp/channelmarker.cpp dsp/ctcssdetector.cpp dsp/cwkeyer.cpp + dsp/cwkeyersettings.cpp dsp/dspcommands.cpp dsp/dspengine.cpp dsp/dspdevicesourceengine.cpp @@ -91,6 +92,7 @@ set(sdrbase_HEADERS dsp/channelmarker.h dsp/complex.h dsp/cwkeyer.h + dsp/cwkeyersettings.h dsp/decimators.h dsp/interpolators.h dsp/dspcommands.h diff --git a/sdrbase/channel/channelsinkapi.h b/sdrbase/channel/channelsinkapi.h index 1ecb14587..6315e4b43 100644 --- a/sdrbase/channel/channelsinkapi.h +++ b/sdrbase/channel/channelsinkapi.h @@ -24,6 +24,11 @@ #include "util/export.h" +namespace SWGSDRangel +{ + class SWGChannelSettings; +} + class SDRANGEL_API ChannelSinkAPI { public: ChannelSinkAPI(); @@ -33,6 +38,11 @@ public: virtual void getIdentifier(QString& id) = 0; virtual void getTitle(QString& title) = 0; + virtual int webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response __attribute__((unused)), + QString& errorMessage) + { errorMessage = "Not implemented"; return 501; } + int getIndexInDeviceSet() const { return m_indexInDeviceSet; } void setIndexInDeviceSet(int indexInDeviceSet) { m_indexInDeviceSet = indexInDeviceSet; } uint64_t getUID() const { return m_uid; } diff --git a/sdrbase/channel/channelsourceapi.h b/sdrbase/channel/channelsourceapi.h index 4767b8f26..f79c45d00 100644 --- a/sdrbase/channel/channelsourceapi.h +++ b/sdrbase/channel/channelsourceapi.h @@ -24,6 +24,11 @@ #include "util/export.h" +namespace SWGSDRangel +{ + class SWGChannelSettings; +} + class SDRANGEL_API ChannelSourceAPI { public: ChannelSourceAPI(); @@ -33,6 +38,11 @@ public: virtual void getIdentifier(QString& id) = 0; virtual void getTitle(QString& title) = 0; + virtual int webapiSettingsGet( + SWGSDRangel::SWGChannelSettings& response __attribute__((unused)), + QString& errorMessage) + { errorMessage = "Not implemented"; return 501; } + int getIndexInDeviceSet() const { return m_indexInDeviceSet; } void setIndexInDeviceSet(int indexInDeviceSet) { m_indexInDeviceSet = indexInDeviceSet; } uint64_t getUID() const { return m_uid; } diff --git a/sdrbase/dsp/cwkeyer.cpp b/sdrbase/dsp/cwkeyer.cpp index 6880d808b..572216f57 100644 --- a/sdrbase/dsp/cwkeyer.cpp +++ b/sdrbase/dsp/cwkeyer.cpp @@ -159,7 +159,6 @@ const signed char CWKeyer::m_asciiToMorse[128][7] = { CWKeyer::CWKeyer() : m_mutex(QMutex::Recursive), - m_sampleRate(48000), m_textPointer(0), m_elementPointer(0), m_samplePointer(0), @@ -169,9 +168,7 @@ CWKeyer::CWKeyer() : m_dot(false), m_dash(false), m_elementOn(false), - m_loop(false), m_asciiChar('\0'), - m_mode(CWNone), m_keyIambicState(KeySilent), m_textState(TextStart) { @@ -185,9 +182,9 @@ CWKeyer::~CWKeyer() void CWKeyer::setSampleRate(int sampleRate) { m_mutex.lock(); - m_sampleRate = sampleRate; + m_settings.m_sampleRate = sampleRate; m_mutex.unlock(); - setWPM(m_wpm); + setWPM(m_settings.m_wpm); } void CWKeyer::setWPM(int wpm) @@ -195,8 +192,8 @@ void CWKeyer::setWPM(int wpm) if ((wpm > 0) && (wpm < 27)) { QMutexLocker mutexLocker(&m_mutex); - m_dotLength = (int) (0.24f * m_sampleRate * (5.0f / wpm)); - m_wpm = wpm; + m_dotLength = (int) (0.24f * m_settings.m_sampleRate * (5.0f / wpm)); + m_settings.m_wpm = wpm; m_cwSmoother.setNbFadeSamples(m_dotLength/5); // 20% the dot time } } @@ -204,34 +201,34 @@ void CWKeyer::setWPM(int wpm) void CWKeyer::setText(const QString& text) { QMutexLocker mutexLocker(&m_mutex); - m_text = text; + m_settings.m_text = text; m_textState = TextStart; } -void CWKeyer::setMode(CWMode mode) +void CWKeyer::setMode(CWKeyerSettings::CWMode mode) { - if (mode != m_mode) + if (mode != m_settings.m_mode) { QMutexLocker mutexLocker(&m_mutex); - if (mode == CWText) + if (mode == CWKeyerSettings::CWText) { m_textState = TextStart; } - else if (mode == CWDots) + else if (mode == CWKeyerSettings::CWDots) { m_dot = true; m_dash = false; m_keyIambicState = KeySilent; } - else if (mode == CWDashes) + else if (mode == CWKeyerSettings::CWDashes) { m_dot = false; m_dash = true; m_keyIambicState = KeySilent; } - m_mode = mode; + m_settings.m_mode = mode; } } @@ -239,12 +236,12 @@ int CWKeyer::getSample() { QMutexLocker mutexLocker(&m_mutex); - if (m_mode == CWText) + if (m_settings.m_mode == CWKeyerSettings::CWText) { nextStateText(); return m_key ? 1 : 0; } - else if ((m_mode == CWDots) || (m_mode == CWDashes)) + else if ((m_settings.m_mode == CWKeyerSettings::CWDots) || (m_settings.m_mode == CWKeyerSettings::CWDashes)) { nextStateIambic(); return m_key ? 1 : 0; @@ -336,7 +333,6 @@ void CWKeyer::nextStateIambic() void CWKeyer::nextStateText() { - // TODO... switch (m_textState) { case TextStart: @@ -351,9 +347,9 @@ void CWKeyer::nextStateText() case TextStartChar: m_samplePointer = 0; m_elementPointer = 0; - if (m_textPointer < m_text.length()) + if (m_textPointer < m_settings.m_text.length()) { - m_asciiChar = (m_text.at(m_textPointer)).toLatin1(); + m_asciiChar = (m_settings.m_text.at(m_textPointer)).toLatin1(); // qDebug() << "CWKeyer::nextStateText: TextStartChar: " << m_asciiChar; if (m_asciiChar < 0) { // non ASCII @@ -433,7 +429,7 @@ void CWKeyer::nextStateText() } break; case TextEnd: - if (m_loop) + if (m_settings.m_loop) { m_textState = TextStart; } @@ -452,7 +448,7 @@ void CWKeyer::nextStateText() bool CWKeyer::eom() { - return !(m_textPointer < m_text.length()); + return !(m_textPointer < m_settings.m_text.length()); } CWSmoother::CWSmoother() : diff --git a/sdrbase/dsp/cwkeyer.h b/sdrbase/dsp/cwkeyer.h index 0d8312c79..a2c3976fe 100644 --- a/sdrbase/dsp/cwkeyer.h +++ b/sdrbase/dsp/cwkeyer.h @@ -22,6 +22,7 @@ #include #include "util/export.h" +#include "cwkeyersettings.h" /** * Ancillary class to smooth out CW transitions with a sine shape @@ -48,13 +49,13 @@ class SDRANGEL_API CWKeyer : public QObject { Q_OBJECT public: - typedef enum - { - CWNone, - CWText, - CWDots, - CWDashes - } CWMode; +// typedef enum +// { +// CWNone, +// CWText, +// CWDots, +// CWDashes +// } CWMode; typedef enum { @@ -85,8 +86,10 @@ public: void setSampleRate(int sampleRate); void setWPM(int wpm); void setText(const QString& text); - void setMode(CWMode mode); - void setLoop(bool loop) { m_loop = loop; } + void setMode(CWKeyerSettings::CWMode mode); + void setLoop(bool loop) { m_settings.m_loop = loop; } + const CWKeyerSettings& getSettings() const { return m_settings; } + void reset() { m_keyIambicState = KeySilent; } CWSmoother& getCWSmoother() { return m_cwSmoother; } @@ -97,10 +100,8 @@ public: private: QMutex m_mutex; - int m_sampleRate; - int m_wpm; + CWKeyerSettings m_settings; int m_dotLength; //!< dot length in samples - QString m_text; int m_textPointer; int m_elementPointer; int m_samplePointer; @@ -110,9 +111,7 @@ private: bool m_dot; bool m_dash; bool m_elementOn; - bool m_loop; char m_asciiChar; - CWMode m_mode; CWKeyIambicState m_keyIambicState; CWTextState m_textState; CWSmoother m_cwSmoother; diff --git a/sdrbase/dsp/cwkeyersettings.cpp b/sdrbase/dsp/cwkeyersettings.cpp new file mode 100644 index 000000000..e22cd9ff5 --- /dev/null +++ b/sdrbase/dsp/cwkeyersettings.cpp @@ -0,0 +1,76 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2016 F4EXB // +// written by Edouard Griffiths // +// // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation as version 3 of the License, or // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License V3 for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program. If not, see . // +/////////////////////////////////////////////////////////////////////////////////// + +#include "util/simpleserializer.h" +#include "cwkeyersettings.h" + +CWKeyerSettings::CWKeyerSettings() +{ + resetToDefaults(); +} + +void CWKeyerSettings::resetToDefaults() +{ + m_loop = false; + m_mode = CWNone; + m_sampleRate = 48000; + m_text = ""; + m_wpm = 13; +} + +QByteArray CWKeyerSettings::serialize() const +{ + SimpleSerializer s(1); + + s.writeBool(2, m_loop); + s.writeS32(3, (int) m_mode); + s.writeS32(4, m_sampleRate); + s.writeString(5, m_text); + s.writeS32(6, m_wpm); + + return s.final(); +} + +bool CWKeyerSettings::deserialize(const QByteArray& data) +{ + SimpleDeserializer d(data); + + if (!d.isValid()) + { + resetToDefaults(); + return false; + } + + if (d.getVersion() == 1) + { + int intval; + + d.readBool(2, &m_loop, false); + d.readS32(3, &intval, 0); + m_mode = (CWMode) intval; + d.readS32(4, &m_sampleRate, 48000); + d.readString(5, &m_text, ""); + d.readS32(6, &m_wpm, 13); + + return true; + } + else + { + resetToDefaults(); + return false; + } +} diff --git a/sdrbase/dsp/cwkeyersettings.h b/sdrbase/dsp/cwkeyersettings.h new file mode 100644 index 000000000..49fcbfd95 --- /dev/null +++ b/sdrbase/dsp/cwkeyersettings.h @@ -0,0 +1,49 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2016 F4EXB // +// written by Edouard Griffiths // +// // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation as version 3 of the License, or // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License V3 for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program. If not, see . // +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef SDRBASE_DSP_CWKEYERSETTINGS_H_ +#define SDRBASE_DSP_CWKEYERSETTINGS_H_ + +#include +#include + +struct CWKeyerSettings +{ + typedef enum + { + CWNone, + CWText, + CWDots, + CWDashes + } CWMode; + + bool m_loop; + CWMode m_mode; + int m_sampleRate; + QString m_text; + int m_wpm; + + CWKeyerSettings(); + void resetToDefaults(); + + QByteArray serialize() const; + bool deserialize(const QByteArray& data); +}; + + + +#endif /* SDRBASE_DSP_CWKEYERSETTINGS_H_ */ diff --git a/sdrbase/resources/index.html b/sdrbase/resources/index.html index 46c4696f5..0f7d6c19f 100644 --- a/sdrbase/resources/index.html +++ b/sdrbase/resources/index.html @@ -763,6 +763,25 @@ margin-bottom: 20px; } }, "description" : "Audio devices selected" +}; + defs.CWKeyerSettings = { + "properties" : { + "sampleRate" : { + "type" : "integer" + }, + "wpm" : { + "type" : "integer" + }, + "mode" : { + "type" : "integer" + }, + "text" : { + "type" : "string" + }, + "loop" : { + "type" : "integer" + } + } }; defs.Channel = { "required" : [ "deltaFrequency", "id", "index", "title", "uid" ], @@ -820,6 +839,27 @@ margin-bottom: 20px; } }, "description" : "Summarized information about channel plugin" +}; + defs.ChannelSettings = { + "required" : [ "channelType", "tx" ], + "discriminator" : "channelType", + "properties" : { + "channelType" : { + "type" : "string", + "description" : "Channel type code" + }, + "tx" : { + "type" : "integer", + "description" : "Not zero if it is a tx channel else it is a rx channel" + }, + "NFMDemodSettings" : { + "$ref" : "#/definitions/NFMDemodSettings" + }, + "NFMModSettings" : { + "$ref" : "#/definitions/NFMModSettings" + } + }, + "description" : "Base channel settings" }; defs.DVSeralDevices = { "required" : [ "nbDevices" ], @@ -1167,6 +1207,127 @@ margin-bottom: 20px; } }, "description" : "Logging parameters setting" +}; + defs.NFMDemodSettings = { + "properties" : { + "inputSampleRate" : { + "type" : "integer" + }, + "inputFrequencyOffset" : { + "type" : "integer", + "format" : "int64" + }, + "rfBandwidth" : { + "type" : "number", + "format" : "float" + }, + "afBandwidth" : { + "type" : "number", + "format" : "float" + }, + "fmDeviation" : { + "type" : "integer" + }, + "squelchGate" : { + "type" : "integer" + }, + "deltaSquelch" : { + "type" : "integer" + }, + "squelch" : { + "type" : "number", + "format" : "float" + }, + "volume" : { + "type" : "number", + "format" : "float" + }, + "ctcssOn" : { + "type" : "integer" + }, + "audioMute" : { + "type" : "integer" + }, + "ctcssIndex" : { + "type" : "integer" + }, + "audioSampleRate" : { + "type" : "integer" + }, + "copyAudioToUDP" : { + "type" : "integer" + }, + "udpAddress" : { + "type" : "string" + }, + "udpPort" : { + "type" : "integer" + }, + "rgbColor" : { + "type" : "integer" + }, + "title" : { + "type" : "string" + } + } +}; + defs.NFMModSettings = { + "properties" : { + "basebandSampleRate" : { + "type" : "integer" + }, + "outputSampleRate" : { + "type" : "integer" + }, + "inputFrequencyOffset" : { + "type" : "integer", + "format" : "int64" + }, + "rfBandwidth" : { + "type" : "number", + "format" : "float" + }, + "afBandwidth" : { + "type" : "number", + "format" : "float" + }, + "fmDeviation" : { + "type" : "number", + "format" : "float" + }, + "toneFrequency" : { + "type" : "number", + "format" : "float" + }, + "volumeFactor" : { + "type" : "number", + "format" : "float" + }, + "audioSampleRate" : { + "type" : "integer" + }, + "channelMute" : { + "type" : "integer" + }, + "playLoop" : { + "type" : "integer" + }, + "ctcssOn" : { + "type" : "integer" + }, + "ctcssIndex" : { + "type" : "integer" + }, + "rgbColor" : { + "type" : "integer" + }, + "title" : { + "type" : "string" + }, + "cwKeyer" : { + "$ref" : "#/definitions/CWKeyerSettings" + } + } }; defs.PresetGroup = { "required" : [ "groupName", "nbPresets" ], @@ -1368,6 +1529,21 @@ margin-bottom: 20px; +
  • + devicesetChannelDelete +
  • +
  • + devicesetChannelPost +
  • +
  • + devicesetChannelSettingsGet +
  • +
  • + devicesetChannelSettingsPatch +
  • +
  • + devicesetChannelSettingsPut +
  • devicesetDevicePut
  • @@ -1468,6 +1644,2320 @@ margin-bottom: 20px;

    DeviceSet

    +
    +
    +
    +

    devicesetChannelDelete

    +

    +
    +
    +
    +

    +

    delete channel

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X DELETE "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        Integer channelIndex = 56; // Integer | Index of channel in the channels list
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelDelete(deviceSetIndex, channelIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelDelete");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        Integer channelIndex = 56; // Integer | Index of channel in the channels list
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelDelete(deviceSetIndex, channelIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelDelete");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +Integer *channelIndex = 56; // Index of channel in the channels list
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetChannelDeleteWith:deviceSetIndex
    +    channelIndex:channelIndex
    +              completionHandler: ^(ChannelSettings output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +var channelIndex = 56; // {Integer} Index of channel in the channels list
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetChannelDelete(deviceSetIndex, channelIndex, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetChannelDeleteExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +            var channelIndex = 56;  // Integer | Index of channel in the channels list
    +
    +            try
    +            {
    +                ChannelSettings result = apiInstance.devicesetChannelDelete(deviceSetIndex, channelIndex);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetChannelDelete: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +$channelIndex = 56; // Integer | Index of channel in the channels list
    +
    +try {
    +    $result = $api_instance->devicesetChannelDelete($deviceSetIndex, $channelIndex);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetChannelDelete: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +my $channelIndex = 56; # Integer | Index of channel in the channels list
    +
    +eval { 
    +    my $result = $api_instance->devicesetChannelDelete(deviceSetIndex => $deviceSetIndex, channelIndex => $channelIndex);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetChannelDelete: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +channelIndex = 56 # Integer | Index of channel in the channels list
    +
    +try: 
    +    api_response = api_instance.deviceset_channel_delete(deviceSetIndex, channelIndex)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetChannelDelete: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    channelIndex* + + +
    +
    +
    + + Integer + + +
    + Index of channel in the channels list +
    +
    +
    + Required +
    +
    +
    +
    + + + + + +

    Responses

    +

    Status: 200 - On success return deleted channel settings

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 400 - Invalid device set or channel index

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Device or channel not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    +
    +
    +
    +

    devicesetChannelPost

    +

    +
    +
    +
    +

    +

    add a channel

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/channel
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X POST "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/channel"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        ChannelSettings body = ; // ChannelSettings | Channel identification (no settings data)
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelPost(deviceSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelPost");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        ChannelSettings body = ; // ChannelSettings | Channel identification (no settings data)
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelPost(deviceSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelPost");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +ChannelSettings *body = ; // Channel identification (no settings data)
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetChannelPostWith:deviceSetIndex
    +    body:body
    +              completionHandler: ^(ChannelSettings output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +var body = ; // {ChannelSettings} Channel identification (no settings data)
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetChannelPost(deviceSetIndex, body, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetChannelPostExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +            var body = new ChannelSettings(); // ChannelSettings | Channel identification (no settings data)
    +
    +            try
    +            {
    +                ChannelSettings result = apiInstance.devicesetChannelPost(deviceSetIndex, body);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetChannelPost: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +$body = ; // ChannelSettings | Channel identification (no settings data)
    +
    +try {
    +    $result = $api_instance->devicesetChannelPost($deviceSetIndex, $body);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetChannelPost: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +my $body = SWGSDRangel::Object::ChannelSettings->new(); # ChannelSettings | Channel identification (no settings data)
    +
    +eval { 
    +    my $result = $api_instance->devicesetChannelPost(deviceSetIndex => $deviceSetIndex, body => $body);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetChannelPost: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +body =  # ChannelSettings | Channel identification (no settings data)
    +
    +try: 
    +    api_response = api_instance.deviceset_channel_post(deviceSetIndex, body)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetChannelPost: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    + + +
    Body parameters
    + + + + + + + + + +
    NameDescription
    body * + + + +
    +
    + + + +

    Responses

    +

    Status: 200 - On success return new channel settings

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 400 - Invalid device set index

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Device not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    +
    +
    +
    +

    devicesetChannelSettingsGet

    +

    +
    +
    +
    +

    +

    get a channel settings

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X GET "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        Integer channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelSettingsGet(deviceSetIndex, channelIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelSettingsGet");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        Integer channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelSettingsGet(deviceSetIndex, channelIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelSettingsGet");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +Integer *channelIndex = 56; // Index of the channel in the channels list for this device set
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetChannelSettingsGetWith:deviceSetIndex
    +    channelIndex:channelIndex
    +              completionHandler: ^(ChannelSettings output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +var channelIndex = 56; // {Integer} Index of the channel in the channels list for this device set
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetChannelSettingsGet(deviceSetIndex, channelIndex, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetChannelSettingsGetExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +            var channelIndex = 56;  // Integer | Index of the channel in the channels list for this device set
    +
    +            try
    +            {
    +                ChannelSettings result = apiInstance.devicesetChannelSettingsGet(deviceSetIndex, channelIndex);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetChannelSettingsGet: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +$channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +
    +try {
    +    $result = $api_instance->devicesetChannelSettingsGet($deviceSetIndex, $channelIndex);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetChannelSettingsGet: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +my $channelIndex = 56; # Integer | Index of the channel in the channels list for this device set
    +
    +eval { 
    +    my $result = $api_instance->devicesetChannelSettingsGet(deviceSetIndex => $deviceSetIndex, channelIndex => $channelIndex);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetChannelSettingsGet: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +channelIndex = 56 # Integer | Index of the channel in the channels list for this device set
    +
    +try: 
    +    api_response = api_instance.deviceset_channel_settings_get(deviceSetIndex, channelIndex)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetChannelSettingsGet: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    channelIndex* + + +
    +
    +
    + + Integer + + +
    + Index of the channel in the channels list for this device set +
    +
    +
    + Required +
    +
    +
    +
    + + + + + +

    Responses

    +

    Status: 200 - On success return channel settings

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 400 - Invalid device set or channel index

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Device or channel not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    +
    +
    +
    +

    devicesetChannelSettingsPatch

    +

    +
    +
    +
    +

    +

    apply settings differentially (no force)

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X PATCH "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        Integer channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelSettingsPatch(deviceSetIndex, channelIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelSettingsPatch");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        Integer channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelSettingsPatch(deviceSetIndex, channelIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelSettingsPatch");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +Integer *channelIndex = 56; // Index of the channel in the channels list for this device set
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetChannelSettingsPatchWith:deviceSetIndex
    +    channelIndex:channelIndex
    +              completionHandler: ^(ChannelSettings output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +var channelIndex = 56; // {Integer} Index of the channel in the channels list for this device set
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetChannelSettingsPatch(deviceSetIndex, channelIndex, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetChannelSettingsPatchExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +            var channelIndex = 56;  // Integer | Index of the channel in the channels list for this device set
    +
    +            try
    +            {
    +                ChannelSettings result = apiInstance.devicesetChannelSettingsPatch(deviceSetIndex, channelIndex);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetChannelSettingsPatch: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +$channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +
    +try {
    +    $result = $api_instance->devicesetChannelSettingsPatch($deviceSetIndex, $channelIndex);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetChannelSettingsPatch: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +my $channelIndex = 56; # Integer | Index of the channel in the channels list for this device set
    +
    +eval { 
    +    my $result = $api_instance->devicesetChannelSettingsPatch(deviceSetIndex => $deviceSetIndex, channelIndex => $channelIndex);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetChannelSettingsPatch: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +channelIndex = 56 # Integer | Index of the channel in the channels list for this device set
    +
    +try: 
    +    api_response = api_instance.deviceset_channel_settings_patch(deviceSetIndex, channelIndex)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetChannelSettingsPatch: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    channelIndex* + + +
    +
    +
    + + Integer + + +
    + Index of the channel in the channels list for this device set +
    +
    +
    + Required +
    +
    +
    +
    + + + + + +

    Responses

    +

    Status: 200 - On success return channel new settings

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 400 - Invalid device set or channel index

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Device or channel not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    +
    +
    +
    +

    devicesetChannelSettingsPut

    +

    +
    +
    +
    +

    +

    apply all settings unconditionally (force)

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X PUT "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        Integer channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelSettingsPut(deviceSetIndex, channelIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelSettingsPut");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        Integer channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelSettingsPut(deviceSetIndex, channelIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelSettingsPut");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +Integer *channelIndex = 56; // Index of the channel in the channels list for this device set
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetChannelSettingsPutWith:deviceSetIndex
    +    channelIndex:channelIndex
    +              completionHandler: ^(ChannelSettings output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +var channelIndex = 56; // {Integer} Index of the channel in the channels list for this device set
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetChannelSettingsPut(deviceSetIndex, channelIndex, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetChannelSettingsPutExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +            var channelIndex = 56;  // Integer | Index of the channel in the channels list for this device set
    +
    +            try
    +            {
    +                ChannelSettings result = apiInstance.devicesetChannelSettingsPut(deviceSetIndex, channelIndex);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetChannelSettingsPut: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +$channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +
    +try {
    +    $result = $api_instance->devicesetChannelSettingsPut($deviceSetIndex, $channelIndex);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetChannelSettingsPut: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +my $channelIndex = 56; # Integer | Index of the channel in the channels list for this device set
    +
    +eval { 
    +    my $result = $api_instance->devicesetChannelSettingsPut(deviceSetIndex => $deviceSetIndex, channelIndex => $channelIndex);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetChannelSettingsPut: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +channelIndex = 56 # Integer | Index of the channel in the channels list for this device set
    +
    +try: 
    +    api_response = api_instance.deviceset_channel_settings_put(deviceSetIndex, channelIndex)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetChannelSettingsPut: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    channelIndex* + + +
    +
    +
    + + Integer + + +
    + Index of the channel in the channels list for this device set +
    +
    +
    + Required +
    +
    +
    +
    + + + + + +

    Responses

    +

    Status: 200 - On success return channel new settings

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 400 - Invalid device set or channel index

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Device or channel not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    @@ -11274,7 +13764,7 @@ except ApiException as e:
    - Generated 2017-12-09T10:46:45.115+01:00 + Generated 2017-12-10T18:03:56.008+01:00
    diff --git a/sdrbase/sdrbase.pro b/sdrbase/sdrbase.pro index 5497ea6ab..c1cb2b32b 100644 --- a/sdrbase/sdrbase.pro +++ b/sdrbase/sdrbase.pro @@ -63,6 +63,7 @@ SOURCES += audio/audiodeviceinfo.cpp\ dsp/channelmarker.cpp\ dsp/ctcssdetector.cpp\ dsp/cwkeyer.cpp\ + dsp/cwkeyersettings.cpp\ dsp/dspcommands.cpp\ dsp/dspengine.cpp\ dsp/dspdevicesourceengine.cpp\ @@ -127,6 +128,7 @@ HEADERS += audio/audiodeviceinfo.h\ dsp/upchannelizer.h\ dsp/channelmarker.h\ dsp/cwkeyer.h\ + dsp/cwkeyersettings.h\ dsp/complex.h\ dsp/decimators.h\ dsp/interpolators.h\ diff --git a/sdrbase/webapi/webapiadapterinterface.cpp b/sdrbase/webapi/webapiadapterinterface.cpp index 05e8ef7e2..7d3be9406 100644 --- a/sdrbase/webapi/webapiadapterinterface.cpp +++ b/sdrbase/webapi/webapiadapterinterface.cpp @@ -32,3 +32,4 @@ std::regex WebAPIAdapterInterface::devicesetURLRe("^/sdrangel/deviceset/([0-9]{1 std::regex WebAPIAdapterInterface::devicesetDeviceURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device$"); std::regex WebAPIAdapterInterface::devicesetDeviceSettingsURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device/settings$"); std::regex WebAPIAdapterInterface::devicesetDeviceRunURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device/run"); +std::regex WebAPIAdapterInterface::devicesetChannelSettingsURLRe("^/sdrangel/deviceset/([0-9]{1,2})/channel/([0-9]{1,2})/settings$"); diff --git a/sdrbase/webapi/webapiadapterinterface.h b/sdrbase/webapi/webapiadapterinterface.h index 77c80ee76..5f9611bc5 100644 --- a/sdrbase/webapi/webapiadapterinterface.h +++ b/sdrbase/webapi/webapiadapterinterface.h @@ -40,6 +40,7 @@ namespace SWGSDRangel class SWGDeviceListItem; class SWGDeviceSettings; class SWGDeviceState; + class SWGChannelSettings; class SWGErrorResponse; } @@ -288,6 +289,17 @@ public: SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) { return 501; } + /** + * Handler of /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels + * returns the Http status code (default 501: not implemented) + */ + virtual int devicesetChannelSettingsGet( + int deviceSetIndex __attribute__((unused)), + int channelIndex __attribute__((unused)), + SWGSDRangel::SWGChannelSettings& response __attribute__((unused)), + SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) + { return 501; } + static QString instanceSummaryURL; static QString instanceDevicesURL; static QString instanceChannelsURL; @@ -301,6 +313,7 @@ public: static std::regex devicesetDeviceURLRe; static std::regex devicesetDeviceSettingsURLRe; static std::regex devicesetDeviceRunURLRe; + static std::regex devicesetChannelSettingsURLRe; }; diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index 5f7db495c..e2813ce1a 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -36,6 +36,7 @@ #include "SWGPresetIdentifier.h" #include "SWGDeviceSettings.h" #include "SWGDeviceState.h" +#include "SWGChannelSettings.h" #include "SWGErrorResponse.h" WebAPIRequestMapper::WebAPIRequestMapper(QObject* parent) : @@ -95,6 +96,8 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http devicesetDeviceSettingsService(std::string(desc_match[1]), request, response); } else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetDeviceRunURLRe)) { devicesetDeviceRunService(std::string(desc_match[1]), request, response); + } else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetChannelSettingsURLRe)) { + devicesetChannelSettingsService(std::string(desc_match[1]), std::string(desc_match[2]), request, response); } else { @@ -762,6 +765,47 @@ void WebAPIRequestMapper::devicesetDeviceRunService(const std::string& indexStr, } } +void WebAPIRequestMapper::devicesetChannelSettingsService( + const std::string& deviceSetIndexStr, + const std::string& channelIndexStr, + qtwebapp::HttpRequest& request, + qtwebapp::HttpResponse& response) +{ + SWGSDRangel::SWGErrorResponse errorResponse; + + try + { + int deviceSetIndex = boost::lexical_cast(deviceSetIndexStr); + int channelIndex = boost::lexical_cast(channelIndexStr); + + if (request.getMethod() == "GET") + { + SWGSDRangel::SWGChannelSettings normalResponse; + resetChannelSettings(normalResponse); + int status = m_adapter->devicesetChannelSettingsGet(deviceSetIndex, channelIndex, normalResponse, errorResponse); + response.setStatus(status); + + if (status == 200) { + response.write(normalResponse.asJson().toUtf8()); + } else { + response.write(errorResponse.asJson().toUtf8()); + } + } + else + { + response.setStatus(405,"Invalid HTTP method"); + response.write("Invalid HTTP method"); + } + } + catch (const boost::bad_lexical_cast &e) + { + errorResponse.init(); + *errorResponse.getMessage() = "Wrong integer conversion on index"; + response.setStatus(400,"Invalid data"); + response.write(errorResponse.asJson().toUtf8()); + } +} + bool WebAPIRequestMapper::parseJsonBody(QString& jsonStr, QJsonObject& jsonObject, qtwebapp::HttpResponse& response) { SWGSDRangel::SWGErrorResponse errorResponse; @@ -902,3 +946,10 @@ void WebAPIRequestMapper::resetDeviceSettings(SWGSDRangel::SWGDeviceSettings& de deviceSettings.setLimeSdrOutputSettings(0); } +void WebAPIRequestMapper::resetChannelSettings(SWGSDRangel::SWGChannelSettings& channelSettings) +{ + channelSettings.cleanup(); + channelSettings.setNfmDemodSettings(0); + channelSettings.setNfmModSettings(0); +} + diff --git a/sdrbase/webapi/webapirequestmapper.h b/sdrbase/webapi/webapirequestmapper.h index f677fb3ab..6f42b66f9 100644 --- a/sdrbase/webapi/webapirequestmapper.h +++ b/sdrbase/webapi/webapirequestmapper.h @@ -59,6 +59,7 @@ private: void devicesetDeviceService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void devicesetDeviceSettingsService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); void devicesetDeviceRunService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); + void devicesetChannelSettingsService(const std::string& deviceSetIndexStr, const std::string& channelIndexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response); bool validatePresetTransfer(SWGSDRangel::SWGPresetTransfer& presetTransfer); bool validatePresetIdentifer(SWGSDRangel::SWGPresetIdentifier& presetIdentifier); @@ -67,6 +68,7 @@ private: bool parseJsonBody(QString& jsonStr, QJsonObject& jsonObject, qtwebapp::HttpResponse& response); void resetDeviceSettings(SWGSDRangel::SWGDeviceSettings& deviceSettings); + void resetChannelSettings(SWGSDRangel::SWGChannelSettings& deviceSettings); }; #endif /* SDRBASE_WEBAPI_WEBAPIREQUESTMAPPER_H_ */ diff --git a/sdrgui/gui/cwkeyergui.cpp b/sdrgui/gui/cwkeyergui.cpp index 358ad141e..5938d537d 100644 --- a/sdrgui/gui/cwkeyergui.cpp +++ b/sdrgui/gui/cwkeyergui.cpp @@ -115,7 +115,7 @@ void CWKeyerGUI::on_playDots_toggled(bool checked) ui->playDashes->setEnabled(!checked); ui->playText->setEnabled(!checked); - m_cwKeyer->setMode(checked ? CWKeyer::CWDots : CWKeyer::CWNone); + m_cwKeyer->setMode(checked ? CWKeyerSettings::CWDots : CWKeyerSettings::CWNone); } void CWKeyerGUI::on_playDashes_toggled(bool checked) @@ -124,7 +124,7 @@ void CWKeyerGUI::on_playDashes_toggled(bool checked) //ui->playDashes->setEnabled(!checked); ui->playText->setEnabled(!checked); - m_cwKeyer->setMode(checked ? CWKeyer::CWDashes : CWKeyer::CWNone); + m_cwKeyer->setMode(checked ? CWKeyerSettings::CWDashes : CWKeyerSettings::CWNone); } void CWKeyerGUI::on_playText_toggled(bool checked) @@ -133,7 +133,7 @@ void CWKeyerGUI::on_playText_toggled(bool checked) ui->playDashes->setEnabled(!checked); //ui->playText->setEnabled(!checked); - m_cwKeyer->setMode(checked ? CWKeyer::CWText : CWKeyer::CWNone); + m_cwKeyer->setMode(checked ? CWKeyerSettings::CWText : CWKeyerSettings::CWNone); if (checked) { ui->playStop->setChecked(true); diff --git a/sdrgui/webapi/webapiadaptergui.cpp b/sdrgui/webapi/webapiadaptergui.cpp index 10c2a25fc..e53e9f136 100644 --- a/sdrgui/webapi/webapiadaptergui.cpp +++ b/sdrgui/webapi/webapiadaptergui.cpp @@ -52,6 +52,7 @@ #include "SWGPresetIdentifier.h" #include "SWGDeviceSettings.h" #include "SWGDeviceState.h" +#include "SWGChannelSettings.h" #include "SWGErrorResponse.h" #include "webapiadaptergui.h" @@ -886,6 +887,65 @@ int WebAPIAdapterGUI::devicesetDeviceRunDelete( } } +int WebAPIAdapterGUI::devicesetChannelSettingsGet( + int deviceSetIndex, + int channelIndex, + SWGSDRangel::SWGChannelSettings& response, + SWGSDRangel::SWGErrorResponse& error) +{ + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + { + DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + + if (deviceSet->m_deviceSourceEngine) // Rx + { + ChannelSinkAPI *channelAPI = deviceSet->m_deviceSourceAPI->getChanelAPIAt(channelIndex); + + if (channelAPI == 0) + { + error.init(); + *error.getMessage() = QString("There is no channel with index %1").arg(channelIndex); + return 404; + } + else + { + response.setChannelType(new QString()); + channelAPI->getIdentifier(*response.getChannelType()); + response.setTx(0); + return channelAPI->webapiSettingsGet(response, *error.getMessage()); + } + } + else if (deviceSet->m_deviceSinkEngine) // Tx + { + ChannelSourceAPI *channelAPI = deviceSet->m_deviceSinkAPI->getChanelAPIAt(channelIndex); + + if (channelAPI == 0) + { + error.init(); + *error.getMessage() = QString("There is no channel with index %1").arg(channelIndex); + return 404; + } + else + { + response.setChannelType(new QString()); + channelAPI->getIdentifier(*response.getChannelType()); + response.setTx(1); + return channelAPI->webapiSettingsGet(response, *error.getMessage()); + } + } + else + { + *error.getMessage() = QString("DeviceSet error"); + return 500; + } + } + else + { + error.init(); + *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex); + return 404; + } +} void WebAPIAdapterGUI::getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSetList) { diff --git a/sdrgui/webapi/webapiadaptergui.h b/sdrgui/webapi/webapiadaptergui.h index ed700c934..9fa72d659 100644 --- a/sdrgui/webapi/webapiadaptergui.h +++ b/sdrgui/webapi/webapiadaptergui.h @@ -146,6 +146,12 @@ public: SWGSDRangel::SWGDeviceState& response, SWGSDRangel::SWGErrorResponse& error); + virtual int devicesetChannelSettingsGet( + int deviceSetIndex, + int channelIndex, + SWGSDRangel::SWGChannelSettings& response, + SWGSDRangel::SWGErrorResponse& error); + private: MainWindow& m_mainWindow; diff --git a/swagger/sdrangel/api/swagger/include/CWKeyer.yaml b/swagger/sdrangel/api/swagger/include/CWKeyer.yaml new file mode 100644 index 000000000..62a91c792 --- /dev/null +++ b/swagger/sdrangel/api/swagger/include/CWKeyer.yaml @@ -0,0 +1,12 @@ +CWKeyerSettings: + properties: + sampleRate: + type: integer + wpm: + type: integer + mode: + type: integer + text: + type: string + loop: + type: integer \ No newline at end of file diff --git a/swagger/sdrangel/api/swagger/include/NFMDemod.yaml b/swagger/sdrangel/api/swagger/include/NFMDemod.yaml new file mode 100644 index 000000000..fed0f8c09 --- /dev/null +++ b/swagger/sdrangel/api/swagger/include/NFMDemod.yaml @@ -0,0 +1,44 @@ +NFMDemodSettings: + properties: + inputSampleRate: + type: integer + inputFrequencyOffset: + type: integer + format: int64 + rfBandwidth: + type: number + format: float + afBandwidth: + type: number + format: float + fmDeviation: + type: integer + squelchGate: + type: integer + deltaSquelch: + type: integer + squelch: + type: number + format: float + volume: + type: number + format: float + ctcssOn: + type: integer + audioMute: + type: integer + ctcssIndex: + type: integer + audioSampleRate: + type: integer + copyAudioToUDP: + type: integer + udpAddress: + type: string + udpPort: + type: integer + rgbColor: + type: integer + title: + type: string + \ No newline at end of file diff --git a/swagger/sdrangel/api/swagger/include/NFMMod.yaml b/swagger/sdrangel/api/swagger/include/NFMMod.yaml new file mode 100644 index 000000000..8fc76d92f --- /dev/null +++ b/swagger/sdrangel/api/swagger/include/NFMMod.yaml @@ -0,0 +1,41 @@ +NFMModSettings: + properties: + basebandSampleRate: + type: integer + outputSampleRate: + type: integer + inputFrequencyOffset: + type: integer + format: int64 + rfBandwidth: + type: number + format: float + afBandwidth: + type: number + format: float + fmDeviation: + type: number + format: float + toneFrequency: + type: number + format: float + volumeFactor: + type: number + format: float + audioSampleRate: + type: integer + channelMute: + type: integer + playLoop: + type: integer + ctcssOn: + type: integer + ctcssIndex: + type: integer + rgbColor: + type: integer + title: + type: string + cwKeyer: + $ref: "http://localhost:8081/CWKeyer.yaml#/CWKeyerSettings" + \ No newline at end of file diff --git a/swagger/sdrangel/api/swagger/swagger.yaml b/swagger/sdrangel/api/swagger/swagger.yaml index 8721fd9a1..7e52da7e0 100644 --- a/swagger/sdrangel/api/swagger/swagger.yaml +++ b/swagger/sdrangel/api/swagger/swagger.yaml @@ -714,6 +714,187 @@ paths: $ref: "#/definitions/ErrorResponse" "501": description: Function not implemented + /sdrangel/deviceset/{deviceSetIndex}/channel: + x-swagger-router-controller: deviceset + post: + description: add a channel + operationId: devicesetChannelPost + tags: + - DeviceSet + parameters: + - in: path + name: deviceSetIndex + type: integer + required: true + description: Index of device set in the device set list + - name: body + in: body + description: Channel identification (no settings data) + required: true + schema: + $ref: "#/definitions/ChannelSettings" + responses: + "200": + description: On success return new channel settings + schema: + $ref: "#/definitions/ChannelSettings" + "400": + description: Invalid device set index + schema: + $ref: "#/definitions/ErrorResponse" + "404": + description: Device not found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + description: Error + schema: + $ref: "#/definitions/ErrorResponse" + "501": + description: Function not implemented + /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}: + delete: + description: delete channel + operationId: devicesetChannelDelete + tags: + - DeviceSet + parameters: + - in: path + name: deviceSetIndex + type: integer + required: true + description: Index of device set in the device set list + - in: path + name: channelIndex + type: integer + required: true + description: Index of channel in the channels list + responses: + "200": + description: On success return deleted channel settings + schema: + $ref: "#/definitions/ChannelSettings" + "400": + description: Invalid device set or channel index + schema: + $ref: "#/definitions/ErrorResponse" + "404": + description: Device or channel not found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + description: Error + schema: + $ref: "#/definitions/ErrorResponse" + "501": + description: Function not implemented + /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings: + x-swagger-router-controller: deviceset + get: + description: get a channel settings + operationId: devicesetChannelSettingsGet + tags: + - DeviceSet + parameters: + - in: path + name: deviceSetIndex + type: integer + required: true + description: Index of device set in the device set list + - in: path + name: channelIndex + type: integer + required: true + description: Index of the channel in the channels list for this device set + responses: + "200": + description: On success return channel settings + schema: + $ref: "#/definitions/ChannelSettings" + "400": + description: Invalid device set or channel index + schema: + $ref: "#/definitions/ErrorResponse" + "404": + description: Device or channel not found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + description: Error + schema: + $ref: "#/definitions/ErrorResponse" + "501": + description: Function not implemented + put: + description: apply all settings unconditionally (force) + operationId: devicesetChannelSettingsPut + tags: + - DeviceSet + parameters: + - in: path + name: deviceSetIndex + type: integer + required: true + description: Index of device set in the device set list + - in: path + name: channelIndex + type: integer + required: true + description: Index of the channel in the channels list for this device set + responses: + "200": + description: On success return channel new settings + schema: + $ref: "#/definitions/ChannelSettings" + "400": + description: Invalid device set or channel index + schema: + $ref: "#/definitions/ErrorResponse" + "404": + description: Device or channel not found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + description: Error + schema: + $ref: "#/definitions/ErrorResponse" + "501": + description: Function not implemented + patch: + description: apply settings differentially (no force) + operationId: devicesetChannelSettingsPatch + tags: + - DeviceSet + parameters: + - in: path + name: deviceSetIndex + type: integer + required: true + description: Index of device set in the device set list + - in: path + name: channelIndex + type: integer + required: true + description: Index of the channel in the channels list for this device set + responses: + "200": + description: On success return channel new settings + schema: + $ref: "#/definitions/ChannelSettings" + "400": + description: Invalid device set or channel index + schema: + $ref: "#/definitions/ErrorResponse" + "404": + description: Device or channel not found + schema: + $ref: "#/definitions/ErrorResponse" + "500": + description: Error + schema: + $ref: "#/definitions/ErrorResponse" + "501": + description: Function not implemented /swagger: x-swagger-pipe: swagger_raw # complex objects have schema definitions @@ -1124,3 +1305,20 @@ definitions: $ref: "http://localhost:8081/LimeSdr.yaml#/LimeSdrInputSettings" limeSdrOutputSettings: $ref: "http://localhost:8081/LimeSdr.yaml#/LimeSdrOutputSettings" + ChannelSettings: + description: Base channel settings + discriminator: channelType + required: + - channelType + - tx + properties: + channelType: + description: Channel type code + type: string + tx: + description: Not zero if it is a tx channel else it is a rx channel + type: integer + NFMDemodSettings: + $ref: "http://localhost:8081/NFMDemod.yaml#/NFMDemodSettings" + NFMModSettings: + $ref: "http://localhost:8081/NFMMod.yaml#/NFMModSettings" diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index 46c4696f5..0f7d6c19f 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -763,6 +763,25 @@ margin-bottom: 20px; } }, "description" : "Audio devices selected" +}; + defs.CWKeyerSettings = { + "properties" : { + "sampleRate" : { + "type" : "integer" + }, + "wpm" : { + "type" : "integer" + }, + "mode" : { + "type" : "integer" + }, + "text" : { + "type" : "string" + }, + "loop" : { + "type" : "integer" + } + } }; defs.Channel = { "required" : [ "deltaFrequency", "id", "index", "title", "uid" ], @@ -820,6 +839,27 @@ margin-bottom: 20px; } }, "description" : "Summarized information about channel plugin" +}; + defs.ChannelSettings = { + "required" : [ "channelType", "tx" ], + "discriminator" : "channelType", + "properties" : { + "channelType" : { + "type" : "string", + "description" : "Channel type code" + }, + "tx" : { + "type" : "integer", + "description" : "Not zero if it is a tx channel else it is a rx channel" + }, + "NFMDemodSettings" : { + "$ref" : "#/definitions/NFMDemodSettings" + }, + "NFMModSettings" : { + "$ref" : "#/definitions/NFMModSettings" + } + }, + "description" : "Base channel settings" }; defs.DVSeralDevices = { "required" : [ "nbDevices" ], @@ -1167,6 +1207,127 @@ margin-bottom: 20px; } }, "description" : "Logging parameters setting" +}; + defs.NFMDemodSettings = { + "properties" : { + "inputSampleRate" : { + "type" : "integer" + }, + "inputFrequencyOffset" : { + "type" : "integer", + "format" : "int64" + }, + "rfBandwidth" : { + "type" : "number", + "format" : "float" + }, + "afBandwidth" : { + "type" : "number", + "format" : "float" + }, + "fmDeviation" : { + "type" : "integer" + }, + "squelchGate" : { + "type" : "integer" + }, + "deltaSquelch" : { + "type" : "integer" + }, + "squelch" : { + "type" : "number", + "format" : "float" + }, + "volume" : { + "type" : "number", + "format" : "float" + }, + "ctcssOn" : { + "type" : "integer" + }, + "audioMute" : { + "type" : "integer" + }, + "ctcssIndex" : { + "type" : "integer" + }, + "audioSampleRate" : { + "type" : "integer" + }, + "copyAudioToUDP" : { + "type" : "integer" + }, + "udpAddress" : { + "type" : "string" + }, + "udpPort" : { + "type" : "integer" + }, + "rgbColor" : { + "type" : "integer" + }, + "title" : { + "type" : "string" + } + } +}; + defs.NFMModSettings = { + "properties" : { + "basebandSampleRate" : { + "type" : "integer" + }, + "outputSampleRate" : { + "type" : "integer" + }, + "inputFrequencyOffset" : { + "type" : "integer", + "format" : "int64" + }, + "rfBandwidth" : { + "type" : "number", + "format" : "float" + }, + "afBandwidth" : { + "type" : "number", + "format" : "float" + }, + "fmDeviation" : { + "type" : "number", + "format" : "float" + }, + "toneFrequency" : { + "type" : "number", + "format" : "float" + }, + "volumeFactor" : { + "type" : "number", + "format" : "float" + }, + "audioSampleRate" : { + "type" : "integer" + }, + "channelMute" : { + "type" : "integer" + }, + "playLoop" : { + "type" : "integer" + }, + "ctcssOn" : { + "type" : "integer" + }, + "ctcssIndex" : { + "type" : "integer" + }, + "rgbColor" : { + "type" : "integer" + }, + "title" : { + "type" : "string" + }, + "cwKeyer" : { + "$ref" : "#/definitions/CWKeyerSettings" + } + } }; defs.PresetGroup = { "required" : [ "groupName", "nbPresets" ], @@ -1368,6 +1529,21 @@ margin-bottom: 20px; +
  • + devicesetChannelDelete +
  • +
  • + devicesetChannelPost +
  • +
  • + devicesetChannelSettingsGet +
  • +
  • + devicesetChannelSettingsPatch +
  • +
  • + devicesetChannelSettingsPut +
  • devicesetDevicePut
  • @@ -1468,6 +1644,2320 @@ margin-bottom: 20px;

    DeviceSet

    +
    +
    +
    +

    devicesetChannelDelete

    +

    +
    +
    +
    +

    +

    delete channel

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X DELETE "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        Integer channelIndex = 56; // Integer | Index of channel in the channels list
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelDelete(deviceSetIndex, channelIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelDelete");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        Integer channelIndex = 56; // Integer | Index of channel in the channels list
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelDelete(deviceSetIndex, channelIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelDelete");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +Integer *channelIndex = 56; // Index of channel in the channels list
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetChannelDeleteWith:deviceSetIndex
    +    channelIndex:channelIndex
    +              completionHandler: ^(ChannelSettings output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +var channelIndex = 56; // {Integer} Index of channel in the channels list
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetChannelDelete(deviceSetIndex, channelIndex, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetChannelDeleteExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +            var channelIndex = 56;  // Integer | Index of channel in the channels list
    +
    +            try
    +            {
    +                ChannelSettings result = apiInstance.devicesetChannelDelete(deviceSetIndex, channelIndex);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetChannelDelete: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +$channelIndex = 56; // Integer | Index of channel in the channels list
    +
    +try {
    +    $result = $api_instance->devicesetChannelDelete($deviceSetIndex, $channelIndex);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetChannelDelete: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +my $channelIndex = 56; # Integer | Index of channel in the channels list
    +
    +eval { 
    +    my $result = $api_instance->devicesetChannelDelete(deviceSetIndex => $deviceSetIndex, channelIndex => $channelIndex);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetChannelDelete: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +channelIndex = 56 # Integer | Index of channel in the channels list
    +
    +try: 
    +    api_response = api_instance.deviceset_channel_delete(deviceSetIndex, channelIndex)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetChannelDelete: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    channelIndex* + + +
    +
    +
    + + Integer + + +
    + Index of channel in the channels list +
    +
    +
    + Required +
    +
    +
    +
    + + + + + +

    Responses

    +

    Status: 200 - On success return deleted channel settings

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 400 - Invalid device set or channel index

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Device or channel not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    +
    +
    +
    +

    devicesetChannelPost

    +

    +
    +
    +
    +

    +

    add a channel

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/channel
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X POST "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/channel"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        ChannelSettings body = ; // ChannelSettings | Channel identification (no settings data)
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelPost(deviceSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelPost");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        ChannelSettings body = ; // ChannelSettings | Channel identification (no settings data)
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelPost(deviceSetIndex, body);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelPost");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +ChannelSettings *body = ; // Channel identification (no settings data)
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetChannelPostWith:deviceSetIndex
    +    body:body
    +              completionHandler: ^(ChannelSettings output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +var body = ; // {ChannelSettings} Channel identification (no settings data)
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetChannelPost(deviceSetIndex, body, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetChannelPostExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +            var body = new ChannelSettings(); // ChannelSettings | Channel identification (no settings data)
    +
    +            try
    +            {
    +                ChannelSettings result = apiInstance.devicesetChannelPost(deviceSetIndex, body);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetChannelPost: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +$body = ; // ChannelSettings | Channel identification (no settings data)
    +
    +try {
    +    $result = $api_instance->devicesetChannelPost($deviceSetIndex, $body);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetChannelPost: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +my $body = SWGSDRangel::Object::ChannelSettings->new(); # ChannelSettings | Channel identification (no settings data)
    +
    +eval { 
    +    my $result = $api_instance->devicesetChannelPost(deviceSetIndex => $deviceSetIndex, body => $body);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetChannelPost: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +body =  # ChannelSettings | Channel identification (no settings data)
    +
    +try: 
    +    api_response = api_instance.deviceset_channel_post(deviceSetIndex, body)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetChannelPost: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    + + +
    Body parameters
    + + + + + + + + + +
    NameDescription
    body * + + + +
    +
    + + + +

    Responses

    +

    Status: 200 - On success return new channel settings

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 400 - Invalid device set index

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Device not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    +
    +
    +
    +

    devicesetChannelSettingsGet

    +

    +
    +
    +
    +

    +

    get a channel settings

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X GET "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        Integer channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelSettingsGet(deviceSetIndex, channelIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelSettingsGet");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        Integer channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelSettingsGet(deviceSetIndex, channelIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelSettingsGet");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +Integer *channelIndex = 56; // Index of the channel in the channels list for this device set
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetChannelSettingsGetWith:deviceSetIndex
    +    channelIndex:channelIndex
    +              completionHandler: ^(ChannelSettings output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +var channelIndex = 56; // {Integer} Index of the channel in the channels list for this device set
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetChannelSettingsGet(deviceSetIndex, channelIndex, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetChannelSettingsGetExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +            var channelIndex = 56;  // Integer | Index of the channel in the channels list for this device set
    +
    +            try
    +            {
    +                ChannelSettings result = apiInstance.devicesetChannelSettingsGet(deviceSetIndex, channelIndex);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetChannelSettingsGet: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +$channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +
    +try {
    +    $result = $api_instance->devicesetChannelSettingsGet($deviceSetIndex, $channelIndex);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetChannelSettingsGet: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +my $channelIndex = 56; # Integer | Index of the channel in the channels list for this device set
    +
    +eval { 
    +    my $result = $api_instance->devicesetChannelSettingsGet(deviceSetIndex => $deviceSetIndex, channelIndex => $channelIndex);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetChannelSettingsGet: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +channelIndex = 56 # Integer | Index of the channel in the channels list for this device set
    +
    +try: 
    +    api_response = api_instance.deviceset_channel_settings_get(deviceSetIndex, channelIndex)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetChannelSettingsGet: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    channelIndex* + + +
    +
    +
    + + Integer + + +
    + Index of the channel in the channels list for this device set +
    +
    +
    + Required +
    +
    +
    +
    + + + + + +

    Responses

    +

    Status: 200 - On success return channel settings

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 400 - Invalid device set or channel index

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Device or channel not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    +
    +
    +
    +

    devicesetChannelSettingsPatch

    +

    +
    +
    +
    +

    +

    apply settings differentially (no force)

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X PATCH "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        Integer channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelSettingsPatch(deviceSetIndex, channelIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelSettingsPatch");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        Integer channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelSettingsPatch(deviceSetIndex, channelIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelSettingsPatch");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +Integer *channelIndex = 56; // Index of the channel in the channels list for this device set
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetChannelSettingsPatchWith:deviceSetIndex
    +    channelIndex:channelIndex
    +              completionHandler: ^(ChannelSettings output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +var channelIndex = 56; // {Integer} Index of the channel in the channels list for this device set
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetChannelSettingsPatch(deviceSetIndex, channelIndex, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetChannelSettingsPatchExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +            var channelIndex = 56;  // Integer | Index of the channel in the channels list for this device set
    +
    +            try
    +            {
    +                ChannelSettings result = apiInstance.devicesetChannelSettingsPatch(deviceSetIndex, channelIndex);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetChannelSettingsPatch: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +$channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +
    +try {
    +    $result = $api_instance->devicesetChannelSettingsPatch($deviceSetIndex, $channelIndex);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetChannelSettingsPatch: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +my $channelIndex = 56; # Integer | Index of the channel in the channels list for this device set
    +
    +eval { 
    +    my $result = $api_instance->devicesetChannelSettingsPatch(deviceSetIndex => $deviceSetIndex, channelIndex => $channelIndex);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetChannelSettingsPatch: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +channelIndex = 56 # Integer | Index of the channel in the channels list for this device set
    +
    +try: 
    +    api_response = api_instance.deviceset_channel_settings_patch(deviceSetIndex, channelIndex)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetChannelSettingsPatch: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    channelIndex* + + +
    +
    +
    + + Integer + + +
    + Index of the channel in the channels list for this device set +
    +
    +
    + Required +
    +
    +
    +
    + + + + + +

    Responses

    +

    Status: 200 - On success return channel new settings

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 400 - Invalid device set or channel index

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Device or channel not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    +
    +
    +
    +

    devicesetChannelSettingsPut

    +

    +
    +
    +
    +

    +

    apply all settings unconditionally (force)

    +

    +
    +
    /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings
    +

    +

    Usage and SDK Samples

    +

    + + +
    +
    +
    curl -X PUT "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings"
    +
    +
    +
    import SWGSDRangel.*;
    +import SWGSDRangel.auth.*;
    +import SWGSDRangel.model.*;
    +import SWGSDRangel.api.DeviceSetApi;
    +
    +import java.io.File;
    +import java.util.*;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        Integer channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelSettingsPut(deviceSetIndex, channelIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelSettingsPut");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    import SWGSDRangel.api.DeviceSetApi;
    +
    +public class DeviceSetApiExample {
    +
    +    public static void main(String[] args) {
    +        DeviceSetApi apiInstance = new DeviceSetApi();
    +        Integer deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +        Integer channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +        try {
    +            ChannelSettings result = apiInstance.devicesetChannelSettingsPut(deviceSetIndex, channelIndex);
    +            System.out.println(result);
    +        } catch (ApiException e) {
    +            System.err.println("Exception when calling DeviceSetApi#devicesetChannelSettingsPut");
    +            e.printStackTrace();
    +        }
    +    }
    +}
    +
    + +
    +
    Integer *deviceSetIndex = 56; // Index of device set in the device set list
    +Integer *channelIndex = 56; // Index of the channel in the channels list for this device set
    +
    +DeviceSetApi *apiInstance = [[DeviceSetApi alloc] init];
    +
    +[apiInstance devicesetChannelSettingsPutWith:deviceSetIndex
    +    channelIndex:channelIndex
    +              completionHandler: ^(ChannelSettings output, NSError* error) {
    +                            if (output) {
    +                                NSLog(@"%@", output);
    +                            }
    +                            if (error) {
    +                                NSLog(@"Error: %@", error);
    +                            }
    +                        }];
    +
    +
    + +
    +
    var SdRangel = require('sd_rangel');
    +
    +var api = new SdRangel.DeviceSetApi()
    +
    +var deviceSetIndex = 56; // {Integer} Index of device set in the device set list
    +
    +var channelIndex = 56; // {Integer} Index of the channel in the channels list for this device set
    +
    +
    +var callback = function(error, data, response) {
    +  if (error) {
    +    console.error(error);
    +  } else {
    +    console.log('API called successfully. Returned data: ' + data);
    +  }
    +};
    +api.devicesetChannelSettingsPut(deviceSetIndex, channelIndex, callback);
    +
    +
    + + +
    +
    using System;
    +using System.Diagnostics;
    +using SWGSDRangel.Api;
    +using SWGSDRangel.Client;
    +using SWGSDRangel.Model;
    +
    +namespace Example
    +{
    +    public class devicesetChannelSettingsPutExample
    +    {
    +        public void main()
    +        {
    +            
    +            var apiInstance = new DeviceSetApi();
    +            var deviceSetIndex = 56;  // Integer | Index of device set in the device set list
    +            var channelIndex = 56;  // Integer | Index of the channel in the channels list for this device set
    +
    +            try
    +            {
    +                ChannelSettings result = apiInstance.devicesetChannelSettingsPut(deviceSetIndex, channelIndex);
    +                Debug.WriteLine(result);
    +            }
    +            catch (Exception e)
    +            {
    +                Debug.Print("Exception when calling DeviceSetApi.devicesetChannelSettingsPut: " + e.Message );
    +            }
    +        }
    +    }
    +}
    +
    +
    + +
    +
    <?php
    +require_once(__DIR__ . '/vendor/autoload.php');
    +
    +$api_instance = new Swagger\Client\Api\DeviceSetApi();
    +$deviceSetIndex = 56; // Integer | Index of device set in the device set list
    +$channelIndex = 56; // Integer | Index of the channel in the channels list for this device set
    +
    +try {
    +    $result = $api_instance->devicesetChannelSettingsPut($deviceSetIndex, $channelIndex);
    +    print_r($result);
    +} catch (Exception $e) {
    +    echo 'Exception when calling DeviceSetApi->devicesetChannelSettingsPut: ', $e->getMessage(), PHP_EOL;
    +}
    +?>
    +
    + +
    +
    use Data::Dumper;
    +use SWGSDRangel::Configuration;
    +use SWGSDRangel::DeviceSetApi;
    +
    +my $api_instance = SWGSDRangel::DeviceSetApi->new();
    +my $deviceSetIndex = 56; # Integer | Index of device set in the device set list
    +my $channelIndex = 56; # Integer | Index of the channel in the channels list for this device set
    +
    +eval { 
    +    my $result = $api_instance->devicesetChannelSettingsPut(deviceSetIndex => $deviceSetIndex, channelIndex => $channelIndex);
    +    print Dumper($result);
    +};
    +if ($@) {
    +    warn "Exception when calling DeviceSetApi->devicesetChannelSettingsPut: $@\n";
    +}
    +
    + +
    +
    from __future__ import print_statement
    +import time
    +import swagger_sdrangel
    +from swagger_sdrangel.rest import ApiException
    +from pprint import pprint
    +
    +# create an instance of the API class
    +api_instance = swagger_sdrangel.DeviceSetApi()
    +deviceSetIndex = 56 # Integer | Index of device set in the device set list
    +channelIndex = 56 # Integer | Index of the channel in the channels list for this device set
    +
    +try: 
    +    api_response = api_instance.deviceset_channel_settings_put(deviceSetIndex, channelIndex)
    +    pprint(api_response)
    +except ApiException as e:
    +    print("Exception when calling DeviceSetApi->devicesetChannelSettingsPut: %s\n" % e)
    +
    +
    + +

    Parameters

    + +
    Path parameters
    + + + + + + + + + + + + + +
    NameDescription
    deviceSetIndex* + + +
    +
    +
    + + Integer + + +
    + Index of device set in the device set list +
    +
    +
    + Required +
    +
    +
    +
    channelIndex* + + +
    +
    +
    + + Integer + + +
    + Index of the channel in the channels list for this device set +
    +
    +
    + Required +
    +
    +
    +
    + + + + + +

    Responses

    +

    Status: 200 - On success return channel new settings

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 400 - Invalid device set or channel index

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 404 - Device or channel not found

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 500 - Error

    + + + +
    +
    +
    + +
    + +
    +
    + +

    Status: 501 - Function not implemented

    + + + +
    +
    + +
    +
    +
    @@ -11274,7 +13764,7 @@ except ApiException as e:
    - Generated 2017-12-09T10:46:45.115+01:00 + Generated 2017-12-10T18:03:56.008+01:00
    diff --git a/swagger/sdrangel/code/qt5/client/SWGCWKeyerSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGCWKeyerSettings.cpp new file mode 100644 index 000000000..f02b3f4d8 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGCWKeyerSettings.cpp @@ -0,0 +1,151 @@ +/** + * SDRangel + * This is the web API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube + * + * OpenAPI spec version: 4.0.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +#include "SWGCWKeyerSettings.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGCWKeyerSettings::SWGCWKeyerSettings(QString* json) { + init(); + this->fromJson(*json); +} + +SWGCWKeyerSettings::SWGCWKeyerSettings() { + init(); +} + +SWGCWKeyerSettings::~SWGCWKeyerSettings() { + this->cleanup(); +} + +void +SWGCWKeyerSettings::init() { + sample_rate = 0; + wpm = 0; + mode = 0; + text = new QString(""); + loop = 0; +} + +void +SWGCWKeyerSettings::cleanup() { + + + + + if(text != nullptr) { + delete text; + } + +} + +SWGCWKeyerSettings* +SWGCWKeyerSettings::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGCWKeyerSettings::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", ""); + ::SWGSDRangel::setValue(&wpm, pJson["wpm"], "qint32", ""); + ::SWGSDRangel::setValue(&mode, pJson["mode"], "qint32", ""); + ::SWGSDRangel::setValue(&text, pJson["text"], "QString", "QString"); + ::SWGSDRangel::setValue(&loop, pJson["loop"], "qint32", ""); +} + +QString +SWGCWKeyerSettings::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject* +SWGCWKeyerSettings::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + + obj->insert("sampleRate", QJsonValue(sample_rate)); + + obj->insert("wpm", QJsonValue(wpm)); + + obj->insert("mode", QJsonValue(mode)); + + toJsonValue(QString("text"), text, obj, QString("QString")); + + obj->insert("loop", QJsonValue(loop)); + + return obj; +} + +qint32 +SWGCWKeyerSettings::getSampleRate() { + return sample_rate; +} +void +SWGCWKeyerSettings::setSampleRate(qint32 sample_rate) { + this->sample_rate = sample_rate; +} + +qint32 +SWGCWKeyerSettings::getWpm() { + return wpm; +} +void +SWGCWKeyerSettings::setWpm(qint32 wpm) { + this->wpm = wpm; +} + +qint32 +SWGCWKeyerSettings::getMode() { + return mode; +} +void +SWGCWKeyerSettings::setMode(qint32 mode) { + this->mode = mode; +} + +QString* +SWGCWKeyerSettings::getText() { + return text; +} +void +SWGCWKeyerSettings::setText(QString* text) { + this->text = text; +} + +qint32 +SWGCWKeyerSettings::getLoop() { + return loop; +} +void +SWGCWKeyerSettings::setLoop(qint32 loop) { + this->loop = loop; +} + + +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGCWKeyerSettings.h b/swagger/sdrangel/code/qt5/client/SWGCWKeyerSettings.h new file mode 100644 index 000000000..27be43486 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGCWKeyerSettings.h @@ -0,0 +1,71 @@ +/** + * SDRangel + * This is the web API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube + * + * OpenAPI spec version: 4.0.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/* + * SWGCWKeyerSettings.h + * + * + */ + +#ifndef SWGCWKeyerSettings_H_ +#define SWGCWKeyerSettings_H_ + +#include + + +#include + +#include "SWGObject.h" + + +namespace SWGSDRangel { + +class SWGCWKeyerSettings: public SWGObject { +public: + SWGCWKeyerSettings(); + SWGCWKeyerSettings(QString* json); + virtual ~SWGCWKeyerSettings(); + void init(); + void cleanup(); + + QString asJson (); + QJsonObject* asJsonObject(); + void fromJsonObject(QJsonObject &json); + SWGCWKeyerSettings* fromJson(QString &jsonString); + + qint32 getSampleRate(); + void setSampleRate(qint32 sample_rate); + + qint32 getWpm(); + void setWpm(qint32 wpm); + + qint32 getMode(); + void setMode(qint32 mode); + + QString* getText(); + void setText(QString* text); + + qint32 getLoop(); + void setLoop(qint32 loop); + + +private: + qint32 sample_rate; + qint32 wpm; + qint32 mode; + QString* text; + qint32 loop; +}; + +} + +#endif /* SWGCWKeyerSettings_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGChannelSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGChannelSettings.cpp new file mode 100644 index 000000000..e6776fd51 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGChannelSettings.cpp @@ -0,0 +1,143 @@ +/** + * SDRangel + * This is the web API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube + * + * OpenAPI spec version: 4.0.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +#include "SWGChannelSettings.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGChannelSettings::SWGChannelSettings(QString* json) { + init(); + this->fromJson(*json); +} + +SWGChannelSettings::SWGChannelSettings() { + init(); +} + +SWGChannelSettings::~SWGChannelSettings() { + this->cleanup(); +} + +void +SWGChannelSettings::init() { + channel_type = new QString(""); + tx = 0; + nfm_demod_settings = new SWGNFMDemodSettings(); + nfm_mod_settings = new SWGNFMModSettings(); +} + +void +SWGChannelSettings::cleanup() { + + if(channel_type != nullptr) { + delete channel_type; + } + + + if(nfm_demod_settings != nullptr) { + delete nfm_demod_settings; + } + + if(nfm_mod_settings != nullptr) { + delete nfm_mod_settings; + } +} + +SWGChannelSettings* +SWGChannelSettings::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGChannelSettings::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&channel_type, pJson["channelType"], "QString", "QString"); + ::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", ""); + ::SWGSDRangel::setValue(&nfm_demod_settings, pJson["NFMDemodSettings"], "SWGNFMDemodSettings", "SWGNFMDemodSettings"); + ::SWGSDRangel::setValue(&nfm_mod_settings, pJson["NFMModSettings"], "SWGNFMModSettings", "SWGNFMModSettings"); +} + +QString +SWGChannelSettings::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject* +SWGChannelSettings::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + + toJsonValue(QString("channelType"), channel_type, obj, QString("QString")); + + obj->insert("tx", QJsonValue(tx)); + + toJsonValue(QString("NFMDemodSettings"), nfm_demod_settings, obj, QString("SWGNFMDemodSettings")); + + toJsonValue(QString("NFMModSettings"), nfm_mod_settings, obj, QString("SWGNFMModSettings")); + + return obj; +} + +QString* +SWGChannelSettings::getChannelType() { + return channel_type; +} +void +SWGChannelSettings::setChannelType(QString* channel_type) { + this->channel_type = channel_type; +} + +qint32 +SWGChannelSettings::getTx() { + return tx; +} +void +SWGChannelSettings::setTx(qint32 tx) { + this->tx = tx; +} + +SWGNFMDemodSettings* +SWGChannelSettings::getNfmDemodSettings() { + return nfm_demod_settings; +} +void +SWGChannelSettings::setNfmDemodSettings(SWGNFMDemodSettings* nfm_demod_settings) { + this->nfm_demod_settings = nfm_demod_settings; +} + +SWGNFMModSettings* +SWGChannelSettings::getNfmModSettings() { + return nfm_mod_settings; +} +void +SWGChannelSettings::setNfmModSettings(SWGNFMModSettings* nfm_mod_settings) { + this->nfm_mod_settings = nfm_mod_settings; +} + + +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGChannelSettings.h b/swagger/sdrangel/code/qt5/client/SWGChannelSettings.h new file mode 100644 index 000000000..622868843 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGChannelSettings.h @@ -0,0 +1,69 @@ +/** + * SDRangel + * This is the web API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube + * + * OpenAPI spec version: 4.0.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/* + * SWGChannelSettings.h + * + * Base channel settings + */ + +#ifndef SWGChannelSettings_H_ +#define SWGChannelSettings_H_ + +#include + + +#include "SWGNFMDemodSettings.h" +#include "SWGNFMModSettings.h" +#include + +#include "SWGObject.h" + + +namespace SWGSDRangel { + +class SWGChannelSettings: public SWGObject { +public: + SWGChannelSettings(); + SWGChannelSettings(QString* json); + virtual ~SWGChannelSettings(); + void init(); + void cleanup(); + + QString asJson (); + QJsonObject* asJsonObject(); + void fromJsonObject(QJsonObject &json); + SWGChannelSettings* fromJson(QString &jsonString); + + QString* getChannelType(); + void setChannelType(QString* channel_type); + + qint32 getTx(); + void setTx(qint32 tx); + + SWGNFMDemodSettings* getNfmDemodSettings(); + void setNfmDemodSettings(SWGNFMDemodSettings* nfm_demod_settings); + + SWGNFMModSettings* getNfmModSettings(); + void setNfmModSettings(SWGNFMModSettings* nfm_mod_settings); + + +private: + QString* channel_type; + qint32 tx; + SWGNFMDemodSettings* nfm_demod_settings; + SWGNFMModSettings* nfm_mod_settings; +}; + +} + +#endif /* SWGChannelSettings_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.cpp b/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.cpp index 692bbe257..345904452 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.cpp @@ -28,6 +28,266 @@ SWGDeviceSetApi::SWGDeviceSetApi(QString host, QString basePath) { this->basePath = basePath; } +void +SWGDeviceSetApi::devicesetChannelDelete(qint32 device_set_index, qint32 channel_index) { + QString fullPath; + fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}"); + + QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}"); + fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); + QString channel_indexPathParam("{"); channel_indexPathParam.append("channelIndex").append("}"); + fullPath.replace(channel_indexPathParam, stringValue(channel_index)); + + + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "DELETE"); + + + + + + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + + connect(worker, + &HttpRequestWorker::on_execution_finished, + this, + &SWGDeviceSetApi::devicesetChannelDeleteCallback); + + worker->execute(&input); +} + +void +SWGDeviceSetApi::devicesetChannelDeleteCallback(HttpRequestWorker * worker) { + QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type == QNetworkReply::NoError) { + msg = QString("Success! %1 bytes").arg(worker->response.length()); + } + else { + msg = "Error: " + worker->error_str; + } + + + QString json(worker->response); + SWGChannelSettings* output = static_cast(create(json, QString("SWGChannelSettings"))); + worker->deleteLater(); + + emit devicesetChannelDeleteSignal(output); + emit devicesetChannelDeleteSignalE(output, error_type, error_str); +} + +void +SWGDeviceSetApi::devicesetChannelPost(qint32 device_set_index, SWGChannelSettings body) { + QString fullPath; + fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel"); + + QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}"); + fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); + + + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "POST"); + + + QString output = body.asJson(); + input.request_body.append(output); + + + + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + + connect(worker, + &HttpRequestWorker::on_execution_finished, + this, + &SWGDeviceSetApi::devicesetChannelPostCallback); + + worker->execute(&input); +} + +void +SWGDeviceSetApi::devicesetChannelPostCallback(HttpRequestWorker * worker) { + QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type == QNetworkReply::NoError) { + msg = QString("Success! %1 bytes").arg(worker->response.length()); + } + else { + msg = "Error: " + worker->error_str; + } + + + QString json(worker->response); + SWGChannelSettings* output = static_cast(create(json, QString("SWGChannelSettings"))); + worker->deleteLater(); + + emit devicesetChannelPostSignal(output); + emit devicesetChannelPostSignalE(output, error_type, error_str); +} + +void +SWGDeviceSetApi::devicesetChannelSettingsGet(qint32 device_set_index, qint32 channel_index) { + QString fullPath; + fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings"); + + QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}"); + fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); + QString channel_indexPathParam("{"); channel_indexPathParam.append("channelIndex").append("}"); + fullPath.replace(channel_indexPathParam, stringValue(channel_index)); + + + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "GET"); + + + + + + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + + connect(worker, + &HttpRequestWorker::on_execution_finished, + this, + &SWGDeviceSetApi::devicesetChannelSettingsGetCallback); + + worker->execute(&input); +} + +void +SWGDeviceSetApi::devicesetChannelSettingsGetCallback(HttpRequestWorker * worker) { + QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type == QNetworkReply::NoError) { + msg = QString("Success! %1 bytes").arg(worker->response.length()); + } + else { + msg = "Error: " + worker->error_str; + } + + + QString json(worker->response); + SWGChannelSettings* output = static_cast(create(json, QString("SWGChannelSettings"))); + worker->deleteLater(); + + emit devicesetChannelSettingsGetSignal(output); + emit devicesetChannelSettingsGetSignalE(output, error_type, error_str); +} + +void +SWGDeviceSetApi::devicesetChannelSettingsPatch(qint32 device_set_index, qint32 channel_index) { + QString fullPath; + fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings"); + + QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}"); + fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); + QString channel_indexPathParam("{"); channel_indexPathParam.append("channelIndex").append("}"); + fullPath.replace(channel_indexPathParam, stringValue(channel_index)); + + + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "PATCH"); + + + + + + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + + connect(worker, + &HttpRequestWorker::on_execution_finished, + this, + &SWGDeviceSetApi::devicesetChannelSettingsPatchCallback); + + worker->execute(&input); +} + +void +SWGDeviceSetApi::devicesetChannelSettingsPatchCallback(HttpRequestWorker * worker) { + QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type == QNetworkReply::NoError) { + msg = QString("Success! %1 bytes").arg(worker->response.length()); + } + else { + msg = "Error: " + worker->error_str; + } + + + QString json(worker->response); + SWGChannelSettings* output = static_cast(create(json, QString("SWGChannelSettings"))); + worker->deleteLater(); + + emit devicesetChannelSettingsPatchSignal(output); + emit devicesetChannelSettingsPatchSignalE(output, error_type, error_str); +} + +void +SWGDeviceSetApi::devicesetChannelSettingsPut(qint32 device_set_index, qint32 channel_index) { + QString fullPath; + fullPath.append(this->host).append(this->basePath).append("/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings"); + + QString device_set_indexPathParam("{"); device_set_indexPathParam.append("deviceSetIndex").append("}"); + fullPath.replace(device_set_indexPathParam, stringValue(device_set_index)); + QString channel_indexPathParam("{"); channel_indexPathParam.append("channelIndex").append("}"); + fullPath.replace(channel_indexPathParam, stringValue(channel_index)); + + + HttpRequestWorker *worker = new HttpRequestWorker(); + HttpRequestInput input(fullPath, "PUT"); + + + + + + foreach(QString key, this->defaultHeaders.keys()) { + input.headers.insert(key, this->defaultHeaders.value(key)); + } + + connect(worker, + &HttpRequestWorker::on_execution_finished, + this, + &SWGDeviceSetApi::devicesetChannelSettingsPutCallback); + + worker->execute(&input); +} + +void +SWGDeviceSetApi::devicesetChannelSettingsPutCallback(HttpRequestWorker * worker) { + QString msg; + QString error_str = worker->error_str; + QNetworkReply::NetworkError error_type = worker->error_type; + + if (worker->error_type == QNetworkReply::NoError) { + msg = QString("Success! %1 bytes").arg(worker->response.length()); + } + else { + msg = "Error: " + worker->error_str; + } + + + QString json(worker->response); + SWGChannelSettings* output = static_cast(create(json, QString("SWGChannelSettings"))); + worker->deleteLater(); + + emit devicesetChannelSettingsPutSignal(output); + emit devicesetChannelSettingsPutSignalE(output, error_type, error_str); +} + void SWGDeviceSetApi::devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem body) { QString fullPath; diff --git a/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.h b/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.h index 0a1c0918d..9630c4199 100644 --- a/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.h +++ b/swagger/sdrangel/code/qt5/client/SWGDeviceSetApi.h @@ -15,6 +15,7 @@ #include "SWGHttpRequest.h" +#include "SWGChannelSettings.h" #include "SWGDeviceListItem.h" #include "SWGDeviceSet.h" #include "SWGDeviceSettings.h" @@ -37,6 +38,11 @@ public: QString basePath; QMap defaultHeaders; + void devicesetChannelDelete(qint32 device_set_index, qint32 channel_index); + void devicesetChannelPost(qint32 device_set_index, SWGChannelSettings body); + void devicesetChannelSettingsGet(qint32 device_set_index, qint32 channel_index); + void devicesetChannelSettingsPatch(qint32 device_set_index, qint32 channel_index); + void devicesetChannelSettingsPut(qint32 device_set_index, qint32 channel_index); void devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem body); void devicesetDeviceRunDelete(qint32 device_set_index); void devicesetDeviceRunGet(qint32 device_set_index); @@ -47,6 +53,11 @@ public: void devicesetGet(qint32 device_set_index); private: + void devicesetChannelDeleteCallback (HttpRequestWorker * worker); + void devicesetChannelPostCallback (HttpRequestWorker * worker); + void devicesetChannelSettingsGetCallback (HttpRequestWorker * worker); + void devicesetChannelSettingsPatchCallback (HttpRequestWorker * worker); + void devicesetChannelSettingsPutCallback (HttpRequestWorker * worker); void devicesetDevicePutCallback (HttpRequestWorker * worker); void devicesetDeviceRunDeleteCallback (HttpRequestWorker * worker); void devicesetDeviceRunGetCallback (HttpRequestWorker * worker); @@ -57,6 +68,11 @@ private: void devicesetGetCallback (HttpRequestWorker * worker); signals: + void devicesetChannelDeleteSignal(SWGChannelSettings* summary); + void devicesetChannelPostSignal(SWGChannelSettings* summary); + void devicesetChannelSettingsGetSignal(SWGChannelSettings* summary); + void devicesetChannelSettingsPatchSignal(SWGChannelSettings* summary); + void devicesetChannelSettingsPutSignal(SWGChannelSettings* summary); void devicesetDevicePutSignal(SWGDeviceListItem* summary); void devicesetDeviceRunDeleteSignal(SWGDeviceState* summary); void devicesetDeviceRunGetSignal(SWGDeviceState* summary); @@ -66,6 +82,11 @@ signals: void devicesetDeviceSettingsPutSignal(SWGDeviceSettings* summary); void devicesetGetSignal(SWGDeviceSet* summary); + void devicesetChannelDeleteSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void devicesetChannelPostSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void devicesetChannelSettingsGetSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void devicesetChannelSettingsPatchSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str); + void devicesetChannelSettingsPutSignalE(SWGChannelSettings* summary, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetDevicePutSignalE(SWGDeviceListItem* summary, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetDeviceRunDeleteSignalE(SWGDeviceState* summary, QNetworkReply::NetworkError error_type, QString& error_str); void devicesetDeviceRunGetSignalE(SWGDeviceState* summary, QNetworkReply::NetworkError error_type, QString& error_str); diff --git a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h index f6eb5be3e..1e0f9857a 100644 --- a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h +++ b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h @@ -17,8 +17,10 @@ #include "SWGAudioDevice.h" #include "SWGAudioDevices.h" #include "SWGAudioDevicesSelect.h" +#include "SWGCWKeyerSettings.h" #include "SWGChannel.h" #include "SWGChannelListItem.h" +#include "SWGChannelSettings.h" #include "SWGDVSeralDevices.h" #include "SWGDVSerialDevice.h" #include "SWGDeviceListItem.h" @@ -35,6 +37,8 @@ #include "SWGLimeSdrOutputSettings.h" #include "SWGLocationInformation.h" #include "SWGLoggingInfo.h" +#include "SWGNFMDemodSettings.h" +#include "SWGNFMModSettings.h" #include "SWGPresetGroup.h" #include "SWGPresetIdentifier.h" #include "SWGPresetItem.h" @@ -55,12 +59,18 @@ namespace SWGSDRangel { if(QString("SWGAudioDevicesSelect").compare(type) == 0) { return new SWGAudioDevicesSelect(); } + if(QString("SWGCWKeyerSettings").compare(type) == 0) { + return new SWGCWKeyerSettings(); + } if(QString("SWGChannel").compare(type) == 0) { return new SWGChannel(); } if(QString("SWGChannelListItem").compare(type) == 0) { return new SWGChannelListItem(); } + if(QString("SWGChannelSettings").compare(type) == 0) { + return new SWGChannelSettings(); + } if(QString("SWGDVSeralDevices").compare(type) == 0) { return new SWGDVSeralDevices(); } @@ -109,6 +119,12 @@ namespace SWGSDRangel { if(QString("SWGLoggingInfo").compare(type) == 0) { return new SWGLoggingInfo(); } + if(QString("SWGNFMDemodSettings").compare(type) == 0) { + return new SWGNFMDemodSettings(); + } + if(QString("SWGNFMModSettings").compare(type) == 0) { + return new SWGNFMModSettings(); + } if(QString("SWGPresetGroup").compare(type) == 0) { return new SWGPresetGroup(); } diff --git a/swagger/sdrangel/code/qt5/client/SWGNFMDemodSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGNFMDemodSettings.cpp new file mode 100644 index 000000000..599e19faf --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGNFMDemodSettings.cpp @@ -0,0 +1,336 @@ +/** + * SDRangel + * This is the web API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube + * + * OpenAPI spec version: 4.0.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +#include "SWGNFMDemodSettings.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGNFMDemodSettings::SWGNFMDemodSettings(QString* json) { + init(); + this->fromJson(*json); +} + +SWGNFMDemodSettings::SWGNFMDemodSettings() { + init(); +} + +SWGNFMDemodSettings::~SWGNFMDemodSettings() { + this->cleanup(); +} + +void +SWGNFMDemodSettings::init() { + input_sample_rate = 0; + input_frequency_offset = 0L; + rf_bandwidth = 0.0f; + af_bandwidth = 0.0f; + fm_deviation = 0; + squelch_gate = 0; + delta_squelch = 0; + squelch = 0.0f; + volume = 0.0f; + ctcss_on = 0; + audio_mute = 0; + ctcss_index = 0; + audio_sample_rate = 0; + copy_audio_to_udp = 0; + udp_address = new QString(""); + udp_port = 0; + rgb_color = 0; + title = new QString(""); +} + +void +SWGNFMDemodSettings::cleanup() { + + + + + + + + + + + + + + + + if(udp_address != nullptr) { + delete udp_address; + } + + + + if(title != nullptr) { + delete title; + } +} + +SWGNFMDemodSettings* +SWGNFMDemodSettings::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGNFMDemodSettings::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&input_sample_rate, pJson["inputSampleRate"], "qint32", ""); + ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", ""); + ::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", ""); + ::SWGSDRangel::setValue(&af_bandwidth, pJson["afBandwidth"], "float", ""); + ::SWGSDRangel::setValue(&fm_deviation, pJson["fmDeviation"], "qint32", ""); + ::SWGSDRangel::setValue(&squelch_gate, pJson["squelchGate"], "qint32", ""); + ::SWGSDRangel::setValue(&delta_squelch, pJson["deltaSquelch"], "qint32", ""); + ::SWGSDRangel::setValue(&squelch, pJson["squelch"], "float", ""); + ::SWGSDRangel::setValue(&volume, pJson["volume"], "float", ""); + ::SWGSDRangel::setValue(&ctcss_on, pJson["ctcssOn"], "qint32", ""); + ::SWGSDRangel::setValue(&audio_mute, pJson["audioMute"], "qint32", ""); + ::SWGSDRangel::setValue(&ctcss_index, pJson["ctcssIndex"], "qint32", ""); + ::SWGSDRangel::setValue(&audio_sample_rate, pJson["audioSampleRate"], "qint32", ""); + ::SWGSDRangel::setValue(©_audio_to_udp, pJson["copyAudioToUDP"], "qint32", ""); + ::SWGSDRangel::setValue(&udp_address, pJson["udpAddress"], "QString", "QString"); + ::SWGSDRangel::setValue(&udp_port, pJson["udpPort"], "qint32", ""); + ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", ""); + ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString"); +} + +QString +SWGNFMDemodSettings::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject* +SWGNFMDemodSettings::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + + obj->insert("inputSampleRate", QJsonValue(input_sample_rate)); + + obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset)); + + obj->insert("rfBandwidth", QJsonValue(rf_bandwidth)); + + obj->insert("afBandwidth", QJsonValue(af_bandwidth)); + + obj->insert("fmDeviation", QJsonValue(fm_deviation)); + + obj->insert("squelchGate", QJsonValue(squelch_gate)); + + obj->insert("deltaSquelch", QJsonValue(delta_squelch)); + + obj->insert("squelch", QJsonValue(squelch)); + + obj->insert("volume", QJsonValue(volume)); + + obj->insert("ctcssOn", QJsonValue(ctcss_on)); + + obj->insert("audioMute", QJsonValue(audio_mute)); + + obj->insert("ctcssIndex", QJsonValue(ctcss_index)); + + obj->insert("audioSampleRate", QJsonValue(audio_sample_rate)); + + obj->insert("copyAudioToUDP", QJsonValue(copy_audio_to_udp)); + + toJsonValue(QString("udpAddress"), udp_address, obj, QString("QString")); + + obj->insert("udpPort", QJsonValue(udp_port)); + + obj->insert("rgbColor", QJsonValue(rgb_color)); + + toJsonValue(QString("title"), title, obj, QString("QString")); + + return obj; +} + +qint32 +SWGNFMDemodSettings::getInputSampleRate() { + return input_sample_rate; +} +void +SWGNFMDemodSettings::setInputSampleRate(qint32 input_sample_rate) { + this->input_sample_rate = input_sample_rate; +} + +qint64 +SWGNFMDemodSettings::getInputFrequencyOffset() { + return input_frequency_offset; +} +void +SWGNFMDemodSettings::setInputFrequencyOffset(qint64 input_frequency_offset) { + this->input_frequency_offset = input_frequency_offset; +} + +float +SWGNFMDemodSettings::getRfBandwidth() { + return rf_bandwidth; +} +void +SWGNFMDemodSettings::setRfBandwidth(float rf_bandwidth) { + this->rf_bandwidth = rf_bandwidth; +} + +float +SWGNFMDemodSettings::getAfBandwidth() { + return af_bandwidth; +} +void +SWGNFMDemodSettings::setAfBandwidth(float af_bandwidth) { + this->af_bandwidth = af_bandwidth; +} + +qint32 +SWGNFMDemodSettings::getFmDeviation() { + return fm_deviation; +} +void +SWGNFMDemodSettings::setFmDeviation(qint32 fm_deviation) { + this->fm_deviation = fm_deviation; +} + +qint32 +SWGNFMDemodSettings::getSquelchGate() { + return squelch_gate; +} +void +SWGNFMDemodSettings::setSquelchGate(qint32 squelch_gate) { + this->squelch_gate = squelch_gate; +} + +qint32 +SWGNFMDemodSettings::getDeltaSquelch() { + return delta_squelch; +} +void +SWGNFMDemodSettings::setDeltaSquelch(qint32 delta_squelch) { + this->delta_squelch = delta_squelch; +} + +float +SWGNFMDemodSettings::getSquelch() { + return squelch; +} +void +SWGNFMDemodSettings::setSquelch(float squelch) { + this->squelch = squelch; +} + +float +SWGNFMDemodSettings::getVolume() { + return volume; +} +void +SWGNFMDemodSettings::setVolume(float volume) { + this->volume = volume; +} + +qint32 +SWGNFMDemodSettings::getCtcssOn() { + return ctcss_on; +} +void +SWGNFMDemodSettings::setCtcssOn(qint32 ctcss_on) { + this->ctcss_on = ctcss_on; +} + +qint32 +SWGNFMDemodSettings::getAudioMute() { + return audio_mute; +} +void +SWGNFMDemodSettings::setAudioMute(qint32 audio_mute) { + this->audio_mute = audio_mute; +} + +qint32 +SWGNFMDemodSettings::getCtcssIndex() { + return ctcss_index; +} +void +SWGNFMDemodSettings::setCtcssIndex(qint32 ctcss_index) { + this->ctcss_index = ctcss_index; +} + +qint32 +SWGNFMDemodSettings::getAudioSampleRate() { + return audio_sample_rate; +} +void +SWGNFMDemodSettings::setAudioSampleRate(qint32 audio_sample_rate) { + this->audio_sample_rate = audio_sample_rate; +} + +qint32 +SWGNFMDemodSettings::getCopyAudioToUdp() { + return copy_audio_to_udp; +} +void +SWGNFMDemodSettings::setCopyAudioToUdp(qint32 copy_audio_to_udp) { + this->copy_audio_to_udp = copy_audio_to_udp; +} + +QString* +SWGNFMDemodSettings::getUdpAddress() { + return udp_address; +} +void +SWGNFMDemodSettings::setUdpAddress(QString* udp_address) { + this->udp_address = udp_address; +} + +qint32 +SWGNFMDemodSettings::getUdpPort() { + return udp_port; +} +void +SWGNFMDemodSettings::setUdpPort(qint32 udp_port) { + this->udp_port = udp_port; +} + +qint32 +SWGNFMDemodSettings::getRgbColor() { + return rgb_color; +} +void +SWGNFMDemodSettings::setRgbColor(qint32 rgb_color) { + this->rgb_color = rgb_color; +} + +QString* +SWGNFMDemodSettings::getTitle() { + return title; +} +void +SWGNFMDemodSettings::setTitle(QString* title) { + this->title = title; +} + + +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGNFMDemodSettings.h b/swagger/sdrangel/code/qt5/client/SWGNFMDemodSettings.h new file mode 100644 index 000000000..da925bf73 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGNFMDemodSettings.h @@ -0,0 +1,123 @@ +/** + * SDRangel + * This is the web API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube + * + * OpenAPI spec version: 4.0.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/* + * SWGNFMDemodSettings.h + * + * + */ + +#ifndef SWGNFMDemodSettings_H_ +#define SWGNFMDemodSettings_H_ + +#include + + +#include + +#include "SWGObject.h" + + +namespace SWGSDRangel { + +class SWGNFMDemodSettings: public SWGObject { +public: + SWGNFMDemodSettings(); + SWGNFMDemodSettings(QString* json); + virtual ~SWGNFMDemodSettings(); + void init(); + void cleanup(); + + QString asJson (); + QJsonObject* asJsonObject(); + void fromJsonObject(QJsonObject &json); + SWGNFMDemodSettings* fromJson(QString &jsonString); + + qint32 getInputSampleRate(); + void setInputSampleRate(qint32 input_sample_rate); + + qint64 getInputFrequencyOffset(); + void setInputFrequencyOffset(qint64 input_frequency_offset); + + float getRfBandwidth(); + void setRfBandwidth(float rf_bandwidth); + + float getAfBandwidth(); + void setAfBandwidth(float af_bandwidth); + + qint32 getFmDeviation(); + void setFmDeviation(qint32 fm_deviation); + + qint32 getSquelchGate(); + void setSquelchGate(qint32 squelch_gate); + + qint32 getDeltaSquelch(); + void setDeltaSquelch(qint32 delta_squelch); + + float getSquelch(); + void setSquelch(float squelch); + + float getVolume(); + void setVolume(float volume); + + qint32 getCtcssOn(); + void setCtcssOn(qint32 ctcss_on); + + qint32 getAudioMute(); + void setAudioMute(qint32 audio_mute); + + qint32 getCtcssIndex(); + void setCtcssIndex(qint32 ctcss_index); + + qint32 getAudioSampleRate(); + void setAudioSampleRate(qint32 audio_sample_rate); + + qint32 getCopyAudioToUdp(); + void setCopyAudioToUdp(qint32 copy_audio_to_udp); + + QString* getUdpAddress(); + void setUdpAddress(QString* udp_address); + + qint32 getUdpPort(); + void setUdpPort(qint32 udp_port); + + qint32 getRgbColor(); + void setRgbColor(qint32 rgb_color); + + QString* getTitle(); + void setTitle(QString* title); + + +private: + qint32 input_sample_rate; + qint64 input_frequency_offset; + float rf_bandwidth; + float af_bandwidth; + qint32 fm_deviation; + qint32 squelch_gate; + qint32 delta_squelch; + float squelch; + float volume; + qint32 ctcss_on; + qint32 audio_mute; + qint32 ctcss_index; + qint32 audio_sample_rate; + qint32 copy_audio_to_udp; + QString* udp_address; + qint32 udp_port; + qint32 rgb_color; + QString* title; +}; + +} + +#endif /* SWGNFMDemodSettings_H_ */ diff --git a/swagger/sdrangel/code/qt5/client/SWGNFMModSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGNFMModSettings.cpp new file mode 100644 index 000000000..996910a54 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGNFMModSettings.cpp @@ -0,0 +1,308 @@ +/** + * SDRangel + * This is the web API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube + * + * OpenAPI spec version: 4.0.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +#include "SWGNFMModSettings.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGNFMModSettings::SWGNFMModSettings(QString* json) { + init(); + this->fromJson(*json); +} + +SWGNFMModSettings::SWGNFMModSettings() { + init(); +} + +SWGNFMModSettings::~SWGNFMModSettings() { + this->cleanup(); +} + +void +SWGNFMModSettings::init() { + baseband_sample_rate = 0; + output_sample_rate = 0; + input_frequency_offset = 0L; + rf_bandwidth = 0.0f; + af_bandwidth = 0.0f; + fm_deviation = 0.0f; + tone_frequency = 0.0f; + volume_factor = 0.0f; + audio_sample_rate = 0; + channel_mute = 0; + play_loop = 0; + ctcss_on = 0; + ctcss_index = 0; + rgb_color = 0; + title = new QString(""); + cw_keyer = new SWGCWKeyerSettings(); +} + +void +SWGNFMModSettings::cleanup() { + + + + + + + + + + + + + + + + if(title != nullptr) { + delete title; + } + + if(cw_keyer != nullptr) { + delete cw_keyer; + } +} + +SWGNFMModSettings* +SWGNFMModSettings::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGNFMModSettings::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&baseband_sample_rate, pJson["basebandSampleRate"], "qint32", ""); + ::SWGSDRangel::setValue(&output_sample_rate, pJson["outputSampleRate"], "qint32", ""); + ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", ""); + ::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", ""); + ::SWGSDRangel::setValue(&af_bandwidth, pJson["afBandwidth"], "float", ""); + ::SWGSDRangel::setValue(&fm_deviation, pJson["fmDeviation"], "float", ""); + ::SWGSDRangel::setValue(&tone_frequency, pJson["toneFrequency"], "float", ""); + ::SWGSDRangel::setValue(&volume_factor, pJson["volumeFactor"], "float", ""); + ::SWGSDRangel::setValue(&audio_sample_rate, pJson["audioSampleRate"], "qint32", ""); + ::SWGSDRangel::setValue(&channel_mute, pJson["channelMute"], "qint32", ""); + ::SWGSDRangel::setValue(&play_loop, pJson["playLoop"], "qint32", ""); + ::SWGSDRangel::setValue(&ctcss_on, pJson["ctcssOn"], "qint32", ""); + ::SWGSDRangel::setValue(&ctcss_index, pJson["ctcssIndex"], "qint32", ""); + ::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", ""); + ::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString"); + ::SWGSDRangel::setValue(&cw_keyer, pJson["cwKeyer"], "SWGCWKeyerSettings", "SWGCWKeyerSettings"); +} + +QString +SWGNFMModSettings::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + return QString(bytes); +} + +QJsonObject* +SWGNFMModSettings::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + + obj->insert("basebandSampleRate", QJsonValue(baseband_sample_rate)); + + obj->insert("outputSampleRate", QJsonValue(output_sample_rate)); + + obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset)); + + obj->insert("rfBandwidth", QJsonValue(rf_bandwidth)); + + obj->insert("afBandwidth", QJsonValue(af_bandwidth)); + + obj->insert("fmDeviation", QJsonValue(fm_deviation)); + + obj->insert("toneFrequency", QJsonValue(tone_frequency)); + + obj->insert("volumeFactor", QJsonValue(volume_factor)); + + obj->insert("audioSampleRate", QJsonValue(audio_sample_rate)); + + obj->insert("channelMute", QJsonValue(channel_mute)); + + obj->insert("playLoop", QJsonValue(play_loop)); + + obj->insert("ctcssOn", QJsonValue(ctcss_on)); + + obj->insert("ctcssIndex", QJsonValue(ctcss_index)); + + obj->insert("rgbColor", QJsonValue(rgb_color)); + + toJsonValue(QString("title"), title, obj, QString("QString")); + + toJsonValue(QString("cwKeyer"), cw_keyer, obj, QString("SWGCWKeyerSettings")); + + return obj; +} + +qint32 +SWGNFMModSettings::getBasebandSampleRate() { + return baseband_sample_rate; +} +void +SWGNFMModSettings::setBasebandSampleRate(qint32 baseband_sample_rate) { + this->baseband_sample_rate = baseband_sample_rate; +} + +qint32 +SWGNFMModSettings::getOutputSampleRate() { + return output_sample_rate; +} +void +SWGNFMModSettings::setOutputSampleRate(qint32 output_sample_rate) { + this->output_sample_rate = output_sample_rate; +} + +qint64 +SWGNFMModSettings::getInputFrequencyOffset() { + return input_frequency_offset; +} +void +SWGNFMModSettings::setInputFrequencyOffset(qint64 input_frequency_offset) { + this->input_frequency_offset = input_frequency_offset; +} + +float +SWGNFMModSettings::getRfBandwidth() { + return rf_bandwidth; +} +void +SWGNFMModSettings::setRfBandwidth(float rf_bandwidth) { + this->rf_bandwidth = rf_bandwidth; +} + +float +SWGNFMModSettings::getAfBandwidth() { + return af_bandwidth; +} +void +SWGNFMModSettings::setAfBandwidth(float af_bandwidth) { + this->af_bandwidth = af_bandwidth; +} + +float +SWGNFMModSettings::getFmDeviation() { + return fm_deviation; +} +void +SWGNFMModSettings::setFmDeviation(float fm_deviation) { + this->fm_deviation = fm_deviation; +} + +float +SWGNFMModSettings::getToneFrequency() { + return tone_frequency; +} +void +SWGNFMModSettings::setToneFrequency(float tone_frequency) { + this->tone_frequency = tone_frequency; +} + +float +SWGNFMModSettings::getVolumeFactor() { + return volume_factor; +} +void +SWGNFMModSettings::setVolumeFactor(float volume_factor) { + this->volume_factor = volume_factor; +} + +qint32 +SWGNFMModSettings::getAudioSampleRate() { + return audio_sample_rate; +} +void +SWGNFMModSettings::setAudioSampleRate(qint32 audio_sample_rate) { + this->audio_sample_rate = audio_sample_rate; +} + +qint32 +SWGNFMModSettings::getChannelMute() { + return channel_mute; +} +void +SWGNFMModSettings::setChannelMute(qint32 channel_mute) { + this->channel_mute = channel_mute; +} + +qint32 +SWGNFMModSettings::getPlayLoop() { + return play_loop; +} +void +SWGNFMModSettings::setPlayLoop(qint32 play_loop) { + this->play_loop = play_loop; +} + +qint32 +SWGNFMModSettings::getCtcssOn() { + return ctcss_on; +} +void +SWGNFMModSettings::setCtcssOn(qint32 ctcss_on) { + this->ctcss_on = ctcss_on; +} + +qint32 +SWGNFMModSettings::getCtcssIndex() { + return ctcss_index; +} +void +SWGNFMModSettings::setCtcssIndex(qint32 ctcss_index) { + this->ctcss_index = ctcss_index; +} + +qint32 +SWGNFMModSettings::getRgbColor() { + return rgb_color; +} +void +SWGNFMModSettings::setRgbColor(qint32 rgb_color) { + this->rgb_color = rgb_color; +} + +QString* +SWGNFMModSettings::getTitle() { + return title; +} +void +SWGNFMModSettings::setTitle(QString* title) { + this->title = title; +} + +SWGCWKeyerSettings* +SWGNFMModSettings::getCwKeyer() { + return cw_keyer; +} +void +SWGNFMModSettings::setCwKeyer(SWGCWKeyerSettings* cw_keyer) { + this->cw_keyer = cw_keyer; +} + + +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGNFMModSettings.h b/swagger/sdrangel/code/qt5/client/SWGNFMModSettings.h new file mode 100644 index 000000000..dfc28348a --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGNFMModSettings.h @@ -0,0 +1,116 @@ +/** + * SDRangel + * This is the web API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube + * + * OpenAPI spec version: 4.0.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/* + * SWGNFMModSettings.h + * + * + */ + +#ifndef SWGNFMModSettings_H_ +#define SWGNFMModSettings_H_ + +#include + + +#include "SWGCWKeyerSettings.h" +#include + +#include "SWGObject.h" + + +namespace SWGSDRangel { + +class SWGNFMModSettings: public SWGObject { +public: + SWGNFMModSettings(); + SWGNFMModSettings(QString* json); + virtual ~SWGNFMModSettings(); + void init(); + void cleanup(); + + QString asJson (); + QJsonObject* asJsonObject(); + void fromJsonObject(QJsonObject &json); + SWGNFMModSettings* fromJson(QString &jsonString); + + qint32 getBasebandSampleRate(); + void setBasebandSampleRate(qint32 baseband_sample_rate); + + qint32 getOutputSampleRate(); + void setOutputSampleRate(qint32 output_sample_rate); + + qint64 getInputFrequencyOffset(); + void setInputFrequencyOffset(qint64 input_frequency_offset); + + float getRfBandwidth(); + void setRfBandwidth(float rf_bandwidth); + + float getAfBandwidth(); + void setAfBandwidth(float af_bandwidth); + + float getFmDeviation(); + void setFmDeviation(float fm_deviation); + + float getToneFrequency(); + void setToneFrequency(float tone_frequency); + + float getVolumeFactor(); + void setVolumeFactor(float volume_factor); + + qint32 getAudioSampleRate(); + void setAudioSampleRate(qint32 audio_sample_rate); + + qint32 getChannelMute(); + void setChannelMute(qint32 channel_mute); + + qint32 getPlayLoop(); + void setPlayLoop(qint32 play_loop); + + qint32 getCtcssOn(); + void setCtcssOn(qint32 ctcss_on); + + qint32 getCtcssIndex(); + void setCtcssIndex(qint32 ctcss_index); + + qint32 getRgbColor(); + void setRgbColor(qint32 rgb_color); + + QString* getTitle(); + void setTitle(QString* title); + + SWGCWKeyerSettings* getCwKeyer(); + void setCwKeyer(SWGCWKeyerSettings* cw_keyer); + + +private: + qint32 baseband_sample_rate; + qint32 output_sample_rate; + qint64 input_frequency_offset; + float rf_bandwidth; + float af_bandwidth; + float fm_deviation; + float tone_frequency; + float volume_factor; + qint32 audio_sample_rate; + qint32 channel_mute; + qint32 play_loop; + qint32 ctcss_on; + qint32 ctcss_index; + qint32 rgb_color; + QString* title; + SWGCWKeyerSettings* cw_keyer; +}; + +} + +#endif /* SWGNFMModSettings_H_ */ diff --git a/swagger/sdrangel/examples/ptt.py b/swagger/sdrangel/examples/ptt.py new file mode 100644 index 000000000..2ed24d58a --- /dev/null +++ b/swagger/sdrangel/examples/ptt.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python + +import requests, json, traceback, sys +from optparse import OptionParser + +base_url = "http://127.0.0.1:8888/sdrangel" + +# ====================================================================== +def getInputOptions(): + + parser = OptionParser(usage="usage: %%prog [-t]\n") + parser.add_option("-a", "--address", dest="address", help="address and port", metavar="ADDRESS", type="string") + parser.add_option("-t", "--transmit", dest="transmit", help="transmit", metavar="TRANSMIT", action="store_true", default=False) + + (options, args) = parser.parse_args() + + if (options.address == None): + options.address = "127.0.0.1:8888" + + return options + +# ====================================================================== +def startDevice(deviceIndex): + dev_run_url = base_url+("/deviceset/%d/device/run" % deviceIndex) + r = requests.get(url=dev_run_url) + if r.status_code == 200: + rj = r.json() + state = rj.get("state", None) + if state is not None: + if state == "idle": + r = requests.post(url=dev_run_url) + if r.status_code == 200: + print("Device %d started" % deviceIndex) + else: + print("Error starting device %d" % deviceIndex) + else: + print("device %d not in idle state" % deviceIndex) + else: + print("Cannot get device %d running state" % deviceIndex) + else: + print("Error getting device %d running state" % deviceIndex) + +# ====================================================================== +def stopDevice(deviceIndex): + dev_run_url = base_url+("/deviceset/%d/device/run" % deviceIndex) + r = requests.get(url=dev_run_url) + if r.status_code == 200: + rj = r.json() + state = rj.get("state", None) + if state is not None: + if state == "running": + r = requests.delete(url=dev_run_url) + if r.status_code == 200: + print("Device %d stopped" % deviceIndex) + else: + print("Error stopping device %d" % deviceIndex) + else: + print("device %d not in running state" % deviceIndex) + else: + print("Cannot get device %d running state" % deviceIndex) + else: + print("Error getting device %d running state" % deviceIndex) + +# ====================================================================== +def main(): + try: + options = getInputOptions() + global base_url + base_url = "http://%s/sdrangel" % options.address + r = requests.get(url=base_url+"/devicesets") + if r.status_code == 200: + rj = r.json() + deviceSets = rj.get("deviceSets", None) + if deviceSets is not None: + if len(deviceSets) > 1: + if deviceSets[0]["samplingDevice"]["tx"] == 0 and deviceSets[1]["samplingDevice"]["tx"] == 1: + if options.transmit: + stopDevice(0) + startDevice(1) + else: + stopDevice(1) + startDevice(0) + else: + print("Incorrect configuration expecting Rx0 and Tx1") + else: + print("Need at least a Rx and a Tx device set") + else: + print("Cannot get device sets configuration") + else: + print("Error getting device sets configuration") + + except Exception, msg: + tb = traceback.format_exc() + print >> sys.stderr, tb + + +if __name__ == "__main__": + main() + diff --git a/swagger/sdrangel/generate.sh b/swagger/sdrangel/generate.sh new file mode 100755 index 000000000..9f9004523 --- /dev/null +++ b/swagger/sdrangel/generate.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +CODEGEN=/opt/install/swagger/swagger-codegen +SDRANGEL_SRC=/opt/build/sdrangel + +${CODEGEN} generate -i api/swagger/swagger.yaml -l qt5cpp -c qt5cpp-config.json -o code/qt5 +${CODEGEN} generate -i api/swagger/swagger.yaml -l html2 -c html2-config.json -o code/html2 +cp -v code/html2/index.html ${SDRANGEL_SRC}/sdrbase/resources/