Switch to unified view

a/libupnpp/description.hxx b/libupnpp/description.hxx
...
...
24
24
25
#include <vector>
25
#include <vector>
26
#include <string>
26
#include <string>
27
#include <sstream>
27
#include <sstream>
28
28
29
#include "upnpp_p.hxx"
30
31
/**
29
/**
32
 * Data holder for a UPnP service, parsed from the XML description
30
 * Data holder for a UPnP service, parsed from the XML description
33
 * downloaded after discovery yielded its URL.
31
 * downloaded after discovery yielded its URL.
34
 */
32
 */
35
class UPnPServiceDesc {
33
class UPnPServiceDesc {
...
...
42
    std::string controlURL; // e.g.: /upnp/control/cm
40
    std::string controlURL; // e.g.: /upnp/control/cm
43
    std::string eventSubURL; // e.g.: /upnp/event/cm
41
    std::string eventSubURL; // e.g.: /upnp/event/cm
44
42
45
    void clear()
43
    void clear()
46
    {
44
    {
47
      serviceType.clear();
45
        serviceType.clear();
48
      serviceId.clear();
46
        serviceId.clear();
49
      SCPDURL.clear();
47
        SCPDURL.clear();
50
      controlURL.clear();
48
        controlURL.clear();
51
      eventSubURL.clear();
49
        eventSubURL.clear();
52
  }
50
    }
53
51
54
    std::string dump() const
52
    std::string dump() const
55
    {
53
    {
56
      std::ostringstream os;
54
        std::ostringstream os;
57
      os << "SERVICE {serviceType [" << serviceType <<
55
        os << "SERVICE {serviceType [" << serviceType <<
58
          "] serviceId [" << serviceId <<
56
            "] serviceId [" << serviceId <<
59
          "] SCPDURL [" << SCPDURL <<
57
            "] SCPDURL [" << SCPDURL <<
60
          "] controlURL [" << controlURL <<
58
            "] controlURL [" << controlURL <<
61
          "] eventSubURL [" << eventSubURL <<
59
            "] eventSubURL [" << eventSubURL <<
62
          "] }" << std::endl;
60
            "] }" << std::endl;
63
      return os.str();
61
        return os.str();
64
  }
62
    }
65
};
63
};
66
64
67
/**
65
/**
68
 * Data holder for a UPnP device, parsed from the XML description obtained
66
 * Data holder for a UPnP device, parsed from the XML description obtained
69
 * during discovery.
67
 * during discovery.
...
...
74
public:
72
public:
75
    /** Build device from xml description downloaded from discovery
73
    /** Build device from xml description downloaded from discovery
76
     * @param url where the description came from
74
     * @param url where the description came from
77
     * @param description the xml device description
75
     * @param description the xml device description
78
     */
76
     */
79
    UPnPDeviceDesc(const string& url, const string& description);
77
    UPnPDeviceDesc(const std::string& url, const std::string& description);
80
78
81
    UPnPDeviceDesc() : ok(false) {}
79
    UPnPDeviceDesc() : ok(false) {}
82
80
83
    bool ok;
81
    bool ok;
84
    // e.g. urn:schemas-upnp-org:device:MediaServer:1
82
    // e.g. urn:schemas-upnp-org:device:MediaServer:1
...
...
92
    std::string URLBase;
90
    std::string URLBase;
93
    // Manufacturer: e.g. D-Link, PacketVideo ("manufacturer")
91
    // Manufacturer: e.g. D-Link, PacketVideo ("manufacturer")
94
    std::string manufacturer;
92
    std::string manufacturer;
95
    // Model name: e.g. MediaTomb, DNS-327L ("modelName")
93
    // Model name: e.g. MediaTomb, DNS-327L ("modelName")
96
    std::string modelName;
94
    std::string modelName;
95
97
    // Services provided by this device.
96
    // Services provided by this device.
98
    std::vector<UPnPServiceDesc> services;
97
    std::vector<UPnPServiceDesc> services;
99
98
100
    std::string dump() const
99
    std::string dump() const
101
    {
100
    {
102
      std::ostringstream os;
101
        std::ostringstream os;
103
      os << "DEVICE " << " {deviceType [" << deviceType <<
102
        os << "DEVICE " << " {deviceType [" << deviceType <<
104
          "] friendlyName [" << friendlyName <<
103
            "] friendlyName [" << friendlyName <<
105
          "] UDN [" << UDN <<
104
            "] UDN [" << UDN <<
106
          "] URLBase [" << URLBase << "] Services:" << std::endl;
105
            "] URLBase [" << URLBase << "] Services:" << std::endl;
107
      for (auto& serv: services) {
106
        for (auto& serv: services) {
108
          os << "    " << serv.dump();
107
            os << "    " << serv.dump();
109
      }
108
        }
110
      os << "}" << std::endl;
109
        os << "}" << std::endl;
111
      return os.str();
110
        return os.str();
112
  }
111
    }
113
};
112
};
114
113
115
typedef std::vector<UPnPServiceDesc>::iterator DevServIt;
114
typedef std::vector<UPnPServiceDesc>::iterator DevServIt;
116
115
117
#endif /* _UPNPDEV_HXX_INCLUDED_ */
116
#endif /* _UPNPDEV_HXX_INCLUDED_ */