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.
devicesamplesink.h
Go to the documentation of this file.
1 // Copyright (C) 2016-2019 F4EXB //
3 // written by Edouard Griffiths //
4 // //
5 // This program is free software; you can redistribute it and/or modify //
6 // it under the terms of the GNU General Public License as published by //
7 // the Free Software Foundation as version 3 of the License, or //
8 // (at your option) any later version. //
9 // //
10 // This program is distributed in the hope that it will be useful, //
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
13 // GNU General Public License V3 for more details. //
14 // //
15 // You should have received a copy of the GNU General Public License //
16 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
18 
19 #ifndef SDRBASE_DSP_DEVICESAMPLESINK_H_
20 #define SDRBASE_DSP_DEVICESAMPLESINK_H_
21 
22 #include <QtGlobal>
23 
24 #include "samplesourcefifo.h"
25 #include "util/message.h"
26 #include "util/messagequeue.h"
27 #include "export.h"
28 
29 namespace SWGSDRangel
30 {
31  class SWGDeviceSettings;
32  class SWGDeviceState;
33  class SWGDeviceReport;
34 }
35 
36 class SDRBASE_API DeviceSampleSink : public QObject {
37  Q_OBJECT
38 public:
39  typedef enum {
40  FC_POS_INFRA = 0,
42  FC_POS_CENTER
43  } fcPos_t;
44 
46  virtual ~DeviceSampleSink();
47  virtual void destroy() = 0;
48 
49  virtual void init() = 0;
50  virtual bool start() = 0;
51  virtual void stop() = 0;
52 
53  virtual QByteArray serialize() const = 0;
54  virtual bool deserialize(const QByteArray& data) = 0;
55 
56  virtual const QString& getDeviceDescription() const = 0;
57  virtual int getSampleRate() const = 0;
58  virtual void setSampleRate(int sampleRate) = 0;
59  virtual quint64 getCenterFrequency() const = 0;
60  virtual void setCenterFrequency(qint64 centerFrequency) = 0;
61 
62  virtual bool handleMessage(const Message& message) = 0;
63 
64  virtual int webapiSettingsGet(
66  QString& errorMessage)
67  {
68  (void) response;
69  errorMessage = "Not implemented";
70  return 501;
71  }
72 
74  bool force,
75  const QStringList& deviceSettingsKeys,
77  QString& errorMessage)
78  {
79  (void) force;
80  (void) deviceSettingsKeys;
81  (void) response;
82  errorMessage = "Not implemented";
83  return 501;
84  }
85 
86  virtual int webapiRunGet(
88  QString& errorMessage)
89  {
90  (void) response;
91  errorMessage = "Not implemented";
92  return 501;
93  }
94 
95  virtual int webapiRun(bool run,
97  QString& errorMessage)
98  {
99  (void) run;
100  (void) response;
101  errorMessage = "Not implemented";
102  return 501;
103  }
104 
105  virtual int webapiReportGet(
107  QString& errorMessage)
108  {
109  (void) response;
110  errorMessage = "Not implemented";
111  return 501;
112  }
113 
114  MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
115  virtual void setMessageQueueToGUI(MessageQueue *queue) = 0; // pure virtual so that child classes must have to deal with this
116  MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
117  SampleSourceFifo* getSampleFifo() { return &m_sampleSourceFifo; }
118 
119  static qint64 calculateDeviceCenterFrequency(
120  quint64 centerFrequency,
121  qint64 transverterDeltaFrequency,
122  int log2Interp,
123  fcPos_t fcPos,
124  quint32 devSampleRate,
125  bool transverterMode = false);
126 
127  static qint64 calculateCenterFrequency(
128  quint64 deviceCenterFrequency,
129  qint64 transverterDeltaFrequency,
130  int log2Interp,
131  fcPos_t fcPos,
132  quint32 devSampleRate,
133  bool transverterMode = false);
134 
135  static qint32 calculateFrequencyShift(
136  int log2Interp,
137  fcPos_t fcPos,
138  quint32 devSampleRate);
139 
140 protected slots:
141  void handleInputMessages();
142 
143 protected:
147 };
148 
149 #endif /* SDRBASE_DSP_DEVICESAMPLESINK_H_ */
MessageQueue m_inputMessageQueue
Input queue to the sink.
MessageQueue * getInputMessageQueue()
SampleSourceFifo * getSampleFifo()
virtual int webapiSettingsPutPatch(bool force, const QStringList &deviceSettingsKeys, SWGSDRangel::SWGDeviceSettings &response, QString &errorMessage)
virtual int webapiSettingsGet(SWGSDRangel::SWGDeviceSettings &response, QString &errorMessage)
SampleSourceFifo m_sampleSourceFifo
virtual int webapiRunGet(SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
virtual int webapiRun(bool run, SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
#define SDRBASE_API
Definition: export.h:40
MessageQueue * getMessageQueueToGUI()
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
virtual int webapiReportGet(SWGSDRangel::SWGDeviceReport &response, QString &errorMessage)