⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gupnp-resource-factory.c

📁 另一 UPNP SDK 支持在UNIX/LINUX上运行。 UPnP是一种网络协议
💻 C
📖 第 1 页 / 共 2 页
字号:
        proxy = g_object_new (proxy_type,                              "context", context,                              "location", location,                              "udn", udn,                              "service-type", service_type,                              "url-base", url_base,                              "document", wrapper,                              "element", element,                              NULL);        return proxy;}/** * gupnp_resource_factory_create_device * @factory: A #GUPnPResourceFactory * @context: A #GUPnPContext * @root_device: The #GUPnPRootDevice * @element: The #xmlNode ponting to the right device element * @udn: The UDN of the device to create a device for * @location: The location of the device description file * @url_base: The URL base for this device * * Create a #GUPnPDevice for the device with element @element, as * read from the device description file specified by @location. * * Return value: A new #GUPnPDevice. **/GUPnPDevice *gupnp_resource_factory_create_device                                (GUPnPResourceFactory *factory,                                 GUPnPContext         *context,                                 GUPnPDevice          *root_device,                                 xmlNode              *element,                                 const char           *udn,                                 const char           *location,                                 const SoupURI        *url_base){        GUPnPDevice *device;        const char  *upnp_type;        GType        device_type = GUPNP_TYPE_DEVICE;        g_return_val_if_fail (GUPNP_IS_RESOURCE_FACTORY (factory), NULL);        g_return_val_if_fail (GUPNP_IS_CONTEXT (context), NULL);        g_return_val_if_fail (GUPNP_IS_ROOT_DEVICE (root_device), NULL);        g_return_val_if_fail (element != NULL, NULL);        g_return_val_if_fail (url_base != NULL, NULL);        upnp_type = xml_util_get_child_element_content_glib (element,                                                             "deviceType");        if (upnp_type) {                gpointer value;                value = g_hash_table_lookup (factory->priv->resource_type_hash,                                             upnp_type);                if (value)                        device_type = GPOINTER_TO_INT (value);        }        device = g_object_new (device_type,                               "resource-factory", factory,                               "context", context,                               "root-device", root_device,                               "location", location,                               "udn", udn,                               "url-base", url_base,                               "element", element,                               NULL);        return device;}/** * gupnp_resource_factory_create_service * @factory: A #GUPnPResourceFactory * @context: A #GUPnPContext * @root_device: The #GUPnPRootDevice * @element: The #xmlNode ponting to the right service element * @udn: The UDN of the device the service is contained in * @location: The location of the service description file * @url_base: The URL base for this service * * Create a #GUPnPService for the service with element @element, as * read from the service description file specified by @location. * * Return value: A new #GUPnPService. **/GUPnPService *gupnp_resource_factory_create_service                                (GUPnPResourceFactory *factory,                                 GUPnPContext         *context,                                 GUPnPDevice          *root_device,                                 xmlNode              *element,                                 const char           *udn,                                 const char           *location,                                 const SoupURI        *url_base){        GUPnPService *service;        const char   *upnp_type;        GType         service_type = GUPNP_TYPE_SERVICE;        g_return_val_if_fail (GUPNP_IS_RESOURCE_FACTORY (factory), NULL);        g_return_val_if_fail (GUPNP_IS_CONTEXT (context), NULL);        g_return_val_if_fail (GUPNP_IS_ROOT_DEVICE (root_device), NULL);        g_return_val_if_fail (element != NULL, NULL);        g_return_val_if_fail (location != NULL, NULL);        g_return_val_if_fail (url_base != NULL, NULL);        upnp_type = xml_util_get_child_element_content_glib (element,                                                             "serviceType");        if (upnp_type) {                gpointer value;                value = g_hash_table_lookup (factory->priv->resource_type_hash,                                             upnp_type);                if (value)                        service_type = GPOINTER_TO_INT (value);        }        service = g_object_new (service_type,                                "context", context,                                "root-device", root_device,                                "location", location,                                "udn", udn,                                "url-base", url_base,                                "element", element,                                NULL);        return service;}/** * gupnp_resource_factory_register_resource_type * @factory: A #GUPnPResourceFactory. * @upnp_type: The UPnP type name of the resource. * @type: The requested GType assignment for the resource. * * Registers the GType @type for the resource of UPnP type @upnp_type. After * this call, the factory @factory will create object of GType @type each time * it is asked to create a resource object for UPnP type @upnp_type. * * Note: GType @type must be a derived type of #GUPNP_TYPE_DEVICE if resource is * a device or #GUPNP_TYPE_SERVICE if its a service. **/voidgupnp_resource_factory_register_resource_type (GUPnPResourceFactory *factory,                                               const char           *upnp_type,                                               GType                 type){        g_hash_table_insert (factory->priv->resource_type_hash,                             g_strdup (upnp_type),                             GINT_TO_POINTER (type));}/** * gupnp_resource_factory_unregister_resource_type * @factory: A #GUPnPResourceFactory. * @upnp_type: The UPnP type name of the resource. * * Unregisters the GType assignment for the resource of UPnP type @upnp_type. * * Return value: %TRUE if GType assignment was removed successfully, %FALSE * otherwise. **/gbooleangupnp_resource_factory_unregister_resource_type                                (GUPnPResourceFactory *factory,                                 const char           *upnp_type){        return g_hash_table_remove (factory->priv->resource_type_hash,                                    upnp_type);}/** * gupnp_resource_factory_register_resource_proxy_type * @factory: A #GUPnPResourceFactory. * @upnp_type: The UPnP type name of the resource. * @type: The requested GType assignment for the resource proxy. * * Registers the GType @type for the proxy of resource of UPnP type @upnp_type. * After this call, the factory @factory will create object of GType @type each * time it is asked to create a resource proxy object for UPnP type @upnp_type. * * Note: GType @type must be a derived type of #GUPNP_TYPE_DEVICE_PROXY if * resource is a device or #GUPNP_TYPE_SERVICE_PROXY if its a service. **/voidgupnp_resource_factory_register_resource_proxy_type                                (GUPnPResourceFactory *factory,                                 const char           *upnp_type,                                 GType                 type){        g_hash_table_insert (factory->priv->proxy_type_hash,                             g_strdup (upnp_type),                             GINT_TO_POINTER (type));}/** * gupnp_resource_factory_unregister_resource_proxy_type * @factory: A #GUPnPResourceFactory. * @upnp_type: The UPnP type name of the resource. * * Unregisters the GType assignment for the proxy of resource of UPnP type * @upnp_type. * * Return value: %TRUE if GType assignment was removed successfully, %FALSE * otherwise. **/gbooleangupnp_resource_factory_unregister_resource_proxy_type                                (GUPnPResourceFactory *factory,                                 const char           *upnp_type){        return g_hash_table_remove (factory->priv->proxy_type_hash, upnp_type);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -