bool HDeviceInfoPrivate::setDeviceType(const HResourceType& deviceType) { if (!deviceType.isValid()) { return false; } if (deviceType.type() != HResourceType::StandardDeviceType && deviceType.type() != HResourceType::VendorSpecifiedDeviceType) { return false; } m_deviceType = deviceType; return true; }
void setState( const HUdn& udn, const HResourceType& rt, HValidityCheckLevel checkLevel) { if (udn.isValid(checkLevel)) { switch(rt.type()) { case HResourceType::Undefined: m_udn = udn; m_type = HDiscoveryType::SpecificDevice; m_resourceType = rt; m_contents = udn.toString(); return; case HResourceType::StandardDeviceType: case HResourceType::VendorSpecifiedDeviceType: m_type = HDiscoveryType::SpecificDeviceWithType; break; case HResourceType::StandardServiceType: case HResourceType::VendorSpecifiedServiceType: m_type = HDiscoveryType::SpecificServiceWithType; break; default: Q_ASSERT(false); } m_contents = QString("%1::%2").arg(udn.toString(), rt.toString()); } else { switch(rt.type()) { case HResourceType::Undefined: m_udn = udn; m_type = HDiscoveryType::Undefined; m_resourceType = rt; m_contents = QString(); return; case HResourceType::StandardDeviceType: case HResourceType::VendorSpecifiedDeviceType: m_type = HDiscoveryType::DeviceType; break; case HResourceType::StandardServiceType: case HResourceType::VendorSpecifiedServiceType: m_type = HDiscoveryType::ServiceType; break; default: Q_ASSERT(false); } m_contents = QString("%1").arg(rt.toString()); } m_udn = udn; m_resourceType = rt; }