BroadcastSm::BroadcastSm(const SequenceNumber &sequence_number, const ServiceType &service_type, const SmeAddress &source_addr, const MessageId &message_id, const PriorityFlag &priority_flag, const Time &schedule_delivery_time, const Time &validity_period, const ReplaceIfPresentFlag &replace_if_present_flag, const DataCoding &data_coding, const SmDefaultMsgId &sm_default_msg_id) : TlvsHeader(CommandLength(min_length), CommandId(CommandId::BroadcastSm), CommandStatus(CommandStatus::ESME_ROK), sequence_number), service_type(service_type), source_addr(source_addr), message_id(message_id), priority_flag(priority_flag), schedule_delivery_time(schedule_delivery_time), validity_period(validity_period), replace_if_present_flag(replace_if_present_flag), data_coding(data_coding), sm_default_msg_id(sm_default_msg_id) { Header::updateLength(service_type.length() + source_addr.getAddress().length() + message_id.length() + schedule_delivery_time.length() + validity_period.length()); }
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); }
DataSm::DataSm(const SequenceNumber &sequence_number, const ServiceType &service_type, const SmeAddress &source_addr, const SmeAddress &destination_addr, const EsmClass &esm_class, const RegisteredDelivery ®istered_delivery, const DataCoding &data_coding) : TlvsHeader(CommandLength(min_length), CommandId(CommandId::DataSm), CommandStatus(CommandStatus::ESME_ROK), sequence_number), service_type(service_type), source_addr(source_addr), destination_addr(destination_addr), esm_class(esm_class), registered_delivery(registered_delivery), data_coding(data_coding) { Header::updateLength(service_type.length() + source_addr.getAddress().length() + destination_addr.getAddress().length()); }