1 /*****************************************************************
3 | Platinum - UPnP Engine
5 | Copyright (c) 2004-2010, Plutinosoft, LLC.
7 | http://www.plutinosoft.com
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.
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
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.
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
33 ****************************************************************/
36 UPnP Devices and ControlPoints Manager
42 /*----------------------------------------------------------------------
44 +---------------------------------------------------------------------*/
45 #include "PltTaskManager.h"
46 #include "PltCtrlPoint.h"
47 #include "PltDeviceHost.h"
48 #include "PltUtilities.h"
50 /*----------------------------------------------------------------------
52 +---------------------------------------------------------------------*/
53 #define PLT_DLNA_SSDP_DELAY 0.05f
54 #define PLT_DLNA_SSDP_DELAY_GROUP 0.2f
56 /*----------------------------------------------------------------------
58 +---------------------------------------------------------------------*/
59 class PLT_SsdpListenTask
;
61 /*----------------------------------------------------------------------
63 +---------------------------------------------------------------------*/
65 The PLT_UPnP class maintains a list of devices (PLT_DeviceHost) to advertise and/or
66 control points (PLT_CtrlPoint).
72 Create a UPnP instance.
78 Add and start a device inside this UPnP context.
79 @param device device to start.
81 NPT_Result
AddDevice(PLT_DeviceHostReference
& device
);
84 Add and start a control point inside this UPnP context.
85 @param ctrlpoint control point to start.
87 NPT_Result
AddCtrlPoint(PLT_CtrlPointReference
& ctrlpoint
);
90 Remove an existing device from this UPnP context.
91 @param device device to stop.
93 NPT_Result
RemoveDevice(PLT_DeviceHostReference
& device
);
96 Remove an existing control point from this UPnP context.
97 @param ctrlpoint control point to stop.
99 NPT_Result
RemoveCtrlPoint(PLT_CtrlPointReference
& ctrlpoint
);
102 Start the UPnP context and all existing devices and control points
108 Stop the UPnP context and all existing devices and control points
114 Return the UPnP Engine state.
115 @return True if the UPnP engine is running.
117 bool IsRunning() { return m_Started
; }
120 When a device and a control point are added to the same UPnP context, it is
121 desired that the device be not discovered by the control point. For example when
122 creating a combo UPnP Renderer/CtrlPoint. This methods tells the control point
123 to ignore devices associated with the same UPnP context.
124 @param ignore boolean to ignore devices in context
126 void SetIgnoreLocalUUIDs(bool ignore
) { m_IgnoreLocalUUIDs
= ignore
; }
131 NPT_List
<PLT_DeviceHostReference
> m_Devices
;
132 NPT_List
<PLT_CtrlPointReference
> m_CtrlPoints
;
133 NPT_Reference
<PLT_TaskManager
> m_TaskManager
;
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
139 PLT_SsdpListenTask
* m_SsdpListenTask
;
140 bool m_IgnoreLocalUUIDs
;
143 #endif /* _PLT_UPNP_H_ */