Add the info dbus message of transfer cancel
[platform/core/connectivity/bluetooth-frwk.git] / include / obex.h
1 /*
2 * Bluetooth-Frwk-NG
3 *
4 * Copyright (c) 2013-2014 Intel Corporation.
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 __OBEX_H__
21 #define __OBEX_H__
22
23 #include <glib.h>
24
25 #include "common.h"
26
27 enum obex_target {
28         OBEX_TARGET_UNKNOWN = 0,
29         OBEX_FTP,
30         OBEX_MAP,
31         OBEX_OPP,
32         OBEX_PBAP,
33         OBEX_SYNC
34 };
35
36 enum obex_role {
37         OBEX_SERVER,
38         OBEX_CLIENT
39 };
40
41 enum session_state {
42         OBEX_SESSION_CREATED = 0,
43         OBEX_SESSION_RETRY,
44         OBEX_SESSION_FAILED,
45         OBEX_SESSION_REFUSED,
46         OBEX_SESSION_TIMEOUT,
47         OBEX_SESSION_NO_SERVICE
48 };
49
50 enum transfer_state {
51         OBEX_TRANSFER_UNKNOWN = 0,
52         OBEX_TRANSFER_QUEUED,
53         OBEX_TRANSFER_ACTIVE,
54         OBEX_TRANSFER_COMPLETE,
55         OBEX_TRANSFER_CANCELED,
56         OBEX_TRANSFER_ERROR
57 };
58
59 int obex_lib_init(void);
60 void obex_lib_deinit(void);
61
62 typedef void (*agent_cb_t)(
63                         enum bluez_error_type type,
64                         void *user_data);
65 void obex_agent_register_agent(
66                         const char *agent_path,
67                         agent_cb_t cb,
68                         void *user_data);
69 void obex_agent_unregister_agent(
70                         const char *agent_path,
71                         agent_cb_t cb,
72                         void *user_data);
73
74 typedef void (*obex_agent_added_cb_t)(
75                         void *user_data);
76 void obex_agent_set_agent_added(
77                         obex_agent_added_cb_t cb,
78                         void *user_data);
79 void obex_agent_unset_agent_added(void);
80
81 typedef void (*obex_session_state_cb)(
82                         const char *session_id,
83                         const char *session,
84                         enum session_state state,
85                         void *data,
86                         char *error_msg);
87
88 int obex_create_session(const char *destination,
89                         enum obex_target target,
90                         obex_session_state_cb cb,
91                         void *data);
92
93 void obex_session_remove_session(const char *object_path);
94
95 typedef void (*obex_transfer_state_cb)(
96                         const char *transfer_path,
97                         enum transfer_state state,
98                         const char *name,
99                         guint64 size,
100                         guint64 transferred,
101                         void *data,
102                         char *error_msg);
103
104 void obex_session_opp_send_file(const char *session,
105                         const char *file,
106                         obex_transfer_state_cb cb,
107                         void *data);
108
109 /* Returned Glist should not be freed and modified */
110
111 void obex_transfer_cancel(const char *path);
112
113 /* notify specific transfer */
114 int obex_transfer_set_notify(
115                         char *transfer_path,
116                         obex_transfer_state_cb cb, void *data);
117
118 void obex_transfer_clear_notify(char *transfer_path);
119
120 enum transfer_state obex_transfer_get_property_state(const char *path);
121
122 enum transfer_state obex_transfer_get_property_state(const char *path);
123
124 char *obex_transfer_get_property_source(const char *path);
125
126 char *obex_transfer_get_property_destination(const char *path);
127
128 char *obex_transfer_get_property_file_name(const char *path);
129
130 char *obex_transfer_get_property_name(const char *path);
131
132 int obex_transfer_get_property_size(const char *path, guint64 *size);
133
134 int obex_get_transfer_id(const char *transfer_path,
135                         enum obex_role role);
136
137 int obex_agent_get_agent(void);
138 #endif