3 * BlueZ - Bluetooth protocol stack for Linux
5 * Copyright (C) 2006-2010 Nokia Corporation
6 * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #ifdef __TIZEN_PATCH__
26 #include "attrib/gattrib.h"
29 #define DEVICE_INTERFACE "org.bluez.Device1"
33 #ifdef __TIZEN_PATCH__
34 /* Device Physical channel connection Type */
35 #define DEV_CONN_DEFAULT 0xFF /* Represents support for BREDR and LE */
36 #define DEV_CONN_BREDR 0x00 /* Only BREDR */
37 #define DEV_CONN_LE 0x01 /* Only LE*/
40 struct btd_device *device_create(struct btd_adapter *adapter,
41 const bdaddr_t *address, uint8_t bdaddr_type);
42 struct btd_device *device_create_from_storage(struct btd_adapter *adapter,
43 const char *address, GKeyFile *key_file);
44 char *btd_device_get_storage_path(struct btd_device *device,
45 const char *filename);
47 void btd_device_device_set_name(struct btd_device *device, const char *name);
48 void device_store_cached_name(struct btd_device *dev, const char *name);
49 void device_get_name(struct btd_device *device, char *name, size_t len);
50 bool device_name_known(struct btd_device *device);
51 void device_set_class(struct btd_device *device, uint32_t class);
52 void device_update_addr(struct btd_device *device, const bdaddr_t *bdaddr,
54 void device_set_bredr_support(struct btd_device *device, bool bredr);
55 void device_update_last_seen(struct btd_device *device, uint8_t bdaddr_type);
56 void device_merge_duplicate(struct btd_device *dev, struct btd_device *dup);
57 uint32_t btd_device_get_class(struct btd_device *device);
58 uint16_t btd_device_get_vendor(struct btd_device *device);
59 uint16_t btd_device_get_vendor_src(struct btd_device *device);
60 uint16_t btd_device_get_product(struct btd_device *device);
61 uint16_t btd_device_get_version(struct btd_device *device);
62 void device_remove(struct btd_device *device, gboolean remove_stored);
63 int device_address_cmp(gconstpointer a, gconstpointer b);
64 int device_bdaddr_cmp(gconstpointer a, gconstpointer b);
65 GSList *btd_device_get_uuids(struct btd_device *device);
66 void device_probe_profiles(struct btd_device *device, GSList *profiles);
67 const sdp_record_t *btd_device_get_record(struct btd_device *device,
69 struct gatt_primary *btd_device_get_primary(struct btd_device *device,
71 GSList *btd_device_get_primaries(struct btd_device *device);
72 void btd_device_gatt_set_service_changed(struct btd_device *device,
73 uint16_t start, uint16_t end);
74 void btd_device_add_uuid(struct btd_device *device, const char *uuid);
75 void device_add_eir_uuids(struct btd_device *dev, GSList *uuids);
76 void device_probe_profile(gpointer a, gpointer b);
77 void device_remove_profile(gpointer a, gpointer b);
78 struct btd_adapter *device_get_adapter(struct btd_device *device);
79 const bdaddr_t *device_get_address(struct btd_device *device);
80 const char *device_get_path(const struct btd_device *device);
81 #ifdef __TIZEN_PATCH__
82 void device_set_remote_feature_flag(struct btd_device *device, int flags);
83 gboolean device_is_bredrle(struct btd_device *device);
84 void device_set_disconnect_reason(struct btd_device *device, uint8_t reason);
85 void device_set_gatt_connected(struct btd_device *device, gboolean connected);
86 void device_set_attrib(struct btd_device *device, guint attachid, GAttrib *attrib);
87 void device_unset_attrib(struct btd_device *device);
88 void device_unpair(struct btd_device *device, gboolean remove_stored);
89 gboolean device_get_gatt_connected(const struct btd_device *device);
91 gboolean device_is_temporary(struct btd_device *device);
92 bool device_is_paired(struct btd_device *device, uint8_t bdaddr_type);
93 bool device_is_bonded(struct btd_device *device, uint8_t bdaddr_type);
94 gboolean device_is_trusted(struct btd_device *device);
95 void device_set_paired(struct btd_device *dev, uint8_t bdaddr_type);
96 void btd_device_set_temporary(struct btd_device *device, gboolean temporary);
97 void btd_device_set_trusted(struct btd_device *device, gboolean trusted);
98 void device_set_bonded(struct btd_device *device, uint8_t bdaddr_type);
99 void device_set_legacy(struct btd_device *device, bool legacy);
100 void device_set_rssi(struct btd_device *device, int8_t rssi);
101 bool btd_device_is_connected(struct btd_device *dev);
102 uint8_t btd_device_get_bdaddr_type(struct btd_device *dev);
103 bool device_is_retrying(struct btd_device *device);
104 void device_bonding_complete(struct btd_device *device, uint8_t bdaddr_type,
106 gboolean device_is_bonding(struct btd_device *device, const char *sender);
107 void device_bonding_attempt_failed(struct btd_device *device, uint8_t status);
108 void device_bonding_failed(struct btd_device *device, uint8_t status);
109 struct btd_adapter_pin_cb_iter *device_bonding_iter(struct btd_device *device);
110 int device_bonding_attempt_retry(struct btd_device *device);
111 long device_bonding_last_duration(struct btd_device *device);
112 void device_bonding_restart_timer(struct btd_device *device);
113 int device_request_pincode(struct btd_device *device, gboolean secure);
114 int device_request_passkey(struct btd_device *device);
115 int device_confirm_passkey(struct btd_device *device, uint32_t passkey,
116 uint8_t confirm_hint);
117 int device_notify_passkey(struct btd_device *device, uint32_t passkey,
119 int device_notify_pincode(struct btd_device *device, gboolean secure,
120 const char *pincode);
121 void device_cancel_authentication(struct btd_device *device, gboolean aborted);
122 gboolean device_is_authenticating(struct btd_device *device);
123 void device_add_connection(struct btd_device *dev, uint8_t bdaddr_type);
124 void device_remove_connection(struct btd_device *device, uint8_t bdaddr_type);
125 void device_request_disconnect(struct btd_device *device, DBusMessage *msg);
127 typedef void (*disconnect_watch) (struct btd_device *device, gboolean removal,
130 guint device_add_disconnect_watch(struct btd_device *device,
131 disconnect_watch watch, void *user_data,
132 GDestroyNotify destroy);
133 void device_remove_disconnect_watch(struct btd_device *device, guint id);
134 int device_get_appearance(struct btd_device *device, uint16_t *value);
135 void device_set_appearance(struct btd_device *device, uint16_t value);
137 #ifdef __TIZEN_PATCH__
139 void device_set_manufacturer_info(struct btd_device *dev, struct eir_data *eir);
140 void device_set_adv_report_info(struct btd_device *device, void *data, uint8_t data_len);
141 void device_set_payload_timeout(struct btd_device *device,
142 uint16_t payload_timeout);
143 void device_set_last_addr_type(struct btd_device *device, uint8_t type);
145 void store_device_info(struct btd_device *device);
148 struct btd_device *btd_device_ref(struct btd_device *device);
149 void btd_device_unref(struct btd_device *device);
151 int device_block(struct btd_device *device, gboolean update_only);
152 int device_unblock(struct btd_device *device, gboolean silent,
153 gboolean update_only);
154 void btd_device_set_pnpid(struct btd_device *device, uint16_t source,
155 uint16_t vendor, uint16_t product, uint16_t version);
157 int device_connect_le(struct btd_device *dev);
159 typedef void (*device_svc_cb_t) (struct btd_device *dev, int err,
162 unsigned int device_wait_for_svc_complete(struct btd_device *dev,
163 device_svc_cb_t func,
165 bool device_remove_svc_complete_callback(struct btd_device *dev,
168 struct btd_service *btd_device_get_service(struct btd_device *dev,
169 const char *remote_uuid);
171 void btd_device_disconnect(struct btd_device *dev);
173 int device_discover_services(struct btd_device *device);
175 void btd_device_init(void);
176 void btd_device_cleanup(void);
177 void btd_device_set_legacy_pairing(struct btd_device *dev, bool legacy_pairing);