a11057a2c1c56926ee5a1c55cfb3baf1efa3ef65
[profile/ivi/GUPnP.git] / libgupnp / gupnp-service-proxy.h
1 /*
2  * Copyright (C) 2006, 2007, 2008 OpenedHand Ltd.
3  *
4  * Author: Jorn Baayen <jorn@openedhand.com>
5  *
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.
10  *
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.
15  *
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.
20  */
21
22 #ifndef __GUPNP_SERVICE_PROXY_H__
23 #define __GUPNP_SERVICE_PROXY_H__
24
25 #include "gupnp-error.h"
26 #include "gupnp-service-info.h"
27
28 G_BEGIN_DECLS
29
30 GType
31 gupnp_service_proxy_get_type (void) G_GNUC_CONST;
32
33 #define GUPNP_TYPE_SERVICE_PROXY \
34                 (gupnp_service_proxy_get_type ())
35 #define GUPNP_SERVICE_PROXY(obj) \
36                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
37                  GUPNP_TYPE_SERVICE_PROXY, \
38                  GUPnPServiceProxy))
39 #define GUPNP_SERVICE_PROXY_CLASS(obj) \
40                 (G_TYPE_CHECK_CLASS_CAST ((obj), \
41                  GUPNP_TYPE_SERVICE_PROXY, \
42                  GUPnPServiceProxyClass))
43 #define GUPNP_IS_SERVICE_PROXY(obj) \
44                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
45                  GUPNP_TYPE_SERVICE_PROXY))
46 #define GUPNP_IS_SERVICE_PROXY_CLASS(obj) \
47                 (G_TYPE_CHECK_CLASS_TYPE ((obj), \
48                  GUPNP_TYPE_SERVICE_PROXY))
49 #define GUPNP_SERVICE_PROXY_GET_CLASS(obj) \
50                 (G_TYPE_INSTANCE_GET_CLASS ((obj), \
51                  GUPNP_TYPE_SERVICE_PROXY, \
52                  GUPnPServiceProxyClass))
53
54 typedef struct _GUPnPServiceProxyPrivate GUPnPServiceProxyPrivate;
55 typedef struct _GUPnPServiceProxy GUPnPServiceProxy;
56 typedef struct _GUPnPServiceProxyClass GUPnPServiceProxyClass;
57
58 /**
59  * GUPnPServiceProxy:
60  *
61  * This struct contains private data only, and should be accessed using the
62  * functions below.
63  */
64 struct _GUPnPServiceProxy {
65         GUPnPServiceInfo parent;
66
67         GUPnPServiceProxyPrivate *priv;
68 };
69
70 struct _GUPnPServiceProxyClass {
71         GUPnPServiceInfoClass parent_class;
72
73         /* signals */
74         void (* subscription_lost) (GUPnPServiceProxy *proxy,
75                                     const GError      *reason);
76
77         /* future padding */
78         void (* _gupnp_reserved1) (void);
79         void (* _gupnp_reserved2) (void);
80         void (* _gupnp_reserved3) (void);
81         void (* _gupnp_reserved4) (void);
82 };
83
84 /**
85  * GUPnPServiceProxyAction:
86  *
87  * Opaque structure for holding in-progress action data.
88  **/
89 typedef struct _GUPnPServiceProxyAction GUPnPServiceProxyAction;
90
91 /**
92  * GUPnPServiceProxyActionCallback:
93  * @proxy: The #GUPnPServiceProxy @action is called from
94  * @action: The #GUPnPServiceProxyAction in progress
95  * @user_data: User data
96  *
97  * Callback notifying that @action on @proxy has returned and
98  * gupnp_service_proxy_end_action() etc can be called.
99  **/
100 typedef void (* GUPnPServiceProxyActionCallback) (
101                                      GUPnPServiceProxy       *proxy,
102                                      GUPnPServiceProxyAction *action,
103                                      gpointer                 user_data);
104
105 /**
106  * GUPnPServiceProxyNotifyCallback:
107  * @proxy: The #GUPnPServiceProxy the notification originates from
108  * @variable: The name of the variable being notified
109  * @value: The #GValue of the variable being notified
110  * @user_data: User data
111  *
112  * Callback notifying that the state variable @variable on @proxy has changed to
113  * @value.
114  **/
115 typedef void (* GUPnPServiceProxyNotifyCallback) (GUPnPServiceProxy *proxy,
116                                                   const char        *variable,
117                                                   GValue            *value,
118                                                   gpointer           user_data);
119
120 gboolean
121 gupnp_service_proxy_send_action    (GUPnPServiceProxy              *proxy,
122                                     const char                     *action,
123                                     GError                        **error,
124                                     ...) G_GNUC_NULL_TERMINATED;
125
126 gboolean
127 gupnp_service_proxy_send_action_valist
128                                    (GUPnPServiceProxy              *proxy,
129                                     const char                     *action,
130                                     GError                        **error,
131                                     va_list                         var_args);
132
133 gboolean
134 gupnp_service_proxy_send_action_hash
135                                    (GUPnPServiceProxy              *proxy,
136                                     const char                     *action,
137                                     GError                        **error,
138                                     GHashTable                     *in_hash,
139                                     GHashTable                     *out_hash);
140
141
142 gboolean
143 gupnp_service_proxy_send_action_list (GUPnPServiceProxy *proxy,
144                                       const char        *action,
145                                       GError           **error,
146                                       GList             *in_names,
147                                       GList             *in_values,
148                                       GList             *out_names,
149                                       GList             *out_types,
150                                       GList            **out_values);
151
152
153 GUPnPServiceProxyAction *
154 gupnp_service_proxy_begin_action   (GUPnPServiceProxy              *proxy,
155                                     const char                     *action,
156                                     GUPnPServiceProxyActionCallback callback,
157                                     gpointer                        user_data,
158                                     ...) G_GNUC_NULL_TERMINATED;
159
160 GUPnPServiceProxyAction *
161 gupnp_service_proxy_begin_action_valist
162                                    (GUPnPServiceProxy              *proxy,
163                                     const char                     *action,
164                                     GUPnPServiceProxyActionCallback callback,
165                                     gpointer                        user_data,
166                                     va_list                         var_args);
167
168 GUPnPServiceProxyAction *
169 gupnp_service_proxy_begin_action_list
170                                    (GUPnPServiceProxy              *proxy,
171                                     const char                     *action,
172                                     GList                          *in_names,
173                                     GList                          *in_values,
174                                     GUPnPServiceProxyActionCallback callback,
175                                     gpointer                        user_data);
176
177 GUPnPServiceProxyAction *
178 gupnp_service_proxy_begin_action_hash
179                                    (GUPnPServiceProxy              *proxy,
180                                     const char                     *action,
181                                     GUPnPServiceProxyActionCallback callback,
182                                     gpointer                        user_data,
183                                     GHashTable                     *hash);
184
185 gboolean
186 gupnp_service_proxy_end_action     (GUPnPServiceProxy              *proxy,
187                                     GUPnPServiceProxyAction        *action,
188                                     GError                        **error,
189                                     ...) G_GNUC_NULL_TERMINATED;
190
191 gboolean
192 gupnp_service_proxy_end_action_valist
193                                    (GUPnPServiceProxy              *proxy,
194                                     GUPnPServiceProxyAction        *action,
195                                     GError                        **error,
196                                     va_list                         var_args);
197
198 gboolean
199 gupnp_service_proxy_end_action_list
200                                   (GUPnPServiceProxy       *proxy,
201                                    GUPnPServiceProxyAction *action,
202                                    GError                  **error,
203                                    GList                   *out_names,
204                                    GList                   *out_types,
205                                    GList                  **out_values);
206
207 gboolean
208 gupnp_service_proxy_end_action_hash
209                                    (GUPnPServiceProxy              *proxy,
210                                     GUPnPServiceProxyAction        *action,
211                                     GError                        **error,
212                                     GHashTable                     *hash);
213
214 void
215 gupnp_service_proxy_cancel_action  (GUPnPServiceProxy              *proxy,
216                                     GUPnPServiceProxyAction        *action);
217
218 gboolean
219 gupnp_service_proxy_add_notify     (GUPnPServiceProxy              *proxy,
220                                     const char                     *variable,
221                                     GType                           type,
222                                     GUPnPServiceProxyNotifyCallback callback,
223                                     gpointer                        user_data);
224
225 gboolean
226 gupnp_service_proxy_remove_notify  (GUPnPServiceProxy              *proxy,
227                                     const char                     *variable,
228                                     GUPnPServiceProxyNotifyCallback callback,
229                                     gpointer                        user_data);
230
231 void
232 gupnp_service_proxy_set_subscribed (GUPnPServiceProxy              *proxy,
233                                     gboolean                        subscribed);
234
235 gboolean
236 gupnp_service_proxy_get_subscribed (GUPnPServiceProxy              *proxy);
237
238 G_END_DECLS
239
240 #endif /* __GUPNP_SERVICE_PROXY_H__ */