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.
remotesinkthread.h
Go to the documentation of this file.
1 // Copyright (C) 2018-2019 Edouard Griffiths, F4EXB. //
3 // //
4 // Remote sink channel (Rx) UDP sender thread //
5 // //
6 // SDRangel can work as a detached SDR front end. With this plugin it can //
7 // sends the I/Q samples stream to another SDRangel instance via UDP. //
8 // It is controlled via a Web REST API. //
9 // //
10 // This program is free software; you can redistribute it and/or modify //
11 // it under the terms of the GNU General Public License as published by //
12 // the Free Software Foundation as version 3 of the License, or //
13 // (at your option) any later version. //
14 // //
15 // This program is distributed in the hope that it will be useful, //
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
18 // GNU General Public License V3 for more details. //
19 // //
20 // You should have received a copy of the GNU General Public License //
21 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
23 
24 #ifndef PLUGINS_CHANNELRX_REMOTESINK_REMOTESINKTHREAD_H_
25 #define PLUGINS_CHANNELRX_REMOTESINK_REMOTESINKTHREAD_H_
26 
27 #include <QThread>
28 #include <QMutex>
29 #include <QWaitCondition>
30 #include <QHostAddress>
31 
32 #include "cm256cc/cm256.h"
33 
34 #include "util/message.h"
35 #include "util/messagequeue.h"
36 
37 class RemoteDataBlock;
38 class CM256;
39 class QUdpSocket;
40 
41 class RemoteSinkThread : public QThread {
42  Q_OBJECT
43 
44 public:
45  class MsgStartStop : public Message {
47 
48  public:
49  bool getStartStop() const { return m_startStop; }
50 
51  static MsgStartStop* create(bool startStop) {
52  return new MsgStartStop(startStop);
53  }
54 
55  protected:
57 
59  Message(),
60  m_startStop(startStop)
61  { }
62  };
63 
64  RemoteSinkThread(QObject* parent = 0);
66 
67  void startStop(bool start);
68 
69 public slots:
70  void processDataBlock(RemoteDataBlock *dataBlock);
71 
72 private:
74  QWaitCondition m_startWaiter;
75  volatile bool m_running;
76 
77  CM256 m_cm256;
78  CM256 *m_cm256p;
79 
80  QHostAddress m_address;
81  QUdpSocket *m_socket;
82 
84 
85  void startWork();
86  void stopWork();
87 
88  void run();
89  void handleDataBlock(RemoteDataBlock& dataBlock);
90 
91 private slots:
92  void handleInputMessages();
93 };
94 
95 #endif // PLUGINS_CHANNELRX_REMOTESINK_REMOTESINKTHREAD_H_
96 
QUdpSocket * m_socket
QHostAddress m_address
RemoteSinkThread(QObject *parent=0)
static MsgStartStop * create(bool startStop)
MessageQueue m_inputMessageQueue
void handleDataBlock(RemoteDataBlock &dataBlock)
#define MESSAGE_CLASS_DECLARATION
Definition: message.h:43
QWaitCondition m_startWaiter
volatile bool m_running
void startStop(bool start)
void processDataBlock(RemoteDataBlock *dataBlock)