xbmc
PltUPnP.h
Go to the documentation of this file.
1 /*****************************************************************
2 |
3 | Platinum - UPnP Engine
4 |
5 | Copyright (c) 2004-2010, Plutinosoft, LLC.
6 | All rights reserved.
7 | http://www.plutinosoft.com
8 |
9 | This program is free software; you can redistribute it and/or
10 | modify it under the terms of the GNU General Public License
11 | as published by the Free Software Foundation; either version 2
12 | of the License, or (at your option) any later version.
13 |
14 | OEMs, ISVs, VARs and other distributors that combine and
15 | distribute commercially licensed software with Platinum software
16 | and do not wish to distribute the source code for the commercially
17 | licensed software under version 2, or (at your option) any later
18 | version, of the GNU General Public License (the "GPL") must enter
19 | into a commercial license agreement with Plutinosoft, LLC.
20 | licensing@plutinosoft.com
21 |
22 | This program is distributed in the hope that it will be useful,
23 | but WITHOUT ANY WARRANTY; without even the implied warranty of
24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 | GNU General Public License for more details.
26 |
27 | You should have received a copy of the GNU General Public License
28 | along with this program; see the file LICENSE.txt. If not, write to
29 | the Free Software Foundation, Inc.,
30 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 | http://www.gnu.org/licenses/gpl-2.0.html
32 |
33 ****************************************************************/
34 
39 #ifndef _PLT_UPNP_H_
40 #define _PLT_UPNP_H_
41 
42 /*----------------------------------------------------------------------
43 | includes
44 +---------------------------------------------------------------------*/
45 #include "PltTaskManager.h"
46 #include "PltCtrlPoint.h"
47 #include "PltDeviceHost.h"
48 #include "PltUtilities.h"
49 
50 /*----------------------------------------------------------------------
51 | constants
52 +---------------------------------------------------------------------*/
53 #define PLT_DLNA_SSDP_DELAY 0.05f
54 #define PLT_DLNA_SSDP_DELAY_GROUP 0.2f
55 
56 /*----------------------------------------------------------------------
57 | forward definitions
58 +---------------------------------------------------------------------*/
59 class PLT_SsdpListenTask;
60 
61 /*----------------------------------------------------------------------
62 | PLT_UPnP class
63 +---------------------------------------------------------------------*/
68 class PLT_UPnP
69 {
70 public:
74  PLT_UPnP();
75  ~PLT_UPnP();
76 
81  NPT_Result AddDevice(PLT_DeviceHostReference& device);
82 
87  NPT_Result AddCtrlPoint(PLT_CtrlPointReference& ctrlpoint);
88 
93  NPT_Result RemoveDevice(PLT_DeviceHostReference& device);
94 
99  NPT_Result RemoveCtrlPoint(PLT_CtrlPointReference& ctrlpoint);
100 
105  NPT_Result Start();
106 
111  NPT_Result Stop();
112 
117  bool IsRunning() { return m_Started; }
118 
126  void SetIgnoreLocalUUIDs(bool ignore) { m_IgnoreLocalUUIDs = ignore; }
127 
128 private:
129  // members
130  NPT_Mutex m_Lock;
133  NPT_Reference<PLT_TaskManager> m_TaskManager;
134 
135  // Since we can only have one socket listening on port 1900,
136  // we create it in here and we will attach every control points
137  // and devices to it when they're added
138  bool m_Started;
139  PLT_SsdpListenTask* m_SsdpListenTask;
140  bool m_IgnoreLocalUUIDs;
141 };
142 
143 #endif /* _PLT_UPNP_H_ */
void SetIgnoreLocalUUIDs(bool ignore)
When a device and a control point are added to the same UPnP context, it is desired that the device b...
Definition: PltUPnP.h:126
NPT_Result RemoveCtrlPoint(PLT_CtrlPointReference &ctrlpoint)
Remove an existing control point from this UPnP context.
Definition: PltUPnP.cpp:288
NPT_Result AddCtrlPoint(PLT_CtrlPointReference &ctrlpoint)
Add and start a control point inside this UPnP context.
Definition: PltUPnP.cpp:261
The PLT_UPnP class maintains a list of devices (PLT_DeviceHost) to advertise and/or control points (P...
Definition: PltUPnP.h:68
The PLT_SsdpListenTask class is used to listen for incoming SSDP packets and keep track of a list of ...
Definition: PltSsdp.h:310
UPnP ControlPoint.
Definition: NptThreads.h:76
NPT_Result Start()
Start the UPnP context and all existing devices and control points associated with it...
Definition: PltUPnP.cpp:155
PLT_UPnP()
Create a UPnP instance.
Definition: PltUPnP.cpp:132
bool IsRunning()
Return the UPnP Engine state.
Definition: PltUPnP.h:117
NPT_Result Stop()
Stop the UPnP context and all existing devices and control points associated with it...
Definition: PltUPnP.cpp:194
NPT_Result AddDevice(PLT_DeviceHostReference &device)
Add and start a device inside this UPnP context.
Definition: PltUPnP.cpp:219
UPnP Device.
Runnable Tasks Manager.
NPT_Result RemoveDevice(PLT_DeviceHostReference &device)
Remove an existing device from this UPnP context.
Definition: PltUPnP.cpp:246
Definition: NptList.h:54