MPD  0.20.6
Device.hxx
Go to the documentation of this file.
1 /*
2  * Copyright 2003-2017 The Music Player Daemon Project
3  * http://www.musicpd.org
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef _UPNPDEV_HXX_INCLUDED_
21 #define _UPNPDEV_HXX_INCLUDED_
22 
23 #include <vector>
24 #include <string>
25 
35 struct UPnPService {
36  // e.g. urn:schemas-upnp-org:service:ConnectionManager:1
37  std::string serviceType;
38  std::string controlURL; // e.g.: /upnp/control/cm
39 
40  void clear()
41  {
42  serviceType.clear();
43  controlURL.clear();
44  }
45 };
46 
53 class UPnPDevice {
54 public:
55  // e.g. urn:schemas-upnp-org:device:MediaServer:1
56  std::string deviceType;
57  // e.g. MediaTomb
58  std::string friendlyName;
59  // Unique device number. This should match the deviceID in the
60  // discovery message. e.g. uuid:a7bdcd12-e6c1-4c7e-b588-3bbc959eda8d
61  std::string UDN;
62  // Base for all relative URLs. e.g. http://192.168.4.4:49152/
63  std::string URLBase;
64  // Manufacturer: e.g. D-Link, PacketVideo ("manufacturer")
65  std::string manufacturer;
66  // Model name: e.g. MediaTomb, DNS-327L ("modelName")
67  std::string modelName;
68  // Services provided by this device.
69  std::vector<UPnPService> services;
70 
71  UPnPDevice() = default;
72  UPnPDevice(const UPnPDevice &) = delete;
73  UPnPDevice(UPnPDevice &&) = default;
74  UPnPDevice &operator=(UPnPDevice &&) = default;
75 
76  ~UPnPDevice();
77 
82  void Parse(const std::string &url, const char *description);
83 };
84 
85 #endif /* _UPNPDEV_HXX_INCLUDED_ */
std::string manufacturer
Definition: Device.hxx:65
UPnPDevice()=default
UPnP Description phase: interpreting the device description which we downloaded from the URL obtained...
Definition: Device.hxx:35
std::string URLBase
Definition: Device.hxx:63
void Parse(const std::string &url, const char *description)
Build device from xml description downloaded from discovery.
std::string modelName
Definition: Device.hxx:67
std::string controlURL
Definition: Device.hxx:38
std::vector< UPnPService > services
Definition: Device.hxx:69
UPnPDevice & operator=(UPnPDevice &&)=default
Data holder for a UPnP device, parsed from the XML description obtained during discovery.
Definition: Device.hxx:53
std::string serviceType
Definition: Device.hxx:37
std::string deviceType
Definition: Device.hxx:56
std::string friendlyName
Definition: Device.hxx:58
std::string UDN
Definition: Device.hxx:61
void clear()
Definition: Device.hxx:40