本文整理汇总了C++中PLT_Service::GetServiceID方法的典型用法代码示例。如果您正苦于以下问题:C++ PLT_Service::GetServiceID方法的具体用法?C++ PLT_Service::GetServiceID怎么用?C++ PLT_Service::GetServiceID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PLT_Service
的用法示例。
在下文中一共展示了PLT_Service::GetServiceID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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;
}