本文整理汇总了C++中PLT_ActionReference类的典型用法代码示例。如果您正苦于以下问题:C++ PLT_ActionReference类的具体用法?C++ PLT_ActionReference怎么用?C++ PLT_ActionReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PLT_ActionReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InvokeActionWithInstance
/*----------------------------------------------------------------------
| PLT_MediaController::Seek
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaController::Seek(PLT_DeviceDataReference& device,
NPT_UInt32 instance_id,
NPT_String unit,
NPT_String target,
void* userdata)
{
PLT_ActionReference action;
NPT_CHECK_SEVERE(m_CtrlPoint->CreateAction(
device,
"urn:schemas-upnp-org:service:AVTransport:1",
"Seek",
action));
// Set the unit
if (NPT_FAILED(action->SetArgumentValue("Unit", unit))) {
return NPT_ERROR_INVALID_PARAMETERS;
}
// Set the target
if (NPT_FAILED(action->SetArgumentValue("Target", target))) {
return NPT_ERROR_INVALID_PARAMETERS;
}
return InvokeActionWithInstance(action, instance_id, userdata);
}
示例2:
/*----------------------------------------------------------------------
| PLT_MediaRenderer::OnSetAVTransportURI
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaRenderer::OnSetAVTransportURI(PLT_ActionReference& action)
{
/*test*/
PLT_Service* serviceAVT;
NPT_CHECK_WARNING(FindServiceByType("urn:schemas-upnp-org:service:AVTransport:1", serviceAVT));
// update service state variables
//serviceAVT->SetStateVariable("TransportState", "TRANSITIONING");
/*test*/
if (m_Delegate) {
return m_Delegate->OnSetAVTransportURI(action);
}
// default implementation is using state variable
NPT_String uri;
NPT_CHECK_WARNING(action->GetArgumentValue("CurrentURI", uri));
NPT_String metadata;
NPT_CHECK_WARNING(action->GetArgumentValue("CurrentURIMetaData", metadata));
//PLT_Service* serviceAVT;
//NPT_CHECK_WARNING(FindServiceByType("urn:schemas-upnp-org:service:AVTransport:1", serviceAVT));
// update service state variables
serviceAVT->SetStateVariable("AVTransportURI", uri);
serviceAVT->SetStateVariable("AVTransportURIMetaData", metadata);
//serviceAVT->SetStateVariable("TransportState", "PLAYING");//test
OutputDebugString(uri.GetChars());
return NPT_SUCCESS;
}
示例3: InvokeUpdateObject
bool InvokeUpdateObject(const char* id, const char* curr_value, const char* new_value)
{
CURL url(id);
PLT_DeviceDataReference device;
PLT_Service* cds;
PLT_ActionReference action;
CLog::Log(LOGDEBUG, "UPNP: attempting to invoke UpdateObject for %s", id);
// check this server supports UpdateObject action
NPT_CHECK_LABEL(FindServer(url.GetHostName().c_str(), device),failed);
NPT_CHECK_LABEL(device->FindServiceById("urn:upnp-org:serviceId:ContentDirectory", cds),failed);
NPT_CHECK_LABEL(m_CtrlPoint->CreateAction(
device,
"urn:schemas-upnp-org:service:ContentDirectory:1",
"UpdateObject",
action), failed);
NPT_CHECK_LABEL(action->SetArgumentValue("ObjectID", url.GetFileName().c_str()), failed);
NPT_CHECK_LABEL(action->SetArgumentValue("CurrentTagValue", curr_value), failed);
NPT_CHECK_LABEL(action->SetArgumentValue("NewTagValue", new_value), failed);
NPT_CHECK_LABEL(m_CtrlPoint->InvokeAction(action, NULL),failed);
CLog::Log(LOGDEBUG, "UPNP: invoked UpdateObject successfully");
return true;
failed:
CLog::Log(LOGINFO, "UPNP: invoking UpdateObject failed");
return false;
}
示例4:
/*----------------------------------------------------------------------
| PLT_MediaRenderer::OnSetAVTransportURI
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaRenderer::OnSetAVTransportURI(PLT_ActionReference& action)
{
if (m_Delegate) {
return m_Delegate->OnSetAVTransportURI(action);
}
// default implementation is using state variable
NPT_String uri;
NPT_CHECK_WARNING(action->GetArgumentValue("CurrentURI", uri));
NPT_String metadata;
NPT_CHECK_WARNING(action->GetArgumentValue("CurrentURIMetaData", metadata));
PLT_Service* serviceAVT;
NPT_CHECK_WARNING(FindServiceByType("urn:schemas-upnp-org:service:AVTransport:1", serviceAVT));
// update service state variables
serviceAVT->SetStateVariable("AVTransportURI", uri);
serviceAVT->SetStateVariable("AVTransportURIMetaData", metadata);
serviceAVT->SetStateVariable("TransportState", "STOPPED");
serviceAVT->SetStateVariable("TransportStatus", "OK");
serviceAVT->SetStateVariable("TransportPlaySpeed", "1");
NPT_CHECK_SEVERE(action->SetArgumentsOutFromStateVariable());
return NPT_SUCCESS;
}
示例5: ParseCSV
/*----------------------------------------------------------------------
| PLT_MediaController::OnGetCurrentTransportActionsResponse
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaController::OnGetCurrentTransportActionsResponse(NPT_Result res,
PLT_DeviceDataReference& device,
PLT_ActionReference& action,
void* userdata)
{
NPT_String actions;
PLT_StringList values;
if (NPT_FAILED(res) || action->GetErrorCode() != 0) {
goto bad_action;
}
if (NPT_FAILED(action->GetArgumentValue("Actions", actions))) {
goto bad_action;
}
// parse the list of actions and return a list to listener
ParseCSV(actions, values);
m_Delegate->OnGetCurrentTransportActionsResult(NPT_SUCCESS, device, &values, userdata);
return NPT_SUCCESS;
bad_action:
m_Delegate->OnGetCurrentTransportActionsResult(NPT_FAILURE, device, NULL, userdata);
return NPT_FAILURE;
}
示例6: PlayMedia
/*----------------------------------------------------------------------
| CUPnPRenderer::OnSetAVTransportURI
+---------------------------------------------------------------------*/
NPT_Result
CUPnPRenderer::OnSetAVTransportURI(PLT_ActionReference& action)
{
NPT_String uri, meta;
PLT_Service* service;
NPT_CHECK_SEVERE(FindServiceByType("urn:schemas-upnp-org:service:AVTransport:1", service));
NPT_CHECK_SEVERE(action->GetArgumentValue("CurrentURI", uri));
NPT_CHECK_SEVERE(action->GetArgumentValue("CurrentURIMetaData", meta));
// if not playing already, just keep around uri & metadata
// and wait for play command
if (!g_application.m_pPlayer->IsPlaying() && g_windowManager.GetActiveWindow() != WINDOW_SLIDESHOW) {
service->SetStateVariable("TransportState", "STOPPED");
service->SetStateVariable("TransportStatus", "OK");
service->SetStateVariable("TransportPlaySpeed", "1");
service->SetStateVariable("AVTransportURI", uri);
service->SetStateVariable("AVTransportURIMetaData", meta);
service->SetStateVariable("NextAVTransportURI", "");
service->SetStateVariable("NextAVTransportURIMetaData", "");
NPT_CHECK_SEVERE(action->SetArgumentsOutFromStateVariable());
return NPT_SUCCESS;
}
return PlayMedia(uri, meta, action.AsPointer());
}
示例7:
/*----------------------------------------------------------------------
| PLT_MediaController::GetCurrentConnectionInfo
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaController::GetCurrentConnectionInfo(PLT_DeviceDataReference& device,
NPT_UInt32 connection_id,
void* userdata)
{
PLT_ActionReference action;
NPT_CHECK_SEVERE(m_CtrlPoint->CreateAction(
device,
"urn:schemas-upnp-org:service:ConnectionManager:1",
"GetCurrentConnectionInfo",
action));
// set the New PlayMode
if (NPT_FAILED(action->SetArgumentValue("ConnectionID",
NPT_String::FromInteger(connection_id)))) {
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;
}
示例8: SetVolume
/*----------------------------------------------------------------------
| PLT_MediaController::SetVolume
+---------------------------------------------------------------------*/
NPT_Result PLT_MediaController::SetVolume(PLT_DeviceDataReference& device,
NPT_UInt32 instance_id,
const char* channel,
int volume,
void* userdata)
{
PLT_ActionReference action;
NPT_CHECK_SEVERE(m_CtrlPoint->CreateAction(
device,
"urn:schemas-upnp-org:service:RenderingControl:1",
"SetVolume",
action));
// set the channel
if (NPT_FAILED(action->SetArgumentValue("Channel", channel))) {
return NPT_ERROR_INVALID_PARAMETERS;
}
if (NPT_FAILED(action->SetArgumentValue("DesiredVolume",
NPT_String::FromInteger(volume)))) {
return NPT_ERROR_INVALID_PARAMETERS;
}
return InvokeActionWithInstance(action, instance_id, userdata);
}
示例9: 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;
}
示例10:
/*----------------------------------------------------------------------
| PLT_MediaConnect::OnRegisterDevice
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaConnect::OnRegisterDevice(PLT_ActionReference& action)
{
NPT_String reqMsgBase64;
NPT_CHECK_WARNING(action->GetArgumentValue("RegistrationReqMsg", reqMsgBase64));
NPT_String respMsgBase64;
NPT_CHECK_WARNING(action->SetArgumentValue("RegistrationRespMsg", respMsgBase64));
return NPT_SUCCESS;
}
示例11:
/*----------------------------------------------------------------------
| PLT_MediaRenderer::OnGetCurrentConnectionInfo
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaRenderer::OnGetCurrentConnectionInfo(PLT_ActionReference& action)
{
if (NPT_FAILED(action->VerifyArgumentValue("ConnectionID", "0"))) {
action->SetError(706,"No Such Connection.");
return NPT_FAILURE;
}
if (NPT_FAILED(action->SetArgumentValue("RcsID", "0"))){
return NPT_FAILURE;
}
if (NPT_FAILED(action->SetArgumentValue("AVTransportID", "0"))) {
return NPT_FAILURE;
}
if (NPT_FAILED(action->SetArgumentValue("ProtocolInfo", "http-get:*:*:*"))) {
return NPT_FAILURE;
}
if (NPT_FAILED(action->SetArgumentValue("PeerConnectionManager", "/"))) {
return NPT_FAILURE;
}
if (NPT_FAILED(action->SetArgumentValue("PeerConnectionID", "-1"))) {
return NPT_FAILURE;
}
if (NPT_FAILED(action->SetArgumentValue("Direction", "Input"))) {
return NPT_FAILURE;
}
if (NPT_FAILED(action->SetArgumentValue("Status", "Unknown"))) {
return NPT_FAILURE;
}
return NPT_SUCCESS;
}
示例12:
/*----------------------------------------------------------------------
| PLT_MediaServer::OnGetCurrentConnectionInfo
+---------------------------------------------------------------------*/
NPT_Result
PLT_MediaServer::OnGetCurrentConnectionInfo(PLT_ActionReference& action,
const PLT_HttpRequestContext& context)
{
NPT_COMPILER_UNUSED(context);
if (NPT_FAILED(action->VerifyArgumentValue("ConnectionID", "0"))) {
action->SetError(706,"No Such Connection.");
return NPT_FAILURE;
}
if (NPT_FAILED(action->SetArgumentValue("RcsID", "-1"))){
return NPT_FAILURE;
}
if (NPT_FAILED(action->SetArgumentValue("AVTransportID", "-1"))) {
return NPT_FAILURE;
}
if (NPT_FAILED(action->SetArgumentValue("ProtocolInfo", "http-get:*:*:*"))) {
return NPT_FAILURE;
}
if (NPT_FAILED(action->SetArgumentValue("PeerConnectionManager", "/"))) {
return NPT_FAILURE;
}
if (NPT_FAILED(action->SetArgumentValue("PeerConnectionID", "-1"))) {
return NPT_FAILURE;
}
if (NPT_FAILED(action->SetArgumentValue("Direction", "Output"))) {
return NPT_FAILURE;
}
if (NPT_FAILED(action->SetArgumentValue("Status", "Unknown"))) {
return NPT_FAILURE;
}
return NPT_SUCCESS;
}
示例13: msg
/*----------------------------------------------------------------------
| CUPnPRenderer::OnSetAVTransportURI
+---------------------------------------------------------------------*/
NPT_Result
CUPnPRenderer::OnSetNextAVTransportURI(PLT_ActionReference& action)
{
NPT_String uri, meta;
PLT_Service* service;
NPT_CHECK_SEVERE(FindServiceByType("urn:schemas-upnp-org:service:AVTransport:1", service));
NPT_CHECK_SEVERE(action->GetArgumentValue("NextURI", uri));
NPT_CHECK_SEVERE(action->GetArgumentValue("NextURIMetaData", meta));
CFileItemPtr item = GetFileItem(uri, meta);
if (!item) {
return NPT_FAILURE;
}
#if 0
if (g_application.m_pPlayer->IsPlaying()) {
int playlist = PLAYLIST_MUSIC;
if(item->IsVideo())
playlist = PLAYLIST_VIDEO;
{ CSingleLock lock(g_graphicsContext);
g_playlistPlayer.ClearPlaylist(playlist);
g_playlistPlayer.Add(playlist, item);
g_playlistPlayer.SetCurrentSong(-1);
g_playlistPlayer.SetCurrentPlaylist(playlist);
}
CGUIMessage msg(GUI_MSG_PLAYLIST_CHANGED, 0, 0);
g_windowManager.SendThreadMessage(msg);
service->SetStateVariable("NextAVTransportURI", uri);
service->SetStateVariable("NextAVTransportURIMetaData", meta);
NPT_CHECK_SEVERE(action->SetArgumentsOutFromStateVariable());
return NPT_SUCCESS;
} else if (g_windowManager.GetActiveWindow() == WINDOW_SLIDESHOW) {
return NPT_FAILURE;
} else {
return NPT_FAILURE;
}
#endif
return NPT_SUCCESS;
}
示例14: OnBrowseDirectChildren
/*----------------------------------------------------------------------
| PLT_FileMediaConnectDelegate::OnSearchContainer
+---------------------------------------------------------------------*/
NPT_Result
PLT_FileMediaConnectDelegate::OnSearchContainer(PLT_ActionReference& action,
const char* object_id,
const char* search_criteria,
const char* filter,
NPT_UInt32 starting_index,
NPT_UInt32 requested_count,
const char* sort_criteria,
const PLT_HttpRequestContext& context)
{
/* parse search criteria */
/* TODO: HACK TO PASS DLNA */
if (search_criteria && NPT_StringsEqual(search_criteria, "Unknownfieldname")) {
/* error */
NPT_LOG_WARNING_1("Unsupported or invalid search criteria %s", search_criteria);
action->SetError(708, "Unsupported or invalid search criteria");
return NPT_FAILURE;
}
/* locate the file from the object ID */
NPT_String dir;
if (NPT_FAILED(GetFilePath(object_id, dir))) {
/* error */
NPT_LOG_WARNING("ObjectID not found.");
action->SetError(710, "No Such Container.");
return NPT_FAILURE;
}
/* retrieve the item type */
NPT_FileInfo info;
NPT_Result res = NPT_File::GetInfo(dir, &info);
if (NPT_FAILED(res) || (info.m_Type != NPT_FileInfo::FILE_TYPE_DIRECTORY)) {
/* error */
NPT_LOG_WARNING("No such container");
action->SetError(710, "No such container");
return NPT_FAILURE;
}
/* hack for now to return something back to XBox 360 */
return OnBrowseDirectChildren(action,
object_id,
filter,
starting_index,
requested_count,
sort_criteria,
context);
}
示例15:
/*----------------------------------------------------------------------
| CUPnPRenderer::OnSetVolume
+---------------------------------------------------------------------*/
NPT_Result
CUPnPRenderer::OnSetVolume(PLT_ActionReference& action)
{
NPT_String volume;
NPT_CHECK_SEVERE(action->GetArgumentValue("DesiredVolume", volume));
g_application.SetVolume((float)strtod((const char*)volume, NULL));
return NPT_SUCCESS;
}