Add gobject introspection
[profile/ivi/GUPnP.git] / libgupnp / gupnp-service.h
1 /*
2  * Copyright (C) 2007 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_H__
23 #define __GUPNP_SERVICE_H__
24
25 #include <stdarg.h>
26
27 #include "gupnp-service-info.h"
28
29 G_BEGIN_DECLS
30
31 GType
32 gupnp_service_get_type (void) G_GNUC_CONST;
33
34 #define GUPNP_TYPE_SERVICE \
35                 (gupnp_service_get_type ())
36 #define GUPNP_SERVICE(obj) \
37                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
38                  GUPNP_TYPE_SERVICE, \
39                  GUPnPService))
40 #define GUPNP_SERVICE_CLASS(obj) \
41                 (G_TYPE_CHECK_CLASS_CAST ((obj), \
42                  GUPNP_TYPE_SERVICE, \
43                  GUPnPServiceClass))
44 #define GUPNP_IS_SERVICE(obj) \
45                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
46                  GUPNP_TYPE_SERVICE))
47 #define GUPNP_IS_SERVICE_CLASS(obj) \
48                 (G_TYPE_CHECK_CLASS_TYPE ((obj), \
49                  GUPNP_TYPE_SERVICE))
50 #define GUPNP_SERVICE_GET_CLASS(obj) \
51                 (G_TYPE_INSTANCE_GET_CLASS ((obj), \
52                  GUPNP_TYPE_SERVICE, \
53                  GUPnPServiceClass))
54
55 /**
56  * GUPnPServiceAction:
57  *
58  * Opaque structure for holding in-progress action data.
59  **/
60 typedef struct _GUPnPServiceAction GUPnPServiceAction;
61
62 GType
63 gupnp_service_action_get_type (void) G_GNUC_CONST;
64
65 #define GUPNP_TYPE_SERVICE_ACTION (gupnp_service_action_get_type ())
66
67 typedef struct _GUPnPServicePrivate GUPnPServicePrivate;
68 typedef struct _GUPnPService GUPnPService;
69 typedef struct _GUPnPServiceClass GUPnPServiceClass;
70
71 /**
72  * GUPnPService:
73  *
74  * This struct contains private data only, and should be accessed using the
75  * functions below.
76  */
77 struct _GUPnPService {
78         GUPnPServiceInfo parent;
79
80         GUPnPServicePrivate *priv;
81 };
82
83 struct _GUPnPServiceClass {
84         GUPnPServiceInfoClass parent_class;
85
86         /* <signals> */
87         void (* action_invoked) (GUPnPService       *service,
88                                  GUPnPServiceAction *action);
89
90         void (* query_variable) (GUPnPService       *service,
91                                  const char         *variable,
92                                  GValue             *value);
93
94         void (* notify_failed)  (GUPnPService       *service,
95                                  const GList        *callback_urls,
96                                  const GError       *reason);
97
98         /* future padding */
99         void (* _gupnp_reserved1) (void);
100         void (* _gupnp_reserved2) (void);
101         void (* _gupnp_reserved3) (void);
102         void (* _gupnp_reserved4) (void);
103 };
104
105
106 const char *
107 gupnp_service_action_get_name     (GUPnPServiceAction *action);
108
109 GList *
110 gupnp_service_action_get_locales  (GUPnPServiceAction *action);
111
112 void
113 gupnp_service_action_get          (GUPnPServiceAction *action,
114                                    ...) G_GNUC_NULL_TERMINATED;
115
116 void
117 gupnp_service_action_get_valist   (GUPnPServiceAction *action,
118                                    va_list             var_args);
119
120 GList *
121 gupnp_service_action_get_values (GUPnPServiceAction *action,
122                                  GList              *arg_names,
123                                  GList              *arg_types);
124
125 void
126 gupnp_service_action_get_value    (GUPnPServiceAction *action,
127                                    const char         *argument,
128                                    GValue             *value);
129
130 GValue *
131 gupnp_service_action_get_gvalue   (GUPnPServiceAction *action,
132                                    const char         *argument,
133                                    GType               type);
134
135 void
136 gupnp_service_action_set          (GUPnPServiceAction *action,
137                                    ...) G_GNUC_NULL_TERMINATED;
138
139 void
140 gupnp_service_action_set_valist   (GUPnPServiceAction *action,
141                                    va_list             var_args);
142
143 void
144 gupnp_service_action_set_values   (GUPnPServiceAction *action,
145                                    GList              *arg_names,
146                                    GList              *arg_values);
147
148 void
149 gupnp_service_action_set_value    (GUPnPServiceAction *action,
150                                    const char         *argument,
151                                    const GValue       *value);
152
153 void
154 gupnp_service_action_return       (GUPnPServiceAction *action);
155
156 void
157 gupnp_service_action_return_error (GUPnPServiceAction *action,
158                                    guint               error_code,
159                                    const char         *error_description);
160
161 SoupMessage *
162 gupnp_service_action_get_message  (GUPnPServiceAction *action);
163
164 guint
165 gupnp_service_action_get_argument_count
166                                   (GUPnPServiceAction *action);
167
168 void
169 gupnp_service_notify              (GUPnPService *service,
170                                    ...) G_GNUC_NULL_TERMINATED;
171
172 void
173 gupnp_service_notify_valist       (GUPnPService *service,
174                                    va_list       var_args);
175
176 void
177 gupnp_service_notify_value        (GUPnPService *service,
178                                    const char   *variable,
179                                    const GValue *value);
180
181 void
182 gupnp_service_freeze_notify       (GUPnPService *service);
183
184 void
185 gupnp_service_thaw_notify         (GUPnPService *service);
186
187 void
188 gupnp_service_signals_autoconnect (GUPnPService *service,
189                                    gpointer      user_data,
190                                    GError      **error);
191
192 G_END_DECLS
193
194 #endif /* __GUPNP_SERVICE_H__ */