SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
webapiadapterbase.cpp
Go to the documentation of this file.
1 // Copyright (C) 2019 Edouard Griffiths, F4EXB. //
3 // //
4 // Swagger server adapter interface //
5 // //
6 // This program is free software; you can redistribute it and/or modify //
7 // it under the terms of the GNU General Public License as published by //
8 // the Free Software Foundation as version 3 of the License, or //
9 // (at your option) any later version. //
10 // //
11 // This program is distributed in the hope that it will be useful, //
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
14 // GNU General Public License V3 for more details. //
15 // //
16 // You should have received a copy of the GNU General Public License //
17 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
19 #include "webapiadapterbase.h"
20 
22  SWGSDRangel::SWGPreferences *apiPreferences,
23  const Preferences& preferences
24 )
25 {
26  apiPreferences->init();
27  apiPreferences->setSourceDevice(new QString(preferences.m_sourceDevice));
28  apiPreferences->setSourceIndex(preferences.m_sourceIndex);
29  apiPreferences->setAudioType(new QString(preferences.m_audioType));
30  apiPreferences->setAudioDevice(new QString(preferences.m_audioDevice));
31  apiPreferences->setLatitude(preferences.m_latitude);
32  apiPreferences->setLongitude(preferences.m_longitude);
33  apiPreferences->setConsoleMinLogLevel((int) preferences.m_consoleMinLogLevel);
34  apiPreferences->setUseLogFile(preferences.m_useLogFile ? 1 : 0);
35  apiPreferences->setLogFileName(new QString(preferences.m_logFileName));
36  apiPreferences->setFileMinLogLevel((int) preferences.m_fileMinLogLevel);
37 }
38 
40  SWGSDRangel::SWGPreset *apiPreset,
41  const Preset& preset
42 )
43 {
44  apiPreset->init();
45  apiPreset->setSourcePreset(preset.m_sourcePreset ? 1 : 0);
46  apiPreset->setGroup(new QString(preset.m_group));
47  apiPreset->setDescription(new QString(preset.m_description));
48  apiPreset->setCenterFrequency(preset.m_centerFrequency);
49  apiPreset->getMSpectrumConfig()->init(); // TODO when spectrum config is extracted to sdrbase
50  apiPreset->setDcOffsetCorrection(preset.m_dcOffsetCorrection ? 1 : 0);
51  apiPreset->setIqImbalanceCorrection(preset.m_iqImbalanceCorrection ? 1 : 0);
52  // TODO: channel configs
53  // TODO: device configs
54 }
float m_longitude
Definition: preferences.h:50
void setLongitude(float longitude)
void setDcOffsetCorrection(qint32 dc_offset_correction)
Definition: SWGPreset.cpp:251
void setUseLogFile(qint32 use_log_file)
quint64 m_centerFrequency
Definition: preset.h:127
QtMsgType m_consoleMinLogLevel
Definition: preferences.h:52
void setSourcePreset(qint32 source_preset)
Definition: SWGPreset.cpp:201
bool m_useLogFile
Definition: preferences.h:54
bool m_sourcePreset
Definition: preset.h:122
void setFileMinLogLevel(qint32 file_min_log_level)
int m_sourceIndex
Index of the source used in R0 tab (GUI flavor) at startup.
Definition: preferences.h:44
void setSourceDevice(QString *source_device)
void setSourceIndex(qint32 source_index)
void setIqImbalanceCorrection(qint32 iq_imbalance_correction)
Definition: SWGPreset.cpp:261
void setDescription(QString *description)
Definition: SWGPreset.cpp:221
void setGroup(QString *group)
Definition: SWGPreset.cpp:211
Definition: preset.h:28
void setLogFileName(QString *log_file_name)
static void webapiFormatPreferences(SWGSDRangel::SWGPreferences *apiPreferences, const Preferences &preferences)
SWGGLSpectrum * getMSpectrumConfig()
Definition: SWGPreset.cpp:237
QString m_audioType
Definition: preferences.h:46
void setCenterFrequency(qint64 center_frequency)
Definition: SWGPreset.cpp:231
QString m_sourceDevice
Identification of the source used in R0 tab (GUI flavor) at startup.
Definition: preferences.h:43
void setConsoleMinLogLevel(qint32 console_min_log_level)
QString m_group
Definition: preset.h:125
float m_latitude
Definition: preferences.h:49
QString m_description
Definition: preset.h:126
QString m_audioDevice
Definition: preferences.h:47
void setAudioDevice(QString *audio_device)
QtMsgType m_fileMinLogLevel
Definition: preferences.h:53
QString m_logFileName
Definition: preferences.h:55
static void webapiFormatPreset(SWGSDRangel::SWGPreset *apiPreset, const Preset &preset)
bool m_dcOffsetCorrection
Definition: preset.h:133
void setLatitude(float latitude)
void setAudioType(QString *audio_type)
bool m_iqImbalanceCorrection
Definition: preset.h:134