MythTV  master
upnptasksearch.h
Go to the documentation of this file.
1 // Program Name: upnptasksearch.h
3 // Created : Oct. 24, 2005
4 //
5 // Purpose : UPnp Task to handle Discovery Responses
6 //
7 // Copyright (c) 2005 David Blain <dblain@mythtv.org>
8 //
9 // Licensed under the GPL v2 or later, see LICENSE for details
10 //
12 
13 #ifndef UPNPTASKSEARCH_H
14 #define UPNPTASKSEARCH_H
15 
16 // POSIX headers
17 #include <sys/types.h>
18 #ifndef _WIN32
19 #include <netinet/in.h>
20 #include <arpa/inet.h>
21 #endif
22 
23 // Qt headers
24 #include <QList>
25 #include <QHostAddress>
26 
27 // MythTV headers
28 #include "libmythbase/compat.h"
29 
30 #include "libmythupnp/msocketdevice.h"
31 #include "libmythupnp/upnp.h"
32 
35 //
36 // UPnpSearchTask Class Definition
37 //
40 
41 class UPnpSearchTask : public Task
42 {
43  protected:
44 
45  QList<QHostAddress> m_addressList;
47  std::chrono::seconds m_nMaxAge {1h};
48 
49  QHostAddress m_peerAddress;
51  QString m_sST;
52  QString m_sUDN;
53 
54 
55  protected:
56 
57  // Destructor protected to force use of Release Method
58 
59  ~UPnpSearchTask() override = default;
60 
61  void ProcessDevice ( MSocketDevice *pSocket, UPnpDevice *pDevice );
62  void SendMsg ( MSocketDevice *pSocket,
63  const QString& sST,
64  const QString& sUDN );
65 
66  public:
67 
68  UPnpSearchTask( int nServicePort,
69  QHostAddress peerAddress,
70  int nPeerPort,
71  QString sST,
72  QString sUDN );
73 
74  QString Name() override { return( "Search" ); } // Task
75  void Execute( TaskQueue *pQueue ) override; // Task
76 
77 };
78 
79 
80 #endif // UPNPTASKSEARCH_H
UPnpSearchTask::m_nServicePort
int m_nServicePort
Definition: upnptasksearch.h:46
UPnpSearchTask
Definition: upnptasksearch.h:41
UPnpSearchTask::SendMsg
void SendMsg(MSocketDevice *pSocket, const QString &sST, const QString &sUDN)
Definition: upnptasksearch.cpp:68
UPnpSearchTask::m_peerAddress
QHostAddress m_peerAddress
Definition: upnptasksearch.h:49
UPnpSearchTask::m_sST
QString m_sST
Definition: upnptasksearch.h:51
UPnpSearchTask::Execute
void Execute(TaskQueue *pQueue) override
Definition: upnptasksearch.cpp:162
TaskQueue
Definition: taskqueue.h:82
UPnpSearchTask::m_nMaxAge
std::chrono::seconds m_nMaxAge
Definition: upnptasksearch.h:47
UPnpSearchTask::UPnpSearchTask
UPnpSearchTask(int nServicePort, QHostAddress peerAddress, int nPeerPort, QString sST, QString sUDN)
Definition: upnptasksearch.cpp:48
UPnpSearchTask::m_nPeerPort
int m_nPeerPort
Definition: upnptasksearch.h:50
upnp.h
compat.h
Task
Definition: taskqueue.h:54
UPnpSearchTask::ProcessDevice
void ProcessDevice(MSocketDevice *pSocket, UPnpDevice *pDevice)
Definition: upnptasksearch.cpp:202
UPnpDevice
Definition: upnpdevice.h:102
UPnpSearchTask::Name
QString Name() override
Definition: upnptasksearch.h:74
UPnpSearchTask::m_addressList
QList< QHostAddress > m_addressList
Definition: upnptasksearch.h:45
UPnpSearchTask::~UPnpSearchTask
~UPnpSearchTask() override=default
UPnpSearchTask::m_sUDN
QString m_sUDN
Definition: upnptasksearch.h:52