Upgrade bluez5_37 :Merge the code from private
[platform/upstream/bluez.git] / src / profile.h
1 /*
2  *
3  *  BlueZ - Bluetooth protocol stack for Linux
4  *
5  *  Copyright (C) 2012  Intel Corporation. All rights reserved.
6  *
7  *
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21  *
22  */
23
24 #define BTD_PROFILE_PRIORITY_LOW        0
25 #define BTD_PROFILE_PRIORITY_MEDIUM     1
26 #define BTD_PROFILE_PRIORITY_HIGH       2
27
28 struct btd_service;
29
30 struct btd_profile {
31         const char *name;
32         int priority;
33
34         const char *local_uuid;
35         const char *remote_uuid;
36
37         bool auto_connect;
38         bool external;
39
40         int (*device_probe) (struct btd_service *service);
41         void (*device_remove) (struct btd_service *service);
42
43         int (*connect) (struct btd_service *service);
44         int (*disconnect) (struct btd_service *service);
45
46         int (*accept) (struct btd_service *service);
47
48         int (*adapter_probe) (struct btd_profile *p,
49                                                 struct btd_adapter *adapter);
50         void (*adapter_remove) (struct btd_profile *p,
51                                                 struct btd_adapter *adapter);
52 };
53
54 void btd_profile_foreach(void (*func)(struct btd_profile *p, void *data),
55                                                                 void *data);
56
57 int btd_profile_register(struct btd_profile *profile);
58 void btd_profile_unregister(struct btd_profile *profile);
59
60 typedef bool (*btd_profile_prop_exists)(const char *uuid,
61                                                 struct btd_device *dev,
62                                                 void *user_data);
63
64 typedef bool (*btd_profile_prop_get)(const char *uuid,
65                                                 struct btd_device *dev,
66                                                 DBusMessageIter *iter,
67                                                 void *user_data);
68
69 bool btd_profile_add_custom_prop(const char *uuid, const char *type,
70                                         const char *name,
71                                         btd_profile_prop_exists exists,
72                                         btd_profile_prop_get get,
73                                         void *user_data);
74 bool btd_profile_remove_custom_prop(const char *uuid, const char *name);
75
76 #ifdef __TIZEN_PATCH__
77 gboolean ext_profile_is_registered_as_client_role(struct btd_profile *p);
78 #endif
79
80 void btd_profile_init(void);
81 void btd_profile_cleanup(void);