703be7b95549dcff139464810eb32f95e056efe1
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / include / bt-service-obex-agent.h
1 /*
2  * bluetooth-frwk
3  *
4  * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *              http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __BT_SERVICE_OBEX_AGENT_H
21 #define __BT_SERVICE_OBEX_AGENT_H
22
23 #include <glib-object.h>
24 #include <dbus/dbus-glib.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 typedef enum {
31         BT_OBEX_AGENT_ERROR_REJECT,
32         BT_OBEX_AGENT_ERROR_CANCEL,
33         BT_OBEX_AGENT_ERROR_TIMEOUT,
34 } bt_agent_error_t;
35
36 G_BEGIN_DECLS
37 typedef struct {
38         GObject parent;
39 } BtObexAgent;
40
41 typedef struct {
42         GObjectClass parent_class;
43 } BtObexAgentClass;
44
45 GType bt_obex_agent_get_type(void);
46
47 #define BT_OBEX_TYPE_AGENT (bt_obex_agent_get_type())
48 #define BT_OBEX_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), BT_OBEX_TYPE_AGENT, BtObexAgent))
49 #define BT_OBEX_AGENT_CLASS(agent_class) (G_TYPE_CHECK_CLASS_CAST((agent_class), BT_OBEX_TYPE_AGENT, BtObexAgentClass))
50 #define BT_OBEX_GET_AGENT_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), BT_OBEX_TYPE_AGENT, BtObexAgentClass))
51
52 typedef gboolean(*bt_obex_authorize_cb)(DBusGMethodInvocation *context,
53                                            const char *path,
54                                            gpointer data);
55
56 typedef gboolean(*bt_obex_request_cb)(DBusGMethodInvocation *context,
57                                 DBusGProxy *transfer,
58                                 gpointer data);
59
60 typedef gboolean(*bt_obex_progress_cb)(DBusGMethodInvocation *context,
61                                 DBusGProxy *transfer,
62                                 guint64 transferred,
63                                 gpointer data);
64
65 typedef gboolean(*bt_obex_error_cb)(DBusGMethodInvocation *context,
66                                 DBusGProxy *transfer,
67                                 const char *message,
68                                 gpointer data);
69
70 typedef gboolean(*bt_obex_complete_cb)(DBusGMethodInvocation *context,
71                                 DBusGProxy *transfer,
72                                 gpointer data);
73
74 typedef gboolean(*bt_obex_release_cb)(DBusGMethodInvocation *context,
75                                 gpointer data);
76
77 G_END_DECLS
78
79 void _bt_obex_set_authorize_cb(BtObexAgent *agent,
80                          bt_obex_authorize_cb func,
81                          gpointer data);
82
83 void _bt_obex_set_request_cb(BtObexAgent *agent,
84                        bt_obex_request_cb func,
85                        gpointer data);
86
87 void _bt_obex_set_progress_cb(BtObexAgent *agent,
88                         bt_obex_progress_cb func,
89                         gpointer data);
90
91 void _bt_obex_set_error_cb(BtObexAgent *agent,
92                         bt_obex_error_cb func,
93                         gpointer data);
94
95 void _bt_obex_set_complete_cb(BtObexAgent *agent,
96                         bt_obex_complete_cb func,
97                         gpointer data);
98
99 void _bt_obex_set_release_cb(BtObexAgent *agent,
100                        bt_obex_release_cb func,
101                        gpointer data);
102
103 BtObexAgent *_bt_obex_agent_new(void);
104
105 gboolean _bt_obex_setup(BtObexAgent *agent, const char *path);
106
107 gboolean bt_obex_agent_request(BtObexAgent *agent, const char *path,
108                                    DBusGMethodInvocation *context);
109
110 gboolean bt_obex_agent_authorize_push(BtObexAgent *agent, const char *path,
111                              DBusGMethodInvocation *context);
112
113 gboolean bt_obex_agent_progress(BtObexAgent *agent, const char *path,
114                     guint64 transferred, DBusGMethodInvocation *context);
115
116 gboolean bt_obex_agent_complete(BtObexAgent *agent, const char *path,
117                                     DBusGMethodInvocation *context);
118
119 gboolean bt_obex_agent_release(BtObexAgent *agent, DBusGMethodInvocation *context);
120
121 gboolean bt_obex_agent_error(BtObexAgent *agent, const char *path,
122                          const char *message, DBusGMethodInvocation *context);
123
124
125 #ifdef __cplusplus
126 }
127 #endif /* __cplusplus */
128
129 #endif /* __BT_SERVICE_OBEX_AGENT_H */