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.
testsourceinput.cpp
Go to the documentation of this file.
1 // Copyright (C) 2018 Edouard Griffiths, F4EXB //
3 // //
4 // This program is free software; you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation as version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // This program is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License V3 for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
17 
18 #include <string.h>
19 #include <errno.h>
20 
21 #include <QDebug>
22 #include <QNetworkReply>
23 #include <QNetworkAccessManager>
24 #include <QBuffer>
25 
26 #include "SWGDeviceSettings.h"
27 #include "SWGDeviceState.h"
28 
29 #include "testsourceinput.h"
30 #include "device/deviceapi.h"
31 #include "testsourcethread.h"
32 #include "dsp/dspcommands.h"
33 #include "dsp/dspengine.h"
34 #include "dsp/filerecord.h"
35 
39 
40 
42  m_deviceAPI(deviceAPI),
43  m_settings(),
44  m_testSourceThread(0),
45  m_deviceDescription(),
46  m_running(false),
47  m_masterTimer(deviceAPI->getMasterTimer())
48 {
49  m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
50  m_deviceAPI->setNbSourceStreams(1);
51  m_deviceAPI->addAncillarySink(m_fileSink);
52 
53  if (!m_sampleFifo.setSize(96000 * 4)) {
54  qCritical("TestSourceInput::TestSourceInput: Could not allocate SampleFifo");
55  }
56 
57  m_networkManager = new QNetworkAccessManager();
58  connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
59 }
60 
62 {
63  disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
64  delete m_networkManager;
65 
66  if (m_running) {
67  stop();
68  }
69 
71  delete m_fileSink;
72 }
73 
75 {
76  delete this;
77 }
78 
80 {
82 }
83 
85 {
86  QMutexLocker mutexLocker(&m_mutex);
87 
88  if (m_running) stop();
89 
93 
94  mutexLocker.unlock();
95 
97  m_running = true;
98 
99  return true;
100 }
101 
103 {
104  QMutexLocker mutexLocker(&m_mutex);
105 
106  if (m_testSourceThread != 0)
107  {
109  m_testSourceThread->deleteLater();
110  m_testSourceThread = 0;
111  }
112 
113  m_running = false;
114 }
115 
116 QByteArray TestSourceInput::serialize() const
117 {
118  return m_settings.serialize();
119 }
120 
121 bool TestSourceInput::deserialize(const QByteArray& data)
122 {
123  bool success = true;
124 
125  if (!m_settings.deserialize(data))
126  {
128  success = false;
129  }
130 
132  m_inputMessageQueue.push(message);
133 
134  if (m_guiMessageQueue)
135  {
137  m_guiMessageQueue->push(messageToGUI);
138  }
139 
140  return success;
141 }
142 
144 {
145  return m_deviceDescription;
146 }
147 
149 {
151 }
152 
154 {
156 }
157 
158 void TestSourceInput::setCenterFrequency(qint64 centerFrequency)
159 {
160  TestSourceSettings settings = m_settings;
161  settings.m_centerFrequency = centerFrequency;
162 
163  MsgConfigureTestSource* message = MsgConfigureTestSource::create(settings, false);
164  m_inputMessageQueue.push(message);
165 
166  if (m_guiMessageQueue)
167  {
168  MsgConfigureTestSource* messageToGUI = MsgConfigureTestSource::create(settings, false);
169  m_guiMessageQueue->push(messageToGUI);
170  }
171 }
172 
174 {
175  if (MsgConfigureTestSource::match(message))
176  {
178  qDebug() << "TestSourceInput::handleMessage: MsgConfigureTestSource";
179 
180  bool success = applySettings(conf.getSettings(), conf.getForce());
181 
182  if (!success)
183  {
184  qDebug("TestSourceInput::handleMessage: config error");
185  }
186 
187  return true;
188  }
189  else if (MsgFileRecord::match(message))
190  {
191  MsgFileRecord& conf = (MsgFileRecord&) message;
192  qDebug() << "TestSourceInput::handleMessage: MsgFileRecord: " << conf.getStartStop();
193 
194  if (conf.getStartStop())
195  {
196  if (m_settings.m_fileRecordName.size() != 0) {
198  } else {
200  }
201 
203  }
204  else
205  {
207  }
208 
209  return true;
210  }
211  else if (MsgStartStop::match(message))
212  {
213  MsgStartStop& cmd = (MsgStartStop&) message;
214  qDebug() << "TestSourceInput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
215 
216  if (cmd.getStartStop())
217  {
219  {
221  }
222  }
223  else
224  {
226  }
227 
230  }
231 
232  return true;
233  }
234  else
235  {
236  return false;
237  }
238 }
239 
240 bool TestSourceInput::applySettings(const TestSourceSettings& settings, bool force)
241 {
242  QList<QString> reverseAPIKeys;
243 
244  if ((m_settings.m_autoCorrOptions != settings.m_autoCorrOptions) || force)
245  {
246  reverseAPIKeys.append("autoCorrOptions");
247 
248  switch(settings.m_autoCorrOptions)
249  {
251  m_deviceAPI->configureCorrections(true, false);
252  break;
254  m_deviceAPI->configureCorrections(true, true);
255  break;
257  default:
258  m_deviceAPI->configureCorrections(false, false);
259  break;
260  }
261  }
262 
263  if ((m_settings.m_sampleRate != settings.m_sampleRate) || force)
264  {
265  reverseAPIKeys.append("sampleRate");
266 
267  if (m_testSourceThread != 0)
268  {
270  qDebug("TestSourceInput::applySettings: sample rate set to %d", settings.m_sampleRate);
271  }
272  }
273 
274  if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
275  {
276  reverseAPIKeys.append("log2Decim");
277 
278  if (m_testSourceThread != 0)
279  {
281  qDebug() << "TestSourceInput::applySettings: set decimation to " << (1<<settings.m_log2Decim);
282  }
283  }
284 
286  || (m_settings.m_fcPos != settings.m_fcPos)
288  || (m_settings.m_sampleRate != settings.m_sampleRate)
289  || (m_settings.m_log2Decim != settings.m_log2Decim) || force)
290  {
291  reverseAPIKeys.append("centerFrequency");
292  reverseAPIKeys.append("fcPos");
293  reverseAPIKeys.append("frequencyShift");
294 
295  qint64 deviceCenterFrequency = DeviceSampleSource::calculateDeviceCenterFrequency(
296  settings.m_centerFrequency,
297  0, // no transverter mode
298  settings.m_log2Decim,
300  settings.m_sampleRate,
301  DeviceSampleSource::FrequencyShiftScheme::FSHIFT_STD,
302  false);
303 
304  int frequencyShift = settings.m_frequencyShift;
305  quint32 devSampleRate = settings.m_sampleRate;
306 
307  if (settings.m_log2Decim != 0)
308  {
310  settings.m_log2Decim,
312  settings.m_sampleRate,
314  }
315 
316  if (m_testSourceThread != 0)
317  {
318  m_testSourceThread->setFcPos((int) settings.m_fcPos);
319  m_testSourceThread->setFrequencyShift(frequencyShift);
320  qDebug() << "TestSourceInput::applySettings:"
321  << " center freq: " << settings.m_centerFrequency << " Hz"
322  << " device center freq: " << deviceCenterFrequency << " Hz"
323  << " device sample rate: " << devSampleRate << "Hz"
324  << " Actual sample rate: " << devSampleRate/(1<<m_settings.m_log2Decim) << "Hz"
325  << " f shift: " << settings.m_frequencyShift;
326  }
327  }
328 
329  if ((m_settings.m_amplitudeBits != settings.m_amplitudeBits) || force)
330  {
331  reverseAPIKeys.append("amplitudeBits");
332 
333  if (m_testSourceThread != 0) {
335  }
336  }
337 
338  if ((m_settings.m_dcFactor != settings.m_dcFactor) || force)
339  {
340  reverseAPIKeys.append("dcFactor");
341 
342  if (m_testSourceThread != 0) {
344  }
345  }
346 
347  if ((m_settings.m_iFactor != settings.m_iFactor) || force)
348  {
349  reverseAPIKeys.append("iFactor");
350 
351  if (m_testSourceThread != 0) {
353  }
354  }
355 
356  if ((m_settings.m_qFactor != settings.m_qFactor) || force)
357  {
358  reverseAPIKeys.append("qFactor");
359 
360  if (m_testSourceThread != 0) {
362  }
363  }
364 
365  if ((m_settings.m_phaseImbalance != settings.m_phaseImbalance) || force)
366  {
367  reverseAPIKeys.append("phaseImbalance");
368 
369  if (m_testSourceThread != 0) {
371  }
372  }
373 
374  if ((m_settings.m_sampleSizeIndex != settings.m_sampleSizeIndex) || force)
375  {
376  reverseAPIKeys.append("sampleSizeIndex");
377 
378  if (m_testSourceThread != 0) {
380  }
381  }
382 
383  if ((m_settings.m_sampleRate != settings.m_sampleRate)
385  || (m_settings.m_log2Decim != settings.m_log2Decim)
386  || (m_settings.m_fcPos != settings.m_fcPos) || force)
387  {
388  int sampleRate = settings.m_sampleRate/(1<<settings.m_log2Decim);
389  DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, settings.m_centerFrequency);
390  m_fileSink->handleMessage(*notif); // forward to file sink
392  }
393 
394  if ((m_settings.m_modulationTone != settings.m_modulationTone) || force)
395  {
396  reverseAPIKeys.append("modulationTone");
397 
398  if (m_testSourceThread != 0) {
400  }
401  }
402 
403  if ((m_settings.m_modulation != settings.m_modulation) || force)
404  {
405  reverseAPIKeys.append("modulation");
406 
407  if (m_testSourceThread != 0)
408  {
410 
413  } else if (settings.m_modulation == TestSourceSettings::ModulationPattern1) {
415  } else if (settings.m_modulation == TestSourceSettings::ModulationPattern2) {
417  }
418  }
419  }
420 
421  if ((m_settings.m_amModulation != settings.m_amModulation) || force)
422  {
423  reverseAPIKeys.append("amModulation");
424 
425  if (m_testSourceThread != 0) {
427  }
428  }
429 
430  if ((m_settings.m_fmDeviation != settings.m_fmDeviation) || force)
431  {
432  reverseAPIKeys.append("fmDeviation");
433 
434  if (m_testSourceThread != 0) {
435  m_testSourceThread->setFMDeviation(settings.m_fmDeviation * 100.0f);
436  }
437  }
438 
439  if (settings.m_useReverseAPI)
440  {
441  qDebug("TestSourceInput::applySettings: call webapiReverseSendSettings");
442  bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
446  webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
447  }
448 
449  m_settings = settings;
450  return true;
451 }
452 
454  SWGSDRangel::SWGDeviceState& response,
455  QString& errorMessage)
456 {
457  (void) errorMessage;
459  return 200;
460 }
461 
463  bool run,
464  SWGSDRangel::SWGDeviceState& response,
465  QString& errorMessage)
466 {
467  (void) errorMessage;
469  MsgStartStop *message = MsgStartStop::create(run);
470  m_inputMessageQueue.push(message);
471 
472  if (m_guiMessageQueue) // forward to GUI if any
473  {
474  MsgStartStop *msgToGUI = MsgStartStop::create(run);
475  m_guiMessageQueue->push(msgToGUI);
476  }
477 
478  return 200;
479 }
480 
483  QString& errorMessage)
484 {
485  (void) errorMessage;
487  response.getTestSourceSettings()->init();
489  return 200;
490 }
491 
493  bool force,
494  const QStringList& deviceSettingsKeys,
495  SWGSDRangel::SWGDeviceSettings& response, // query + response
496  QString& errorMessage)
497 {
498  (void) errorMessage;
499  TestSourceSettings settings = m_settings;
500 
501  if (deviceSettingsKeys.contains("centerFrequency")) {
503  }
504  if (deviceSettingsKeys.contains("frequencyShift")) {
506  }
507  if (deviceSettingsKeys.contains("sampleRate")) {
508  settings.m_sampleRate = response.getTestSourceSettings()->getSampleRate();
509  }
510  if (deviceSettingsKeys.contains("log2Decim")) {
511  settings.m_log2Decim = response.getTestSourceSettings()->getLog2Decim();
512  }
513  if (deviceSettingsKeys.contains("fcPos")) {
514  int fcPos = response.getTestSourceSettings()->getFcPos();
515  fcPos = fcPos < 0 ? 0 : fcPos > 2 ? 2 : fcPos;
516  settings.m_fcPos = (TestSourceSettings::fcPos_t) fcPos;
517  }
518  if (deviceSettingsKeys.contains("sampleSizeIndex")) {
519  int sampleSizeIndex = response.getTestSourceSettings()->getSampleSizeIndex();
520  sampleSizeIndex = sampleSizeIndex < 0 ? 0 : sampleSizeIndex > 1 ? 2 : sampleSizeIndex;
521  settings.m_sampleSizeIndex = sampleSizeIndex;
522  }
523  if (deviceSettingsKeys.contains("amplitudeBits")) {
524  settings.m_amplitudeBits = response.getTestSourceSettings()->getAmplitudeBits();
525  }
526  if (deviceSettingsKeys.contains("autoCorrOptions")) {
527  int autoCorrOptions = response.getTestSourceSettings()->getAutoCorrOptions();
528  autoCorrOptions = autoCorrOptions < 0 ? 0 : autoCorrOptions >= TestSourceSettings::AutoCorrLast ? TestSourceSettings::AutoCorrLast-1 : autoCorrOptions;
529  settings.m_sampleSizeIndex = (TestSourceSettings::AutoCorrOptions) autoCorrOptions;
530  }
531  if (deviceSettingsKeys.contains("modulation")) {
532  int modulation = response.getTestSourceSettings()->getModulation();
533  modulation = modulation < 0 ? 0 : modulation >= TestSourceSettings::ModulationLast ? TestSourceSettings::ModulationLast-1 : modulation;
534  settings.m_modulation = (TestSourceSettings::Modulation) modulation;
535  }
536  if (deviceSettingsKeys.contains("modulationTone")) {
538  }
539  if (deviceSettingsKeys.contains("amModulation")) {
540  settings.m_amModulation = response.getTestSourceSettings()->getAmModulation();
541  };
542  if (deviceSettingsKeys.contains("fmDeviation")) {
543  settings.m_fmDeviation = response.getTestSourceSettings()->getFmDeviation();
544  };
545  if (deviceSettingsKeys.contains("dcFactor")) {
546  settings.m_dcFactor = response.getTestSourceSettings()->getDcFactor();
547  };
548  if (deviceSettingsKeys.contains("iFactor")) {
549  settings.m_iFactor = response.getTestSourceSettings()->getIFactor();
550  };
551  if (deviceSettingsKeys.contains("qFactor")) {
552  settings.m_qFactor = response.getTestSourceSettings()->getQFactor();
553  };
554  if (deviceSettingsKeys.contains("phaseImbalance")) {
556  };
557  if (deviceSettingsKeys.contains("fileRecordName")) {
558  settings.m_fileRecordName = *response.getTestSourceSettings()->getFileRecordName();
559  }
560  if (deviceSettingsKeys.contains("useReverseAPI")) {
561  settings.m_useReverseAPI = response.getTestSourceSettings()->getUseReverseApi() != 0;
562  }
563  if (deviceSettingsKeys.contains("reverseAPIAddress")) {
565  }
566  if (deviceSettingsKeys.contains("reverseAPIPort")) {
568  }
569  if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
571  }
572 
575 
576  if (m_guiMessageQueue) // forward to GUI if any
577  {
578  MsgConfigureTestSource *msgToGUI = MsgConfigureTestSource::create(settings, force);
579  m_guiMessageQueue->push(msgToGUI);
580  }
581 
582  webapiFormatDeviceSettings(response, settings);
583  return 200;
584 }
585 
587 {
590  response.getTestSourceSettings()->setSampleRate(settings.m_sampleRate);
591  response.getTestSourceSettings()->setLog2Decim(settings.m_log2Decim);
592  response.getTestSourceSettings()->setFcPos((int) settings.m_fcPos);
593  response.getTestSourceSettings()->setSampleSizeIndex((int) settings.m_sampleSizeIndex);
595  response.getTestSourceSettings()->setAutoCorrOptions((int) settings.m_autoCorrOptions);
596  response.getTestSourceSettings()->setModulation((int) settings.m_modulation);
599  response.getTestSourceSettings()->setFmDeviation(settings.m_fmDeviation);
600  response.getTestSourceSettings()->setDcFactor(settings.m_dcFactor);
601  response.getTestSourceSettings()->setIFactor(settings.m_iFactor);
602  response.getTestSourceSettings()->setQFactor(settings.m_qFactor);
604 
605  if (response.getTestSourceSettings()->getFileRecordName()) {
606  *response.getTestSourceSettings()->getFileRecordName() = settings.m_fileRecordName;
607  } else {
608  response.getTestSourceSettings()->setFileRecordName(new QString(settings.m_fileRecordName));
609  }
610 
611  response.getTestSourceSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
612 
613  if (response.getTestSourceSettings()->getReverseApiAddress()) {
615  } else {
616  response.getTestSourceSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
617  }
618 
621 }
622 
623 void TestSourceInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const TestSourceSettings& settings, bool force)
624 {
626  swgDeviceSettings->setDirection(0); // single Rx
627  swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
628  swgDeviceSettings->setDeviceHwType(new QString("TestSource"));
630  SWGSDRangel::SWGTestSourceSettings *swgTestSourceSettings = swgDeviceSettings->getTestSourceSettings();
631 
632  // transfer data that has been modified. When force is on transfer all data except reverse API data
633 
634  if (deviceSettingsKeys.contains("centerFrequency") || force) {
635  swgTestSourceSettings->setCenterFrequency(settings.m_centerFrequency);
636  }
637  if (deviceSettingsKeys.contains("frequencyShift") || force) {
638  swgTestSourceSettings->setFrequencyShift(settings.m_frequencyShift);
639  }
640  if (deviceSettingsKeys.contains("sampleRate") || force) {
641  swgTestSourceSettings->setSampleRate(settings.m_sampleRate);
642  }
643  if (deviceSettingsKeys.contains("log2Decim") || force) {
644  swgTestSourceSettings->setLog2Decim(settings.m_log2Decim);
645  }
646  if (deviceSettingsKeys.contains("fcPos") || force) {
647  swgTestSourceSettings->setFcPos((int) settings.m_fcPos);
648  }
649  if (deviceSettingsKeys.contains("sampleSizeIndex") || force) {
650  swgTestSourceSettings->setSampleSizeIndex(settings.m_sampleSizeIndex);
651  }
652  if (deviceSettingsKeys.contains("amplitudeBits") || force) {
653  swgTestSourceSettings->setAmplitudeBits(settings.m_amplitudeBits);
654  }
655  if (deviceSettingsKeys.contains("autoCorrOptions") || force) {
656  swgTestSourceSettings->setAutoCorrOptions((int) settings.m_sampleSizeIndex);
657  }
658  if (deviceSettingsKeys.contains("modulation") || force) {
659  swgTestSourceSettings->setModulation((int) settings.m_modulation);
660  }
661  if (deviceSettingsKeys.contains("modulationTone")) {
662  swgTestSourceSettings->setModulationTone(settings.m_modulationTone);
663  }
664  if (deviceSettingsKeys.contains("amModulation") || force) {
665  swgTestSourceSettings->setAmModulation(settings.m_amModulation);
666  };
667  if (deviceSettingsKeys.contains("fmDeviation") || force) {
668  swgTestSourceSettings->setFmDeviation(settings.m_fmDeviation);
669  };
670  if (deviceSettingsKeys.contains("dcFactor") || force) {
671  swgTestSourceSettings->setDcFactor(settings.m_dcFactor);
672  };
673  if (deviceSettingsKeys.contains("iFactor") || force) {
674  swgTestSourceSettings->setIFactor(settings.m_iFactor);
675  };
676  if (deviceSettingsKeys.contains("qFactor") || force) {
677  swgTestSourceSettings->setQFactor(settings.m_qFactor);
678  };
679  if (deviceSettingsKeys.contains("phaseImbalance") || force) {
680  swgTestSourceSettings->setPhaseImbalance(settings.m_phaseImbalance);
681  };
682  if (deviceSettingsKeys.contains("fileRecordName") || force) {
683  swgTestSourceSettings->setFileRecordName(new QString(settings.m_fileRecordName));
684  }
685 
686  QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings")
687  .arg(settings.m_reverseAPIAddress)
688  .arg(settings.m_reverseAPIPort)
689  .arg(settings.m_reverseAPIDeviceIndex);
690  m_networkRequest.setUrl(QUrl(channelSettingsURL));
691  m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
692 
693  QBuffer *buffer=new QBuffer();
694  buffer->open((QBuffer::ReadWrite));
695  buffer->write(swgDeviceSettings->asJson().toUtf8());
696  buffer->seek(0);
697 // qDebug("TestSourceInput::webapiReverseSendSettings: %s", channelSettingsURL.toStdString().c_str());
698 // qDebug("TestSourceInput::webapiReverseSendSettings: query:\n%s", swgDeviceSettings->asJson().toStdString().c_str());
699 
700  // Always use PATCH to avoid passing reverse API settings
701  m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
702 
703  delete swgDeviceSettings;
704 }
705 
707 {
709  swgDeviceSettings->setDirection(0); // single Rx
710  swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
711  swgDeviceSettings->setDeviceHwType(new QString("TestSource"));
712 
713  QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/run")
717  m_networkRequest.setUrl(QUrl(channelSettingsURL));
718  m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
719 
720  QBuffer *buffer=new QBuffer();
721  buffer->open((QBuffer::ReadWrite));
722  buffer->write(swgDeviceSettings->asJson().toUtf8());
723  buffer->seek(0);
724 
725  if (start) {
726  m_networkManager->sendCustomRequest(m_networkRequest, "POST", buffer);
727  } else {
728  m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
729  }
730 
731  delete swgDeviceSettings;
732 }
733 
734 void TestSourceInput::networkManagerFinished(QNetworkReply *reply)
735 {
736  QNetworkReply::NetworkError replyError = reply->error();
737 
738  if (replyError)
739  {
740  qWarning() << "TestSourceInput::networkManagerFinished:"
741  << " error(" << (int) replyError
742  << "): " << replyError
743  << ": " << reply->errorString();
744  return;
745  }
746 
747  QString answer = reply->readAll();
748  answer.chop(1); // remove last \n
749  qDebug("TestSourceInput::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
750 }
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings &response, const TestSourceSettings &settings)
virtual bool deserialize(const QByteArray &data)
bool startDeviceEngine()
Start the device engine corresponding to the stream type.
Definition: deviceapi.cpp:253
virtual int webapiRun(bool run, SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
static qint32 calculateFrequencyShift(int log2Decim, fcPos_t fcPos, quint32 devSampleRate, FrequencyShiftScheme frequencyShiftScheme)
virtual void destroy()
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.
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
virtual void init()
initializations to be done when all collaborating objects are created and possibly connected ...
bool deserialize(const QByteArray &data)
SWGTestSourceSettings * getTestSourceSettings()
void setPhaseImbalance(float phaseImbalance)
void startRecording()
Definition: filerecord.cpp:105
void setSamplerate(int samplerate)
void setFileRecordName(QString *file_record_name)
MessageQueue m_inputMessageQueue
Input queue to the source.
void setIFactor(float iFactor)
virtual QString asJson() override
void setLog2Decimation(unsigned int log2_decim)
MessageQueue * getDeviceEngineInputMessageQueue()
Device engine message queue.
Definition: deviceapi.cpp:316
void setReverseApiPort(qint32 reverse_api_port)
virtual bool handleMessage(const Message &message)
void startStop(bool start)
void setAMModulation(float amModulation)
void setBitSize(uint32_t bitSizeIndex)
float m_qFactor
-1.0 < x < 1.0
virtual int getSampleRate() const
Sample rate exposed by the source.
virtual quint64 getCenterFrequency() const
Center frequency exposed by the source.
void setUseReverseApi(qint32 use_reverse_api)
float m_phaseImbalance
-1.0 < x < 1.0
virtual ~TestSourceInput()
QByteArray serialize() const
void networkManagerFinished(QNetworkReply *reply)
bool initDeviceEngine()
Init the device engine corresponding to the stream type.
Definition: deviceapi.cpp:240
virtual void stop()
AutoCorrOptions m_autoCorrOptions
virtual int webapiSettingsPutPatch(bool force, const QStringList &deviceSettingsKeys, SWGSDRangel::SWGDeviceSettings &response, QString &errorMessage)
void setModulation(TestSourceSettings::Modulation modulation)
void setOriginatorIndex(qint32 originator_index)
virtual int webapiSettingsGet(SWGSDRangel::SWGDeviceSettings &response, QString &errorMessage)
SampleSinkFifo m_sampleFifo
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
virtual bool handleMessage(const Message &message)
Processing of a message. Returns true if message has actually been processed.
Definition: filerecord.cpp:128
QNetworkAccessManager * m_networkManager
virtual const QString & getDeviceDescription() const
void setToneFrequency(int toneFrequency)
void setFrequencyShift(int shift)
void setSampleSizeIndex(qint32 sample_size_index)
int getDeviceSetIndex() const
Definition: deviceapi.h:131
float m_iFactor
-1.0 < x < 1.0
static MsgConfigureTestSource * create(const TestSourceSettings &settings, bool force)
#define MESSAGE_CLASS_DEFINITION(Name, BaseClass)
Definition: message.h:52
void genUniqueFileName(uint deviceUID, int istream=-1)
Definition: filerecord.cpp:67
void setReverseApiAddress(QString *reverse_api_address)
void setAutoCorrOptions(qint32 auto_corr_options)
uint16_t m_reverseAPIDeviceIndex
void webapiReverseSendStartStop(bool start)
QNetworkRequest m_networkRequest
TestSourceThread * m_testSourceThread
TestSourceSettings m_settings
void setAmplitudeBits(qint32 amplitude_bits)
void stopRecording()
Definition: filerecord.cpp:117
void setModulationTone(qint32 modulation_tone)
void setTestSourceSettings(SWGTestSourceSettings *test_source_settings)
virtual void setCenterFrequency(qint64 centerFrequency)
void setAmplitudeBits(int32_t amplitudeBits)
static bool match(const Message *message)
Definition: message.cpp:45
void removeAncillarySink(BasebandSampleSink *sink, unsigned int index=0)
Removes it.
Definition: deviceapi.cpp:100
void setPhaseImbalance(float phase_imbalance)
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
void setCenterFrequency(qint32 center_frequency)
void setFMDeviation(float deviation)
FileRecord * m_fileSink
File sink to record device I/Q output.
void getDeviceEngineStateStr(QString &state)
Definition: deviceapi.cpp:389
void setDCFactor(float iFactor)
void setAmModulation(qint32 am_modulation)
int m_modulationTone
10&#39;Hz
virtual QByteArray serialize() const
static MsgStartStop * create(bool startStop)
virtual int webapiRunGet(SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
DeviceAPI * m_deviceAPI
void setFrequencyShift(qint32 frequency_shift)
void setQFactor(float qFactor)
void webapiReverseSendSettings(QList< QString > &deviceSettingsKeys, const TestSourceSettings &settings, bool force)
virtual bool start()
void configureCorrections(bool dcOffsetCorrection, bool iqImbalanceCorrection, int streamIndex=0)
Configure current device engine DSP corrections (Rx)
Definition: deviceapi.cpp:355
int m_fmDeviation
100&#39;Hz
void setDirection(qint32 direction)
bool applySettings(const TestSourceSettings &settings, bool force)
QString m_deviceDescription
void setDeviceHwType(QString *device_hw_type)
void setFcPos(int fcPos)
const TestSourceSettings & getSettings() const
int m_amModulation
percent
float m_dcFactor
-1.0 < x < 1.0