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.
Classes | Signals | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
KiwiSDRInput Class Reference

#include <kiwisdrinput.h>

+ Inheritance diagram for KiwiSDRInput:
+ Collaboration diagram for KiwiSDRInput:

Classes

class  MsgConfigureKiwiSDR
 
class  MsgFileRecord
 
class  MsgSetStatus
 
class  MsgStartStop
 

Signals

void startWorker ()
 
void stopWorker ()
 
void setWorkerCenterFrequency (quint64 centerFrequency)
 
void setWorkerServerAddress (QString serverAddress)
 
void setWorkerGain (quint32 gain, bool useAGC)
 

Public Member Functions

 KiwiSDRInput (DeviceAPI *deviceAPI)
 
virtual ~KiwiSDRInput ()
 
virtual void destroy ()
 
virtual void init ()
 initializations to be done when all collaborating objects are created and possibly connected More...
 
virtual bool start ()
 
virtual void stop ()
 
virtual QByteArray serialize () const
 
virtual bool deserialize (const QByteArray &data)
 
virtual void setMessageQueueToGUI (MessageQueue *queue)
 
virtual const QString & getDeviceDescription () const
 
virtual int getSampleRate () const
 Sample rate exposed by the source. More...
 
virtual void setSampleRate (int sampleRate)
 For when the source sample rate is set externally. More...
 
virtual quint64 getCenterFrequency () const
 Center frequency exposed by the source. More...
 
virtual void setCenterFrequency (qint64 centerFrequency)
 
virtual bool handleMessage (const Message &message)
 
virtual int webapiSettingsGet (SWGSDRangel::SWGDeviceSettings &response, QString &errorMessage)
 
virtual int webapiSettingsPutPatch (bool force, const QStringList &deviceSettingsKeys, SWGSDRangel::SWGDeviceSettings &response, QString &errorMessage)
 
virtual int webapiRunGet (SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
 
virtual int webapiRun (bool run, SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
 
virtual int webapiReportGet (SWGSDRangel::SWGDeviceReport &response, QString &errorMessage)
 
- Public Member Functions inherited from DeviceSampleSource
 DeviceSampleSource ()
 
virtual ~DeviceSampleSource ()
 
MessageQueuegetInputMessageQueue ()
 
MessageQueuegetMessageQueueToGUI ()
 
SampleSinkFifogetSampleFifo ()
 

Private Slots

void setWorkerStatus (int status)
 
void networkManagerFinished (QNetworkReply *reply)
 

Private Member Functions

int getStatus () const
 
bool applySettings (const KiwiSDRSettings &settings, bool force)
 
void webapiFormatDeviceSettings (SWGSDRangel::SWGDeviceSettings &response, const KiwiSDRSettings &settings)
 
void webapiFormatDeviceReport (SWGSDRangel::SWGDeviceReport &response)
 
void webapiReverseSendSettings (QList< QString > &deviceSettingsKeys, const KiwiSDRSettings &settings, bool force)
 
void webapiReverseSendStartStop (bool start)
 

Private Attributes

DeviceAPIm_deviceAPI
 
FileRecordm_fileSink
 File sink to record device I/Q output. More...
 
QMutex m_mutex
 
KiwiSDRSettings m_settings
 
KiwiSDRWorkerm_kiwiSDRWorker
 
QThread m_kiwiSDRWorkerThread
 
QString m_deviceDescription
 
bool m_running
 
const QTimer & m_masterTimer
 
QNetworkAccessManager * m_networkManager
 
QNetworkRequest m_networkRequest
 

Additional Inherited Members

- Public Types inherited from DeviceSampleSource
enum  fcPos_t { FC_POS_INFRA = 0, FC_POS_SUPRA, FC_POS_CENTER }
 
enum  FrequencyShiftScheme { FSHIFT_STD = 0, FSHIFT_TXSYNC }
 
- Static Public Member Functions inherited from DeviceSampleSource
static qint64 calculateDeviceCenterFrequency (quint64 centerFrequency, qint64 transverterDeltaFrequency, int log2Decim, fcPos_t fcPos, quint32 devSampleRate, FrequencyShiftScheme frequencyShiftScheme, bool transverterMode=false)
 
static qint64 calculateCenterFrequency (quint64 deviceCenterFrequency, qint64 transverterDeltaFrequency, int log2Decim, fcPos_t fcPos, quint32 devSampleRate, FrequencyShiftScheme frequencyShiftScheme, bool transverterMode=false)
 
static qint32 calculateFrequencyShift (int log2Decim, fcPos_t fcPos, quint32 devSampleRate, FrequencyShiftScheme frequencyShiftScheme)
 
- Protected Slots inherited from DeviceSampleSource
void handleInputMessages ()
 
- Protected Attributes inherited from DeviceSampleSource
SampleSinkFifo m_sampleFifo
 
MessageQueue m_inputMessageQueue
 Input queue to the source. More...
 
MessageQueuem_guiMessageQueue
 Input message queue to the GUI. More...
 

Detailed Description

Definition at line 37 of file kiwisdrinput.h.

Constructor & Destructor Documentation

◆ KiwiSDRInput()

KiwiSDRInput::KiwiSDRInput ( DeviceAPI deviceAPI)

Definition at line 45 of file kiwisdrinput.cpp.

References start().

Referenced by KiwiSDRInput::MsgSetStatus::MsgSetStatus().

45  :
46  m_deviceAPI(deviceAPI),
47  m_settings(),
48  m_kiwiSDRWorker(nullptr),
50  m_running(false),
51  m_masterTimer(deviceAPI->getMasterTimer())
52 {
53  m_kiwiSDRWorkerThread.start();
54 
55  m_fileSink = new FileRecord();
58 
59  if (!m_sampleFifo.setSize(getSampleRate() * 2)) {
60  qCritical("KiwiSDRInput::KiwiSDRInput: Could not allocate SampleFifo");
61  }
62 
63  m_networkManager = new QNetworkAccessManager();
64  connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
65 }
QNetworkAccessManager * m_networkManager
Definition: kiwisdrinput.h:173
DeviceAPI * m_deviceAPI
Definition: kiwisdrinput.h:164
QThread m_kiwiSDRWorkerThread
Definition: kiwisdrinput.h:169
void setNbSourceStreams(uint32_t nbSourceStreams)
Definition: deviceapi.h:168
const QTimer & getMasterTimer() const
This is the DSPEngine master timer.
Definition: deviceapi.h:173
const QTimer & m_masterTimer
Definition: kiwisdrinput.h:172
SampleSinkFifo m_sampleFifo
bool setSize(int size)
void networkManagerFinished(QNetworkReply *reply)
void addAncillarySink(BasebandSampleSink *sink, unsigned int index=0)
Adds a sink to receive full baseband and that is not a channel (e.g. spectrum)
Definition: deviceapi.cpp:89
QString m_deviceDescription
Definition: kiwisdrinput.h:170
virtual int getSampleRate() const
Sample rate exposed by the source.
FileRecord * m_fileSink
File sink to record device I/Q output.
Definition: kiwisdrinput.h:165
KiwiSDRSettings m_settings
Definition: kiwisdrinput.h:167
KiwiSDRWorker * m_kiwiSDRWorker
Definition: kiwisdrinput.h:168
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~KiwiSDRInput()

KiwiSDRInput::~KiwiSDRInput ( )
virtual

Definition at line 67 of file kiwisdrinput.cpp.

References m_deviceAPI, m_fileSink, m_kiwiSDRWorkerThread, m_networkManager, m_running, networkManagerFinished(), DeviceAPI::removeAncillarySink(), and stop().

Referenced by KiwiSDRInput::MsgSetStatus::MsgSetStatus().

68 {
69  disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
70  delete m_networkManager;
71 
72  if (m_running) {
73  stop();
74  }
75 
76  m_kiwiSDRWorkerThread.quit();
77  m_kiwiSDRWorkerThread.wait();
78 
80  delete m_fileSink;
81 }
QNetworkAccessManager * m_networkManager
Definition: kiwisdrinput.h:173
DeviceAPI * m_deviceAPI
Definition: kiwisdrinput.h:164
QThread m_kiwiSDRWorkerThread
Definition: kiwisdrinput.h:169
virtual void stop()
void networkManagerFinished(QNetworkReply *reply)
void removeAncillarySink(BasebandSampleSink *sink, unsigned int index=0)
Removes it.
Definition: deviceapi.cpp:100
FileRecord * m_fileSink
File sink to record device I/Q output.
Definition: kiwisdrinput.h:165
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ applySettings()

bool KiwiSDRInput::applySettings ( const KiwiSDRSettings settings,
bool  force 
)
private

Definition at line 270 of file kiwisdrinput.cpp.

References DeviceAPI::configureCorrections(), DeviceAPI::getDeviceEngineInputMessageQueue(), getSampleRate(), FileRecord::handleMessage(), KiwiSDRSettings::m_centerFrequency, KiwiSDRSettings::m_dcBlock, m_deviceAPI, KiwiSDRSettings::m_fileRecordName, m_fileSink, KiwiSDRSettings::m_gain, KiwiSDRSettings::m_reverseAPIAddress, KiwiSDRSettings::m_reverseAPIDeviceIndex, KiwiSDRSettings::m_reverseAPIPort, KiwiSDRSettings::m_serverAddress, m_settings, KiwiSDRSettings::m_useAGC, KiwiSDRSettings::m_useReverseAPI, MessageQueue::push(), setWorkerCenterFrequency(), setWorkerGain(), setWorkerServerAddress(), and webapiReverseSendSettings().

Referenced by handleMessage(), init(), and start().

271 {
272  qDebug() << "KiwiSDRInput::applySettings: "
273  << " m_serverAddress: " << settings.m_serverAddress
274  << " m_centerFrequency: " << settings.m_centerFrequency
275  << " m_gain: " << settings.m_gain
276  << " m_useAGC: " << settings.m_useAGC
277  << " m_fileRecordName: " << settings.m_fileRecordName
278  << " m_useAGC: " << settings.m_useAGC
279  << " m_useReverseAPI: " << settings.m_useReverseAPI
280  << " m_reverseAPIAddress: " << settings.m_reverseAPIAddress
281  << " m_reverseAPIPort: " << settings.m_reverseAPIPort
282  << " m_reverseAPIDeviceIndex: " << settings.m_reverseAPIDeviceIndex;
283 
284  QList<QString> reverseAPIKeys;
285 
286  if (m_settings.m_serverAddress != settings.m_serverAddress || force)
287  {
288  reverseAPIKeys.append("serverAddress");
290  }
291 
292  if (m_settings.m_gain != settings.m_gain || force) {
293  reverseAPIKeys.append("gain");
294  }
295  if (m_settings.m_useAGC != settings.m_useAGC || force) {
296  reverseAPIKeys.append("useAGC");
297  }
298 
299  if (m_settings.m_gain != settings.m_gain ||
300  m_settings.m_useAGC != settings.m_useAGC || force)
301  {
302  emit setWorkerGain(settings.m_gain, settings.m_useAGC);
303  }
304 
305  if (m_settings.m_dcBlock != settings.m_dcBlock)
306  {
307  reverseAPIKeys.append("dcBlock");
308  m_deviceAPI->configureCorrections(settings.m_dcBlock, false);
309  }
310 
311  if (m_settings.m_centerFrequency != settings.m_centerFrequency || force)
312  {
313  reverseAPIKeys.append("centerFrequency");
314 
316 
318  getSampleRate(), settings.m_centerFrequency);
319  m_fileSink->handleMessage(*notif); // forward to file sink
321  }
322 
323  if (settings.m_useReverseAPI)
324  {
325  qDebug("KiwiSDRInput::applySettings: call webapiReverseSendSettings");
326  bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
330  webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
331  }
332 
333  m_settings = settings;
334  return true;
335 }
void setWorkerServerAddress(QString serverAddress)
DeviceAPI * m_deviceAPI
Definition: kiwisdrinput.h:164
void push(Message *message, bool emitSignal=true)
Push message onto queue.
QString m_serverAddress
MessageQueue * getDeviceEngineInputMessageQueue()
Device engine message queue.
Definition: deviceapi.cpp:316
QString m_reverseAPIAddress
virtual bool handleMessage(const Message &message)
Processing of a message. Returns true if message has actually been processed.
Definition: filerecord.cpp:128
uint16_t m_reverseAPIDeviceIndex
void setWorkerGain(quint32 gain, bool useAGC)
QString m_fileRecordName
void setWorkerCenterFrequency(quint64 centerFrequency)
virtual int getSampleRate() const
Sample rate exposed by the source.
FileRecord * m_fileSink
File sink to record device I/Q output.
Definition: kiwisdrinput.h:165
void webapiReverseSendSettings(QList< QString > &deviceSettingsKeys, const KiwiSDRSettings &settings, bool force)
uint16_t m_reverseAPIPort
quint64 m_centerFrequency
KiwiSDRSettings m_settings
Definition: kiwisdrinput.h:167
void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection, int streamIndex=0)
Configure current device engine DSP corrections (Rx)
Definition: deviceapi.cpp:355
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deserialize()

bool KiwiSDRInput::deserialize ( const QByteArray &  data)
virtual

Implements DeviceSampleSource.

Definition at line 135 of file kiwisdrinput.cpp.

References KiwiSDRInput::MsgConfigureKiwiSDR::create(), KiwiSDRSettings::deserialize(), DeviceSampleSource::m_guiMessageQueue, DeviceSampleSource::m_inputMessageQueue, m_settings, MessageQueue::push(), and KiwiSDRSettings::resetToDefaults().

Referenced by KiwiSDRInput::MsgSetStatus::MsgSetStatus().

136 {
137  bool success = true;
138 
139  if (!m_settings.deserialize(data))
140  {
142  success = false;
143  }
144 
145  MsgConfigureKiwiSDR* message = MsgConfigureKiwiSDR::create(m_settings, true);
146  m_inputMessageQueue.push(message);
147 
148  if (m_guiMessageQueue)
149  {
150  MsgConfigureKiwiSDR* messageToGUI = MsgConfigureKiwiSDR::create(m_settings, true);
151  m_guiMessageQueue->push(messageToGUI);
152  }
153 
154  return success;
155 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue m_inputMessageQueue
Input queue to the source.
static MsgConfigureKiwiSDR * create(const KiwiSDRSettings &settings, bool force)
Definition: kiwisdrinput.h:47
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
bool deserialize(const QByteArray &data)
KiwiSDRSettings m_settings
Definition: kiwisdrinput.h:167
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ destroy()

void KiwiSDRInput::destroy ( )
virtual

Implements DeviceSampleSource.

Definition at line 83 of file kiwisdrinput.cpp.

Referenced by KiwiSDRInput::MsgSetStatus::MsgSetStatus().

84 {
85  delete this;
86 }
+ Here is the caller graph for this function:

◆ getCenterFrequency()

quint64 KiwiSDRInput::getCenterFrequency ( ) const
virtual

Center frequency exposed by the source.

Implements DeviceSampleSource.

Definition at line 167 of file kiwisdrinput.cpp.

References KiwiSDRSettings::m_centerFrequency, and m_settings.

Referenced by setSampleRate().

168 {
170 }
quint64 m_centerFrequency
KiwiSDRSettings m_settings
Definition: kiwisdrinput.h:167
+ Here is the caller graph for this function:

◆ getDeviceDescription()

const QString & KiwiSDRInput::getDeviceDescription ( ) const
virtual

Implements DeviceSampleSource.

Definition at line 157 of file kiwisdrinput.cpp.

References m_deviceDescription.

Referenced by setMessageQueueToGUI().

158 {
159  return m_deviceDescription;
160 }
QString m_deviceDescription
Definition: kiwisdrinput.h:170
+ Here is the caller graph for this function:

◆ getSampleRate()

int KiwiSDRInput::getSampleRate ( ) const
virtual

Sample rate exposed by the source.

Implements DeviceSampleSource.

Definition at line 162 of file kiwisdrinput.cpp.

Referenced by applySettings(), and setMessageQueueToGUI().

163 {
164  return 12000;
165 }
+ Here is the caller graph for this function:

◆ getStatus()

int KiwiSDRInput::getStatus ( ) const
private

Definition at line 261 of file kiwisdrinput.cpp.

References KiwiSDRWorker::getStatus(), and m_kiwiSDRWorker.

Referenced by webapiFormatDeviceReport().

262 {
263  if (m_kiwiSDRWorker) {
264  return m_kiwiSDRWorker->getStatus();
265  } else {
266  return 0;
267  }
268 }
int getStatus() const
Definition: kiwisdrworker.h:31
KiwiSDRWorker * m_kiwiSDRWorker
Definition: kiwisdrinput.h:168
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleMessage()

bool KiwiSDRInput::handleMessage ( const Message message)
virtual

Implements DeviceSampleSource.

Definition at line 194 of file kiwisdrinput.cpp.

References applySettings(), FileRecord::genUniqueFileName(), DeviceAPI::getDeviceUID(), KiwiSDRInput::MsgConfigureKiwiSDR::getForce(), KiwiSDRInput::MsgConfigureKiwiSDR::getSettings(), KiwiSDRInput::MsgFileRecord::getStartStop(), KiwiSDRInput::MsgStartStop::getStartStop(), DeviceAPI::initDeviceEngine(), m_deviceAPI, KiwiSDRSettings::m_fileRecordName, m_fileSink, m_settings, KiwiSDRSettings::m_useReverseAPI, Message::match(), FileRecord::setFileName(), DeviceAPI::startDeviceEngine(), FileRecord::startRecording(), DeviceAPI::stopDeviceEngine(), FileRecord::stopRecording(), and webapiReverseSendStartStop().

Referenced by setSampleRate().

195 {
196  if (MsgConfigureKiwiSDR::match(message))
197  {
198  MsgConfigureKiwiSDR& conf = (MsgConfigureKiwiSDR&) message;
199  qDebug() << "KiwiSDRInput::handleMessage: MsgConfigureKiwiSDR";
200 
201  bool success = applySettings(conf.getSettings(), conf.getForce());
202 
203  if (!success)
204  {
205  qDebug("KiwiSDRInput::handleMessage: config error");
206  }
207 
208  return true;
209  }
210  else if (MsgFileRecord::match(message))
211  {
212  MsgFileRecord& conf = (MsgFileRecord&) message;
213  qDebug() << "KiwiSDRInput::handleMessage: MsgFileRecord: " << conf.getStartStop();
214 
215  if (conf.getStartStop())
216  {
217  if (m_settings.m_fileRecordName.size() != 0) {
219  } else {
221  }
222 
224  }
225  else
226  {
228  }
229 
230  return true;
231  }
232  else if (MsgStartStop::match(message))
233  {
234  MsgStartStop& cmd = (MsgStartStop&) message;
235  qDebug() << "KiwiSDRInput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
236 
237  if (cmd.getStartStop())
238  {
240  {
242  }
243  }
244  else
245  {
247  }
248 
250  webapiReverseSendStartStop(cmd.getStartStop());
251  }
252 
253  return true;
254  }
255  else
256  {
257  return false;
258  }
259 }
bool startDeviceEngine()
Start the device engine corresponding to the stream type.
Definition: deviceapi.cpp:253
DeviceAPI * m_deviceAPI
Definition: kiwisdrinput.h:164
void stopDeviceEngine()
Stop the device engine corresponding to the stream type.
Definition: deviceapi.cpp:266
bool applySettings(const KiwiSDRSettings &settings, bool force)
void setFileName(const QString &filename)
Definition: filerecord.cpp:59
uint getDeviceUID() const
Return the current device engine unique ID.
Definition: deviceapi.cpp:303
void startRecording()
Definition: filerecord.cpp:105
void webapiReverseSendStartStop(bool start)
bool initDeviceEngine()
Init the device engine corresponding to the stream type.
Definition: deviceapi.cpp:240
void genUniqueFileName(uint deviceUID, int istream=-1)
Definition: filerecord.cpp:67
void stopRecording()
Definition: filerecord.cpp:117
static bool match(const Message *message)
Definition: message.cpp:45
QString m_fileRecordName
FileRecord * m_fileSink
File sink to record device I/Q output.
Definition: kiwisdrinput.h:165
KiwiSDRSettings m_settings
Definition: kiwisdrinput.h:167
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

void KiwiSDRInput::init ( )
virtual

initializations to be done when all collaborating objects are created and possibly connected

Implements DeviceSampleSource.

Definition at line 88 of file kiwisdrinput.cpp.

References applySettings(), and m_settings.

Referenced by KiwiSDRInput::MsgSetStatus::MsgSetStatus().

89 {
91 }
bool applySettings(const KiwiSDRSettings &settings, bool force)
KiwiSDRSettings m_settings
Definition: kiwisdrinput.h:167
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ networkManagerFinished

void KiwiSDRInput::networkManagerFinished ( QNetworkReply *  reply)
privateslot

Definition at line 552 of file kiwisdrinput.cpp.

Referenced by ~KiwiSDRInput().

553 {
554  QNetworkReply::NetworkError replyError = reply->error();
555 
556  if (replyError)
557  {
558  qWarning() << "KiwiSDRInput::networkManagerFinished:"
559  << " error(" << (int) replyError
560  << "): " << replyError
561  << ": " << reply->errorString();
562  return;
563  }
564 
565  QString answer = reply->readAll();
566  answer.chop(1); // remove last \n
567  qDebug("KiwiSDRInput::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
568 }
+ Here is the caller graph for this function:

◆ serialize()

QByteArray KiwiSDRInput::serialize ( ) const
virtual

Implements DeviceSampleSource.

Definition at line 130 of file kiwisdrinput.cpp.

References m_settings, and KiwiSDRSettings::serialize().

Referenced by KiwiSDRInput::MsgSetStatus::MsgSetStatus().

131 {
132  return m_settings.serialize();
133 }
KiwiSDRSettings m_settings
Definition: kiwisdrinput.h:167
QByteArray serialize() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCenterFrequency()

void KiwiSDRInput::setCenterFrequency ( qint64  centerFrequency)
virtual

Implements DeviceSampleSource.

Definition at line 172 of file kiwisdrinput.cpp.

References KiwiSDRInput::MsgConfigureKiwiSDR::create(), KiwiSDRSettings::m_centerFrequency, DeviceSampleSource::m_guiMessageQueue, DeviceSampleSource::m_inputMessageQueue, m_settings, and MessageQueue::push().

Referenced by setSampleRate().

173 {
174  KiwiSDRSettings settings = m_settings;
175  settings.m_centerFrequency = centerFrequency;
176 
177  MsgConfigureKiwiSDR* message = MsgConfigureKiwiSDR::create(settings, false);
178  m_inputMessageQueue.push(message);
179 
180  if (m_guiMessageQueue)
181  {
182  MsgConfigureKiwiSDR* messageToGUI = MsgConfigureKiwiSDR::create(settings, false);
183  m_guiMessageQueue->push(messageToGUI);
184  }
185 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue m_inputMessageQueue
Input queue to the source.
static MsgConfigureKiwiSDR * create(const KiwiSDRSettings &settings, bool force)
Definition: kiwisdrinput.h:47
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
quint64 m_centerFrequency
KiwiSDRSettings m_settings
Definition: kiwisdrinput.h:167
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMessageQueueToGUI()

virtual void KiwiSDRInput::setMessageQueueToGUI ( MessageQueue queue)
inlinevirtual

Implements DeviceSampleSource.

Definition at line 131 of file kiwisdrinput.h.

References getDeviceDescription(), getSampleRate(), and DeviceSampleSource::m_guiMessageQueue.

131 { m_guiMessageQueue = queue; }
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
+ Here is the call graph for this function:

◆ setSampleRate()

virtual void KiwiSDRInput::setSampleRate ( int  sampleRate)
inlinevirtual

For when the source sample rate is set externally.

Implements DeviceSampleSource.

Definition at line 134 of file kiwisdrinput.h.

References getCenterFrequency(), handleMessage(), setCenterFrequency(), webapiReportGet(), webapiRun(), webapiRunGet(), webapiSettingsGet(), and webapiSettingsPutPatch().

134 { (void) sampleRate; }
+ Here is the call graph for this function:

◆ setWorkerCenterFrequency

void KiwiSDRInput::setWorkerCenterFrequency ( quint64  centerFrequency)
signal

Referenced by applySettings(), and start().

+ Here is the caller graph for this function:

◆ setWorkerGain

void KiwiSDRInput::setWorkerGain ( quint32  gain,
bool  useAGC 
)
signal

Referenced by applySettings(), and start().

+ Here is the caller graph for this function:

◆ setWorkerServerAddress

void KiwiSDRInput::setWorkerServerAddress ( QString  serverAddress)
signal

Referenced by applySettings(), and start().

+ Here is the caller graph for this function:

◆ setWorkerStatus

void KiwiSDRInput::setWorkerStatus ( int  status)
privateslot

Definition at line 187 of file kiwisdrinput.cpp.

References KiwiSDRInput::MsgSetStatus::create(), DeviceSampleSource::m_guiMessageQueue, and MessageQueue::push().

Referenced by start(), and stop().

188 {
189  if (m_guiMessageQueue) {
191  }
192 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
static MsgSetStatus * create(int status)
Definition: kiwisdrinput.h:107
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start()

bool KiwiSDRInput::start ( )
virtual

Implements DeviceSampleSource.

Definition at line 93 of file kiwisdrinput.cpp.

References applySettings(), m_kiwiSDRWorker, m_kiwiSDRWorkerThread, m_mutex, m_running, DeviceSampleSource::m_sampleFifo, m_settings, KiwiSDRWorker::onCenterFrequencyChanged(), KiwiSDRWorker::onGainChanged(), KiwiSDRWorker::onServerAddressChanged(), setWorkerCenterFrequency(), setWorkerGain(), setWorkerServerAddress(), setWorkerStatus(), stop(), and KiwiSDRWorker::updateStatus().

Referenced by KiwiSDRInput(), and KiwiSDRInput::MsgSetStatus::MsgSetStatus().

94 {
95  QMutexLocker mutexLocker(&m_mutex);
96 
97  if (m_running) stop();
98 
100  m_kiwiSDRWorker->moveToThread(&m_kiwiSDRWorkerThread);
101 
106 
107  mutexLocker.unlock();
108 
109  applySettings(m_settings, true);
110  m_running = true;
111 
112  return true;
113 }
void setWorkerServerAddress(QString serverAddress)
QThread m_kiwiSDRWorkerThread
Definition: kiwisdrinput.h:169
bool applySettings(const KiwiSDRSettings &settings, bool force)
void onCenterFrequencyChanged(quint64 centerFrequency)
SampleSinkFifo m_sampleFifo
virtual void stop()
void updateStatus(int status)
void setWorkerGain(quint32 gain, bool useAGC)
void onServerAddressChanged(QString serverAddress)
void setWorkerCenterFrequency(quint64 centerFrequency)
void setWorkerStatus(int status)
KiwiSDRSettings m_settings
Definition: kiwisdrinput.h:167
KiwiSDRWorker * m_kiwiSDRWorker
Definition: kiwisdrinput.h:168
void onGainChanged(quint32 gain, bool useAGC)
QMutex m_mutex
Definition: kiwisdrinput.h:166
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ startWorker

void KiwiSDRInput::startWorker ( )
signal

◆ stop()

void KiwiSDRInput::stop ( )
virtual

Implements DeviceSampleSource.

Definition at line 115 of file kiwisdrinput.cpp.

References m_kiwiSDRWorker, m_mutex, m_running, and setWorkerStatus().

Referenced by KiwiSDRInput::MsgSetStatus::MsgSetStatus(), start(), and ~KiwiSDRInput().

116 {
117  QMutexLocker mutexLocker(&m_mutex);
118 
119  setWorkerStatus(0);
120 
121  if (m_kiwiSDRWorker != 0)
122  {
123  m_kiwiSDRWorker->deleteLater();
124  m_kiwiSDRWorker = 0;
125  }
126 
127  m_running = false;
128 }
void setWorkerStatus(int status)
KiwiSDRWorker * m_kiwiSDRWorker
Definition: kiwisdrinput.h:168
QMutex m_mutex
Definition: kiwisdrinput.h:166
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stopWorker

void KiwiSDRInput::stopWorker ( )
signal

◆ webapiFormatDeviceReport()

void KiwiSDRInput::webapiFormatDeviceReport ( SWGSDRangel::SWGDeviceReport response)
private

Definition at line 471 of file kiwisdrinput.cpp.

References SWGSDRangel::SWGDeviceReport::getKiwiSdrReport(), getStatus(), and SWGSDRangel::SWGKiwiSDRReport::setStatus().

Referenced by webapiReportGet().

472 {
473  response.getKiwiSdrReport()->setStatus(getStatus());
474 }
int getStatus() const
SWGKiwiSDRReport * getKiwiSdrReport()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiFormatDeviceSettings()

void KiwiSDRInput::webapiFormatDeviceSettings ( SWGSDRangel::SWGDeviceSettings response,
const KiwiSDRSettings settings 
)
private

Definition at line 440 of file kiwisdrinput.cpp.

References SWGSDRangel::SWGKiwiSDRSettings::getFileRecordName(), SWGSDRangel::SWGDeviceSettings::getKiwiSdrSettings(), SWGSDRangel::SWGKiwiSDRSettings::getReverseApiAddress(), SWGSDRangel::SWGKiwiSDRSettings::getServerAddress(), KiwiSDRSettings::m_centerFrequency, KiwiSDRSettings::m_dcBlock, KiwiSDRSettings::m_fileRecordName, KiwiSDRSettings::m_gain, KiwiSDRSettings::m_reverseAPIAddress, KiwiSDRSettings::m_reverseAPIDeviceIndex, KiwiSDRSettings::m_reverseAPIPort, KiwiSDRSettings::m_serverAddress, KiwiSDRSettings::m_useAGC, KiwiSDRSettings::m_useReverseAPI, SWGSDRangel::SWGKiwiSDRSettings::setCenterFrequency(), SWGSDRangel::SWGKiwiSDRSettings::setDcBlock(), SWGSDRangel::SWGKiwiSDRSettings::setFileRecordName(), SWGSDRangel::SWGKiwiSDRSettings::setGain(), SWGSDRangel::SWGKiwiSDRSettings::setReverseApiAddress(), SWGSDRangel::SWGKiwiSDRSettings::setReverseApiDeviceIndex(), SWGSDRangel::SWGKiwiSDRSettings::setReverseApiPort(), SWGSDRangel::SWGKiwiSDRSettings::setServerAddress(), SWGSDRangel::SWGKiwiSDRSettings::setUseAgc(), and SWGSDRangel::SWGKiwiSDRSettings::setUseReverseApi().

Referenced by webapiSettingsGet(), and webapiSettingsPutPatch().

441 {
442  response.getKiwiSdrSettings()->setGain(settings.m_gain);
443  response.getKiwiSdrSettings()->setUseAgc(settings.m_useAGC ? 1 : 0);
444  response.getKiwiSdrSettings()->setDcBlock(settings.m_dcBlock ? 1 : 0);
446 
447  if (response.getKiwiSdrSettings()->getServerAddress()) {
448  *response.getKiwiSdrSettings()->getServerAddress() = settings.m_serverAddress;
449  } else {
450  response.getKiwiSdrSettings()->setServerAddress(new QString(settings.m_serverAddress));
451  }
452 
453  if (response.getKiwiSdrSettings()->getFileRecordName()) {
454  *response.getKiwiSdrSettings()->getFileRecordName() = settings.m_fileRecordName;
455  } else {
456  response.getKiwiSdrSettings()->setFileRecordName(new QString(settings.m_fileRecordName));
457  }
458 
459  response.getKiwiSdrSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
460 
461  if (response.getKiwiSdrSettings()->getReverseApiAddress()) {
463  } else {
464  response.getKiwiSdrSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
465  }
466 
469 }
void setReverseApiPort(qint32 reverse_api_port)
QString m_serverAddress
void setCenterFrequency(qint64 center_frequency)
QString m_reverseAPIAddress
void setServerAddress(QString *server_address)
void setFileRecordName(QString *file_record_name)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
void setUseReverseApi(qint32 use_reverse_api)
uint16_t m_reverseAPIDeviceIndex
QString m_fileRecordName
void setReverseApiAddress(QString *reverse_api_address)
uint16_t m_reverseAPIPort
quint64 m_centerFrequency
SWGKiwiSDRSettings * getKiwiSdrSettings()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiReportGet()

int KiwiSDRInput::webapiReportGet ( SWGSDRangel::SWGDeviceReport response,
QString &  errorMessage 
)
virtual

Reimplemented from DeviceSampleSource.

Definition at line 429 of file kiwisdrinput.cpp.

References SWGSDRangel::SWGDeviceReport::getKiwiSdrReport(), SWGSDRangel::SWGKiwiSDRReport::init(), SWGSDRangel::SWGDeviceReport::setKiwiSdrReport(), and webapiFormatDeviceReport().

Referenced by setSampleRate().

432 {
433  (void) errorMessage;
435  response.getKiwiSdrReport()->init();
436  webapiFormatDeviceReport(response);
437  return 200;
438 }
void setKiwiSdrReport(SWGKiwiSDRReport *kiwi_sdr_report)
SWGKiwiSDRReport * getKiwiSdrReport()
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport &response)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiReverseSendSettings()

void KiwiSDRInput::webapiReverseSendSettings ( QList< QString > &  deviceSettingsKeys,
const KiwiSDRSettings settings,
bool  force 
)
private

Definition at line 476 of file kiwisdrinput.cpp.

References SWGSDRangel::SWGDeviceSettings::asJson(), DeviceAPI::getDeviceSetIndex(), SWGSDRangel::SWGDeviceSettings::getKiwiSdrSettings(), KiwiSDRSettings::m_centerFrequency, KiwiSDRSettings::m_dcBlock, m_deviceAPI, KiwiSDRSettings::m_fileRecordName, KiwiSDRSettings::m_gain, m_networkManager, m_networkRequest, KiwiSDRSettings::m_reverseAPIAddress, KiwiSDRSettings::m_reverseAPIDeviceIndex, KiwiSDRSettings::m_reverseAPIPort, KiwiSDRSettings::m_serverAddress, KiwiSDRSettings::m_useAGC, SWGSDRangel::SWGKiwiSDRSettings::setCenterFrequency(), SWGSDRangel::SWGKiwiSDRSettings::setDcBlock(), SWGSDRangel::SWGDeviceSettings::setDeviceHwType(), SWGSDRangel::SWGDeviceSettings::setDirection(), SWGSDRangel::SWGKiwiSDRSettings::setFileRecordName(), SWGSDRangel::SWGKiwiSDRSettings::setGain(), SWGSDRangel::SWGDeviceSettings::setKiwiSdrSettings(), SWGSDRangel::SWGDeviceSettings::setOriginatorIndex(), SWGSDRangel::SWGKiwiSDRSettings::setServerAddress(), and SWGSDRangel::SWGKiwiSDRSettings::setUseAgc().

Referenced by applySettings().

477 {
479  swgDeviceSettings->setDirection(0); // single Rx
480  swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
481  swgDeviceSettings->setDeviceHwType(new QString("KiwiSDR"));
482  swgDeviceSettings->setKiwiSdrSettings(new SWGSDRangel::SWGKiwiSDRSettings());
483  SWGSDRangel::SWGKiwiSDRSettings *swgKiwiSDRSettings = swgDeviceSettings->getKiwiSdrSettings();
484 
485  // transfer data that has been modified. When force is on transfer all data except reverse API data
486 
487  if (deviceSettingsKeys.contains("gain")) {
488  swgKiwiSDRSettings->setGain(settings.m_gain);
489  }
490  if (deviceSettingsKeys.contains("useAGC")) {
491  swgKiwiSDRSettings->setUseAgc(settings.m_useAGC ? 1 : 0);
492  }
493  if (deviceSettingsKeys.contains("dcBlock") || force) {
494  swgKiwiSDRSettings->setDcBlock(settings.m_dcBlock ? 1 : 0);
495  }
496  if (deviceSettingsKeys.contains("centerFrequency") || force) {
497  swgKiwiSDRSettings->setCenterFrequency(settings.m_centerFrequency);
498  }
499  if (deviceSettingsKeys.contains("serverAddress") || force) {
500  swgKiwiSDRSettings->setServerAddress(new QString(settings.m_serverAddress));
501  }
502  if (deviceSettingsKeys.contains("fileRecordName") || force) {
503  swgKiwiSDRSettings->setFileRecordName(new QString(settings.m_fileRecordName));
504  }
505 
506  QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings")
507  .arg(settings.m_reverseAPIAddress)
508  .arg(settings.m_reverseAPIPort)
509  .arg(settings.m_reverseAPIDeviceIndex);
510  m_networkRequest.setUrl(QUrl(deviceSettingsURL));
511  m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
512 
513  QBuffer *buffer=new QBuffer();
514  buffer->open((QBuffer::ReadWrite));
515  buffer->write(swgDeviceSettings->asJson().toUtf8());
516  buffer->seek(0);
517 
518  // Always use PATCH to avoid passing reverse API settings
519  m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
520 
521  delete swgDeviceSettings;
522 }
QNetworkAccessManager * m_networkManager
Definition: kiwisdrinput.h:173
DeviceAPI * m_deviceAPI
Definition: kiwisdrinput.h:164
QString m_serverAddress
virtual QString asJson() override
void setCenterFrequency(qint64 center_frequency)
QNetworkRequest m_networkRequest
Definition: kiwisdrinput.h:174
void setOriginatorIndex(qint32 originator_index)
QString m_reverseAPIAddress
void setServerAddress(QString *server_address)
int getDeviceSetIndex() const
Definition: deviceapi.h:131
void setFileRecordName(QString *file_record_name)
void setKiwiSdrSettings(SWGKiwiSDRSettings *kiwi_sdr_settings)
uint16_t m_reverseAPIDeviceIndex
QString m_fileRecordName
uint16_t m_reverseAPIPort
quint64 m_centerFrequency
void setDirection(qint32 direction)
void setDeviceHwType(QString *device_hw_type)
SWGKiwiSDRSettings * getKiwiSdrSettings()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiReverseSendStartStop()

void KiwiSDRInput::webapiReverseSendStartStop ( bool  start)
private

Definition at line 524 of file kiwisdrinput.cpp.

References SWGSDRangel::SWGDeviceSettings::asJson(), DeviceAPI::getDeviceSetIndex(), m_deviceAPI, m_networkManager, m_networkRequest, KiwiSDRSettings::m_reverseAPIAddress, KiwiSDRSettings::m_reverseAPIDeviceIndex, KiwiSDRSettings::m_reverseAPIPort, m_settings, SWGSDRangel::SWGDeviceSettings::setDeviceHwType(), SWGSDRangel::SWGDeviceSettings::setDirection(), and SWGSDRangel::SWGDeviceSettings::setOriginatorIndex().

Referenced by handleMessage().

525 {
527  swgDeviceSettings->setDirection(0); // single Rx
528  swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
529  swgDeviceSettings->setDeviceHwType(new QString("KiwiSDR"));
530 
531  QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/run")
535  m_networkRequest.setUrl(QUrl(deviceSettingsURL));
536  m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
537 
538  QBuffer *buffer=new QBuffer();
539  buffer->open((QBuffer::ReadWrite));
540  buffer->write(swgDeviceSettings->asJson().toUtf8());
541  buffer->seek(0);
542 
543  if (start) {
544  m_networkManager->sendCustomRequest(m_networkRequest, "POST", buffer);
545  } else {
546  m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
547  }
548 
549  delete swgDeviceSettings;
550 }
QNetworkAccessManager * m_networkManager
Definition: kiwisdrinput.h:173
DeviceAPI * m_deviceAPI
Definition: kiwisdrinput.h:164
virtual QString asJson() override
virtual bool start()
QNetworkRequest m_networkRequest
Definition: kiwisdrinput.h:174
void setOriginatorIndex(qint32 originator_index)
QString m_reverseAPIAddress
int getDeviceSetIndex() const
Definition: deviceapi.h:131
uint16_t m_reverseAPIDeviceIndex
uint16_t m_reverseAPIPort
KiwiSDRSettings m_settings
Definition: kiwisdrinput.h:167
void setDirection(qint32 direction)
void setDeviceHwType(QString *device_hw_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiRun()

int KiwiSDRInput::webapiRun ( bool  run,
SWGSDRangel::SWGDeviceState response,
QString &  errorMessage 
)
virtual

Reimplemented from DeviceSampleSource.

Definition at line 346 of file kiwisdrinput.cpp.

References KiwiSDRInput::MsgStartStop::create(), DeviceAPI::getDeviceEngineStateStr(), SWGSDRangel::SWGDeviceState::getState(), m_deviceAPI, DeviceSampleSource::m_guiMessageQueue, DeviceSampleSource::m_inputMessageQueue, and MessageQueue::push().

Referenced by setSampleRate().

350 {
351  (void) errorMessage;
353  MsgStartStop *message = MsgStartStop::create(run);
354  m_inputMessageQueue.push(message);
355 
356  if (m_guiMessageQueue) // forward to GUI if any
357  {
358  MsgStartStop *msgToGUI = MsgStartStop::create(run);
359  m_guiMessageQueue->push(msgToGUI);
360  }
361 
362  return 200;
363 }
DeviceAPI * m_deviceAPI
Definition: kiwisdrinput.h:164
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue m_inputMessageQueue
Input queue to the source.
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
void getDeviceEngineStateStr(QString &state)
Definition: deviceapi.cpp:389
static MsgStartStop * create(bool startStop)
Definition: kiwisdrinput.h:88
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiRunGet()

int KiwiSDRInput::webapiRunGet ( SWGSDRangel::SWGDeviceState response,
QString &  errorMessage 
)
virtual

Reimplemented from DeviceSampleSource.

Definition at line 337 of file kiwisdrinput.cpp.

References DeviceAPI::getDeviceEngineStateStr(), SWGSDRangel::SWGDeviceState::getState(), and m_deviceAPI.

Referenced by setSampleRate().

340 {
341  (void) errorMessage;
343  return 200;
344 }
DeviceAPI * m_deviceAPI
Definition: kiwisdrinput.h:164
void getDeviceEngineStateStr(QString &state)
Definition: deviceapi.cpp:389
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiSettingsGet()

int KiwiSDRInput::webapiSettingsGet ( SWGSDRangel::SWGDeviceSettings response,
QString &  errorMessage 
)
virtual

Reimplemented from DeviceSampleSource.

Definition at line 365 of file kiwisdrinput.cpp.

References SWGSDRangel::SWGDeviceSettings::getKiwiSdrSettings(), SWGSDRangel::SWGKiwiSDRSettings::init(), m_settings, SWGSDRangel::SWGDeviceSettings::setKiwiSdrSettings(), and webapiFormatDeviceSettings().

Referenced by setSampleRate().

368 {
369  (void) errorMessage;
371  response.getKiwiSdrSettings()->init();
373  return 200;
374 }
void setKiwiSdrSettings(SWGKiwiSDRSettings *kiwi_sdr_settings)
KiwiSDRSettings m_settings
Definition: kiwisdrinput.h:167
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings &response, const KiwiSDRSettings &settings)
SWGKiwiSDRSettings * getKiwiSdrSettings()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiSettingsPutPatch()

int KiwiSDRInput::webapiSettingsPutPatch ( bool  force,
const QStringList &  deviceSettingsKeys,
SWGSDRangel::SWGDeviceSettings response,
QString &  errorMessage 
)
virtual

Reimplemented from DeviceSampleSource.

Definition at line 376 of file kiwisdrinput.cpp.

References KiwiSDRInput::MsgConfigureKiwiSDR::create(), SWGSDRangel::SWGKiwiSDRSettings::getCenterFrequency(), SWGSDRangel::SWGKiwiSDRSettings::getDcBlock(), SWGSDRangel::SWGKiwiSDRSettings::getFileRecordName(), SWGSDRangel::SWGKiwiSDRSettings::getGain(), SWGSDRangel::SWGDeviceSettings::getKiwiSdrSettings(), SWGSDRangel::SWGKiwiSDRSettings::getReverseApiAddress(), SWGSDRangel::SWGKiwiSDRSettings::getReverseApiDeviceIndex(), SWGSDRangel::SWGKiwiSDRSettings::getReverseApiPort(), SWGSDRangel::SWGKiwiSDRSettings::getServerAddress(), SWGSDRangel::SWGKiwiSDRSettings::getUseAgc(), SWGSDRangel::SWGKiwiSDRSettings::getUseReverseApi(), KiwiSDRSettings::m_centerFrequency, KiwiSDRSettings::m_dcBlock, KiwiSDRSettings::m_fileRecordName, KiwiSDRSettings::m_gain, DeviceSampleSource::m_guiMessageQueue, DeviceSampleSource::m_inputMessageQueue, KiwiSDRSettings::m_reverseAPIAddress, KiwiSDRSettings::m_reverseAPIDeviceIndex, KiwiSDRSettings::m_reverseAPIPort, KiwiSDRSettings::m_serverAddress, m_settings, KiwiSDRSettings::m_useAGC, KiwiSDRSettings::m_useReverseAPI, MessageQueue::push(), and webapiFormatDeviceSettings().

Referenced by setSampleRate().

381 {
382  (void) errorMessage;
383  KiwiSDRSettings settings = m_settings;
384 
385  if (deviceSettingsKeys.contains("gain")) {
386  settings.m_gain = response.getKiwiSdrSettings()->getGain();
387  }
388  if (deviceSettingsKeys.contains("useAGC")) {
389  settings.m_useAGC = response.getKiwiSdrSettings()->getUseAgc();
390  }
391  if (deviceSettingsKeys.contains("dcBlock")) {
392  settings.m_dcBlock = response.getKiwiSdrSettings()->getDcBlock() != 0;
393  }
394  if (deviceSettingsKeys.contains("centerFrequency")) {
396  }
397  if (deviceSettingsKeys.contains("serverAddress")) {
398  settings.m_serverAddress = *response.getKiwiSdrSettings()->getServerAddress();
399  }
400  if (deviceSettingsKeys.contains("fileRecordName")) {
401  settings.m_fileRecordName = *response.getKiwiSdrSettings()->getFileRecordName();
402  }
403  if (deviceSettingsKeys.contains("useReverseAPI")) {
404  settings.m_useReverseAPI = response.getKiwiSdrSettings()->getUseReverseApi() != 0;
405  }
406  if (deviceSettingsKeys.contains("reverseAPIAddress")) {
408  }
409  if (deviceSettingsKeys.contains("reverseAPIPort")) {
410  settings.m_reverseAPIPort = response.getKiwiSdrSettings()->getReverseApiPort();
411  }
412  if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
414  }
415 
416  MsgConfigureKiwiSDR *msg = MsgConfigureKiwiSDR::create(settings, force);
418 
419  if (m_guiMessageQueue) // forward to GUI if any
420  {
421  MsgConfigureKiwiSDR *msgToGUI = MsgConfigureKiwiSDR::create(settings, force);
422  m_guiMessageQueue->push(msgToGUI);
423  }
424 
425  webapiFormatDeviceSettings(response, settings);
426  return 200;
427 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
QString m_serverAddress
MessageQueue m_inputMessageQueue
Input queue to the source.
QString m_reverseAPIAddress
static MsgConfigureKiwiSDR * create(const KiwiSDRSettings &settings, bool force)
Definition: kiwisdrinput.h:47
uint16_t m_reverseAPIDeviceIndex
QString m_fileRecordName
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
uint16_t m_reverseAPIPort
quint64 m_centerFrequency
KiwiSDRSettings m_settings
Definition: kiwisdrinput.h:167
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings &response, const KiwiSDRSettings &settings)
SWGKiwiSDRSettings * getKiwiSdrSettings()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_deviceAPI

DeviceAPI* KiwiSDRInput::m_deviceAPI
private

◆ m_deviceDescription

QString KiwiSDRInput::m_deviceDescription
private

Definition at line 170 of file kiwisdrinput.h.

Referenced by getDeviceDescription().

◆ m_fileSink

FileRecord* KiwiSDRInput::m_fileSink
private

File sink to record device I/Q output.

Definition at line 165 of file kiwisdrinput.h.

Referenced by applySettings(), handleMessage(), and ~KiwiSDRInput().

◆ m_kiwiSDRWorker

KiwiSDRWorker* KiwiSDRInput::m_kiwiSDRWorker
private

Definition at line 168 of file kiwisdrinput.h.

Referenced by getStatus(), start(), and stop().

◆ m_kiwiSDRWorkerThread

QThread KiwiSDRInput::m_kiwiSDRWorkerThread
private

Definition at line 169 of file kiwisdrinput.h.

Referenced by start(), and ~KiwiSDRInput().

◆ m_masterTimer

const QTimer& KiwiSDRInput::m_masterTimer
private

Definition at line 172 of file kiwisdrinput.h.

◆ m_mutex

QMutex KiwiSDRInput::m_mutex
private

Definition at line 166 of file kiwisdrinput.h.

Referenced by start(), and stop().

◆ m_networkManager

QNetworkAccessManager* KiwiSDRInput::m_networkManager
private

◆ m_networkRequest

QNetworkRequest KiwiSDRInput::m_networkRequest
private

Definition at line 174 of file kiwisdrinput.h.

Referenced by webapiReverseSendSettings(), and webapiReverseSendStartStop().

◆ m_running

bool KiwiSDRInput::m_running
private

Definition at line 171 of file kiwisdrinput.h.

Referenced by start(), stop(), and ~KiwiSDRInput().

◆ m_settings

KiwiSDRSettings KiwiSDRInput::m_settings
private

The documentation for this class was generated from the following files: