本文整理汇总了C++中PLT_Service::GetServiceType方法的典型用法代码示例。如果您正苦于以下问题:C++ PLT_Service::GetServiceType方法的具体用法?C++ PLT_Service::GetServiceType怎么用?C++ PLT_Service::GetServiceType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PLT_Service
的用法示例。
在下文中一共展示了PLT_Service::GetServiceType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RefreshServiceList
void GPAC_DeviceItem::RefreshServiceList()
{
u32 i;
NPT_Array<PLT_Service*> services = m_device->GetServices();
for (i=0; i<services.GetItemCount(); i++) {
PLT_Service *serv = services[i];
FindService(serv->GetServiceType());
}
}
示例2: 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);
}
//.........这里部分代码省略.........
示例3:
GPAC_ServiceItem *GPAC_DeviceItem::FindService(const char *type)
{
u32 i, count;
GPAC_ServiceItem *serv;
count = gf_list_count(m_Services);
for (i=0; i<count; i++) {
serv = (GPAC_ServiceItem*)gf_list_get(m_Services, i);
if (serv->m_service->GetServiceType() == type)
return serv;
}
PLT_Service *service;
if (m_device->FindServiceByType(type, service) != NPT_SUCCESS) return NULL;
serv = new GPAC_ServiceItem(this, service);
#ifdef GPAC_HAS_SPIDERMONKEY
serv->js_ctx = js_ctx;
serv->obj = JS_NewObject(serv->js_ctx, &m_pUPnP->upnpServiceClass._class, 0, obj);
gf_js_add_root(serv->js_ctx, &serv->obj, GF_JSGC_OBJECT);
SMJS_SET_PRIVATE(serv->js_ctx, serv->obj, serv);
JS_DefineProperty(serv->js_ctx, serv->obj, "Name", STRING_TO_JSVAL( JS_NewStringCopyZ(serv->js_ctx, service->GetServiceID()) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineProperty(serv->js_ctx, serv->obj, "Type", STRING_TO_JSVAL( JS_NewStringCopyZ(serv->js_ctx, service->GetServiceType()) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineProperty(serv->js_ctx, serv->obj, "Hostname", STRING_TO_JSVAL( JS_NewStringCopyZ(serv->js_ctx, m_device->GetURLBase().GetHost() ) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(serv->js_ctx, serv->obj, "SetStateVariableListener", upnp_service_set_listener, 1, 0);
JS_DefineFunction(serv->js_ctx, serv->obj, "HasStateVariable", upnp_service_has_var, 1, 0);
JS_DefineFunction(serv->js_ctx, serv->obj, "HasAction", upnp_service_has_action, 2, 0);
JS_DefineFunction(serv->js_ctx, serv->obj, "CallAction", upnp_service_call_action, 2, 0);
JS_DefineFunction(serv->js_ctx, serv->obj, "SetActionListener", upnp_service_set_action_listener, 2, 0);
JS_DefineFunction(serv->js_ctx, serv->obj, "GetSCPD", upnp_service_get_scpd, 1, 0);
#endif
gf_list_add(m_Services, serv);
return serv;
}