2 * Copyright (C) 2006, 2007 OpenedHand Ltd.
4 * Author: Jorn Baayen <jorn@openedhand.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 * SECTION:gupnp-device-proxy
24 * @short_description: Proxy class for remote devices.
26 * #GUPnPDeviceProxy allows for retrieving proxies for a device's subdevices
27 * and services. #GUPnPDeviceProxy implements the #GUPnPDeviceInfo interface.
32 #include "gupnp-device-proxy.h"
33 #include "gupnp-device-info-private.h"
34 #include "gupnp-resource-factory-private.h"
37 G_DEFINE_TYPE (GUPnPDeviceProxy,
39 GUPNP_TYPE_DEVICE_INFO);
41 static GUPnPDeviceInfo *
42 gupnp_device_proxy_get_device (GUPnPDeviceInfo *info,
45 GUPnPDeviceProxy *device;
46 GUPnPResourceFactory *factory;
47 GUPnPContext *context;
50 const SoupURI *url_base;
52 factory = gupnp_device_info_get_resource_factory (info);
53 context = gupnp_device_info_get_context (info);
54 doc = _gupnp_device_info_get_document (info);
55 location = gupnp_device_info_get_location (info);
56 url_base = gupnp_device_info_get_url_base (info);
58 device = gupnp_resource_factory_create_device_proxy (factory,
66 return GUPNP_DEVICE_INFO (device);
69 static GUPnPServiceInfo *
70 gupnp_device_proxy_get_service (GUPnPDeviceInfo *info,
73 GUPnPResourceFactory *factory;
74 GUPnPServiceProxy *service;
75 GUPnPContext *context;
77 const char *location, *udn;
78 const SoupURI *url_base;
80 factory = gupnp_device_info_get_resource_factory (info);
81 context = gupnp_device_info_get_context (info);
82 doc = _gupnp_device_info_get_document (info);
83 udn = gupnp_device_info_get_udn (info);
84 location = gupnp_device_info_get_location (info);
85 url_base = gupnp_device_info_get_url_base (info);
87 service = gupnp_resource_factory_create_service_proxy (factory,
96 return GUPNP_SERVICE_INFO (service);
100 gupnp_device_proxy_init (G_GNUC_UNUSED GUPnPDeviceProxy *proxy)
105 gupnp_device_proxy_class_init (GUPnPDeviceProxyClass *klass)
107 GUPnPDeviceInfoClass *info_class;
109 info_class = GUPNP_DEVICE_INFO_CLASS (klass);
111 info_class->get_device = gupnp_device_proxy_get_device;
112 info_class->get_service = gupnp_device_proxy_get_service;