QString UPnpDeviceDesc::FindDeviceUDN( UPnpDevice *pDevice, QString sST ) { if (sST == pDevice->m_sDeviceType) return pDevice->GetUDN(); if (sST == pDevice->GetUDN()) return sST; // ---------------------------------------------------------------------- // Check for matching Service // ---------------------------------------------------------------------- UPnpServiceList::const_iterator sit = pDevice->m_listServices.begin(); for (; sit != pDevice->m_listServices.end(); ++sit) { if (sST == (*sit)->m_sServiceType) return pDevice->GetUDN(); } // ---------------------------------------------------------------------- // Check Embedded Devices for a Match // ---------------------------------------------------------------------- UPnpDeviceList::const_iterator dit = pDevice->m_listDevices.begin(); for (; dit != pDevice->m_listDevices.end(); ++dit) { QString sUDN = FindDeviceUDN( *dit, sST ); if (sUDN.length() > 0) return sUDN; } return ""; }
QString UPnpDeviceDesc::FindDeviceUDN( UPnpDevice *pDevice, QString sST ) { // Ignore device version, UPnP is backwards compatible if (sST.section(':', 0, -2) == pDevice->m_sDeviceType.section(':', 0, -2)) return pDevice->GetUDN(); if (sST.section(':', 0, -2) == pDevice->GetUDN().section(':', 0, -2)) return sST; // ---------------------------------------------------------------------- // Check for matching Service // ---------------------------------------------------------------------- UPnpServiceList::const_iterator sit = pDevice->m_listServices.begin(); for (; sit != pDevice->m_listServices.end(); ++sit) { // Ignore the service version, UPnP is backwards compatible if (sST.section(':', 0, -2) == (*sit)->m_sServiceType.section(':', 0, -2)) return pDevice->GetUDN(); } // ---------------------------------------------------------------------- // Check Embedded Devices for a Match // ---------------------------------------------------------------------- UPnpDeviceList::const_iterator dit = pDevice->m_listDevices.begin(); for (; dit != pDevice->m_listDevices.end(); ++dit) { QString sUDN = FindDeviceUDN( *dit, sST ); if (sUDN.length() > 0) return sUDN; } return ""; }