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