MythTV  master
mythudplistener.h
Go to the documentation of this file.
1 #ifndef MYTHUDPLISTENER_H
2 #define MYTHUDPLISTENER_H
3 
4 // Qt
5 #include <QObject>
6 
7 // MythTV
8 #include "libmythbase/mthread.h"
10 
11 class MythUDPListener : public QObject
12 {
13  friend class MythUDP;
14 
15  Q_OBJECT
16 
17  signals:
18  void EnableUDPListener(bool Enable = true);
19 
20  protected:
22  ~MythUDPListener() override;
23 
24  private slots:
25  void DoEnable(bool Enable = true);
26  static void Process(const QByteArray &Buffer, const QHostAddress& /*Sender*/, quint16 /*SenderPort*/);
27 
28  private:
29  Q_DISABLE_COPY(MythUDPListener)
30  ServerPool* m_socketPool { nullptr };
31 };
32 
33 class MythUDP
34 {
35  public:
36  static void EnableUDPListener(bool Enable = true);
37  static void StopUDPListener();
38 
39  private:
40  Q_DISABLE_COPY(MythUDP)
41  static MythUDP& Instance();
42  MythUDP();
43  ~MythUDP();
44 
46  MThread* m_thread { nullptr };
47 };
48 
49 #endif
MythUDP::m_thread
MThread * m_thread
Definition: mythudplistener.h:46
MythUDP
Definition: mythudplistener.h:33
ServerPool
Manages a collection of sockets listening on different ports.
Definition: serverpool.h:59
MythUDPListener::Process
static void Process(const QByteArray &Buffer, const QHostAddress &, quint16)
Definition: mythudplistener.cpp:58
MythUDP::Instance
static MythUDP & Instance()
Definition: mythudplistener.cpp:186
MythUDPListener::EnableUDPListener
void EnableUDPListener(bool Enable=true)
MythUDPListener
Definition: mythudplistener.h:11
MythUDP::EnableUDPListener
static void EnableUDPListener(bool Enable=true)
Definition: mythudplistener.cpp:173
MythUDP::~MythUDP
~MythUDP()
Definition: mythudplistener.cpp:202
Buffer
Definition: MythExternControl.h:36
MythUDPListener::MythUDPListener
MythUDPListener()
Definition: mythudplistener.cpp:17
MythUDP::m_listener
MythUDPListener * m_listener
Definition: mythudplistener.h:45
serverpool.h
MThread
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:48
MythUDPListener::~MythUDPListener
~MythUDPListener() override
Definition: mythudplistener.cpp:22
mthread.h
MythUDPListener::m_socketPool
ServerPool * m_socketPool
Definition: mythudplistener.h:30
MythUDP::MythUDP
MythUDP()
Definition: mythudplistener.cpp:192
MythUDPListener::DoEnable
void DoEnable(bool Enable=true)
Definition: mythudplistener.cpp:27
MythUDP::StopUDPListener
static void StopUDPListener()
Definition: mythudplistener.cpp:213