本文整理汇总了C++中PLT_ActionReference::GetActionDesc方法的典型用法代码示例。如果您正苦于以下问题:C++ PLT_ActionReference::GetActionDesc方法的具体用法?C++ PLT_ActionReference::GetActionDesc怎么用?C++ PLT_ActionReference::GetActionDesc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PLT_ActionReference
的用法示例。
在下文中一共展示了PLT_ActionReference::GetActionDesc方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/*----------------------------------------------------------------------
| PLT_LightSampleDevice::OnAction
+---------------------------------------------------------------------*/
NPT_Result
PLT_LightSampleDevice::OnAction(PLT_ActionReference& action, NPT_SocketInfo* /* info */)
{
/* parse the action name */
NPT_String name = action->GetActionDesc()->GetName();
if (name.Compare("SetTarget") == 0) {
NPT_String value;
action->GetArgumentValue("newTargetValue", value);
PLT_StateVariable* variable = action->GetActionDesc()->GetService()->FindStateVariable("Status");
if (NPT_FAILED(variable->SetValue(value))) {
action->SetError(402, "Invalid Args");
return NPT_FAILURE;
}
return NPT_SUCCESS;
} else if (name.Compare("GetStatus") == 0) {
PLT_StateVariable* variable = action->GetActionDesc()->GetService()->FindStateVariable("Status");
if (variable) {
action->SetArgumentValue("ResultStatus", variable->GetValue());
return NPT_SUCCESS;
}
}
action->SetError(501, "Action Failed");
return NPT_FAILURE;
}
示例2: called
NPT_Result
GPAC_GenericDevice::OnAction(PLT_ActionReference& action,
const PLT_HttpRequestContext& context)
{
NPT_COMPILER_UNUSED(context);
#ifdef GPAC_HAS_SPIDERMONKEY
gf_mx_p(m_pMutex);
#endif
PLT_ActionDesc &act_desc = action->GetActionDesc();
NPT_String name = act_desc.GetName();
#ifdef GPAC_HAS_SPIDERMONKEY
assert(!m_pSema);
#endif
GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[UPnP] Action %s called (thread %d)\n", (char *) name, gf_th_id() ));
#ifdef GPAC_HAS_SPIDERMONKEY
if (JSVAL_IS_NULL(act_proc)) {
gf_mx_v(m_pMutex);
return NPT_SUCCESS;
}
jsval argv[2];
m_pUPnP->LockJavascript(GF_TRUE);
JSObject *js_action = JS_NewObject(m_pUPnP->m_pJSCtx, &m_pUPnP->upnpDeviceClass._class, 0, 0);
argv[0] = OBJECT_TO_JSVAL(js_action);
SMJS_SET_PRIVATE(m_pUPnP->m_pJSCtx, js_action, this);
act_ref = action;
JS_DefineProperty(m_pUPnP->m_pJSCtx, js_action, "Name", STRING_TO_JSVAL( JS_NewStringCopyZ(m_pUPnP->m_pJSCtx, name) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
GPAC_Service *service = (GPAC_Service *) act_desc.GetService();
JS_DefineProperty(m_pUPnP->m_pJSCtx, js_action, "Service", service->m_pObj ? OBJECT_TO_JSVAL( service->m_pObj) : JSVAL_NULL, 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(m_pUPnP->m_pJSCtx, js_action, "GetArgument", upnp_action_get_argument, 1, 0);
JS_DefineFunction(m_pUPnP->m_pJSCtx, js_action, "SendReply", upnp_action_send_reply, 1, 0);
/*create a semaphore*/
m_pSema = gf_sema_new(1, 0);
jsval rval;
JS_CallFunctionValue(m_pUPnP->m_pJSCtx, obj, act_proc, 1, argv, &rval);
SMJS_SET_PRIVATE(m_pUPnP->m_pJSCtx, js_action, NULL);
m_pUPnP->LockJavascript(GF_FALSE);
if (JSVAL_IS_INT(rval) && (JSVAL_TO_INT(rval) != 0)) {
action->SetError(JSVAL_TO_INT(rval), "Action Failed");
}
/*wait on the semaphore*/
if (!gf_sema_wait_for(m_pSema, 10000)) {
GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("[UPnP] Reply processing to action %s timeout - sending incomplete reply)\n", (char *) name));
}
gf_sema_del(m_pSema);
m_pSema = NULL;
gf_mx_v(m_pMutex);
#endif
return NPT_SUCCESS;
}
示例3: OnBrowseResponse
/*----------------------------------------------------------------------
| PLT_MediaBrowser::OnActionResponse
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaBrowser::OnActionResponse(NPT_Result res,
PLT_ActionReference& action,
void* userdata)
{
NPT_String actionName = action->GetActionDesc().GetName();
// look for device in our list first
PLT_DeviceDataReference device;
NPT_String uuid = action->GetActionDesc().GetService()->GetDevice()->GetUUID();
if (NPT_FAILED(FindServer(uuid, device))) res = NPT_FAILURE;
// Browse action response
if (actionName.Compare("Browse", true) == 0) {
return OnBrowseResponse(res, device, action, userdata);
} else if (actionName.Compare("Search", true) == 0) {
return OnSearchResponse(res, device, action, userdata);
}
return NPT_SUCCESS;
}
示例4: lock
/*----------------------------------------------------------------------
| PLT_MediaBrowser::OnActionResponse
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaBrowser::OnActionResponse(NPT_Result res, PLT_ActionReference& action, void* userdata)
{
PLT_DeviceDataReference device;
{
NPT_AutoLock lock(m_MediaServers);
NPT_String uuid = action->GetActionDesc()->GetService()->GetDevice()->GetUUID();
if (NPT_FAILED(NPT_ContainerFind(m_MediaServers, PLT_DeviceDataFinder(uuid), device))) {
NPT_LOG_WARNING_1("Device (%s) not found in our list of servers", (const char*)uuid);
return NPT_FAILURE;
}
}
NPT_String actionName = action->GetActionDesc()->GetName();
// Browse action response
if (actionName.Compare("Browse", true) == 0) {
return OnBrowseResponse(res, device, action, userdata);
}
return NPT_SUCCESS;
}
示例5: OnBrowse
/*----------------------------------------------------------------------
| PLT_MediaServer::OnAction
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaServer::OnAction(PLT_ActionReference& action,
const PLT_HttpRequestContext& context)
{
/* parse the action name */
NPT_String name = action->GetActionDesc().GetName();
// ContentDirectory
if (name.Compare("Browse", true) == 0) {
return OnBrowse(action, context);
}
if (name.Compare("Search", true) == 0) {
return OnSearch(action, context);
}
if (name.Compare("UpdateObject", true) == 0) {
return OnUpdate(action, context);
}
if (name.Compare("GetSystemUpdateID", true) == 0) {
return OnGetSystemUpdateID(action, context);
}
if (name.Compare("GetSortCapabilities", true) == 0) {
return OnGetSortCapabilities(action, context);
}
if (name.Compare("GetSearchCapabilities", true) == 0) {
return OnGetSearchCapabilities(action, context);
}
// ConnectionMananger
if (name.Compare("GetCurrentConnectionIDs", true) == 0) {
return OnGetCurrentConnectionIDs(action, context);
}
if (name.Compare("GetProtocolInfo", true) == 0) {
return OnGetProtocolInfo(action, context);
}
if (name.Compare("GetCurrentConnectionInfo", true) == 0) {
return OnGetCurrentConnectionInfo(action, context);
}
action->SetError(401,"No Such Action.");
return NPT_SUCCESS;
}
示例6: OnIsAuthorized
/*----------------------------------------------------------------------
| PLT_MediaConnect::OnAction
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaConnect::OnAction(PLT_ActionReference& action,
const PLT_HttpRequestContext& context)
{
/* parse the action name */
NPT_String name = action->GetActionDesc().GetName();
/* handle X_MS_MediaReceiverRegistrar actions here */
if (name.Compare("IsAuthorized") == 0) {
return OnIsAuthorized(action);
}
if (name.Compare("RegisterDevice") == 0) {
return OnRegisterDevice(action);
}
if (name.Compare("IsValidated") == 0) {
return OnIsValidated(action);
}
return PLT_MediaServer::OnAction(action, context);
}
示例7: OnGetCurrentConnectionInfo
/*----------------------------------------------------------------------
| PLT_MediaRenderer::OnAction
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaRenderer::OnAction(PLT_ActionReference& action, NPT_SocketInfo* info /* = NULL */)
{
NPT_COMPILER_UNUSED(info);
/* parse the action name */
NPT_String name = action->GetActionDesc()->GetName();
/* Is it a ConnectionManager Service Action ? */
if (name.Compare("GetCurrentConnectionIDs", true) == 0) {
if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
return NPT_FAILURE;
}
return NPT_SUCCESS;
}
if (name.Compare("GetProtocolInfo", true) == 0) {
if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
return NPT_FAILURE;
}
return NPT_SUCCESS;
}
if (name.Compare("GetCurrentConnectionInfo", true) == 0) {
return OnGetCurrentConnectionInfo(action);
}
/* Is it a AVTransport Service Action ? */
// since all actions take an instance ID and we only support 1 instance
// verify that the Instance ID is 0 and return an error here now if not
NPT_String serviceType = action->GetActionDesc()->GetService()->GetServiceType();
if (serviceType.Compare("urn:schemas-upnp-org:service:AVTransport:1", true) == 0) {
if (NPT_FAILED(action->VerifyArgumentValue("InstanceID", "0"))) {
action->SetError(802,"Not valid InstanceID.");
return NPT_FAILURE;
}
}
if (name.Compare("GetCurrentTransportActions", true) == 0) {
if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
return NPT_FAILURE;
}
return NPT_SUCCESS;
}
if (name.Compare("GetDeviceCapabilities", true) == 0) {
if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
return NPT_FAILURE;
}
return NPT_SUCCESS;
}
if (name.Compare("GetMediaInfo", true) == 0) {
if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
return NPT_FAILURE;
}
return NPT_SUCCESS;
}
if (name.Compare("GetPositionInfo", true) == 0) {
if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
return NPT_FAILURE;
}
return NPT_SUCCESS;
}
if (name.Compare("GetTransportInfo", true) == 0) {
if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
return NPT_FAILURE;
}
return NPT_SUCCESS;
}
if (name.Compare("GetTransportSettings", true) == 0) {
if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
return NPT_FAILURE;
}
return NPT_SUCCESS;
}
if (name.Compare("Next", true) == 0) {
return OnNext(action);
}
if (name.Compare("Pause", true) == 0) {
return OnPause(action);
}
if (name.Compare("Play", true) == 0) {
return OnPlay(action);
}
if (name.Compare("Previous", true) == 0) {
return OnPrevious(action);
}
if (name.Compare("Seek", true) == 0) {
return OnSeek(action);
}
if (name.Compare("Stop", true) == 0) {
return OnStop(action);
}
if (name.Compare("SetAVTransportURI", true) == 0) {
return OnSetAVTransportURI(action);
}
if (name.Compare("SetPlayMode", true) == 0) {
return OnSetPlayMode(action);
}
//.........这里部分代码省略.........
示例8: OnGetCurrentConnectionInfo
/*----------------------------------------------------------------------
| PLT_MediaRenderer::OnAction
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaRenderer::OnAction(PLT_ActionReference& action,
const PLT_HttpRequestContext& context)
{
NPT_COMPILER_UNUSED(context);
/* parse the action name */
NPT_String name = action->GetActionDesc().GetName();
// since all actions take an instance ID and we only support 1 instance
// verify that the Instance ID is 0 and return an error here now if not
NPT_String serviceType = action->GetActionDesc().GetService()->GetServiceType();
if (serviceType.Compare("urn:schemas-upnp-org:service:AVTransport:1", true) == 0) {
if (NPT_FAILED(action->VerifyArgumentValue("InstanceID", "0"))) {
action->SetError(718, "Not valid InstanceID");
return NPT_FAILURE;
}
}
serviceType = action->GetActionDesc().GetService()->GetServiceType();
if (serviceType.Compare("urn:schemas-upnp-org:service:RenderingControl:1", true) == 0) {
if (NPT_FAILED(action->VerifyArgumentValue("InstanceID", "0"))) {
action->SetError(702, "Not valid InstanceID");
return NPT_FAILURE;
}
}
/* Is it a ConnectionManager Service Action ? */
if (name.Compare("GetCurrentConnectionInfo", true) == 0) {
return OnGetCurrentConnectionInfo(action);
}
/* Is it a AVTransport Service Action ? */
if (name.Compare("Next", true) == 0) {
return OnNext(action);
}
if (name.Compare("Pause", true) == 0) {
return OnPause(action);
}
if (name.Compare("Play", true) == 0) {
return OnPlay(action);
}
if (name.Compare("Previous", true) == 0) {
return OnPrevious(action);
}
if (name.Compare("Seek", true) == 0) {
return OnSeek(action);
}
if (name.Compare("Stop", true) == 0) {
return OnStop(action);
}
if (name.Compare("SetAVTransportURI", true) == 0) {
return OnSetAVTransportURI(action);
}
if (name.Compare("SetNextAVTransportURI", true) == 0) {
return OnSetNextAVTransportURI(action);
}
if (name.Compare("SetPlayMode", true) == 0) {
return OnSetPlayMode(action);
}
/* Is it a RendererControl Service Action ? */
if (name.Compare("SetVolume", true) == 0) {
return OnSetVolume(action);
}
if (name.Compare("SetVolumeDB", true) == 0) {
return OnSetVolumeDB(action);
}
if (name.Compare("GetVolumeDBRange", true) == 0) {
return OnGetVolumeDBRange(action);
}
if (name.Compare("SetMute", true) == 0) {
return OnSetMute(action);
}
// other actions rely on state variables
NPT_CHECK_LABEL_WARNING(action->SetArgumentsOutFromStateVariable(), failure);
return NPT_SUCCESS;
failure:
action->SetError(401,"No Such Action.");
return NPT_FAILURE;
}
示例9: OnGetCurrentConnectionInfo
NPT_Result
GPAC_MediaRenderer::OnAction(PLT_ActionReference& action,
const PLT_HttpRequestContext& context)
{
NPT_COMPILER_UNUSED(context);
/* parse the action name */
NPT_String name = action->GetActionDesc().GetName();
m_ip_src = context.GetRemoteAddress().GetIpAddress().ToString();
/* Is it a ConnectionManager Service Action ? */
if (name.Compare("GetCurrentConnectionIDs", true) == 0) {
if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
return NPT_FAILURE;
}
return NPT_SUCCESS;
}
if (name.Compare("GetProtocolInfo", true) == 0) {
if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
return NPT_FAILURE;
}
return NPT_SUCCESS;
}
if (name.Compare("GetCurrentConnectionInfo", true) == 0) {
return OnGetCurrentConnectionInfo(action);
}
if (name.Compare("StopForMigration", true) == 0) {
NPT_String res = m_pUPnP->OnMigrate();
m_pMigrationService->SetStateVariable("MigrationStatus", "OK");
m_pMigrationService->SetStateVariable("MigrationMetaData", res);
if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
return NPT_FAILURE;
}
return NPT_SUCCESS;
}
/* Is it a AVTransport Service Action ? */
// since all actions take an instance ID and we only support 1 instance
// verify that the Instance ID is 0 and return an error here now if not
NPT_String serviceType = action->GetActionDesc().GetService()->GetServiceType();
if (serviceType.Compare("urn:schemas-upnp-org:service:AVTransport:1", true) == 0) {
if (NPT_FAILED(action->VerifyArgumentValue("InstanceID", "0"))) {
action->SetError(802,"Not valid InstanceID.");
return NPT_FAILURE;
}
}
if (name.Compare("GetCurrentTransportActions", true) == 0) {
if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
return NPT_FAILURE;
}
return NPT_SUCCESS;
}
if (name.Compare("GetDeviceCapabilities", true) == 0) {
if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
return NPT_FAILURE;
}
return NPT_SUCCESS;
}
if (name.Compare("GetMediaInfo", true) == 0) {
if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
return NPT_FAILURE;
}
return NPT_SUCCESS;
}
if (name.Compare("GetPositionInfo", true) == 0) {
if (m_pUPnP->m_pTerm->root_scene) {
char szVal[100];
m_pAVService->SetStateVariable("CurrentTrack", "0");
format_time_string(szVal, m_Duration);
m_pAVService->SetStateVariable("CurrentTrackDuration", szVal);
m_pAVService->SetStateVariable("CurrentTrackMetadata", "");
m_pAVService->SetStateVariable("CurrentTrackURI", "");
format_time_string(szVal, m_Time);
m_pAVService->SetStateVariable("RelativeTimePosition", szVal);
m_pAVService->SetStateVariable("AbsoluteTimePosition", szVal);
m_pAVService->SetStateVariable("RelativeCounterPosition", "2147483647"); // means NOT_IMPLEMENTED
m_pAVService->SetStateVariable("AbsoluteCounterPosition", "2147483647"); // means NOT_IMPLEMENTED
} else {
if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
return NPT_FAILURE;
}
}
return NPT_SUCCESS;
}
if (name.Compare("GetTransportInfo", true) == 0) {
if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
return NPT_FAILURE;
}
return NPT_SUCCESS;
}
if (name.Compare("GetTransportSettings", true) == 0) {
if (NPT_FAILED(action->SetArgumentsOutFromStateVariable())) {
return NPT_FAILURE;
}
//.........这里部分代码省略.........
示例10: OnActionResponse
NPT_Result GPAC_GenericController::OnActionResponse(NPT_Result res, PLT_ActionReference& action, void* userdata)
{
#ifdef GPAC_HAS_SPIDERMONKEY
u32 i, count;
GPAC_DeviceItem *item = NULL;
GPAC_ServiceItem *serv = NULL;
GPAC_ActionArgListener *argl, *act_l;
PLT_Service* service = action->GetActionDesc().GetService();
NPT_String uuid;
GPAC_ActionUDTA *act_udta = (GPAC_ActionUDTA *)userdata;
/*this is NOT an actionResponse to an action triggered on a generic device*/
if (act_udta && act_udta->m_Reserved) act_udta = NULL;
GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[UPnP] Receive %s Response - error code %d\n", (char *) action->GetActionDesc().GetName(), res));
gf_mx_p(m_ControlPointLock);
/*get our device*/
uuid = service->GetDevice()->GetUUID();
count = gf_list_count(m_Devices);
for (i=0; i<count; i++) {
item = (GPAC_DeviceItem *) gf_list_get(m_Devices, i);
if (item->m_UUID == uuid ) {
break;
}
item = NULL;
}
gf_mx_v(m_ControlPointLock);
if (!item) {
GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[UPnP] Receive %s Response on unknown device (uuid %s)\n", (char *) action->GetActionDesc().GetName(), (char *) uuid));
goto exit;
}
/*get our service*/
count = gf_list_count(item->m_Services);
for (i=0; i<count; i++) {
serv = (GPAC_ServiceItem *)gf_list_get(item->m_Services, i);
if (serv->m_service == service) break;
}
if (!serv) {
GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[UPnP] Receive %s Response on unknown service %s\n", (char *) action->GetActionDesc().GetName(), (char *) service->GetServiceType()));
goto exit;
}
/*locate our listeners*/
act_l = NULL;
i=0;
while ((argl = (GPAC_ActionArgListener *)gf_list_enum(serv->m_ArgListeners, &i))) {
NPT_String value;
GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[UPnP] checking argument %s\n", (char *) argl->action->GetName() ));
if (argl->action->GetName() != action->GetActionDesc().GetName() ) continue;
/*global action listener*/
if (argl->arg==NULL) {
act_l = argl;
continue;
}
/*if error don't trigger listeners*/
if (res != NPT_SUCCESS) {
GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("[UPnP] Receive %s Response: error on remote device %d\n", (char *) action->GetActionDesc().GetName(), res));
continue;
}
/*action arg listener*/
if (action->GetArgumentValue(argl->arg->GetName(), value) == NPT_SUCCESS) {
jsval argv[1], rval;
GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[UPnP] Calling handler for response %s argument %s\n", (char *) action->GetActionDesc().GetName(), (char *) argl->arg->GetName() ));
m_pUPnP->LockJavascript(GF_TRUE);
argv[0] = STRING_TO_JSVAL( JS_NewStringCopyZ(serv->js_ctx, value) );
JS_CallFunctionValue(serv->js_ctx, serv->obj, argl->on_event, 1, argv, &rval);
m_pUPnP->LockJavascript(GF_FALSE);
} else {
GF_LOG(GF_LOG_ERROR, GF_LOG_NETWORK, ("[UPnP] %s Response: couldn't get argument %s value\n", (char *) action->GetActionDesc().GetName(), (char *) argl->arg->GetName() ));
}
}
if (act_l) {
jsval rval;
m_pUPnP->LockJavascript(GF_TRUE);
if (act_l->is_script) {
JSObject *act_obj;
jsval argv[2];
GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[UPnP] Calling handler for response %s\n", (char *) action->GetActionDesc().GetName()));
act_obj = JS_NewObject(serv->js_ctx, &item->m_pUPnP->upnpDeviceClass._class, 0, item->obj);
SMJS_SET_PRIVATE(serv->js_ctx, act_obj, (void *)action.AsPointer() );
JS_DefineFunction(serv->js_ctx, act_obj, "GetArgumentValue", upnp_action_get_argument_value, 1, 0);
JS_DefineFunction(serv->js_ctx, act_obj, "GetErrorCode", upnp_action_get_error_code, 1, 0);
JS_DefineFunction(serv->js_ctx, act_obj, "GetError", upnp_action_get_error, 1, 0);
gf_js_add_root(serv->js_ctx, &act_obj, GF_JSGC_OBJECT);
argv[0] = OBJECT_TO_JSVAL(act_obj);
if (act_udta) {
argv[1] = act_udta->udta;
JS_CallFunctionValue(serv->js_ctx, serv->obj, act_l->on_event, 2, argv, &rval);
} else {
JS_CallFunctionValue(serv->js_ctx, serv->obj, act_l->on_event, 1, argv, &rval);
}
//.........这里部分代码省略.........
示例11: OnGetCurrentTransportActionsResponse
/*----------------------------------------------------------------------
| PLT_MediaController::OnActionResponse
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaController::OnActionResponse(NPT_Result res,
PLT_ActionReference& action,
void* userdata)
{
if (m_Delegate == NULL) return NPT_SUCCESS;
PLT_DeviceDataReference device;
NPT_String uuid = action->GetActionDesc().GetService()->GetDevice()->GetUUID();
/* extract action name */
NPT_String actionName = action->GetActionDesc().GetName();
/* AVTransport response ? */
if (actionName.Compare("GetCurrentTransportActions", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
return OnGetCurrentTransportActionsResponse(res, device, action, userdata);
}
else if (actionName.Compare("GetDeviceCapabilities", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
return OnGetDeviceCapabilitiesResponse(res, device, action, userdata);
}
else if (actionName.Compare("GetMediaInfo", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
return OnGetMediaInfoResponse(res, device, action, userdata);
}
else if (actionName.Compare("GetPositionInfo", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
return OnGetPositionInfoResponse(res, device, action, userdata);
}
else if (actionName.Compare("GetTransportInfo", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
return OnGetTransportInfoResponse(res, device, action, userdata);
}
else if (actionName.Compare("GetTransportSettings", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
return OnGetTransportSettingsResponse(res, device, action, userdata);
}
else if (actionName.Compare("Next", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
m_Delegate->OnNextResult(res, device, userdata);
}
else if (actionName.Compare("Pause", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
m_Delegate->OnPauseResult(res, device, userdata);
}
else if (actionName.Compare("Play", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
m_Delegate->OnPlayResult(res, device, userdata);
}
else if (actionName.Compare("Previous", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
m_Delegate->OnPreviousResult(res, device, userdata);
}
else if (actionName.Compare("Seek", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
m_Delegate->OnSeekResult(res, device, userdata);
}
else if (actionName.Compare("SetAVTransportURI", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
m_Delegate->OnSetAVTransportURIResult(res, device, userdata);
}
else if (actionName.Compare("SetPlayMode", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
m_Delegate->OnSetPlayModeResult(res, device, userdata);
}
else if (actionName.Compare("Stop", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
m_Delegate->OnStopResult(res, device, userdata);
}
else if (actionName.Compare("GetCurrentConnectionIDs", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
return OnGetCurrentConnectionIDsResponse(res, device, action, userdata);
}
else if (actionName.Compare("GetCurrentConnectionInfo", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
return OnGetCurrentConnectionInfoResponse(res, device, action, userdata);
}
else if (actionName.Compare("GetProtocolInfo", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
return OnGetProtocolInfoResponse(res, device, action, userdata);
}
else if (actionName.Compare("SetMute", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
m_Delegate->OnSetMuteResult(res, device, userdata);
}
else if (actionName.Compare("GetMute", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
return OnGetMuteResponse(res, device, action, userdata);
}
else if (actionName.Compare("SetVolume", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
m_Delegate->OnSetVolumeResult(res, device, userdata);
}
else if (actionName.Compare("GetVolume", true) == 0) {
if (NPT_FAILED(FindRenderer(uuid, device))) res = NPT_FAILURE;
return OnGetVolumeResponse(res, device, action, userdata);
//.........这里部分代码省略.........