Update media-service-upnp to version 0.3.0 ( ca17a69 )
[profile/ivi/media-service-upnp.git] / src / device.h
1 /*
2  * media-service-upnp
3  *
4  * Copyright (C) 2012 Intel Corporation. All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU Lesser General Public License,
8  * version 2.1, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License
13  * for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Mark Ryan <mark.d.ryan@intel.com>
20  *
21  */
22
23 #ifndef MSU_DEVICE_H__
24 #define MSU_DEVICE_H__
25
26 #include <libgupnp/gupnp-control-point.h>
27
28 #include "async.h"
29 #include "chain-task.h"
30 #include "client.h"
31 #include "props.h"
32
33 typedef struct msu_device_context_t_ msu_device_context_t;
34 struct msu_device_context_t_ {
35         gchar *ip_address;
36         GUPnPDeviceProxy *device_proxy;
37         GUPnPServiceProxy *service_proxy;
38         msu_device_t *device;
39         gboolean subscribed;
40         guint timeout_id;
41 };
42
43 struct msu_device_t_ {
44         GDBusConnection *connection;
45         guint id;
46         gchar *path;
47         GPtrArray *contexts;
48         guint timeout_id;
49         GHashTable *uploads;
50         GHashTable *upload_jobs;
51         guint upload_id;
52         guint system_update_id;
53         GVariant *search_caps;
54         GVariant *sort_caps;
55         GVariant *sort_ext_caps;
56         GVariant *feature_list;
57         gboolean shutting_down;
58 };
59
60 void msu_device_append_new_context(msu_device_t *device,
61                                    const gchar *ip_address,
62                                    GUPnPDeviceProxy *proxy);
63 void msu_device_delete(void *device);
64 msu_device_t *msu_device_new(GDBusConnection *connection,
65                              GUPnPDeviceProxy *proxy,
66                              const gchar *ip_address,
67                              const GDBusSubtreeVTable *vtable,
68                              void *user_data,
69                              GHashTable *filter_map,
70                              guint counter,
71                              msu_chain_task_t *chain);
72
73 msu_device_t *msu_device_from_path(const gchar *path, GHashTable *device_list);
74 msu_device_context_t *msu_device_get_context(msu_device_t *device,
75                                              msu_client_t *client);
76 void msu_device_get_children(msu_device_t *device, msu_client_t *client,
77                              msu_task_t *task, msu_async_cb_data_t *cb_data,
78                              const gchar *upnp_filter, const gchar *sort_by,
79                              GCancellable *cancellable);
80 void msu_device_get_all_props(msu_device_t *device, msu_client_t *client,
81                               msu_task_t *task,
82                               msu_async_cb_data_t *cb_data,
83                               gboolean root_object,
84                               GCancellable *cancellable);
85 void msu_device_get_prop(msu_device_t *device, msu_client_t *client,
86                          msu_task_t *task, msu_async_cb_data_t *cb_data,
87                          msu_prop_map_t *prop_map, gboolean root_object,
88                          GCancellable *cancellable);
89 void msu_device_search(msu_device_t *device, msu_client_t *client,
90                        msu_task_t *task, msu_async_cb_data_t *cb_data,
91                        const gchar *upnp_filter, const gchar *upnp_query,
92                        const gchar *sort_by, GCancellable *cancellable);
93 void msu_device_get_resource(msu_device_t *device, msu_client_t *client,
94                              msu_task_t *task,
95                              msu_async_cb_data_t *cb_data,
96                              const gchar *upnp_filter,
97                              GCancellable *cancellable);
98 void msu_device_subscribe_to_contents_change(msu_device_t *device);
99 void msu_device_upload(msu_device_t *device, msu_client_t *client,
100                        msu_task_t *task, const gchar *parent_id,
101                        msu_async_cb_data_t *cb_data, GCancellable *cancellable);
102 gboolean msu_device_get_upload_status(msu_device_t *device,
103                                       msu_task_t *task, GError **error);
104 gboolean msu_device_cancel_upload(msu_device_t *device, msu_task_t *task,
105                                   GError **error);
106 void msu_device_get_upload_ids(msu_device_t *device, msu_task_t *task);
107 void msu_device_delete_object(msu_device_t *device, msu_client_t *client,
108                               msu_task_t *task,
109                               msu_async_cb_data_t *cb_data,
110                               GCancellable *cancellable);
111 void msu_device_create_container(msu_device_t *device, msu_client_t *client,
112                                  msu_task_t *task,
113                                  const gchar *parent_id,
114                                  msu_async_cb_data_t *cb_data,
115                                  GCancellable *cancellable);
116 void msu_device_update_object(msu_device_t *device, msu_client_t *client,
117                               msu_task_t *task,
118                               msu_async_cb_data_t *cb_data,
119                               const gchar *upnp_filter,
120                               GCancellable *cancellable);
121
122 #endif