OpenHome::Net::ServiceType::ServiceType(const ServiceType& aServiceType) : iEnv(aServiceType.iEnv) , iVersion(aServiceType.iVersion) , iFullName(aServiceType.FullName()) { iDomain.Set(aServiceType.iDomain); iName.Set(aServiceType.iName); }
void CpiDeviceUpnp::GetServiceUri(Uri& aUri, const TChar* aType, const ServiceType& aServiceType) { Brn root = XmlParserBasic::Find("root", iXml); Brn device = XmlParserBasic::Find("device", root); Brn udn = XmlParserBasic::Find("UDN", device); if (!CpiDeviceUpnp::UdnMatches(udn, Udn())) { Brn deviceList = XmlParserBasic::Find("deviceList", device); do { Brn remaining; device.Set(XmlParserBasic::Find("device", deviceList, remaining)); udn.Set(XmlParserBasic::Find("UDN", device)); deviceList.Set(remaining); } while (!CpiDeviceUpnp::UdnMatches(udn, Udn())); } Brn serviceList = XmlParserBasic::Find("serviceList", device); Brn service; Brn serviceType; Brn devServiceTypeNoVer; const Brx& targServiceType = aServiceType.FullName(); // Must have backwards compatibility. Need to compare service type and version separately. Parser serviceParser = targServiceType; serviceParser.Next(':'); // urn serviceParser.Next(':'); // schema url serviceParser.Next(':'); // service serviceParser.Next(':'); // name Brn targServiceTypeNoVer(targServiceType.Ptr(), serviceParser.Index()); // full name minus ":x" (where x is version) do { Brn remaining; service.Set(XmlParserBasic::Find("service", serviceList, remaining)); serviceType.Set(XmlParserBasic::Find("serviceType", service)); serviceList.Set(remaining); // Parse service type and version separately. serviceParser.Set(serviceType); serviceParser.Next(':'); // urn serviceParser.Next(':'); // schema url serviceParser.Next(':'); // service serviceParser.Next(':'); // name devServiceTypeNoVer.Set(serviceType.Ptr(), serviceParser.Index()); // full name minus ":x" (where x is version) // MUST allow use of device with version >= target version } while (devServiceTypeNoVer != targServiceTypeNoVer); Brn path = XmlParserBasic::Find(aType, service); if (path.Bytes() == 0) { // no event url => service doesn't have any evented state variables THROW(XmlError); } // now create a uri using the scheme/host/port of the device xml location // plus the path we've just constructed Bws<40> base; // just need space for http://xxx.xxx.xxx.xxx:xxxxx aUri.Replace(iLocation); base.Append(aUri.Scheme()); base.Append("://"); base.Append(aUri.Host()); base.Append(':'); Ascii::AppendDec(base, aUri.Port()); aUri.Replace(base, path); }
void CpiDeviceUpnp::GetServiceUri(Uri& aUri, const TChar* aType, const ServiceType& aServiceType) { Brn root = XmlParserBasic::Find("root", iXml); Brn device = XmlParserBasic::Find("device", root); Brn udn = XmlParserBasic::Find("UDN", device); if (!CpiDeviceUpnp::UdnMatches(udn, Udn())) { Brn deviceList = XmlParserBasic::Find("deviceList", device); do { Brn remaining; device.Set(XmlParserBasic::Find("device", deviceList, remaining)); udn.Set(XmlParserBasic::Find("UDN", device)); deviceList.Set(remaining); } while (!CpiDeviceUpnp::UdnMatches(udn, Udn())); } Brn serviceList = XmlParserBasic::Find("serviceList", device); Brn service; Brn serviceType; const Brx& targServiceType = aServiceType.FullName(); do { Brn remaining; service.Set(XmlParserBasic::Find("service", serviceList, remaining)); serviceType.Set(XmlParserBasic::Find("serviceType", service)); serviceList.Set(remaining); } while (serviceType != targServiceType); Brn path = XmlParserBasic::Find(aType, service); if (path.Bytes() == 0) { // no event url => service doesn't have any evented state variables THROW(XmlError); } // now create a uri using the scheme/host/port of the device xml location // plus the path we've just constructed Bws<40> base; // just need space for http://xxx.xxx.xxx.xxx:xxxxx aUri.Replace(iLocation); base.Append(aUri.Scheme()); base.Append("://"); base.Append(aUri.Host()); base.Append(':'); Ascii::AppendDec(base, aUri.Port()); aUri.Replace(base, path); }