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.
devicesamplesource.h
Go to the documentation of this file.
1 // Copyright (C) 2015 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 INCLUDE_SAMPLESOURCE_H
20 #define INCLUDE_SAMPLESOURCE_H
21 
22 #include <QtGlobal>
23 #include <QByteArray>
24 
25 #include "samplesinkfifo.h"
26 #include "util/message.h"
27 #include "util/messagequeue.h"
28 #include "export.h"
29 
30 namespace SWGSDRangel
31 {
32  class SWGDeviceSettings;
33  class SWGDeviceState;
34  class SWGDeviceReport;
35 }
36 
37 class SDRBASE_API DeviceSampleSource : public QObject {
38  Q_OBJECT
39 public:
40  typedef enum {
41  FC_POS_INFRA = 0,
43  FC_POS_CENTER
44  } fcPos_t;
45 
46  typedef enum {
47  FSHIFT_STD = 0, // Standard Rx independent
48  FSHIFT_TXSYNC // Follows same scheme as Tx
50 
52  virtual ~DeviceSampleSource();
53  virtual void destroy() = 0;
54 
55  virtual void init() = 0;
56  virtual bool start() = 0;
57  virtual void stop() = 0;
58 
59  virtual QByteArray serialize() const = 0;
60  virtual bool deserialize(const QByteArray& data) = 0;
61 
62  virtual const QString& getDeviceDescription() const = 0;
63  virtual int getSampleRate() const = 0;
64  virtual void setSampleRate(int sampleRate) = 0;
65  virtual quint64 getCenterFrequency() const = 0;
66  virtual void setCenterFrequency(qint64 centerFrequency) = 0;
67 
68  virtual bool handleMessage(const Message& message) = 0;
69 
70  virtual int webapiSettingsGet(
72  QString& errorMessage)
73  {
74  (void) response;
75  errorMessage = "Not implemented";
76  return 501;
77  }
78 
80  bool force,
81  const QStringList& deviceSettingsKeys,
83  QString& errorMessage)
84  {
85  (void) force;
86  (void) deviceSettingsKeys;
87  (void) response;
88  errorMessage = "Not implemented";
89  return 501;
90  }
91 
92  virtual int webapiRunGet(
94  QString& errorMessage)
95  {
96  (void) response;
97  errorMessage = "Not implemented";
98  return 501;
99  }
100 
101  virtual int webapiRun(bool run,
102  SWGSDRangel::SWGDeviceState& response,
103  QString& errorMessage)
104  {
105  (void) run;
106  (void) response;
107  errorMessage = "Not implemented";
108  return 501;
109  }
110 
111  virtual int webapiReportGet(
113  QString& errorMessage)
114  {
115  (void) response;
116  errorMessage = "Not implemented";
117  return 501;
118  }
119 
120  MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
121  virtual void setMessageQueueToGUI(MessageQueue *queue) = 0; // pure virtual so that child classes must have to deal with this
122  MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
123  SampleSinkFifo* getSampleFifo() { return &m_sampleFifo; }
124 
125  static qint64 calculateDeviceCenterFrequency(
126  quint64 centerFrequency,
127  qint64 transverterDeltaFrequency,
128  int log2Decim,
129  fcPos_t fcPos,
130  quint32 devSampleRate,
131  FrequencyShiftScheme frequencyShiftScheme,
132  bool transverterMode = false
133  );
134 
135  static qint64 calculateCenterFrequency(
136  quint64 deviceCenterFrequency,
137  qint64 transverterDeltaFrequency,
138  int log2Decim,
139  fcPos_t fcPos,
140  quint32 devSampleRate,
141  FrequencyShiftScheme frequencyShiftScheme,
142  bool transverterMode = false
143  );
144 
145  static qint32 calculateFrequencyShift(
146  int log2Decim,
147  fcPos_t fcPos,
148  quint32 devSampleRate,
149  FrequencyShiftScheme frequencyShiftScheme
150  );
151 
152 protected slots:
153  void handleInputMessages();
154 
155 protected:
159 };
160 
161 #endif // INCLUDE_SAMPLESOURCE_H
SampleSinkFifo * getSampleFifo()
MessageQueue m_inputMessageQueue
Input queue to the source.
MessageQueue * getInputMessageQueue()
SampleSinkFifo m_sampleFifo
MessageQueue * getMessageQueueToGUI()
virtual int webapiReportGet(SWGSDRangel::SWGDeviceReport &response, QString &errorMessage)
virtual int webapiSettingsPutPatch(bool force, const QStringList &deviceSettingsKeys, SWGSDRangel::SWGDeviceSettings &response, QString &errorMessage)
virtual int webapiRun(bool run, SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
virtual int webapiRunGet(SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
#define SDRBASE_API
Definition: export.h:40
virtual int webapiSettingsGet(SWGSDRangel::SWGDeviceSettings &response, QString &errorMessage)