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.
perseusinput.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 <QDebug>
19 #include <QNetworkReply>
20 #include <QBuffer>
21 
22 #include "SWGDeviceSettings.h"
23 #include "SWGDeviceState.h"
24 #include "SWGDeviceReport.h"
25 #include "SWGPerseusReport.h"
26 
27 #include "dsp/filerecord.h"
28 #include "dsp/dspcommands.h"
29 #include "dsp/dspengine.h"
30 #include "device/deviceapi.h"
31 #include "perseus/deviceperseus.h"
32 
33 #include "perseusinput.h"
34 #include "perseusthread.h"
35 
39 
41  m_deviceAPI(deviceAPI),
42  m_fileSink(0),
43  m_deviceDescription("PerseusInput"),
44  m_running(false),
45  m_perseusThread(0),
46  m_perseusDescriptor(0)
47 {
48  openDevice();
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  m_networkManager = new QNetworkAccessManager();
54  connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
55 }
56 
58 {
59  disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
60  delete m_networkManager;
62  delete m_fileSink;
63  closeDevice();
64 }
65 
67 {
68  delete this;
69 }
70 
72 {
74 }
75 
77 {
78  if (m_running) stop();
79 
80  // start / stop streaming is done in the thread.
81 
83  qDebug("PerseusInput::start: thread created");
84 
86 
89 
90  m_running = true;
91 
92  return true;
93 }
94 
96 {
97  if (m_perseusThread != 0)
98  {
100  delete m_perseusThread;
101  m_perseusThread = 0;
102  }
103 
104  m_running = false;
105 }
106 
107 QByteArray PerseusInput::serialize() const
108 {
109  return m_settings.serialize();
110 }
111 
112 bool PerseusInput::deserialize(const QByteArray& data)
113 {
114  bool success = true;
115 
116  if (!m_settings.deserialize(data))
117  {
119  success = false;
120  }
121 
123  m_inputMessageQueue.push(message);
124 
125  if (m_guiMessageQueue)
126  {
128  m_guiMessageQueue->push(messageToGUI);
129  }
130 
131  return success;
132 }
133 
135 {
136  return m_deviceDescription;
137 }
139 {
142  } else {
143  return (m_sampleRates[0] / (1<<m_settings.m_log2Decim));
144  }
145 }
146 
148 {
150 }
151 
152 void PerseusInput::setCenterFrequency(qint64 centerFrequency)
153 {
154  PerseusSettings settings = m_settings;
155  settings.m_centerFrequency = centerFrequency;
156 
157  MsgConfigurePerseus* message = MsgConfigurePerseus::create(settings, false);
158  m_inputMessageQueue.push(message);
159 
160  if (m_guiMessageQueue)
161  {
162  MsgConfigurePerseus* messageToGUI = MsgConfigurePerseus::create(settings, false);
163  m_guiMessageQueue->push(messageToGUI);
164  }
165 }
166 
168 {
169  if (MsgConfigurePerseus::match(message))
170  {
171  MsgConfigurePerseus& conf = (MsgConfigurePerseus&) message;
172  qDebug() << "PerseusInput::handleMessage: MsgConfigurePerseus";
173 
174  bool success = applySettings(conf.getSettings(), conf.getForce());
175 
176  if (!success) {
177  qDebug("MsgConfigurePerseus::handleMessage: Perseus config error");
178  }
179 
180  return true;
181  }
182  else if (MsgStartStop::match(message))
183  {
184  MsgStartStop& cmd = (MsgStartStop&) message;
185  qDebug() << "PerseusInput::handleMessage: MsgStartStop: " << (cmd.getStartStop() ? "start" : "stop");
186 
187  if (cmd.getStartStop())
188  {
190  {
192  }
193  }
194  else
195  {
197  }
198 
201  }
202 
203  return true;
204  }
205  else if (MsgFileRecord::match(message))
206  {
207  MsgFileRecord& conf = (MsgFileRecord&) message;
208  qDebug() << "PerseusInput::handleMessage: MsgFileRecord: " << conf.getStartStop();
209 
210  if (conf.getStartStop())
211  {
212  if (m_settings.m_fileRecordName.size() != 0) {
214  } else {
216  }
217 
219  }
220  else
221  {
223  }
224 
225  return true;
226  }
227  else
228  {
229  return false;
230  }
231 }
232 
234 {
235  if (m_perseusDescriptor != 0) {
236  closeDevice();
237  }
238 
240  {
241  qCritical("PerseusInput::start: could not allocate SampleFifo");
242  return false;
243  }
244 
246  int deviceSequence = DevicePerseus::instance().getSequenceFromSerial(m_deviceAPI->getSamplingDeviceSerial().toStdString());
247 
248  if ((m_perseusDescriptor = perseus_open(deviceSequence)) == 0)
249  {
250  qCritical("PerseusInput::openDevice: cannot open device: %s", perseus_errorstr());
251  return false;
252  }
253 
254  int buf[32];
255  m_sampleRates.clear();
256 
257  if (perseus_get_sampling_rates(m_perseusDescriptor, buf, sizeof(buf)/sizeof(buf[0])) < 0)
258  {
259  qCritical("PerseusInput::openDevice: cannot get sampling rates: %s", perseus_errorstr());
260  perseus_close(m_perseusDescriptor);
261  return false;
262  }
263  else
264  {
265  for (int i = 0; (i < 32) && (buf[i] != 0); i++)
266  {
267  qDebug("PerseusInput::openDevice: sample rate: %d", buf[i]);
268  m_sampleRates.push_back(buf[i]);
269  }
270  }
271 
272  return true;
273 }
274 
276 {
278  {
279  if (m_running) { stop(); }
280  perseus_close(m_perseusDescriptor);
281  }
282 }
283 
284 void PerseusInput::setDeviceCenterFrequency(quint64 freq_hz, const PerseusSettings& settings)
285 {
286  qint64 df = ((qint64)freq_hz * settings.m_LOppmTenths) / 10000000LL;
287  freq_hz += df;
288 
289  // wideband flag is inverted since parameter is set to enable preselection filters
290  int rc = perseus_set_ddc_center_freq(m_perseusDescriptor, freq_hz, settings.m_wideBand ? 0 : 1);
291 
292  if (rc < 0) {
293  qWarning("PerseusInput::setDeviceCenterFrequency: could not set frequency to %llu Hz: %s", freq_hz, perseus_errorstr());
294  } else {
295  qDebug("PerseusInput::setDeviceCenterFrequency: frequency set to %llu Hz", freq_hz);
296  }
297 }
298 
299 bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
300 {
301  bool forwardChange = false;
302  int sampleRateIndex = settings.m_devSampleRateIndex;
303  QList<QString> reverseAPIKeys;
304 
305  if ((m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex) || force)
306  {
307  reverseAPIKeys.append("devSampleRateIndex");
308  forwardChange = true;
309 
310  if (settings.m_devSampleRateIndex >= m_sampleRates.size()) {
311  sampleRateIndex = m_sampleRates.size() - 1;
312  }
313 
314  if (m_perseusDescriptor != 0)
315  {
316  int rate = m_sampleRates[settings.m_devSampleRateIndex < m_sampleRates.size() ? settings.m_devSampleRateIndex: 0];
317  int rc;
318 
319  for (int i = 0; i < 2; i++) // it turns out that it has to be done twice
320  {
321  rc = perseus_set_sampling_rate(m_perseusDescriptor, rate);
322 
323  if (rc < 0) {
324  qCritical("PerseusInput::applySettings: could not set sample rate index %u (%d S/s): %s",
325  settings.m_devSampleRateIndex, rate, perseus_errorstr());
326  break;
327  }
328  else
329  {
330  qDebug("PerseusInput::applySettings: sample rate set to index #%d: %u (%d S/s)",
331  i, settings.m_devSampleRateIndex, rate);
332  }
333  }
334  }
335  }
336 
337  if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
338  {
339  reverseAPIKeys.append("log2Decim");
340  forwardChange = true;
341 
342  if (m_perseusThread != 0)
343  {
345  qDebug("PerseusInput: set decimation to %d", (1<<settings.m_log2Decim));
346  }
347  }
348 
349  if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)) {
350  reverseAPIKeys.append("centerFrequency");
351  }
352  if (force || (m_settings.m_LOppmTenths != settings.m_LOppmTenths)) {
353  reverseAPIKeys.append("LOppmTenths");
354  }
355  if (force || (m_settings.m_wideBand != settings.m_wideBand)) {
356  reverseAPIKeys.append("wideBand");
357  }
358  if (force || (m_settings.m_transverterMode != settings.m_transverterMode)) {
359  reverseAPIKeys.append("transverterMode");
360  }
362  reverseAPIKeys.append("transverterDeltaFrequency");
363  }
364 
365  if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
366  || (m_settings.m_LOppmTenths != settings.m_LOppmTenths)
367  || (m_settings.m_wideBand != settings.m_wideBand)
371  {
372  qint64 deviceCenterFrequency = settings.m_centerFrequency;
373  deviceCenterFrequency -= settings.m_transverterMode ? settings.m_transverterDeltaFrequency : 0;
374  deviceCenterFrequency = deviceCenterFrequency < 0 ? 0 : deviceCenterFrequency;
375 
376  if (m_perseusDescriptor != 0)
377  {
378  setDeviceCenterFrequency(deviceCenterFrequency, settings);
379  qDebug("PerseusInput::applySettings: center freq: %llu Hz", settings.m_centerFrequency);
380  }
381 
382  forwardChange = true;
383  }
384 
385  if ((m_settings.m_attenuator != settings.m_attenuator) || force)
386  {
387  reverseAPIKeys.append("attenuator");
388  int rc = perseus_set_attenuator_n(m_perseusDescriptor, (int) settings.m_attenuator);
389 
390  if (rc < 0) {
391  qWarning("PerseusInput::applySettings: cannot set attenuator to %d dB: %s", (int) settings.m_attenuator*10, perseus_errorstr());
392  } else {
393  qDebug("PerseusInput::applySettings: attenuator set to %d dB", (int) settings.m_attenuator*10);
394  }
395  }
396 
397  if (force || (m_settings.m_adcDither != settings.m_adcDither)) {
398  reverseAPIKeys.append("adcDither");
399  }
400  if (force || (m_settings.m_adcPreamp != settings.m_adcPreamp)) {
401  reverseAPIKeys.append("adcPreamp");
402  }
403 
404  if ((m_settings.m_adcDither != settings.m_adcDither)
405  || (m_settings.m_adcPreamp != settings.m_adcPreamp) || force)
406  {
407  int rc = perseus_set_adc(m_perseusDescriptor, settings.m_adcDither ? 1 : 0, settings.m_adcPreamp ? 1 : 0);
408 
409  if (rc < 0) {
410  qWarning("PerseusInput::applySettings: cannot set ADC to dither %s and preamp %s: %s",
411  settings.m_adcDither ? "on" : "off", settings.m_adcPreamp ? "on" : "off", perseus_errorstr());
412  } else {
413  qDebug("PerseusInput::applySettings: ADC set to dither %s and preamp %s",
414  settings.m_adcDither ? "on" : "off", settings.m_adcPreamp ? "on" : "off");
415  }
416  }
417 
418  if (forwardChange)
419  {
420  int sampleRate = m_sampleRates[sampleRateIndex]/(1<<settings.m_log2Decim);
421  DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, settings.m_centerFrequency);
422  m_fileSink->handleMessage(*notif); // forward to file sink
424  }
425 
426  if (settings.m_useReverseAPI)
427  {
428  bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
432  webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
433  }
434 
435  m_settings = settings;
436  m_settings.m_devSampleRateIndex = sampleRateIndex;
437 
438  qDebug() << "PerseusInput::applySettings: "
439  << " m_LOppmTenths: " << m_settings.m_LOppmTenths
440  << " m_devSampleRateIndex: " << m_settings.m_devSampleRateIndex
441  << " m_log2Decim: " << m_settings.m_log2Decim
442  << " m_transverterMode: " << m_settings.m_transverterMode
443  << " m_transverterDeltaFrequency: " << m_settings.m_transverterDeltaFrequency
444  << " m_adcDither: " << m_settings.m_adcDither
445  << " m_adcPreamp: " << m_settings.m_adcPreamp
446  << " m_wideBand: " << m_settings.m_wideBand
447  << " m_attenuator: " << m_settings.m_attenuator;
448 
449  return true;
450 }
451 
453  SWGSDRangel::SWGDeviceState& response,
454  QString& errorMessage)
455 {
456  (void) errorMessage;
458  return 200;
459 }
460 
462  bool run,
463  SWGSDRangel::SWGDeviceState& response,
464  QString& errorMessage)
465 {
466  (void) errorMessage;
468  MsgStartStop *message = MsgStartStop::create(run);
469  m_inputMessageQueue.push(message);
470 
471  if (m_guiMessageQueue) // forward to GUI if any
472  {
473  MsgStartStop *msgToGUI = MsgStartStop::create(run);
474  m_guiMessageQueue->push(msgToGUI);
475  }
476 
477  return 200;
478 }
479 
482  QString& errorMessage)
483 {
484  (void) errorMessage;
486  response.getPerseusSettings()->init();
488  return 200;
489 }
490 
492  bool force,
493  const QStringList& deviceSettingsKeys,
494  SWGSDRangel::SWGDeviceSettings& response, // query + response
495  QString& errorMessage)
496 {
497  (void) errorMessage;
498  PerseusSettings settings = m_settings;
499 
500  if (deviceSettingsKeys.contains("centerFrequency")) {
502  }
503  if (deviceSettingsKeys.contains("LOppmTenths")) {
504  settings.m_LOppmTenths = response.getPerseusSettings()->getLOppmTenths();
505  }
506  if (deviceSettingsKeys.contains("devSampleRateIndex")) {
508  }
509  if (deviceSettingsKeys.contains("log2Decim")) {
510  settings.m_log2Decim = response.getPerseusSettings()->getLog2Decim();
511  }
512  if (deviceSettingsKeys.contains("adcDither")) {
513  settings.m_adcDither = response.getPerseusSettings()->getAdcDither() != 0;
514  }
515  if (deviceSettingsKeys.contains("adcPreamp")) {
516  settings.m_adcPreamp = response.getPerseusSettings()->getAdcPreamp() != 0;
517  }
518  if (deviceSettingsKeys.contains("wideBand")) {
519  settings.m_wideBand = response.getPerseusSettings()->getWideBand() != 0;
520  }
521  if (deviceSettingsKeys.contains("attenuator")) {
522  int attenuator = response.getPerseusSettings()->getAttenuator();
523  attenuator = attenuator < 0 ? 0 : attenuator > 3 ? 3 : attenuator;
524  settings.m_attenuator = (PerseusSettings::Attenuator) attenuator;
525  }
526  if (deviceSettingsKeys.contains("transverterDeltaFrequency")) {
528  }
529  if (deviceSettingsKeys.contains("transverterMode")) {
530  settings.m_transverterMode = response.getPerseusSettings()->getTransverterMode() != 0;
531  }
532  if (deviceSettingsKeys.contains("fileRecordName")) {
533  settings.m_fileRecordName = *response.getPerseusSettings()->getFileRecordName();
534  }
535  if (deviceSettingsKeys.contains("useReverseAPI")) {
536  settings.m_useReverseAPI = response.getPerseusSettings()->getUseReverseApi() != 0;
537  }
538  if (deviceSettingsKeys.contains("reverseAPIAddress")) {
540  }
541  if (deviceSettingsKeys.contains("reverseAPIPort")) {
542  settings.m_reverseAPIPort = response.getPerseusSettings()->getReverseApiPort();
543  }
544  if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
546  }
547 
548  MsgConfigurePerseus *msg = MsgConfigurePerseus::create(settings, force);
550 
551  if (m_guiMessageQueue) // forward to GUI if any
552  {
553  MsgConfigurePerseus *msgToGUI = MsgConfigurePerseus::create(settings, force);
554  m_guiMessageQueue->push(msgToGUI);
555  }
556 
557  webapiFormatDeviceSettings(response, settings);
558  return 200;
559 }
560 
563  QString& errorMessage)
564 {
565  (void) errorMessage;
567  response.getPerseusReport()->init();
568  webapiFormatDeviceReport(response);
569  return 200;
570 }
571 
573 {
575  response.getPerseusSettings()->setLOppmTenths(settings.m_LOppmTenths);
577  response.getPerseusSettings()->setLog2Decim(settings.m_log2Decim);
578  response.getPerseusSettings()->setAdcDither(settings.m_adcDither ? 1 : 0);
579  response.getPerseusSettings()->setAdcPreamp(settings.m_adcPreamp ? 1 : 0);
580  response.getPerseusSettings()->setWideBand(settings.m_wideBand ? 1 : 0);
581  response.getPerseusSettings()->setAttenuator((int) settings.m_attenuator);
583  response.getPerseusSettings()->setTransverterMode(settings.m_transverterMode ? 1 : 0);
584 
585  if (response.getPerseusSettings()->getFileRecordName()) {
586  *response.getPerseusSettings()->getFileRecordName() = settings.m_fileRecordName;
587  } else {
588  response.getPerseusSettings()->setFileRecordName(new QString(settings.m_fileRecordName));
589  }
590 
591  response.getPerseusSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
592 
593  if (response.getPerseusSettings()->getReverseApiAddress()) {
595  } else {
596  response.getPerseusSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
597  }
598 
601 }
602 
604 {
605  response.getPerseusReport()->setSampleRates(new QList<SWGSDRangel::SWGSampleRate*>);
606 
607  for (std::vector<uint32_t>::const_iterator it = getSampleRates().begin(); it != getSampleRates().end(); ++it)
608  {
610  response.getPerseusReport()->getSampleRates()->back()->setRate(*it);
611  }
612 }
613 
614 void PerseusInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const PerseusSettings& settings, bool force)
615 {
617  swgDeviceSettings->setDirection(0); // single Rx
618  swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
619  swgDeviceSettings->setDeviceHwType(new QString("Perseus"));
620  swgDeviceSettings->setPerseusSettings(new SWGSDRangel::SWGPerseusSettings());
621  SWGSDRangel::SWGPerseusSettings *swgPerseusSettings = swgDeviceSettings->getPerseusSettings();
622 
623  // transfer data that has been modified. When force is on transfer all data except reverse API data
624 
625  if (deviceSettingsKeys.contains("centerFrequency") || force) {
626  swgPerseusSettings->setCenterFrequency(settings.m_centerFrequency);
627  }
628  if (deviceSettingsKeys.contains("LOppmTenths") || force) {
629  swgPerseusSettings->setLOppmTenths(settings.m_LOppmTenths);
630  }
631  if (deviceSettingsKeys.contains("devSampleRateIndex") || force) {
632  swgPerseusSettings->setDevSampleRateIndex(settings.m_devSampleRateIndex);
633  }
634  if (deviceSettingsKeys.contains("log2Decim") || force) {
635  swgPerseusSettings->setLog2Decim(settings.m_log2Decim);
636  }
637  if (deviceSettingsKeys.contains("adcDither") || force) {
638  swgPerseusSettings->setAdcDither(settings.m_adcDither ? 1 : 0);
639  }
640  if (deviceSettingsKeys.contains("adcPreamp") || force) {
641  swgPerseusSettings->setAdcPreamp(settings.m_adcPreamp ? 1 : 0);
642  }
643  if (deviceSettingsKeys.contains("wideBand") || force) {
644  swgPerseusSettings->setWideBand(settings.m_wideBand ? 1 : 0);
645  }
646  if (deviceSettingsKeys.contains("attenuator") || force) {
647  swgPerseusSettings->setAttenuator((int) settings.m_attenuator);
648  }
649  if (deviceSettingsKeys.contains("transverterDeltaFrequency") || force) {
650  swgPerseusSettings->setTransverterDeltaFrequency(settings.m_transverterDeltaFrequency);
651  }
652  if (deviceSettingsKeys.contains("transverterMode") || force) {
653  swgPerseusSettings->setTransverterMode(settings.m_transverterMode ? 1 : 0);
654  }
655  if (deviceSettingsKeys.contains("fileRecordName") || force) {
656  swgPerseusSettings->setFileRecordName(new QString(settings.m_fileRecordName));
657  }
658 
659  QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings")
660  .arg(settings.m_reverseAPIAddress)
661  .arg(settings.m_reverseAPIPort)
662  .arg(settings.m_reverseAPIDeviceIndex);
663  m_networkRequest.setUrl(QUrl(deviceSettingsURL));
664  m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
665 
666  QBuffer *buffer=new QBuffer();
667  buffer->open((QBuffer::ReadWrite));
668  buffer->write(swgDeviceSettings->asJson().toUtf8());
669  buffer->seek(0);
670 
671  // Always use PATCH to avoid passing reverse API settings
672  m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
673 
674  delete swgDeviceSettings;
675 }
676 
678 {
680  swgDeviceSettings->setDirection(0); // single Rx
681  swgDeviceSettings->setOriginatorIndex(m_deviceAPI->getDeviceSetIndex());
682  swgDeviceSettings->setDeviceHwType(new QString("Perseus"));
683 
684  QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/run")
688  m_networkRequest.setUrl(QUrl(deviceSettingsURL));
689  m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
690 
691  QBuffer *buffer=new QBuffer();
692  buffer->open((QBuffer::ReadWrite));
693  buffer->write(swgDeviceSettings->asJson().toUtf8());
694  buffer->seek(0);
695 
696  if (start) {
697  m_networkManager->sendCustomRequest(m_networkRequest, "POST", buffer);
698  } else {
699  m_networkManager->sendCustomRequest(m_networkRequest, "DELETE", buffer);
700  }
701 
702  delete swgDeviceSettings;
703 }
704 
705 void PerseusInput::networkManagerFinished(QNetworkReply *reply)
706 {
707  QNetworkReply::NetworkError replyError = reply->error();
708 
709  if (replyError)
710  {
711  qWarning() << "PerseusInput::networkManagerFinished:"
712  << " error(" << (int) replyError
713  << "): " << replyError
714  << ": " << reply->errorString();
715  return;
716  }
717 
718  QString answer = reply->readAll();
719  answer.chop(1); // remove last \n
720  qDebug("PerseusInput::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
721 }
qint64 m_transverterDeltaFrequency
Attenuator m_attenuator
bool startDeviceEngine()
Start the device engine corresponding to the stream type.
Definition: deviceapi.cpp:253
void setLOppmTenths(qint32 l_oppm_tenths)
void webapiReverseSendSettings(QList< QString > &deviceSettingsKeys, const PerseusSettings &settings, bool force)
virtual int webapiRun(bool run, SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
static DevicePerseus & instance()
void webapiReverseSendStartStop(bool start)
QNetworkAccessManager * m_networkManager
Definition: perseusinput.h:154
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 setPerseusReport(SWGPerseusReport *perseus_report)
quint32 m_devSampleRateIndex
void setFileName(const QString &filename)
Definition: filerecord.cpp:59
uint getDeviceUID() const
Return the current device engine unique ID.
Definition: deviceapi.cpp:303
void setTransverterMode(qint32 transverter_mode)
void setUseReverseApi(qint32 use_reverse_api)
SWGPerseusReport * getPerseusReport()
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings &response, const PerseusSettings &settings)
void setReverseApiPort(qint32 reverse_api_port)
QString m_fileRecordName
void startRecording()
Definition: filerecord.cpp:105
const std::vector< uint32_t > & getSampleRates() const
Definition: perseusinput.h:143
MessageQueue m_inputMessageQueue
Input queue to the source.
void setAdcPreamp(qint32 adc_preamp)
virtual QString asJson() override
MessageQueue * getDeviceEngineInputMessageQueue()
Device engine message queue.
Definition: deviceapi.cpp:316
uint16_t m_reverseAPIDeviceIndex
int getSequenceFromSerial(const std::string &serial) const
Definition: deviceperseus.h:31
DeviceAPI * m_deviceAPI
Definition: perseusinput.h:146
SWGPerseusSettings * getPerseusSettings()
void networkManagerFinished(QNetworkReply *reply)
void closeDevice()
void setPerseusSettings(SWGPerseusSettings *perseus_settings)
void setDevSampleRateIndex(qint32 dev_sample_rate_index)
void setReverseApiAddress(QString *reverse_api_address)
virtual int getSampleRate() const
Sample rate exposed by the source.
bool initDeviceEngine()
Init the device engine corresponding to the stream type.
Definition: deviceapi.cpp:240
void setSampleRates(QList< SWGSampleRate *> *sample_rates)
void setLog2Decimation(unsigned int log2_decim)
void setOriginatorIndex(qint32 originator_index)
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport &response)
virtual int webapiSettingsPutPatch(bool force, const QStringList &deviceSettingsKeys, SWGSDRangel::SWGDeviceSettings &response, QString &errorMessage)
SampleSinkFifo m_sampleFifo
bool setSize(int size)
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
quint64 m_centerFrequency
void setAdcDither(qint32 adc_dither)
int getDeviceSetIndex() const
Definition: deviceapi.h:131
QByteArray serialize() const
FileRecord * m_fileSink
Definition: perseusinput.h:147
#define MESSAGE_CLASS_DEFINITION(Name, BaseClass)
Definition: message.h:52
void genUniqueFileName(uint deviceUID, int istream=-1)
Definition: filerecord.cpp:67
virtual const QString & getDeviceDescription() const
virtual int webapiRunGet(SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
void setDeviceCenterFrequency(quint64 freq, const PerseusSettings &settings)
virtual bool deserialize(const QByteArray &data)
virtual void stop()
void setTransverterDeltaFrequency(qint64 transverter_delta_frequency)
QString m_reverseAPIAddress
void stopRecording()
Definition: filerecord.cpp:117
int32_t i
Definition: decimators.h:244
perseus_descr * m_perseusDescriptor
Definition: perseusinput.h:152
std::vector< uint32_t > m_sampleRates
Definition: perseusinput.h:153
static MsgConfigurePerseus * create(const PerseusSettings &settings, bool force)
Definition: perseusinput.h:46
void setReverseApiDeviceIndex(qint32 reverse_api_device_index)
static bool match(const Message *message)
Definition: message.cpp:45
virtual void setCenterFrequency(qint64 centerFrequency)
QList< SWGSampleRate * > * getSampleRates()
virtual int webapiSettingsGet(SWGSDRangel::SWGDeviceSettings &response, QString &errorMessage)
void removeAncillarySink(BasebandSampleSink *sink, unsigned int index=0)
Removes it.
Definition: deviceapi.cpp:100
static MsgStartStop * create(bool startStop)
Definition: perseusinput.h:87
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
virtual bool start()
QNetworkRequest m_networkRequest
Definition: perseusinput.h:155
PerseusThread * m_perseusThread
Definition: perseusinput.h:151
bool deserialize(const QByteArray &data)
virtual bool handleMessage(const Message &message)
virtual int webapiReportGet(SWGSDRangel::SWGDeviceReport &response, QString &errorMessage)
virtual void destroy()
void getDeviceEngineStateStr(QString &state)
Definition: deviceapi.cpp:389
PerseusSettings m_settings
Definition: perseusinput.h:149
const QString & getSamplingDeviceSerial() const
Definition: deviceapi.h:121
void setCenterFrequency(qint64 center_frequency)
uint16_t m_reverseAPIPort
void setFileRecordName(QString *file_record_name)
void setLog2Decim(qint32 log2_decim)
#define PERSEUS_NBSAMPLES
Definition: perseusthread.h:29
const PerseusSettings & getSettings() const
Definition: perseusinput.h:43
void setAttenuator(qint32 attenuator)
virtual quint64 getCenterFrequency() const
Center frequency exposed by the source.
virtual QByteArray serialize() const
void setDirection(qint32 direction)
bool applySettings(const PerseusSettings &settings, bool force=false)
void setDeviceHwType(QString *device_hw_type)
virtual void init()
initializations to be done when all collaborating objects are created and possibly connected ...
QString m_deviceDescription
Definition: perseusinput.h:148