当前位置: 首页>>代码示例>>C++>>正文


C++ PLT_DeviceDataReference::FindServiceByType方法代码示例

本文整理汇总了C++中PLT_DeviceDataReference::FindServiceByType方法的典型用法代码示例。如果您正苦于以下问题:C++ PLT_DeviceDataReference::FindServiceByType方法的具体用法?C++ PLT_DeviceDataReference::FindServiceByType怎么用?C++ PLT_DeviceDataReference::FindServiceByType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PLT_DeviceDataReference的用法示例。


在下文中一共展示了PLT_DeviceDataReference::FindServiceByType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: lock

/*----------------------------------------------------------------------
|   PLT_MediaBrowser::OnDeviceAdded
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaBrowser::OnDeviceAdded(PLT_DeviceDataReference& device)
{
    // verify the device implements the function we need
    PLT_Service* serviceCDS;
    PLT_Service* serviceCMR;
    NPT_String   type;

    if (!device->GetType().StartsWith("urn:schemas-upnp-org:device:MediaServer"))
        return NPT_FAILURE;
    
    type = "urn:schemas-upnp-org:service:ContentDirectory:*";
    if (NPT_FAILED(device->FindServiceByType(type, serviceCDS))) {
        NPT_LOG_WARNING_2("Service %s not found in device \"%s\"", 
            type.GetChars(),
            device->GetFriendlyName().GetChars());
        return NPT_FAILURE;
    } else {
        // in case it's a newer upnp implementation, force to 1
        serviceCDS->ForceVersion(1);
    }
    
    type = "urn:schemas-upnp-org:service:ConnectionManager:*";
    if (NPT_FAILED(device->FindServiceByType(type, serviceCMR))) {
        NPT_LOG_WARNING_2("Service %s not found in device \"%s\"", 
            type.GetChars(), 
            device->GetFriendlyName().GetChars());
        return NPT_FAILURE;
    } else {
        // in case it's a newer upnp implementation, force to 1
        serviceCMR->ForceVersion(1);
    }
    
    {
        NPT_AutoLock lock(m_MediaServers);

        PLT_DeviceDataReference data;
        NPT_String uuid = device->GetUUID();
        
        // is it a new device?
        if (NPT_SUCCEEDED(NPT_ContainerFind(m_MediaServers, PLT_DeviceDataFinder(uuid), data))) {
            NPT_LOG_WARNING_1("Device (%s) is already in our list!", (const char*)uuid);
            return NPT_FAILURE;
        }

        NPT_LOG_FINE_1("Device Found: %s", (const char*)*device);

        m_MediaServers.Add(device);
    }

    if (m_Delegate && m_Delegate->OnMSAdded(device)) {
        m_CtrlPoint->Subscribe(serviceCDS);
        m_CtrlPoint->Subscribe(serviceCMR);
    }
    
    return NPT_SUCCESS;
}
开发者ID:AWilco,项目名称:xbmc,代码行数:60,代码来源:PltMediaBrowser.cpp

示例2: lock

/*----------------------------------------------------------------------
|   PLT_MediaBrowser::OnDeviceAdded
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaBrowser::OnDeviceAdded(PLT_DeviceDataReference& device)
{
    // verify the device implements the function we need
    PLT_Service* serviceCDS;
    PLT_Service* serviceCMR;
    NPT_String type;
    
    type = "urn:schemas-upnp-org:service:ContentDirectory:1";
    if (NPT_FAILED(device->FindServiceByType(type, serviceCDS))) {
        NPT_LOG_WARNING_1("Service %s not found", (const char*)type);
        return NPT_FAILURE;
    }
    
    type = "urn:schemas-upnp-org:service:ConnectionManager:1";
    if (NPT_FAILED(device->FindServiceByType(type, serviceCMR))) {
        NPT_LOG_WARNING_1("Service %s not found", (const char*)type);
        return NPT_FAILURE;
    }    
    
    {
        NPT_AutoLock lock(m_MediaServers);

        PLT_DeviceDataReference data;
        NPT_String uuid = device->GetUUID();
        // is it a new device?
        if (NPT_SUCCEEDED(NPT_ContainerFind(m_MediaServers, PLT_DeviceDataFinder(uuid), data))) {
            NPT_LOG_WARNING_1("Device (%s) is already in our list!", (const char*)uuid);
            return NPT_FAILURE;
        }

        NPT_LOG_FINE("Device Found:");
        device->ToLog(NPT_LOG_LEVEL_FINE);

        m_MediaServers.Add(device);
    }

    if (m_Listener) {
        m_Listener->OnMSAddedRemoved(device, 1);
    }

    m_CtrlPoint->Subscribe(serviceCDS);
    m_CtrlPoint->Subscribe(serviceCMR);

    return NPT_SUCCESS;
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:49,代码来源:PltMediaBrowser.cpp

示例3: lock

/*----------------------------------------------------------------------
|   PLT_MicroMediaController::OnMRAdded
+---------------------------------------------------------------------*/
bool
PLT_MicroMediaController::OnMRAdded(PLT_DeviceDataReference& device)
{
    NPT_String uuid = device->GetUUID();

    // test if it's a media renderer
    PLT_Service* service;
    if (NPT_SUCCEEDED(device->FindServiceByType("urn:schemas-upnp-org:service:AVTransport:*", service))) {
        NPT_AutoLock lock(m_MediaRenderers);
        m_MediaRenderers.Put(uuid, device);
    }

    return true;
}
开发者ID:arifcode,项目名称:Platinum-fork,代码行数:17,代码来源:PltMicroMediaController.cpp

示例4: lock

/*----------------------------------------------------------------------
|   PLT_SyncMediaBrowser::OnDeviceAdded
+---------------------------------------------------------------------*/
NPT_Result
PLT_SyncMediaBrowser::OnDeviceAdded(PLT_DeviceDataReference& device)
{
    NPT_String uuid = device->GetUUID();

    // test if it's a media server
    PLT_Service* service;
    if (NPT_SUCCEEDED(device->FindServiceByType("urn:schemas-upnp-org:service:ContentDirectory:*", service))) {
        NPT_AutoLock lock(m_MediaServers);
        m_MediaServers.Put(uuid, device);
    }
    
    return PLT_MediaBrowser::OnDeviceAdded(device);
}
开发者ID:AWilco,项目名称:xbmc,代码行数:17,代码来源:PltSyncMediaBrowser.cpp

示例5:

bool 
GPAC_MediaController::OnMSAdded(PLT_DeviceDataReference& device)
{
    NPT_String uuid = device->GetUUID();

     gf_mx_p(m_ControlPointLock);
    // test if it's a media server
    PLT_Service* service;
    if (NPT_SUCCEEDED(device->FindServiceByType("urn:schemas-upnp-org:service:ContentDirectory:1", service))) {
		gf_list_add(m_MediaServers, new GPAC_MediaServerItem(device, uuid) );
    }
	m_pUPnP->OnMediaServerAdd(device, 1);
    gf_mx_v(m_ControlPointLock);
	return true;
}
开发者ID:bigbensk,项目名称:gpac,代码行数:15,代码来源:GPACMediaController.cpp

示例6:

/*----------------------------------------------------------------------
|   PLT_MediaController::GetProtocolInfoSink
+---------------------------------------------------------------------*/
NPT_Result 
PLT_MediaController::GetProtocolInfoSink(PLT_DeviceDataReference& device, 
                                         NPT_List<NPT_String>&    sinks)
{
    PLT_DeviceDataReference renderer;
    NPT_CHECK_WARNING(FindRenderer(device->GetUUID(), renderer));

    // look for ConnectionManager service
    PLT_Service* serviceCMR;
    NPT_CHECK_SEVERE(device->FindServiceByType(
        "urn:schemas-upnp-org:service:ConnectionManager:*", 
        serviceCMR));

    NPT_String value;
    NPT_CHECK_SEVERE(serviceCMR->GetStateVariableValue(
        "SinkProtocolInfo", 
        value));

    sinks = value.Split(",");
    return NPT_SUCCESS;
}
开发者ID:fangxingli,项目名称:H3DLNA,代码行数:24,代码来源:PltMediaController.cpp

示例7:

/*----------------------------------------------------------------------
|   PLT_SyncMediaBrowser::OnMSAddedRemoved
+---------------------------------------------------------------------*/
void
PLT_SyncMediaBrowser::OnMSAddedRemoved(PLT_DeviceDataReference& device, int added)
{
    NPT_String uuid = device->GetUUID();

    if (added) {
        // test if it's a media server
        m_MediaServers.Lock();
        PLT_Service* service;
        if (NPT_SUCCEEDED(device->FindServiceByType("urn:schemas-upnp-org:service:ContentDirectory:1", service))) {
            m_MediaServers.Put(uuid, device);
        }
        m_MediaServers.Unlock();
    } else { /* removed */
        // Remove from our list of servers first if found
        m_MediaServers.Lock();
        m_MediaServers.Erase(uuid);
        m_MediaServers.Unlock();

        // clear cache for that device
        if (m_UseCache) m_Cache.Clear(device.AsPointer()->GetUUID());
    }
}
开发者ID:Castlecard,项目名称:plex,代码行数:26,代码来源:PltSyncMediaBrowser.cpp

示例8:

/*----------------------------------------------------------------------
|   PLT_MicroMediaController::OnMSAdded
+---------------------------------------------------------------------*/
bool
PLT_MicroMediaController::OnMSAdded(PLT_DeviceDataReference& device)
{
    // Issue special action upon discovering MediaConnect server
    PLT_Service* service;
    if (NPT_SUCCEEDED(device->FindServiceByType("urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:*", service))) {
        PLT_ActionReference action;
        PLT_SyncMediaBrowser::m_CtrlPoint->CreateAction(
            device,
            "urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1",
            "IsAuthorized",
            action);
        if (!action.IsNull()) PLT_SyncMediaBrowser::m_CtrlPoint->InvokeAction(action, 0);

        PLT_SyncMediaBrowser::m_CtrlPoint->CreateAction(
            device,
            "urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1",
            "IsValidated",
            action);
        if (!action.IsNull()) PLT_SyncMediaBrowser::m_CtrlPoint->InvokeAction(action, 0);
    }

    return true;
}
开发者ID:arifcode,项目名称:Platinum-fork,代码行数:27,代码来源:PltMicroMediaController.cpp

示例9: lock

/*----------------------------------------------------------------------
|   PLT_MediaController::OnDeviceAdded
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaController::OnDeviceAdded(PLT_DeviceDataReference& device)
{
    // verify the device implements the function we need
    PLT_Service* serviceAVT = NULL;
    PLT_Service* serviceCMR;
	PLT_Service* serviceRC;
    NPT_String   type;
    
    if (!device->GetType().StartsWith("urn:schemas-upnp-org:device:MediaRenderer"))
        return NPT_FAILURE;

    // optional service
    type = "urn:schemas-upnp-org:service:AVTransport:*";
    if (NPT_SUCCEEDED(device->FindServiceByType(type, serviceAVT))) {
        // in case it's a newer upnp implementation, force to 1
        NPT_LOG_FINE_1("Service %s found", (const char*)type);
        serviceAVT->ForceVersion(1);
    }
    
    // required services
    type = "urn:schemas-upnp-org:service:ConnectionManager:*";
    if (NPT_FAILED(device->FindServiceByType(type, serviceCMR))) {
        NPT_LOG_FINE_1("Service %s not found", (const char*)type);
        return NPT_FAILURE;
    } else {
        // in case it's a newer upnp implementation, force to 1
        serviceCMR->ForceVersion(1);
    }

	type = "urn:schemas-upnp-org:service:RenderingControl:*";
    if (NPT_FAILED(device->FindServiceByType(type, serviceRC))) {
        NPT_LOG_FINE_1("Service %s not found", (const char*)type);
        return NPT_FAILURE;
    } else {
        // in case it's a newer upnp implementation, force to 1
        serviceRC->ForceVersion(1);
    }

    {
        NPT_AutoLock lock(m_MediaRenderers);

        PLT_DeviceDataReference data;
        NPT_String uuid = device->GetUUID();
        
        // is it a new device?
        if (NPT_SUCCEEDED(NPT_ContainerFind(m_MediaRenderers, 
                                            PLT_DeviceDataFinder(uuid), data))) {
            NPT_LOG_WARNING_1("Device (%s) is already in our list!", (const char*)uuid);
            return NPT_FAILURE;
        }

        NPT_LOG_FINE_1("Device Found: %s", (const char*)*device);

        m_MediaRenderers.Add(device);
    }
    
    if (m_Delegate && m_Delegate->OnMRAdded(device)) {
        // subscribe to services eventing only if delegate wants it
        if (serviceAVT) m_CtrlPoint->Subscribe(serviceAVT);

        // subscribe to required services
		m_CtrlPoint->Subscribe(serviceCMR);
		m_CtrlPoint->Subscribe(serviceRC);
    }

    return NPT_SUCCESS;
}
开发者ID:fangxingli,项目名称:H3DLNA,代码行数:71,代码来源:PltMediaController.cpp

示例10: action

/*----------------------------------------------------------------------
|   PLT_MediaBrowser::Browse
+---------------------------------------------------------------------*/
NPT_Result 
PLT_MediaBrowser::Browse(PLT_DeviceDataReference&   device, 
                         const char*                obj_id,
                         NPT_UInt32                 start_index,
                         NPT_UInt32                 count,
                         bool                       browse_metadata,
                         const char*                filter,
                         const char*                sort_criteria,
                         void*                      userdata)
{
    // look for the service
    PLT_Service* service;
    NPT_String type;

    type = "urn:schemas-upnp-org:service:ContentDirectory:1";
    if (NPT_FAILED(device->FindServiceByType(type, service))) {
        NPT_LOG_WARNING_1("Service %s not found", (const char*)type);
        return NPT_FAILURE;
    }

    PLT_ActionDesc* action_desc = service->FindActionDesc("Browse");
    if (action_desc == NULL) {
        NPT_LOG_WARNING("Action Browse not found in service");
        return NPT_FAILURE;
    }

    PLT_ActionReference action(new PLT_Action(action_desc));

    // Set the object id
    PLT_Arguments args;
    if (NPT_FAILED(action->SetArgumentValue("ObjectID", obj_id))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }

    // set the browse_flag
    if (NPT_FAILED(action->SetArgumentValue("BrowseFlag", browse_metadata?"BrowseMetadata":"BrowseDirectChildren"))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }
 
    // set the Filter
    if (NPT_FAILED(action->SetArgumentValue("Filter", filter))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }

    // set the Starting Index
    if (NPT_FAILED(action->SetArgumentValue("StartingIndex", NPT_String::FromInteger(start_index)))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }

    // set the Requested Count
    if (NPT_FAILED(action->SetArgumentValue("RequestedCount", NPT_String::FromInteger(count)))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }

    // set the Requested Count
    if (NPT_FAILED(action->SetArgumentValue("SortCriteria", sort_criteria))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }

    // set the arguments on the action, this will check the argument values
    if (NPT_FAILED(m_CtrlPoint->InvokeAction(action, userdata))) {
        return NPT_ERROR_INVALID_PARAMETERS;
    }

    return NPT_SUCCESS;
}
开发者ID:Avoidnf8,项目名称:xbmc-fork,代码行数:69,代码来源:PltMediaBrowser.cpp


注:本文中的PLT_DeviceDataReference::FindServiceByType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。