Пример #1
0
/*----------------------------------------------------------------------
|   PLT_DeviceData::FindServiceByControlURI
+---------------------------------------------------------------------*/
NPT_Result
PLT_DeviceData::FindServiceByControlURI(const char*   uri, 
                                        PLT_Service*& service)
{
    if (NPT_SUCCEEDED(NPT_ContainerFind(m_Services, 
                                        PLT_ServiceControlURLFinder(uri), 
                                        service))) {
        return NPT_SUCCESS;
    }

    for (int i=0; i < (int)m_EmbeddedDevices.GetItemCount(); i++) {
        if (NPT_SUCCEEDED(NPT_ContainerFind(m_EmbeddedDevices[i]->m_Services, 
                                            PLT_ServiceControlURLFinder(uri), 
                                            service)))
            return NPT_SUCCESS;
    }
    return NPT_FAILURE;
}
Пример #2
0
/*----------------------------------------------------------------------
|   PLT_DeviceData::FindServiceByControlURL
+---------------------------------------------------------------------*/
NPT_Result
PLT_DeviceData::FindServiceByControlURL(const char*   url, 
                                        PLT_Service*& service, 
                                        bool          recursive /* = false */)
{
    NPT_Result res = NPT_ContainerFind(m_Services, 
        PLT_ServiceControlURLFinder(url), 
        service);
    if (NPT_SUCCEEDED(res)) return res;

    if (recursive) {
		for (int i=0; i<(int)m_EmbeddedDevices.GetItemCount(); i++) {
            res = m_EmbeddedDevices[i]->FindServiceByControlURL(
                url, 
                service,
                recursive);
            if (NPT_SUCCEEDED(res)) return res;
        }
    }

    return NPT_FAILURE;
}