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 | Public Types | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
SDRPlayInput Class Reference

#include <sdrplayinput.h>

+ Inheritance diagram for SDRPlayInput:
+ Collaboration diagram for SDRPlayInput:

Classes

class  MsgConfigureSDRPlay
 
class  MsgFileRecord
 
class  MsgReportSDRPlayGains
 
class  MsgStartStop
 

Public Types

enum  SDRPlayVariant { SDRPlayUndef, SDRPlayRSP1, SDRPlayRSP1A, SDRPlayRSP2 }
 
- 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 }
 

Public Member Functions

 SDRPlayInput (DeviceAPI *deviceAPI)
 
virtual ~SDRPlayInput ()
 
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 webapiReportGet (SWGSDRangel::SWGDeviceReport &response, QString &errorMessage)
 
virtual int webapiRunGet (SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
 
virtual int webapiRun (bool run, SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
 
SDRPlayVariant getVariant () const
 
- Public Member Functions inherited from DeviceSampleSource
 DeviceSampleSource ()
 
virtual ~DeviceSampleSource ()
 
MessageQueuegetInputMessageQueue ()
 
MessageQueuegetMessageQueueToGUI ()
 
SampleSinkFifogetSampleFifo ()
 

Private Slots

void networkManagerFinished (QNetworkReply *reply)
 

Private Member Functions

bool openDevice ()
 
void closeDevice ()
 
bool applySettings (const SDRPlaySettings &settings, bool forwardChange, bool force)
 
bool setDeviceCenterFrequency (quint64 freq)
 
void webapiFormatDeviceSettings (SWGSDRangel::SWGDeviceSettings &response, const SDRPlaySettings &settings)
 
void webapiFormatDeviceReport (SWGSDRangel::SWGDeviceReport &response)
 
void webapiReverseSendSettings (QList< QString > &deviceSettingsKeys, const SDRPlaySettings &settings, bool force)
 
void webapiReverseSendStartStop (bool start)
 

Private Attributes

DeviceAPIm_deviceAPI
 
QMutex m_mutex
 
SDRPlayVariant m_variant
 
SDRPlaySettings m_settings
 
mirisdr_dev_t * m_dev
 
SDRPlayThreadm_sdrPlayThread
 
QString m_deviceDescription
 
int m_devNumber
 
bool m_running
 
FileRecordm_fileSink
 File sink to record device I/Q output. More...
 
QNetworkAccessManager * m_networkManager
 
QNetworkRequest m_networkRequest
 

Additional Inherited Members

- 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 sdrplayinput.h.

Member Enumeration Documentation

◆ SDRPlayVariant

Enumerator
SDRPlayUndef 
SDRPlayRSP1 
SDRPlayRSP1A 
SDRPlayRSP2 

Definition at line 40 of file sdrplayinput.h.

Constructor & Destructor Documentation

◆ SDRPlayInput()

SDRPlayInput::SDRPlayInput ( DeviceAPI deviceAPI)

Definition at line 45 of file sdrplayinput.cpp.

References arg().

Referenced by SDRPlayInput::MsgStartStop::MsgStartStop().

45  :
46  m_deviceAPI(deviceAPI),
48  m_settings(),
49  m_dev(0),
50  m_sdrPlayThread(0),
51  m_deviceDescription("SDRPlay"),
52  m_devNumber(0),
53  m_running(false)
54 {
55  openDevice();
56  m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
59 
60  m_networkManager = new QNetworkAccessManager();
61  connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
62 }
SDRPlayThread * m_sdrPlayThread
Definition: sdrplayinput.h:189
uint getDeviceUID() const
Return the current device engine unique ID.
Definition: deviceapi.cpp:303
void setNbSourceStreams(uint32_t nbSourceStreams)
Definition: deviceapi.h:168
QString m_deviceDescription
Definition: sdrplayinput.h:190
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
void networkManagerFinished(QNetworkReply *reply)
FileRecord * m_fileSink
File sink to record device I/Q output.
Definition: sdrplayinput.h:193
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
SDRPlayVariant m_variant
Definition: sdrplayinput.h:186
DeviceAPI * m_deviceAPI
Definition: sdrplayinput.h:184
QNetworkAccessManager * m_networkManager
Definition: sdrplayinput.h:194
bool openDevice()
SDRPlaySettings m_settings
Definition: sdrplayinput.h:187
mirisdr_dev_t * m_dev
Definition: sdrplayinput.h:188
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~SDRPlayInput()

SDRPlayInput::~SDRPlayInput ( )
virtual

Definition at line 64 of file sdrplayinput.cpp.

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

Referenced by SDRPlayInput::MsgStartStop::MsgStartStop().

65 {
66  disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
67  delete m_networkManager;
68 
69  if (m_running) {
70  stop();
71  }
72 
74  delete m_fileSink;
75  closeDevice();
76 }
virtual void stop()
void networkManagerFinished(QNetworkReply *reply)
FileRecord * m_fileSink
File sink to record device I/Q output.
Definition: sdrplayinput.h:193
DeviceAPI * m_deviceAPI
Definition: sdrplayinput.h:184
void removeAncillarySink(BasebandSampleSink *sink, unsigned int index=0)
Removes it.
Definition: deviceapi.cpp:100
QNetworkAccessManager * m_networkManager
Definition: sdrplayinput.h:194
void closeDevice()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ applySettings()

bool SDRPlayInput::applySettings ( const SDRPlaySettings settings,
bool  forwardChange,
bool  force 
)
private

Definition at line 363 of file sdrplayinput.cpp.

References DeviceSampleSource::calculateDeviceCenterFrequency(), DeviceAPI::configureCorrections(), SDRPlayInput::MsgReportSDRPlayGains::create(), SDRPlayBandwidths::getBandwidth(), DeviceAPI::getDeviceEngineInputMessageQueue(), SDRPlayIF::getIF(), DeviceSampleSource::getMessageQueueToGUI(), SDRPlaySampleRates::getRate(), getSampleRate(), FileRecord::handleMessage(), SDRPlaySettings::m_bandwidthIndex, SDRPlaySettings::m_basebandGain, SDRPlaySettings::m_centerFrequency, SDRPlaySettings::m_dcBlock, m_dev, m_deviceAPI, SDRPlaySettings::m_devSampleRateIndex, SDRPlaySettings::m_fcPos, m_fileSink, SDRPlaySettings::m_frequencyBandIndex, SDRPlaySettings::m_ifFrequencyIndex, SDRPlaySettings::m_iqCorrection, SDRPlaySettings::m_lnaOn, SDRPlaySettings::m_log2Decim, SDRPlaySettings::m_LOppmTenths, SDRPlaySettings::m_mixerAmpOn, m_mutex, SDRPlaySettings::m_reverseAPIAddress, SDRPlaySettings::m_reverseAPIDeviceIndex, SDRPlaySettings::m_reverseAPIPort, m_sdrPlayThread, m_settings, SDRPlaySettings::m_tunerGain, SDRPlaySettings::m_tunerGainMode, SDRPlaySettings::m_useReverseAPI, MessageQueue::push(), setDeviceCenterFrequency(), SDRPlayThread::setFcPos(), SDRPlayThread::setLog2Decimation(), and webapiReverseSendSettings().

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

364 {
365  bool forceGainSetting = false;
366  QList<QString> reverseAPIKeys;
367  QMutexLocker mutexLocker(&m_mutex);
368 
369  if ((m_settings.m_dcBlock != settings.m_dcBlock) || force)
370  {
371  reverseAPIKeys.append("dcBlock");
373  }
374 
375  if ((m_settings.m_iqCorrection != settings.m_iqCorrection) || force)
376  {
377  reverseAPIKeys.append("iqCorrection");
379  }
380 
381  // gains processing
382 
383  if ((m_settings.m_tunerGainMode != settings.m_tunerGainMode) || force)
384  {
385  reverseAPIKeys.append("tunerGainMode");
386  forceGainSetting = true;
387  }
388 
389  if ((m_settings.m_tunerGain != settings.m_tunerGain) || force) {
390  reverseAPIKeys.append("tunerGain");
391  }
392  if ((m_settings.m_lnaOn != settings.m_lnaOn) || force) {
393  reverseAPIKeys.append("lnaOn");
394  }
395 
396  if (settings.m_tunerGainMode) // auto
397  {
398  if ((m_settings.m_tunerGain != settings.m_tunerGain) || forceGainSetting)
399  {
400  if(m_dev != 0)
401  {
402  int r = mirisdr_set_tuner_gain(m_dev, settings.m_tunerGain);
403 
404  if (r < 0)
405  {
406  qDebug("SDRPlayInput::applySettings: could not set tuner gain");
407  }
408  else
409  {
410  int lnaGain;
411 
412  if (settings.m_frequencyBandIndex < 3) // bands using AM mode
413  {
414  lnaGain = mirisdr_get_mixbuffer_gain(m_dev);
415  }
416  else
417  {
418  lnaGain = mirisdr_get_lna_gain(m_dev);
419  }
420 
421  MsgReportSDRPlayGains *message = MsgReportSDRPlayGains::create(
422  lnaGain,
423  mirisdr_get_mixer_gain(m_dev),
424  mirisdr_get_baseband_gain(m_dev),
425  mirisdr_get_tuner_gain(m_dev)
426  );
427 
428  if (getMessageQueueToGUI()) {
429  getMessageQueueToGUI()->push(message);
430  }
431  }
432  }
433  }
434  }
435  else // manual
436  {
437  bool anyChange = false;
438 
439  if ((m_settings.m_lnaOn != settings.m_lnaOn) || forceGainSetting)
440  {
441  if (m_dev != 0)
442  {
443  if (settings.m_frequencyBandIndex < 3) // bands using AM mode
444  {
445  int r = mirisdr_set_mixbuffer_gain(m_dev, settings.m_lnaOn ? 0 : 1); // mirisdr_set_mixbuffer_gain takes gain reduction
446 
447  if (r != 0) {
448  qDebug("SDRPlayInput::applySettings: could not set mixer buffer gain");
449  } else {
450  anyChange = true;
451  }
452  }
453  else
454  {
455  int r = mirisdr_set_lna_gain(m_dev, settings.m_lnaOn ? 0 : 1); // mirisdr_set_lna_gain takes gain reduction
456 
457  if (r != 0) {
458  qDebug("SDRPlayInput::applySettings: could not set LNA gain");
459  } else {
460  anyChange = true;
461  }
462  }
463  }
464  }
465 
466  if ((m_settings.m_mixerAmpOn != settings.m_mixerAmpOn) || forceGainSetting)
467  {
468  reverseAPIKeys.append("mixerAmpOn");
469 
470  if (m_dev != 0)
471  {
472  int r = mirisdr_set_mixer_gain(m_dev, settings.m_mixerAmpOn ? 0 : 1); // mirisdr_set_lna_gain takes gain reduction
473 
474  if (r != 0) {
475  qDebug("SDRPlayInput::applySettings: could not set mixer gain");
476  } else {
477  anyChange = true;
478  }
479  }
480  }
481 
482  if ((m_settings.m_basebandGain != settings.m_basebandGain) || forceGainSetting)
483  {
484  reverseAPIKeys.append("basebandGain");
485 
486  if (m_dev != 0)
487  {
488  int r = mirisdr_set_baseband_gain(m_dev, settings.m_basebandGain);
489 
490  if (r != 0) {
491  qDebug("SDRPlayInput::applySettings: could not set mixer gain");
492  } else {
493  anyChange = true;
494  }
495  }
496  }
497 
498  if (anyChange)
499  {
500  int lnaGain;
501 
502  if (settings.m_frequencyBandIndex < 3) { // bands using AM mode
503  lnaGain = mirisdr_get_mixbuffer_gain(m_dev);
504  } else {
505  lnaGain = mirisdr_get_lna_gain(m_dev);
506  }
507 
508  MsgReportSDRPlayGains *message = MsgReportSDRPlayGains::create(
509  lnaGain,
510  mirisdr_get_mixer_gain(m_dev),
511  mirisdr_get_baseband_gain(m_dev),
512  mirisdr_get_tuner_gain(m_dev)
513  );
514 
515  if (getMessageQueueToGUI()) {
516  getMessageQueueToGUI()->push(message);
517  }
518  }
519  }
520 
521  if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
522  {
523  reverseAPIKeys.append("log2Decim");
524 
525  if (m_sdrPlayThread != 0)
526  {
528  qDebug() << "SDRPlayInput::applySettings: set decimation to " << (1<<settings.m_log2Decim);
529  }
530  }
531 
532  if ((m_settings.m_fcPos != settings.m_fcPos) || force)
533  {
534  reverseAPIKeys.append("fcPos");
535 
536  if (m_sdrPlayThread != 0)
537  {
538  m_sdrPlayThread->setFcPos((int) settings.m_fcPos);
539  qDebug() << "SDRPlayInput: set fc pos (enum) to " << (int) settings.m_fcPos;
540  }
541  }
542 
543  if ((m_settings.m_centerFrequency != settings.m_centerFrequency) || force) {
544  reverseAPIKeys.append("centerFrequency");
545  }
546  if ((m_settings.m_LOppmTenths != settings.m_LOppmTenths) || force) {
547  reverseAPIKeys.append("LOppmTenths");
548  }
549 
551  || (m_settings.m_LOppmTenths != settings.m_LOppmTenths)
552  || (m_settings.m_fcPos != settings.m_fcPos)
553  || (m_settings.m_log2Decim != settings.m_log2Decim) || force)
554  {
555  qint64 deviceCenterFrequency = DeviceSampleSource::calculateDeviceCenterFrequency(
556  settings.m_centerFrequency,
557  0,
558  settings.m_log2Decim,
561  DeviceSampleSource::FrequencyShiftScheme::FSHIFT_STD,
562  false);
563 
564  forwardChange = true;
565 
566  if(m_dev != 0)
567  {
568  if (setDeviceCenterFrequency(deviceCenterFrequency)) {
569  qDebug() << "SDRPlayInput::applySettings: center freq: " << settings.m_centerFrequency << " Hz";
570  }
571  }
572  }
573 
574  if ((m_settings.m_bandwidthIndex != settings.m_bandwidthIndex) || force)
575  {
576  reverseAPIKeys.append("bandwidthIndex");
577  int bandwidth = SDRPlayBandwidths::getBandwidth(settings.m_bandwidthIndex);
578  int r = mirisdr_set_bandwidth(m_dev, bandwidth);
579 
580  if (r < 0) {
581  qCritical("SDRPlayInput::applySettings: set bandwidth %d failed: rc: %d", bandwidth, r);
582  } else {
583  qDebug("SDRPlayInput::applySettings: bandwidth set to %d", bandwidth);
584  }
585  }
586 
587  if ((m_settings.m_ifFrequencyIndex != settings.m_ifFrequencyIndex) || force)
588  {
589  reverseAPIKeys.append("ifFrequencyIndex");
590  int iFFrequency = SDRPlayIF::getIF(settings.m_ifFrequencyIndex);
591  int r = mirisdr_set_if_freq(m_dev, iFFrequency);
592 
593  if (r < 0) {
594  qCritical("SDRPlayInput::applySettings: set IF frequency to %d failed: rc: %d", iFFrequency, r);
595  } else {
596  qDebug("SDRPlayInput::applySettings: IF frequency set to %d", iFFrequency);
597  }
598  }
599 
600  if (settings.m_useReverseAPI)
601  {
602  bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
606  webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
607  }
608 
609  m_settings = settings;
610 
611  if (forwardChange)
612  {
613  int sampleRate = getSampleRate();
615  m_fileSink->handleMessage(*notif); // forward to file sink
617  }
618 
619  return true;
620 }
QMutex m_mutex
Definition: sdrplayinput.h:185
uint32_t m_ifFrequencyIndex
void webapiReverseSendSettings(QList< QString > &deviceSettingsKeys, const SDRPlaySettings &settings, bool force)
uint16_t m_reverseAPIPort
static qint64 calculateDeviceCenterFrequency(quint64 centerFrequency, qint64 transverterDeltaFrequency, int log2Decim, fcPos_t fcPos, quint32 devSampleRate, FrequencyShiftScheme frequencyShiftScheme, bool transverterMode=false)
void push(Message *message, bool emitSignal=true)
Push message onto queue.
SDRPlayThread * m_sdrPlayThread
Definition: sdrplayinput.h:189
bool setDeviceCenterFrequency(quint64 freq)
MessageQueue * getDeviceEngineInputMessageQueue()
Device engine message queue.
Definition: deviceapi.cpp:316
MessageQueue * getMessageQueueToGUI()
static MsgReportSDRPlayGains * create(int lnaGain, int mixerGain, int basebandGain, int tunerGain)
Definition: sdrplayinput.h:75
virtual bool handleMessage(const Message &message)
Processing of a message. Returns true if message has actually been processed.
Definition: filerecord.cpp:128
FileRecord * m_fileSink
File sink to record device I/Q output.
Definition: sdrplayinput.h:193
QString m_reverseAPIAddress
void setLog2Decimation(unsigned int log2_decim)
DeviceAPI * m_deviceAPI
Definition: sdrplayinput.h:184
uint64_t m_centerFrequency
static unsigned int getBandwidth(unsigned int bandwidth_index)
uint32_t m_frequencyBandIndex
uint32_t m_log2Decim
uint32_t m_bandwidthIndex
static unsigned int getRate(unsigned int rate_index)
static unsigned int getIF(unsigned int if_index)
SDRPlaySettings m_settings
Definition: sdrplayinput.h:187
virtual int getSampleRate() const
Sample rate exposed by the source.
void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection, int streamIndex=0)
Configure current device engine DSP corrections (Rx)
Definition: deviceapi.cpp:355
uint16_t m_reverseAPIDeviceIndex
uint32_t m_devSampleRateIndex
void setFcPos(int fcPos)
mirisdr_dev_t * m_dev
Definition: sdrplayinput.h:188
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ closeDevice()

void SDRPlayInput::closeDevice ( )
private

Definition at line 197 of file sdrplayinput.cpp.

References m_dev, and m_deviceDescription.

Referenced by openDevice(), and ~SDRPlayInput().

198 {
199  if (m_dev != 0)
200  {
201  mirisdr_close(m_dev);
202  m_dev = 0;
203  }
204 
205  m_deviceDescription.clear();
206 }
QString m_deviceDescription
Definition: sdrplayinput.h:190
mirisdr_dev_t * m_dev
Definition: sdrplayinput.h:188
+ Here is the caller graph for this function:

◆ deserialize()

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

Implements DeviceSampleSource.

Definition at line 232 of file sdrplayinput.cpp.

References SDRPlayInput::MsgConfigureSDRPlay::create(), SDRPlaySettings::deserialize(), DeviceSampleSource::m_guiMessageQueue, DeviceSampleSource::m_inputMessageQueue, m_settings, MessageQueue::push(), and SDRPlaySettings::resetToDefaults().

Referenced by SDRPlayInput::MsgStartStop::MsgStartStop().

233 {
234  bool success = true;
235 
236  if (!m_settings.deserialize(data))
237  {
239  success = false;
240  }
241 
242  MsgConfigureSDRPlay* message = MsgConfigureSDRPlay::create(m_settings, true);
243  m_inputMessageQueue.push(message);
244 
245  if (m_guiMessageQueue)
246  {
247  MsgConfigureSDRPlay* messageToGUI = MsgConfigureSDRPlay::create(m_settings, true);
248  m_guiMessageQueue->push(messageToGUI);
249  }
250 
251  return success;
252 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue m_inputMessageQueue
Input queue to the source.
static MsgConfigureSDRPlay * create(const SDRPlaySettings &settings, bool force)
Definition: sdrplayinput.h:55
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
bool deserialize(const QByteArray &data)
SDRPlaySettings m_settings
Definition: sdrplayinput.h:187
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ destroy()

void SDRPlayInput::destroy ( )
virtual

Implements DeviceSampleSource.

Definition at line 78 of file sdrplayinput.cpp.

Referenced by SDRPlayInput::MsgStartStop::MsgStartStop().

79 {
80  delete this;
81 }
+ Here is the caller graph for this function:

◆ getCenterFrequency()

quint64 SDRPlayInput::getCenterFrequency ( ) const
virtual

Center frequency exposed by the source.

Implements DeviceSampleSource.

Definition at line 265 of file sdrplayinput.cpp.

References SDRPlaySettings::m_centerFrequency, and m_settings.

Referenced by setSampleRate().

266 {
268 }
uint64_t m_centerFrequency
SDRPlaySettings m_settings
Definition: sdrplayinput.h:187
+ Here is the caller graph for this function:

◆ getDeviceDescription()

const QString & SDRPlayInput::getDeviceDescription ( ) const
virtual

Implements DeviceSampleSource.

Definition at line 254 of file sdrplayinput.cpp.

References m_deviceDescription.

Referenced by setMessageQueueToGUI().

255 {
256  return m_deviceDescription;
257 }
QString m_deviceDescription
Definition: sdrplayinput.h:190
+ Here is the caller graph for this function:

◆ getSampleRate()

int SDRPlayInput::getSampleRate ( ) const
virtual

Sample rate exposed by the source.

Implements DeviceSampleSource.

Definition at line 259 of file sdrplayinput.cpp.

References SDRPlaySampleRates::getRate(), SDRPlaySettings::m_devSampleRateIndex, SDRPlaySettings::m_log2Decim, and m_settings.

Referenced by applySettings(), and setMessageQueueToGUI().

260 {
262  return rate / (1<<m_settings.m_log2Decim);
263 }
uint32_t m_log2Decim
static unsigned int getRate(unsigned int rate_index)
SDRPlaySettings m_settings
Definition: sdrplayinput.h:187
uint32_t m_devSampleRateIndex
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getVariant()

SDRPlayVariant SDRPlayInput::getVariant ( ) const
inline

Definition at line 181 of file sdrplayinput.h.

References m_variant.

181 { return m_variant; }
SDRPlayVariant m_variant
Definition: sdrplayinput.h:186

◆ handleMessage()

bool SDRPlayInput::handleMessage ( const Message message)
virtual

Implements DeviceSampleSource.

Definition at line 285 of file sdrplayinput.cpp.

References applySettings(), FileRecord::genUniqueFileName(), DeviceAPI::getDeviceUID(), SDRPlayInput::MsgConfigureSDRPlay::getForce(), SDRPlayInput::MsgConfigureSDRPlay::getSettings(), SDRPlayInput::MsgFileRecord::getStartStop(), SDRPlayInput::MsgStartStop::getStartStop(), DeviceAPI::initDeviceEngine(), m_dev, m_deviceAPI, SDRPlaySettings::m_devSampleRateIndex, SDRPlaySettings::m_fileRecordName, m_fileSink, m_settings, SDRPlaySettings::m_useReverseAPI, Message::match(), FileRecord::setFileName(), start(), DeviceAPI::startDeviceEngine(), FileRecord::startRecording(), stop(), DeviceAPI::stopDeviceEngine(), FileRecord::stopRecording(), and webapiReverseSendStartStop().

Referenced by setSampleRate().

286 {
287  if (MsgConfigureSDRPlay::match(message))
288  {
289  MsgConfigureSDRPlay& conf = (MsgConfigureSDRPlay&) message;
290  qDebug() << "SDRPlayInput::handleMessage: MsgConfigureSDRPlay";
291  const SDRPlaySettings& settings = conf.getSettings();
292 
293  // change of sample rate needs full stop / start sequence that includes the standard apply settings
294  // only if in started state (iff m_dev != 0)
295  if ((m_dev != 0) && (m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex))
296  {
297  m_settings = settings;
298  stop();
299  start();
300  }
301  // standard changes
302  else
303  {
304  if (!applySettings(settings, false, conf.getForce()))
305  {
306  qDebug("SDRPlayInput::handleMessage: config error");
307  }
308  }
309 
310  return true;
311  }
312  else if (MsgFileRecord::match(message))
313  {
314  MsgFileRecord& conf = (MsgFileRecord&) message;
315  qDebug() << "SDRPlayInput::handleMessage: MsgFileRecord: " << conf.getStartStop();
316 
317  if (conf.getStartStop())
318  {
319  if (m_settings.m_fileRecordName.size() != 0) {
321  } else {
323  }
324 
326  }
327  else
328  {
330  }
331 
332  return true;
333  }
334  else if (MsgStartStop::match(message))
335  {
336  MsgStartStop& cmd = (MsgStartStop&) message;
337  qDebug() << "SDRPlayInput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
338 
339  if (cmd.getStartStop())
340  {
342  {
344  }
345  }
346  else
347  {
349  }
350 
352  webapiReverseSendStartStop(cmd.getStartStop());
353  }
354 
355  return true;
356  }
357  else
358  {
359  return false;
360  }
361 }
bool startDeviceEngine()
Start the device engine corresponding to the stream type.
Definition: deviceapi.cpp:253
void stopDeviceEngine()
Stop the device engine corresponding to the stream type.
Definition: deviceapi.cpp:266
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
virtual void stop()
bool initDeviceEngine()
Init the device engine corresponding to the stream type.
Definition: deviceapi.cpp:240
bool applySettings(const SDRPlaySettings &settings, bool forwardChange, bool force)
void webapiReverseSendStartStop(bool start)
FileRecord * m_fileSink
File sink to record device I/Q output.
Definition: sdrplayinput.h:193
void genUniqueFileName(uint deviceUID, int istream=-1)
Definition: filerecord.cpp:67
QString m_fileRecordName
virtual bool start()
void stopRecording()
Definition: filerecord.cpp:117
DeviceAPI * m_deviceAPI
Definition: sdrplayinput.h:184
static bool match(const Message *message)
Definition: message.cpp:45
SDRPlaySettings m_settings
Definition: sdrplayinput.h:187
uint32_t m_devSampleRateIndex
mirisdr_dev_t * m_dev
Definition: sdrplayinput.h:188
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

void SDRPlayInput::init ( )
virtual

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

Implements DeviceSampleSource.

Definition at line 208 of file sdrplayinput.cpp.

References applySettings(), and m_settings.

Referenced by SDRPlayInput::MsgStartStop::MsgStartStop().

209 {
210  applySettings(m_settings, true, true);
211 }
bool applySettings(const SDRPlaySettings &settings, bool forwardChange, bool force)
SDRPlaySettings m_settings
Definition: sdrplayinput.h:187
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ networkManagerFinished

void SDRPlayInput::networkManagerFinished ( QNetworkReply *  reply)
privateslot

Definition at line 956 of file sdrplayinput.cpp.

References SDRPlaySampleRates::m_rates.

Referenced by ~SDRPlayInput().

957 {
958  QNetworkReply::NetworkError replyError = reply->error();
959 
960  if (replyError)
961  {
962  qWarning() << "SDRPlayInput::networkManagerFinished:"
963  << " error(" << (int) replyError
964  << "): " << replyError
965  << ": " << reply->errorString();
966  return;
967  }
968 
969  QString answer = reply->readAll();
970  answer.chop(1); // remove last \n
971  qDebug("SDRPlayInput::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
972 }
+ Here is the caller graph for this function:

◆ openDevice()

bool SDRPlayInput::openDevice ( )
private

Definition at line 83 of file sdrplayinput.cpp.

References closeDevice(), DeviceAPI::getSamplingDeviceSequence(), m_dev, m_deviceAPI, m_deviceDescription, m_devNumber, DeviceSampleSource::m_sampleFifo, m_variant, SDRPlayRSP1, SDRPlayRSP1A, SDRPlayRSP2, SampleSinkFifo::setSize(), and stop().

84 {
86 
87  if (m_dev != 0)
88  {
89  closeDevice();
90  }
91 
92  int res;
93  //int numberOfGains;
94 
95  if (!m_sampleFifo.setSize(96000 * 4))
96  {
97  qCritical("SDRPlayInput::openDevice: could not allocate SampleFifo");
98  return false;
99  }
100 
101  if ((res = mirisdr_open(&m_dev, MIRISDR_HW_SDRPLAY, m_devNumber)) < 0)
102  {
103  qCritical("SDRPlayInput::openDevice: could not open SDRPlay #%d: %s", m_devNumber, strerror(errno));
104  return false;
105  }
106 
107  char vendor[256];
108  char product[256];
109  char serial[256];
110 
111  vendor[0] = '\0';
112  product[0] = '\0';
113  serial[0] = '\0';
114 
115  if ((res = mirisdr_get_device_usb_strings(m_devNumber, vendor, product, serial)) < 0)
116  {
117  qCritical("SDRPlayInput::openDevice: error accessing USB device");
118  stop();
119  return false;
120  }
121 
122  qWarning("SDRPlayInput::openDevice: %s %s, SN: %s", vendor, product, serial);
123  m_deviceDescription = QString("%1 (SN %2)").arg(product).arg(serial);
124 
125  if (QString(product) == "RSP1A") {
127  } else if (QString(product) == "RSP2") {
129  } else {
131  }
132 
133  qDebug("SDRPlayInput::openDevice: m_variant: %d", (int) m_variant);
134 
135  return true;
136 }
virtual void stop()
QString m_deviceDescription
Definition: sdrplayinput.h:190
SampleSinkFifo m_sampleFifo
bool setSize(int size)
SDRPlayVariant m_variant
Definition: sdrplayinput.h:186
DeviceAPI * m_deviceAPI
Definition: sdrplayinput.h:184
void closeDevice()
uint32_t getSamplingDeviceSequence() const
Definition: deviceapi.h:123
mirisdr_dev_t * m_dev
Definition: sdrplayinput.h:188
+ Here is the call graph for this function:

◆ serialize()

QByteArray SDRPlayInput::serialize ( ) const
virtual

Implements DeviceSampleSource.

Definition at line 227 of file sdrplayinput.cpp.

References m_settings, and SDRPlaySettings::serialize().

Referenced by SDRPlayInput::MsgStartStop::MsgStartStop().

228 {
229  return m_settings.serialize();
230 }
QByteArray serialize() const
SDRPlaySettings m_settings
Definition: sdrplayinput.h:187
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCenterFrequency()

void SDRPlayInput::setCenterFrequency ( qint64  centerFrequency)
virtual

Implements DeviceSampleSource.

Definition at line 270 of file sdrplayinput.cpp.

References SDRPlayInput::MsgConfigureSDRPlay::create(), SDRPlaySettings::m_centerFrequency, DeviceSampleSource::m_guiMessageQueue, DeviceSampleSource::m_inputMessageQueue, m_settings, and MessageQueue::push().

Referenced by setSampleRate().

271 {
272  SDRPlaySettings settings = m_settings;
273  settings.m_centerFrequency = centerFrequency;
274 
275  MsgConfigureSDRPlay* message = MsgConfigureSDRPlay::create(settings, false);
276  m_inputMessageQueue.push(message);
277 
278  if (m_guiMessageQueue)
279  {
280  MsgConfigureSDRPlay* messageToGUI = MsgConfigureSDRPlay::create(settings, false);
281  m_guiMessageQueue->push(messageToGUI);
282  }
283 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
MessageQueue m_inputMessageQueue
Input queue to the source.
static MsgConfigureSDRPlay * create(const SDRPlaySettings &settings, bool force)
Definition: sdrplayinput.h:55
uint64_t m_centerFrequency
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
SDRPlaySettings m_settings
Definition: sdrplayinput.h:187
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDeviceCenterFrequency()

bool SDRPlayInput::setDeviceCenterFrequency ( quint64  freq)
private

Definition at line 622 of file sdrplayinput.cpp.

References m_dev, SDRPlaySettings::m_LOppmTenths, and m_settings.

Referenced by applySettings().

623 {
624  qint64 df = ((qint64)freq_hz * m_settings.m_LOppmTenths) / 10000000LL;
625  freq_hz += df;
626 
627  int r = mirisdr_set_center_freq(m_dev, static_cast<uint32_t>(freq_hz));
628 
629  if (r != 0)
630  {
631  qWarning("SDRPlayInput::setDeviceCenterFrequency: could not frequency to %llu Hz", freq_hz);
632  return false;
633  }
634  else
635  {
636  qWarning("SDRPlayInput::setDeviceCenterFrequency: frequency set to %llu Hz", freq_hz);
637  return true;
638  }
639 }
SDRPlaySettings m_settings
Definition: sdrplayinput.h:187
mirisdr_dev_t * m_dev
Definition: sdrplayinput.h:188
+ Here is the caller graph for this function:

◆ setMessageQueueToGUI()

virtual void SDRPlayInput::setMessageQueueToGUI ( MessageQueue queue)
inlinevirtual

Implements DeviceSampleSource.

Definition at line 149 of file sdrplayinput.h.

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

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

◆ setSampleRate()

virtual void SDRPlayInput::setSampleRate ( int  sampleRate)
inlinevirtual

For when the source sample rate is set externally.

Implements DeviceSampleSource.

Definition at line 152 of file sdrplayinput.h.

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

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

◆ start()

bool SDRPlayInput::start ( )
virtual

Implements DeviceSampleSource.

Definition at line 138 of file sdrplayinput.cpp.

References applySettings(), SDRPlaySampleRates::getRate(), m_dev, SDRPlaySettings::m_devSampleRateIndex, SDRPlaySettings::m_fcPos, SDRPlaySettings::m_log2Decim, m_running, DeviceSampleSource::m_sampleFifo, m_sdrPlayThread, m_settings, SDRPlayThread::setFcPos(), SDRPlayThread::setLog2Decimation(), SDRPlayThread::startWork(), and stop().

Referenced by handleMessage(), and SDRPlayInput::MsgStartStop::MsgStartStop().

139 {
140 // QMutexLocker mutexLocker(&m_mutex);
141  int res;
142 
143  if (!m_dev) {
144  return false;
145  }
146 
147  if (m_running) stop();
148 
149  char s12FormatString[] = "336_S16";
150 
151  if ((res = mirisdr_set_sample_format(m_dev, s12FormatString))) // sample format S12
152  {
153  qCritical("SDRPlayInput::start: could not set sample format: rc: %d", res);
154  stop();
155  return false;
156  }
157 
159 
160  if ((res = mirisdr_set_sample_rate(m_dev, sampleRate)))
161  {
162  qCritical("SDRPlayInput::start: could not set sample rate to %d: rc: %d", sampleRate, res);
163  stop();
164  return false;
165  }
166 
167  char bulkFormatString[] = "BULK";
168 
169  if ((res = mirisdr_set_transfer(m_dev, bulkFormatString)) < 0)
170  {
171  qCritical("SDRPlayInput::start: could not set USB Bulk mode: rc: %d", res);
172  stop();
173  return false;
174  }
175 
176  if ((res = mirisdr_reset_buffer(m_dev)) < 0)
177  {
178  qCritical("SDRPlayInput::start: could not reset USB EP buffers: %s", strerror(errno));
179  stop();
180  return false;
181  }
182 
186 
188 
189 // mutexLocker.unlock();
190 
191  applySettings(m_settings, true, true);
192  m_running = true;
193 
194  return true;
195 }
SDRPlayThread * m_sdrPlayThread
Definition: sdrplayinput.h:189
virtual void stop()
SampleSinkFifo m_sampleFifo
bool applySettings(const SDRPlaySettings &settings, bool forwardChange, bool force)
void setLog2Decimation(unsigned int log2_decim)
uint32_t m_log2Decim
static unsigned int getRate(unsigned int rate_index)
SDRPlaySettings m_settings
Definition: sdrplayinput.h:187
uint32_t m_devSampleRateIndex
void setFcPos(int fcPos)
mirisdr_dev_t * m_dev
Definition: sdrplayinput.h:188
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stop()

void SDRPlayInput::stop ( )
virtual

Implements DeviceSampleSource.

Definition at line 213 of file sdrplayinput.cpp.

References m_running, m_sdrPlayThread, and SDRPlayThread::stopWork().

Referenced by handleMessage(), SDRPlayInput::MsgStartStop::MsgStartStop(), openDevice(), start(), and ~SDRPlayInput().

214 {
215 // QMutexLocker mutexLocker(&m_mutex);
216 
217  if(m_sdrPlayThread != 0)
218  {
220  delete m_sdrPlayThread;
221  m_sdrPlayThread = 0;
222  }
223 
224  m_running = false;
225 }
SDRPlayThread * m_sdrPlayThread
Definition: sdrplayinput.h:189
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiFormatDeviceReport()

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

Definition at line 813 of file sdrplayinput.cpp.

References SDRPlayBands::getBandHigh(), SDRPlayBands::getBandLow(), SDRPlayBands::getBandName(), SDRPlayBandwidths::getBandwidth(), SWGSDRangel::SWGSDRPlayReport::getBandwidths(), SWGSDRangel::SWGSDRPlayReport::getFrequencyBands(), SDRPlayIF::getIF(), SWGSDRangel::SWGSDRPlayReport::getIntermediateFrequencies(), SDRPlayBands::getNbBands(), SDRPlayBandwidths::getNbBandwidths(), SDRPlayIF::getNbIFs(), SDRPlaySampleRates::getNbRates(), SDRPlaySampleRates::getRate(), SWGSDRangel::SWGSDRPlayReport::getSampleRates(), SWGSDRangel::SWGDeviceReport::getSdrPlayReport(), i, SWGSDRangel::SWGSDRPlayReport::setBandwidths(), SWGSDRangel::SWGSDRPlayReport::setFrequencyBands(), SWGSDRangel::SWGSDRPlayReport::setIntermediateFrequencies(), and SWGSDRangel::SWGSDRPlayReport::setSampleRates().

Referenced by webapiReportGet().

814 {
815  response.getSdrPlayReport()->setSampleRates(new QList<SWGSDRangel::SWGSampleRate*>);
816 
817  for (unsigned int i = 0; i < SDRPlaySampleRates::getNbRates(); i++)
818  {
820  response.getSdrPlayReport()->getSampleRates()->back()->setRate(SDRPlaySampleRates::getRate(i));
821  }
822 
823  response.getSdrPlayReport()->setIntermediateFrequencies(new QList<SWGSDRangel::SWGFrequency*>);
824 
825  for (unsigned int i = 0; i < SDRPlayIF::getNbIFs(); i++)
826  {
828  response.getSdrPlayReport()->getIntermediateFrequencies()->back()->setFrequency(SDRPlayIF::getIF(i));
829  }
830 
831  response.getSdrPlayReport()->setBandwidths(new QList<SWGSDRangel::SWGBandwidth*>);
832 
833  for (unsigned int i = 0; i < SDRPlayBandwidths::getNbBandwidths(); i++)
834  {
835  response.getSdrPlayReport()->getBandwidths()->append(new SWGSDRangel::SWGBandwidth);
836  response.getSdrPlayReport()->getBandwidths()->back()->setBandwidth(SDRPlayBandwidths::getBandwidth(i));
837  }
838 
839  response.getSdrPlayReport()->setFrequencyBands(new QList<SWGSDRangel::SWGFrequencyBand*>);
840 
841  for (unsigned int i = 0; i < SDRPlayBands::getNbBands(); i++)
842  {
844  response.getSdrPlayReport()->getFrequencyBands()->back()->setName(new QString(SDRPlayBands::getBandName(i)));
845  response.getSdrPlayReport()->getFrequencyBands()->back()->setLowerBound(SDRPlayBands::getBandLow(i));
846  response.getSdrPlayReport()->getFrequencyBands()->back()->setHigherBound(SDRPlayBands::getBandHigh(i));
847  }
848 }
static unsigned int getNbRates()
void setIntermediateFrequencies(QList< SWGFrequency *> *intermediate_frequencies)
void setBandwidths(QList< SWGBandwidth *> *bandwidths)
QList< SWGSampleRate * > * getSampleRates()
void setFrequencyBands(QList< SWGFrequencyBand *> *frequency_bands)
static unsigned int getNbBands()
static unsigned int getNbBandwidths()
static unsigned int getNbIFs()
SWGSDRPlayReport * getSdrPlayReport()
int32_t i
Definition: decimators.h:244
static unsigned int getBandLow(unsigned int band_index)
static unsigned int getBandwidth(unsigned int bandwidth_index)
QList< SWGBandwidth * > * getBandwidths()
QList< SWGFrequency * > * getIntermediateFrequencies()
QList< SWGFrequencyBand * > * getFrequencyBands()
static unsigned int getRate(unsigned int rate_index)
static unsigned int getIF(unsigned int if_index)
static unsigned int getBandHigh(unsigned int band_index)
void setSampleRates(QList< SWGSampleRate *> *sample_rates)
static QString getBandName(unsigned int band_index)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiFormatDeviceSettings()

void SDRPlayInput::webapiFormatDeviceSettings ( SWGSDRangel::SWGDeviceSettings response,
const SDRPlaySettings settings 
)
private

Definition at line 766 of file sdrplayinput.cpp.

References SWGSDRangel::SWGSDRPlaySettings::getFileRecordName(), SWGSDRangel::SWGSDRPlaySettings::getReverseApiAddress(), SWGSDRangel::SWGDeviceSettings::getSdrPlaySettings(), SDRPlaySettings::m_bandwidthIndex, SDRPlaySettings::m_basebandGain, SDRPlaySettings::m_centerFrequency, SDRPlaySettings::m_dcBlock, SDRPlaySettings::m_devSampleRateIndex, SDRPlaySettings::m_fcPos, SDRPlaySettings::m_fileRecordName, SDRPlaySettings::m_frequencyBandIndex, SDRPlaySettings::m_ifFrequencyIndex, SDRPlaySettings::m_iqCorrection, SDRPlaySettings::m_lnaOn, SDRPlaySettings::m_log2Decim, SDRPlaySettings::m_LOppmTenths, SDRPlaySettings::m_mixerAmpOn, SDRPlaySettings::m_reverseAPIAddress, SDRPlaySettings::m_reverseAPIDeviceIndex, SDRPlaySettings::m_reverseAPIPort, SDRPlaySettings::m_tunerGain, SDRPlaySettings::m_tunerGainMode, SDRPlaySettings::m_useReverseAPI, SWGSDRangel::SWGSDRPlaySettings::setBandwidthIndex(), SWGSDRangel::SWGSDRPlaySettings::setBasebandGain(), SWGSDRangel::SWGSDRPlaySettings::setCenterFrequency(), SWGSDRangel::SWGSDRPlaySettings::setDcBlock(), SWGSDRangel::SWGSDRPlaySettings::setDevSampleRateIndex(), SWGSDRangel::SWGSDRPlaySettings::setFcPos(), SWGSDRangel::SWGSDRPlaySettings::setFileRecordName(), SWGSDRangel::SWGSDRPlaySettings::setFrequencyBandIndex(), SWGSDRangel::SWGSDRPlaySettings::setIfFrequencyIndex(), SWGSDRangel::SWGSDRPlaySettings::setIqCorrection(), SWGSDRangel::SWGSDRPlaySettings::setLnaOn(), SWGSDRangel::SWGSDRPlaySettings::setLog2Decim(), SWGSDRangel::SWGSDRPlaySettings::setLOppmTenths(), SWGSDRangel::SWGSDRPlaySettings::setMixerAmpOn(), SWGSDRangel::SWGSDRPlaySettings::setReverseApiAddress(), SWGSDRangel::SWGSDRPlaySettings::setReverseApiDeviceIndex(), SWGSDRangel::SWGSDRPlaySettings::setReverseApiPort(), SWGSDRangel::SWGSDRPlaySettings::setTunerGain(), SWGSDRangel::SWGSDRPlaySettings::setTunerGainMode(), and SWGSDRangel::SWGSDRPlaySettings::setUseReverseApi().

Referenced by webapiSettingsGet(), and webapiSettingsPutPatch().

767 {
769  response.getSdrPlaySettings()->setTunerGain(settings.m_tunerGain);
770  response.getSdrPlaySettings()->setLOppmTenths(settings.m_LOppmTenths);
775  response.getSdrPlaySettings()->setLog2Decim(settings.m_log2Decim);
776  response.getSdrPlaySettings()->setFcPos((int) settings.m_fcPos);
777  response.getSdrPlaySettings()->setDcBlock(settings.m_dcBlock ? 1 : 0);
778  response.getSdrPlaySettings()->setIqCorrection(settings.m_iqCorrection ? 1 : 0);
779  response.getSdrPlaySettings()->setTunerGainMode((int) settings.m_tunerGainMode);
780  response.getSdrPlaySettings()->setLnaOn(settings.m_lnaOn ? 1 : 0);
781  response.getSdrPlaySettings()->setMixerAmpOn(settings.m_mixerAmpOn ? 1 : 0);
782  response.getSdrPlaySettings()->setBasebandGain(settings.m_basebandGain);
783 
784  if (response.getSdrPlaySettings()->getFileRecordName()) {
785  *response.getSdrPlaySettings()->getFileRecordName() = settings.m_fileRecordName;
786  } else {
787  response.getSdrPlaySettings()->setFileRecordName(new QString(settings.m_fileRecordName));
788  }
789 
790  response.getSdrPlaySettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
791 
792  if (response.getSdrPlaySettings()->getReverseApiAddress()) {
794  } else {
795  response.getSdrPlaySettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
796  }
797 
800 }
uint32_t m_ifFrequencyIndex
void setFileRecordName(QString *file_record_name)
uint16_t m_reverseAPIPort
void setReverseApiPort(qint32 reverse_api_port)
void setIqCorrection(qint32 iq_correction)
void setTunerGain(qint32 tuner_gain)
SWGSDRPlaySettings * getSdrPlaySettings()
void setBasebandGain(qint32 baseband_gain)
void setIfFrequencyIndex(qint32 if_frequency_index)
void setUseReverseApi(qint32 use_reverse_api)
void setTunerGainMode(qint32 tuner_gain_mode)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
QString m_reverseAPIAddress
QString m_fileRecordName
void setLog2Decim(qint32 log2_decim)
void setFrequencyBandIndex(qint32 frequency_band_index)
uint64_t m_centerFrequency
void setCenterFrequency(qint32 center_frequency)
uint32_t m_frequencyBandIndex
void setBandwidthIndex(qint32 bandwidth_index)
uint32_t m_log2Decim
uint32_t m_bandwidthIndex
void setLOppmTenths(qint32 l_oppm_tenths)
void setDevSampleRateIndex(qint32 dev_sample_rate_index)
uint16_t m_reverseAPIDeviceIndex
uint32_t m_devSampleRateIndex
void setMixerAmpOn(qint32 mixer_amp_on)
void setReverseApiAddress(QString *reverse_api_address)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiReportGet()

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

Reimplemented from DeviceSampleSource.

Definition at line 802 of file sdrplayinput.cpp.

References SWGSDRangel::SWGDeviceReport::getSdrPlayReport(), SWGSDRangel::SWGSDRPlayReport::init(), SWGSDRangel::SWGDeviceReport::setSdrPlayReport(), and webapiFormatDeviceReport().

Referenced by setSampleRate().

805 {
806  (void) errorMessage;
808  response.getSdrPlayReport()->init();
809  webapiFormatDeviceReport(response);
810  return 200;
811 }
void setSdrPlayReport(SWGSDRPlayReport *sdr_play_report)
SWGSDRPlayReport * getSdrPlayReport()
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport &response)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiReverseSendSettings()

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

Definition at line 850 of file sdrplayinput.cpp.

References SWGSDRangel::SWGDeviceSettings::asJson(), DeviceAPI::getDeviceSetIndex(), SWGSDRangel::SWGDeviceSettings::getSdrPlaySettings(), SDRPlaySettings::m_bandwidthIndex, SDRPlaySettings::m_basebandGain, SDRPlaySettings::m_centerFrequency, SDRPlaySettings::m_dcBlock, m_deviceAPI, SDRPlaySettings::m_devSampleRateIndex, SDRPlaySettings::m_fcPos, SDRPlaySettings::m_fileRecordName, SDRPlaySettings::m_frequencyBandIndex, SDRPlaySettings::m_ifFrequencyIndex, SDRPlaySettings::m_iqCorrection, SDRPlaySettings::m_lnaOn, SDRPlaySettings::m_log2Decim, SDRPlaySettings::m_LOppmTenths, SDRPlaySettings::m_mixerAmpOn, m_networkManager, m_networkRequest, SDRPlaySettings::m_reverseAPIAddress, SDRPlaySettings::m_reverseAPIDeviceIndex, SDRPlaySettings::m_reverseAPIPort, SDRPlaySettings::m_tunerGain, SDRPlaySettings::m_tunerGainMode, SWGSDRangel::SWGSDRPlaySettings::setBandwidthIndex(), SWGSDRangel::SWGSDRPlaySettings::setBasebandGain(), SWGSDRangel::SWGSDRPlaySettings::setCenterFrequency(), SWGSDRangel::SWGSDRPlaySettings::setDcBlock(), SWGSDRangel::SWGDeviceSettings::setDeviceHwType(), SWGSDRangel::SWGSDRPlaySettings::setDevSampleRateIndex(), SWGSDRangel::SWGDeviceSettings::setDirection(), SWGSDRangel::SWGSDRPlaySettings::setFcPos(), SWGSDRangel::SWGSDRPlaySettings::setFileRecordName(), SWGSDRangel::SWGSDRPlaySettings::setFrequencyBandIndex(), SWGSDRangel::SWGSDRPlaySettings::setIfFrequencyIndex(), SWGSDRangel::SWGSDRPlaySettings::setIqCorrection(), SWGSDRangel::SWGSDRPlaySettings::setLnaOn(), SWGSDRangel::SWGSDRPlaySettings::setLog2Decim(), SWGSDRangel::SWGSDRPlaySettings::setLOppmTenths(), SWGSDRangel::SWGSDRPlaySettings::setMixerAmpOn(), SWGSDRangel::SWGDeviceSettings::setOriginatorIndex(), SWGSDRangel::SWGDeviceSettings::setSdrPlaySettings(), SWGSDRangel::SWGSDRPlaySettings::setTunerGain(), and SWGSDRangel::SWGSDRPlaySettings::setTunerGainMode().

Referenced by applySettings().

851 {
853  swgDeviceSettings->setDirection(0); // single Rx
854  swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
855  swgDeviceSettings->setDeviceHwType(new QString("SDRplay1"));
856  swgDeviceSettings->setSdrPlaySettings(new SWGSDRangel::SWGSDRPlaySettings());
857  SWGSDRangel::SWGSDRPlaySettings *swgSDRPlaySettings = swgDeviceSettings->getSdrPlaySettings();
858 
859  // transfer data that has been modified. When force is on transfer all data except reverse API data
860 
861  if (deviceSettingsKeys.contains("centerFrequency") || force) {
862  swgSDRPlaySettings->setCenterFrequency(settings.m_centerFrequency);
863  }
864  if (deviceSettingsKeys.contains("tunerGain") || force) {
865  swgSDRPlaySettings->setTunerGain(settings.m_tunerGain);
866  }
867  if (deviceSettingsKeys.contains("LOppmTenths") || force) {
868  swgSDRPlaySettings->setLOppmTenths(settings.m_LOppmTenths);
869  }
870  if (deviceSettingsKeys.contains("frequencyBandIndex") || force) {
871  swgSDRPlaySettings->setFrequencyBandIndex(settings.m_frequencyBandIndex);
872  }
873  if (deviceSettingsKeys.contains("ifFrequencyIndex") || force) {
874  swgSDRPlaySettings->setIfFrequencyIndex(settings.m_ifFrequencyIndex);
875  }
876  if (deviceSettingsKeys.contains("bandwidthIndex") || force) {
877  swgSDRPlaySettings->setBandwidthIndex(settings.m_bandwidthIndex);
878  }
879  if (deviceSettingsKeys.contains("devSampleRateIndex") || force) {
880  swgSDRPlaySettings->setDevSampleRateIndex(settings.m_devSampleRateIndex);
881  }
882  if (deviceSettingsKeys.contains("log2Decim") || force) {
883  swgSDRPlaySettings->setLog2Decim(settings.m_log2Decim);
884  }
885  if (deviceSettingsKeys.contains("fcPos") || force) {
886  swgSDRPlaySettings->setFcPos((int) settings.m_fcPos);
887  }
888  if (deviceSettingsKeys.contains("dcBlock") || force) {
889  swgSDRPlaySettings->setDcBlock(settings.m_dcBlock ? 1 : 0);
890  }
891  if (deviceSettingsKeys.contains("iqCorrection") || force) {
892  swgSDRPlaySettings->setIqCorrection(settings.m_iqCorrection ? 1 : 0);
893  }
894  if (deviceSettingsKeys.contains("tunerGainMode") || force) {
895  swgSDRPlaySettings->setTunerGainMode(settings.m_tunerGainMode ? 1 : 0);
896  }
897  if (deviceSettingsKeys.contains("lnaOn") || force) {
898  swgSDRPlaySettings->setLnaOn(settings.m_lnaOn ? 1 : 0);
899  }
900  if (deviceSettingsKeys.contains("mixerAmpOn") || force) {
901  swgSDRPlaySettings->setMixerAmpOn(settings.m_mixerAmpOn ? 1 : 0);
902  }
903  if (deviceSettingsKeys.contains("basebandGain") || force) {
904  swgSDRPlaySettings->setBasebandGain(settings.m_basebandGain);
905  }
906  if (deviceSettingsKeys.contains("fileRecordName") || force) {
907  swgSDRPlaySettings->setFileRecordName(new QString(settings.m_fileRecordName));
908  }
909 
910  QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings")
911  .arg(settings.m_reverseAPIAddress)
912  .arg(settings.m_reverseAPIPort)
913  .arg(settings.m_reverseAPIDeviceIndex);
914  m_networkRequest.setUrl(QUrl(deviceSettingsURL));
915  m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
916 
917  QBuffer *buffer=new QBuffer();
918  buffer->open((QBuffer::ReadWrite));
919  buffer->write(swgDeviceSettings->asJson().toUtf8());
920  buffer->seek(0);
921 
922  // Always use PATCH to avoid passing reverse API settings
923  m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
924 
925  delete swgDeviceSettings;
926 }
uint32_t m_ifFrequencyIndex
void setFileRecordName(QString *file_record_name)
uint16_t m_reverseAPIPort
void setIqCorrection(qint32 iq_correction)
void setTunerGain(qint32 tuner_gain)
SWGSDRPlaySettings * getSdrPlaySettings()
virtual QString asJson() override
void setBasebandGain(qint32 baseband_gain)
void setSdrPlaySettings(SWGSDRPlaySettings *sdr_play_settings)
void setIfFrequencyIndex(qint32 if_frequency_index)
void setOriginatorIndex(qint32 originator_index)
QNetworkRequest m_networkRequest
Definition: sdrplayinput.h:195
void setTunerGainMode(qint32 tuner_gain_mode)
int getDeviceSetIndex() const
Definition: deviceapi.h:131
QString m_reverseAPIAddress
QString m_fileRecordName
void setLog2Decim(qint32 log2_decim)
void setFrequencyBandIndex(qint32 frequency_band_index)
DeviceAPI * m_deviceAPI
Definition: sdrplayinput.h:184
uint64_t m_centerFrequency
void setCenterFrequency(qint32 center_frequency)
QNetworkAccessManager * m_networkManager
Definition: sdrplayinput.h:194
uint32_t m_frequencyBandIndex
void setBandwidthIndex(qint32 bandwidth_index)
uint32_t m_log2Decim
uint32_t m_bandwidthIndex
void setLOppmTenths(qint32 l_oppm_tenths)
void setDevSampleRateIndex(qint32 dev_sample_rate_index)
uint16_t m_reverseAPIDeviceIndex
uint32_t m_devSampleRateIndex
void setDirection(qint32 direction)
void setMixerAmpOn(qint32 mixer_amp_on)
void setDeviceHwType(QString *device_hw_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiReverseSendStartStop()

void SDRPlayInput::webapiReverseSendStartStop ( bool  start)
private

Definition at line 928 of file sdrplayinput.cpp.

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

Referenced by handleMessage().

929 {
931  swgDeviceSettings->setDirection(0); // single Rx
932  swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
933  swgDeviceSettings->setDeviceHwType(new QString("SDRplay1"));
934 
935  QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/run")
939  m_networkRequest.setUrl(QUrl(deviceSettingsURL));
940  m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
941 
942  QBuffer *buffer=new QBuffer();
943  buffer->open((QBuffer::ReadWrite));
944  buffer->write(swgDeviceSettings->asJson().toUtf8());
945  buffer->seek(0);
946 
947  if (start) {
948  m_networkManager->sendCustomRequest(m_networkRequest, "POST", buffer);
949  } else {
950  m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
951  }
952 
953  delete swgDeviceSettings;
954 }
uint16_t m_reverseAPIPort
virtual QString asJson() override
void setOriginatorIndex(qint32 originator_index)
QNetworkRequest m_networkRequest
Definition: sdrplayinput.h:195
int getDeviceSetIndex() const
Definition: deviceapi.h:131
QString m_reverseAPIAddress
virtual bool start()
DeviceAPI * m_deviceAPI
Definition: sdrplayinput.h:184
QNetworkAccessManager * m_networkManager
Definition: sdrplayinput.h:194
SDRPlaySettings m_settings
Definition: sdrplayinput.h:187
uint16_t m_reverseAPIDeviceIndex
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 SDRPlayInput::webapiRun ( bool  run,
SWGSDRangel::SWGDeviceState response,
QString &  errorMessage 
)
virtual

Reimplemented from DeviceSampleSource.

Definition at line 650 of file sdrplayinput.cpp.

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

Referenced by setSampleRate().

654 {
655  (void) errorMessage;
657  MsgStartStop *message = MsgStartStop::create(run);
658  m_inputMessageQueue.push(message);
659 
660  if (m_guiMessageQueue) // forward to GUI if any
661  {
662  MsgStartStop *msgToGUI = MsgStartStop::create(run);
663  m_guiMessageQueue->push(msgToGUI);
664  }
665 
666  return 200;
667 }
void push(Message *message, bool emitSignal=true)
Push message onto queue.
static MsgStartStop * create(bool startStop)
Definition: sdrplayinput.h:125
MessageQueue m_inputMessageQueue
Input queue to the source.
DeviceAPI * m_deviceAPI
Definition: sdrplayinput.h:184
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
void getDeviceEngineStateStr(QString &state)
Definition: deviceapi.cpp:389
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiRunGet()

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

Reimplemented from DeviceSampleSource.

Definition at line 641 of file sdrplayinput.cpp.

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

Referenced by setSampleRate().

644 {
645  (void) errorMessage;
647  return 200;
648 }
DeviceAPI * m_deviceAPI
Definition: sdrplayinput.h:184
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 SDRPlayInput::webapiSettingsGet ( SWGSDRangel::SWGDeviceSettings response,
QString &  errorMessage 
)
virtual

Reimplemented from DeviceSampleSource.

Definition at line 669 of file sdrplayinput.cpp.

References SWGSDRangel::SWGDeviceSettings::getSdrPlaySettings(), SWGSDRangel::SWGSDRPlaySettings::init(), m_settings, SWGSDRangel::SWGDeviceSettings::setSdrPlaySettings(), and webapiFormatDeviceSettings().

Referenced by setSampleRate().

672 {
673  (void) errorMessage;
675  response.getSdrPlaySettings()->init();
677  return 200;
678 }
SWGSDRPlaySettings * getSdrPlaySettings()
void setSdrPlaySettings(SWGSDRPlaySettings *sdr_play_settings)
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings &response, const SDRPlaySettings &settings)
SDRPlaySettings m_settings
Definition: sdrplayinput.h:187
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ webapiSettingsPutPatch()

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

Reimplemented from DeviceSampleSource.

Definition at line 680 of file sdrplayinput.cpp.

References SDRPlayInput::MsgConfigureSDRPlay::create(), SWGSDRangel::SWGSDRPlaySettings::getBandwidthIndex(), SWGSDRangel::SWGSDRPlaySettings::getBasebandGain(), SWGSDRangel::SWGSDRPlaySettings::getCenterFrequency(), SWGSDRangel::SWGSDRPlaySettings::getDcBlock(), SWGSDRangel::SWGSDRPlaySettings::getDevSampleRateIndex(), SWGSDRangel::SWGSDRPlaySettings::getFcPos(), SWGSDRangel::SWGSDRPlaySettings::getFileRecordName(), SWGSDRangel::SWGSDRPlaySettings::getFrequencyBandIndex(), SWGSDRangel::SWGSDRPlaySettings::getIfFrequencyIndex(), SWGSDRangel::SWGSDRPlaySettings::getIqCorrection(), SWGSDRangel::SWGSDRPlaySettings::getLnaOn(), SWGSDRangel::SWGSDRPlaySettings::getLog2Decim(), SWGSDRangel::SWGSDRPlaySettings::getLOppmTenths(), SWGSDRangel::SWGSDRPlaySettings::getMixerAmpOn(), SWGSDRangel::SWGSDRPlaySettings::getReverseApiAddress(), SWGSDRangel::SWGSDRPlaySettings::getReverseApiDeviceIndex(), SWGSDRangel::SWGSDRPlaySettings::getReverseApiPort(), SWGSDRangel::SWGDeviceSettings::getSdrPlaySettings(), SWGSDRangel::SWGSDRPlaySettings::getTunerGain(), SWGSDRangel::SWGSDRPlaySettings::getTunerGainMode(), SWGSDRangel::SWGSDRPlaySettings::getUseReverseApi(), SDRPlaySettings::m_bandwidthIndex, SDRPlaySettings::m_basebandGain, SDRPlaySettings::m_centerFrequency, SDRPlaySettings::m_dcBlock, SDRPlaySettings::m_devSampleRateIndex, SDRPlaySettings::m_fcPos, SDRPlaySettings::m_fileRecordName, SDRPlaySettings::m_frequencyBandIndex, DeviceSampleSource::m_guiMessageQueue, SDRPlaySettings::m_ifFrequencyIndex, DeviceSampleSource::m_inputMessageQueue, SDRPlaySettings::m_iqCorrection, SDRPlaySettings::m_lnaOn, SDRPlaySettings::m_log2Decim, SDRPlaySettings::m_LOppmTenths, SDRPlaySettings::m_mixerAmpOn, SDRPlaySettings::m_reverseAPIAddress, SDRPlaySettings::m_reverseAPIDeviceIndex, SDRPlaySettings::m_reverseAPIPort, m_settings, SDRPlaySettings::m_tunerGain, SDRPlaySettings::m_tunerGainMode, SDRPlaySettings::m_useReverseAPI, MessageQueue::push(), and webapiFormatDeviceSettings().

Referenced by setSampleRate().

685 {
686  (void) errorMessage;
687  SDRPlaySettings settings = m_settings;
688 
689  if (deviceSettingsKeys.contains("centerFrequency")) {
691  }
692  if (deviceSettingsKeys.contains("tunerGain")) {
693  settings.m_tunerGain = response.getSdrPlaySettings()->getTunerGain();
694  }
695  if (deviceSettingsKeys.contains("LOppmTenths")) {
696  settings.m_LOppmTenths = response.getSdrPlaySettings()->getLOppmTenths();
697  }
698  if (deviceSettingsKeys.contains("frequencyBandIndex")) {
700  }
701  if (deviceSettingsKeys.contains("ifFrequencyIndex")) {
703  }
704  if (deviceSettingsKeys.contains("bandwidthIndex")) {
705  settings.m_bandwidthIndex = response.getSdrPlaySettings()->getBandwidthIndex();
706  }
707  if (deviceSettingsKeys.contains("devSampleRateIndex")) {
709  }
710  if (deviceSettingsKeys.contains("log2Decim")) {
711  settings.m_log2Decim = response.getSdrPlaySettings()->getLog2Decim();
712  }
713  if (deviceSettingsKeys.contains("fcPos"))
714  {
715  int fcPos = response.getSdrPlaySettings()->getFcPos();
716  fcPos = fcPos < 0 ? 0 : fcPos > 2 ? 2 : fcPos;
717  settings.m_fcPos = (SDRPlaySettings::fcPos_t) fcPos;
718  }
719  if (deviceSettingsKeys.contains("dcBlock")) {
720  settings.m_dcBlock = response.getSdrPlaySettings()->getDcBlock() != 0;
721  }
722  if (deviceSettingsKeys.contains("iqCorrection")) {
723  settings.m_iqCorrection = response.getSdrPlaySettings()->getIqCorrection() != 0;
724  }
725  if (deviceSettingsKeys.contains("tunerGainMode")) {
726  settings.m_tunerGainMode = response.getSdrPlaySettings()->getTunerGainMode() != 0;
727  }
728  if (deviceSettingsKeys.contains("lnaOn")) {
729  settings.m_lnaOn = response.getSdrPlaySettings()->getLnaOn() != 0;
730  }
731  if (deviceSettingsKeys.contains("mixerAmpOn")) {
732  settings.m_mixerAmpOn = response.getSdrPlaySettings()->getMixerAmpOn() != 0;
733  }
734  if (deviceSettingsKeys.contains("basebandGain")) {
735  settings.m_basebandGain = response.getSdrPlaySettings()->getBasebandGain();
736  }
737  if (deviceSettingsKeys.contains("fileRecordName")) {
738  settings.m_fileRecordName = *response.getSdrPlaySettings()->getFileRecordName();
739  }
740  if (deviceSettingsKeys.contains("useReverseAPI")) {
741  settings.m_useReverseAPI = response.getSdrPlaySettings()->getUseReverseApi() != 0;
742  }
743  if (deviceSettingsKeys.contains("reverseAPIAddress")) {
745  }
746  if (deviceSettingsKeys.contains("reverseAPIPort")) {
747  settings.m_reverseAPIPort = response.getSdrPlaySettings()->getReverseApiPort();
748  }
749  if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
751  }
752 
753  MsgConfigureSDRPlay *msg = MsgConfigureSDRPlay::create(settings, force);
755 
756  if (m_guiMessageQueue) // forward to GUI if any
757  {
758  MsgConfigureSDRPlay *msgToGUI = MsgConfigureSDRPlay::create(settings, force);
759  m_guiMessageQueue->push(msgToGUI);
760  }
761 
762  webapiFormatDeviceSettings(response, settings);
763  return 200;
764 }
uint32_t m_ifFrequencyIndex
uint16_t m_reverseAPIPort
void push(Message *message, bool emitSignal=true)
Push message onto queue.
SWGSDRPlaySettings * getSdrPlaySettings()
MessageQueue m_inputMessageQueue
Input queue to the source.
QString m_reverseAPIAddress
static MsgConfigureSDRPlay * create(const SDRPlaySettings &settings, bool force)
Definition: sdrplayinput.h:55
QString m_fileRecordName
uint64_t m_centerFrequency
uint32_t m_frequencyBandIndex
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings &response, const SDRPlaySettings &settings)
uint32_t m_log2Decim
uint32_t m_bandwidthIndex
SDRPlaySettings m_settings
Definition: sdrplayinput.h:187
uint16_t m_reverseAPIDeviceIndex
uint32_t m_devSampleRateIndex
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_dev

mirisdr_dev_t* SDRPlayInput::m_dev
private

◆ m_deviceAPI

DeviceAPI* SDRPlayInput::m_deviceAPI
private

◆ m_deviceDescription

QString SDRPlayInput::m_deviceDescription
private

Definition at line 190 of file sdrplayinput.h.

Referenced by closeDevice(), getDeviceDescription(), and openDevice().

◆ m_devNumber

int SDRPlayInput::m_devNumber
private

Definition at line 191 of file sdrplayinput.h.

Referenced by openDevice().

◆ m_fileSink

FileRecord* SDRPlayInput::m_fileSink
private

File sink to record device I/Q output.

Definition at line 193 of file sdrplayinput.h.

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

◆ m_mutex

QMutex SDRPlayInput::m_mutex
private

Definition at line 185 of file sdrplayinput.h.

Referenced by applySettings().

◆ m_networkManager

QNetworkAccessManager* SDRPlayInput::m_networkManager
private

◆ m_networkRequest

QNetworkRequest SDRPlayInput::m_networkRequest
private

Definition at line 195 of file sdrplayinput.h.

Referenced by webapiReverseSendSettings(), and webapiReverseSendStartStop().

◆ m_running

bool SDRPlayInput::m_running
private

Definition at line 192 of file sdrplayinput.h.

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

◆ m_sdrPlayThread

SDRPlayThread* SDRPlayInput::m_sdrPlayThread
private

Definition at line 189 of file sdrplayinput.h.

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

◆ m_settings

SDRPlaySettings SDRPlayInput::m_settings
private

◆ m_variant

SDRPlayVariant SDRPlayInput::m_variant
private

Definition at line 186 of file sdrplayinput.h.

Referenced by getVariant(), and openDevice().


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