Exemple #1
0
static GUPnPServiceInfo *
gupnp_device_proxy_get_service (GUPnPDeviceInfo *info,
                                xmlNode         *element)
{
        GUPnPResourceFactory *factory;
        GUPnPServiceProxy    *service;
        GUPnPContext         *context;
        GUPnPXMLDoc          *doc;
        const char           *location, *udn;
        const SoupURI        *url_base;

        factory = gupnp_device_info_get_resource_factory (info);
        context = gupnp_device_info_get_context (info);
        doc = _gupnp_device_info_get_document (info);
        udn = gupnp_device_info_get_udn (info);
        location = gupnp_device_info_get_location (info);
        url_base = gupnp_device_info_get_url_base (info);

        service = gupnp_resource_factory_create_service_proxy (factory,
                                                               context,
                                                               doc,
                                                               element,
                                                               udn,
                                                               NULL,
                                                               location,
                                                               url_base);

        return GUPNP_SERVICE_INFO (service);
}
Exemple #2
0
void
show_device_details (GUPnPDeviceInfo *info)
{
        char          *details[32];
        const SoupURI *uri;
        const char    *str;
        int            i = 0;

        details[i++] = _("Location");
        str = gupnp_device_info_get_location (info);
        if (str)
                details[i++] = g_strdup (str);

        details[i++] = _("UDN");
        str = gupnp_device_info_get_udn (info);
        if (str)
                details[i++] = g_strdup (str);

        details[i++] = _("Type");
        str = gupnp_device_info_get_device_type (info);
        if (str)
                details[i++] = g_strdup (str);

        details[i++] = _("Base URL");
        uri = gupnp_device_info_get_url_base (info);
        if (uri)
                details[i++] = soup_uri_to_string ((SoupURI *) uri, FALSE);

        details[i++] = _("Friendly Name");
        details[i++] = gupnp_device_info_get_friendly_name (info);
        details[i++] = _("Manufacturer");
        details[i++] = gupnp_device_info_get_manufacturer (info);
        details[i++] = _("Manufacturer URL");
        details[i++] = gupnp_device_info_get_manufacturer_url (info);
        details[i++] = _("Model Description");
        details[i++] = gupnp_device_info_get_model_description (info);
        details[i++] = _("Model Name");
        details[i++] = gupnp_device_info_get_model_name (info);
        details[i++] = _("Model Number");
        details[i++] = gupnp_device_info_get_model_number (info);
        details[i++] = _("Model URL");
        details[i++] = gupnp_device_info_get_model_url (info);
        details[i++] = _("Serial Number");
        details[i++] = gupnp_device_info_get_serial_number (info);
        details[i++] = _("UPC");
        details[i++] = gupnp_device_info_get_upc (info);
        details[i++] = _("Presentation URL");
        details[i++] = gupnp_device_info_get_presentation_url (info);
        details[i] = NULL;

        update_details ((const char **) details);

        /* Only free the values */
        for (i = 1; details[i - 1]; i += 2) {
                if (details[i])
                        g_free (details[i]);
        }
}
void UpnpControlPointService::deviceProxyRemoved (GUPnPControlPoint *cp, GUPnPServiceProxy *proxy, gpointer data)
{
	UpnpControlPointService* pThis = static_cast<UpnpControlPointService*>(data);
	const char* type = gupnp_device_info_get_device_type(GUPNP_DEVICE_INFO(proxy));
	const char* location = gupnp_device_info_get_location(GUPNP_DEVICE_INFO(proxy));

	g_print("Device removed: \n");
	g_print("\ttype: %s\n", type);
	g_print("\tlocation: %s\n", location);
	pThis->fireDeviceRemoved(cp, proxy);
}
Exemple #4
0
static GUPnPServiceInfo *
gupnp_device_get_service (GUPnPDeviceInfo *info,
                          xmlNode         *element)
{
        GUPnPDevice          *device;
        GUPnPService         *service;
        GUPnPResourceFactory *factory;
        GUPnPContext         *context;
        GUPnPDevice          *root_device;
        const char           *location, *udn;
        const SoupURI        *url_base;

        device = GUPNP_DEVICE (info);

        root_device = GUPNP_IS_ROOT_DEVICE (device) ? device :
                      GUPNP_DEVICE (device->priv->root_device);
        if (root_device == NULL) {
                g_warning ("Root device not found.");

                return NULL;
        }

        factory = gupnp_device_info_get_resource_factory (info);
        context = gupnp_device_info_get_context (info);
        udn = gupnp_device_info_get_udn (info);
        location = gupnp_device_info_get_location (info);
        url_base = gupnp_device_info_get_url_base (info);

        service = gupnp_resource_factory_create_service (factory,
                                                         context,
                                                         root_device,
                                                         element,
                                                         udn,
                                                         location,
                                                         url_base);

        return GUPNP_SERVICE_INFO (service);
}