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.
devicesamplemimo.h
Go to the documentation of this file.
1 // Copyright (C) 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_DEVICESAMPLEMIMO_H_
20 #define SDRBASE_DSP_DEVICESAMPLEMIMO_H_
21 
22 #include <vector>
23 
24 #include "samplesourcefifo.h"
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 DeviceSampleMIMO : public QObject {
38  Q_OBJECT
39 public:
40  typedef enum {
41  FC_POS_INFRA = 0,
43  FC_POS_CENTER
44  } fcPos_t;
45 
47  virtual ~DeviceSampleMIMO();
48  virtual void destroy() = 0;
49 
50  virtual void init() = 0;
51  virtual bool start() = 0;
52  virtual void stop() = 0;
53 
54  virtual QByteArray serialize() const = 0;
55  virtual bool deserialize(const QByteArray& data) = 0;
56 
57  virtual const QString& getDeviceDescription() const = 0;
58 
59  virtual int getSinkSampleRate(int index) const = 0;
60  virtual void setSinkSampleRate(int sampleRate, int index) = 0;
61  virtual quint64 getSinkCenterFrequency(int index) const = 0;
62  virtual void setSinkCenterFrequency(qint64 centerFrequency, int index) = 0;
63 
64  virtual int getSourceSampleRate(int index) const = 0;
65  virtual void setSourceSampleRate(int sampleRate, int index) = 0;
66  virtual quint64 getSourceCenterFrequency(int index) const = 0;
67  virtual void setSourceCenterFrequency(qint64 centerFrequency, int index) = 0;
68 
69  virtual bool handleMessage(const Message& message) = 0;
70 
71  virtual int webapiSettingsGet(
73  QString& errorMessage)
74  {
75  (void) response;
76  errorMessage = "Not implemented";
77  return 501;
78  }
79 
81  bool force,
82  const QStringList& deviceSettingsKeys,
84  QString& errorMessage)
85  {
86  (void) force;
87  (void) deviceSettingsKeys;
88  (void) response;
89  errorMessage = "Not implemented";
90  return 501;
91  }
92 
93  virtual int webapiRunGet(
95  QString& errorMessage)
96  {
97  (void) response;
98  errorMessage = "Not implemented";
99  return 501;
100  }
101 
102  virtual int webapiRun(bool run,
103  SWGSDRangel::SWGDeviceState& response,
104  QString& errorMessage)
105  {
106  (void) run;
107  (void) response;
108  errorMessage = "Not implemented";
109  return 501;
110  }
111 
112  virtual int webapiReportGet(
114  QString& errorMessage)
115  {
116  (void) response;
117  errorMessage = "Not implemented";
118  return 501;
119  }
120 
121  MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
122  virtual void setMessageQueueToGUI(MessageQueue *queue) = 0; // pure virtual so that child classes must have to deal with this
123  MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
124 
125  unsigned int getNbSourceFifos() const { return m_sampleSourceFifos.size(); }
126  unsigned int getNbSinkFifos() const { return m_sampleSinkFifos.size(); }
127  SampleSourceFifo* getSampleSourceFifo(unsigned int index);
128  SampleSinkFifo* getSampleSinkFifo(unsigned int index);
129  // Streams and FIFOs are in opposed source/sink type whick makes it confusing when stream direction is involved:
130  // Rx: source stream -> sink FIFO -> channel sinks
131  // Tx: sink stream <- source FIFO <- channel sources
132  unsigned int getNbSourceStreams() const { return m_sampleSinkFifos.size(); }
133  unsigned int getNbSinkStreams() const { return m_sampleSourceFifos.size(); }
134 
135 protected slots:
136  void handleInputMessages();
137 
138 protected:
139  std::vector<SampleSourceFifo> m_sampleSourceFifos;
140  std::vector<SampleSinkFifo> m_sampleSinkFifos;
143 };
144 
145 #endif // SDRBASE_DSP_DEVICESAMPLEMIMO_H_
unsigned int getNbSourceFifos() const
Get the number of Tx FIFOs.
virtual int webapiSettingsPutPatch(bool force, const QStringList &deviceSettingsKeys, SWGSDRangel::SWGDeviceSettings &response, QString &errorMessage)
MessageQueue * getInputMessageQueue()
virtual int webapiRunGet(SWGSDRangel::SWGDeviceState &response, QString &errorMessage)
unsigned int getNbSourceStreams() const
Commodity function same as getNbSinkFifos (Rx or source streams)
virtual int webapiSettingsGet(SWGSDRangel::SWGDeviceSettings &response, QString &errorMessage)
virtual int webapiReportGet(SWGSDRangel::SWGDeviceReport &response, QString &errorMessage)
std::vector< SampleSinkFifo > m_sampleSinkFifos
Rx FIFOs.
std::vector< SampleSourceFifo > m_sampleSourceFifos
Tx FIFOs.
unsigned int getNbSinkStreams() const
Commodity function same as getNbSourceFifos (Tx or sink streams)
unsigned int getNbSinkFifos() const
Get the number of Rx FIFOs.
MessageQueue * getMessageQueueToGUI()
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
MessageQueue m_inputMessageQueue
Input queue to the sink.
#define SDRBASE_API
Definition: export.h:40
virtual int webapiRun(bool run, SWGSDRangel::SWGDeviceState &response, QString &errorMessage)