Update media-service-upnp to version 0.3.0 ( ca17a69 )
[profile/ivi/media-service-upnp.git] / src / async.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_ASYNC_H__
24 #define MSU_ASYNC_H__
25
26 #include <libgupnp/gupnp-control-point.h>
27
28 #include "task.h"
29 #include "upnp.h"
30
31 typedef struct msu_async_cb_data_t_ msu_async_cb_data_t;
32 typedef struct msu_device_t_ msu_device_t;
33
34 typedef void (*msu_async_cb_t)(msu_async_cb_data_t *cb_data);
35
36 typedef struct msu_async_bas_t_ msu_async_bas_t;
37 struct msu_async_bas_t_ {
38         guint32 filter_mask;
39         gchar *root_path;
40         GPtrArray *vbs;
41         const gchar *protocol_info;
42         gboolean need_child_count;
43         guint retrieved;
44         guint max_count;
45         msu_async_cb_t get_children_cb;
46 };
47
48 typedef struct msu_async_get_prop_t_ msu_async_get_prop_t;
49 struct msu_async_get_prop_t_ {
50         GCallback prop_func;
51         gchar *root_path;
52         const gchar *protocol_info;
53 };
54
55 typedef struct msu_async_get_all_t_ msu_async_get_all_t;
56 struct msu_async_get_all_t_ {
57         GCallback prop_func;
58         GVariantBuilder *vb;
59         gchar *root_path;
60         guint32 filter_mask;
61         const gchar *protocol_info;
62         gboolean need_child_count;
63         gboolean device_object;
64         msu_device_t *device;
65 };
66
67 typedef struct msu_async_upload_t_ msu_async_upload_t;
68 struct msu_async_upload_t_ {
69         const gchar *object_class;
70         gchar *root_path;
71         gchar *mime_type;
72         msu_device_t *device;
73 };
74
75 typedef struct msu_async_create_container_t_ msu_async_create_container_t;
76 struct msu_async_create_container_t_ {
77         gchar *root_path;
78 };
79
80 typedef struct msu_async_update_t_ msu_async_update_t;
81 struct msu_async_update_t_ {
82         gchar *current_tag_value;
83         gchar *new_tag_value;
84         GHashTable *map;
85 };
86
87 struct msu_async_cb_data_t_ {
88         msu_task_type_t type;
89         msu_task_t *task;
90         msu_upnp_task_complete_t cb;
91         GVariant *result;
92         GError *error;
93         GUPnPServiceProxyAction *action;
94         GUPnPServiceProxy *proxy;
95         GCancellable *cancellable;
96         gulong cancel_id;
97         gchar *id;
98         union {
99                 msu_async_bas_t bas;
100                 msu_async_get_prop_t get_prop;
101                 msu_async_get_all_t get_all;
102                 msu_async_upload_t upload;
103                 msu_async_create_container_t create_container;
104                 msu_async_update_t update;
105         } ut;
106 };
107
108 msu_async_cb_data_t *msu_async_cb_data_new(msu_task_t *task,
109                                           msu_upnp_task_complete_t cb);
110 void msu_async_cb_data_delete(msu_async_cb_data_t *cb_data);
111 gboolean msu_async_complete_task(gpointer user_data);
112 void msu_async_task_cancelled(GCancellable *cancellable, gpointer user_data);
113
114
115
116 #endif