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.
basebandsamplesink.h
Go to the documentation of this file.
1 // Copyright (C) 2016 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_SAMPLESINK_H
20 #define INCLUDE_SAMPLESINK_H
21 
22 #include <QObject>
23 #include "dsp/dsptypes.h"
24 #include "export.h"
25 #include "util/messagequeue.h"
26 #include "util/message.h"
27 
28 class Message;
29 
30 class SDRBASE_API BasebandSampleSink : public QObject {
31  Q_OBJECT
32 public:
36 
37  public:
38  const QThread* getThread() const { return m_thread; }
39 
40  static MsgThreadedSink* create(const QThread* thread)
41  {
42  return new MsgThreadedSink(thread);
43  }
44 
45  private:
46  const QThread *m_thread;
47 
48  MsgThreadedSink(const QThread *thread) :
49  Message(),
50  m_thread(thread)
51  { }
52  };
53 
55  virtual ~BasebandSampleSink();
56 
57  virtual void start() = 0;
58  virtual void stop() = 0;
59  virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly) = 0;
60  virtual bool handleMessage(const Message& cmd) = 0;
61 
62  MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
63  virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
64  MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
65 
66 protected:
69 
70 protected slots:
71  void handleInputMessages();
72 };
73 
74 #endif // INCLUDE_SAMPLESINK_H
MsgThreadedSink(const QThread *thread)
MessageQueue * getInputMessageQueue()
Get the queue for asynchronous inbound communication.
MessageQueue m_inputMessageQueue
Queue for asynchronous inbound communication.
MessageQueue * m_guiMessageQueue
Input message queue to the GUI.
virtual void setMessageQueueToGUI(MessageQueue *queue)
#define MESSAGE_CLASS_DECLARATION
Definition: message.h:43
MessageQueue * getMessageQueueToGUI()
static MsgThreadedSink * create(const QThread *thread)
#define SDRBASE_API
Definition: export.h:40