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 #define DEVICE_INTERFACE "org.bluez.Device"
33 AUTH_TYPE_NOTIFY_PASSKEY,
34 AUTH_TYPE_NOTIFY_PINCODE,
37 struct btd_device *device_create(DBusConnection *conn,
38 struct btd_adapter *adapter,
39 const char *address, uint8_t bdaddr_type);
40 void device_set_name(struct btd_device *device, const char *name);
41 void device_get_name(struct btd_device *device, char *name, size_t len);
42 uint16_t btd_device_get_vendor(struct btd_device *device);
43 uint16_t btd_device_get_vendor_src(struct btd_device *device);
44 uint16_t btd_device_get_product(struct btd_device *device);
45 uint16_t btd_device_get_version(struct btd_device *device);
46 void device_remove(struct btd_device *device, gboolean remove_stored);
47 gint device_address_cmp(struct btd_device *device, const gchar *address);
48 int device_browse_primary(struct btd_device *device, DBusConnection *conn,
49 DBusMessage *msg, gboolean secure);
50 int device_browse_sdp(struct btd_device *device, DBusConnection *conn,
51 DBusMessage *msg, uuid_t *search, gboolean reverse);
52 void device_probe_drivers(struct btd_device *device, GSList *profiles);
53 const sdp_record_t *btd_device_get_record(struct btd_device *device,
55 GSList *btd_device_get_primaries(struct btd_device *device);
56 void device_register_services(DBusConnection *conn, struct btd_device *device,
57 GSList *prim_list, int psm);
58 GSList *device_services_from_record(struct btd_device *device,
60 void btd_device_add_uuid(struct btd_device *device, const char *uuid);
61 struct btd_adapter *device_get_adapter(struct btd_device *device);
62 void device_get_address(struct btd_device *device, bdaddr_t *bdaddr,
63 uint8_t *bdaddr_type);
64 void device_set_addr_type(struct btd_device *device, uint8_t bdaddr_type);
65 uint8_t device_get_addr_type(struct btd_device *device);
66 const gchar *device_get_path(struct btd_device *device);
67 struct agent *device_get_agent(struct btd_device *device);
68 gboolean device_is_bredr(struct btd_device *device);
69 gboolean device_is_le(struct btd_device *device);
70 gboolean device_is_busy(struct btd_device *device);
71 gboolean device_is_temporary(struct btd_device *device);
72 gboolean device_is_paired(struct btd_device *device);
73 gboolean device_is_bonded(struct btd_device *device);
74 gboolean device_is_trusted(struct btd_device *device);
75 void device_set_paired(struct btd_device *device, gboolean paired);
76 void device_set_temporary(struct btd_device *device, gboolean temporary);
77 void device_set_bonded(struct btd_device *device, gboolean bonded);
78 void device_set_auto_connect(struct btd_device *device, gboolean enable);
79 gboolean device_is_connected(struct btd_device *device);
80 DBusMessage *device_create_bonding(struct btd_device *device,
81 DBusConnection *conn, DBusMessage *msg,
82 const char *agent_path, uint8_t capability);
83 void device_bonding_complete(struct btd_device *device, uint8_t status);
84 void device_simple_pairing_complete(struct btd_device *device, uint8_t status);
85 gboolean device_is_creating(struct btd_device *device, const char *sender);
86 gboolean device_is_bonding(struct btd_device *device, const char *sender);
87 void device_cancel_bonding(struct btd_device *device, uint8_t status);
88 int device_request_authentication(struct btd_device *device, auth_type_t type,
89 void *data, gboolean secure, void *cb);
90 void device_cancel_authentication(struct btd_device *device, gboolean aborted);
91 gboolean device_is_authenticating(struct btd_device *device);
92 gboolean device_is_authorizing(struct btd_device *device);
93 void device_set_authorizing(struct btd_device *device, gboolean auth);
94 void device_add_connection(struct btd_device *device, DBusConnection *conn);
95 void device_remove_connection(struct btd_device *device, DBusConnection *conn);
96 void device_request_disconnect(struct btd_device *device, DBusMessage *msg);
98 typedef void (*disconnect_watch) (struct btd_device *device, gboolean removal,
101 guint device_add_disconnect_watch(struct btd_device *device,
102 disconnect_watch watch, void *user_data,
103 GDestroyNotify destroy);
104 void device_remove_disconnect_watch(struct btd_device *device, guint id);
105 void device_set_class(struct btd_device *device, uint32_t value);
107 #define BTD_UUIDS(args...) ((const char *[]) { args, NULL } )
109 struct btd_device_driver {
112 int (*probe) (struct btd_device *device, GSList *uuids);
113 void (*remove) (struct btd_device *device);
116 int btd_register_device_driver(struct btd_device_driver *driver);
117 void btd_unregister_device_driver(struct btd_device_driver *driver);
119 struct btd_device *btd_device_ref(struct btd_device *device);
120 void btd_device_unref(struct btd_device *device);
122 int device_block(DBusConnection *conn, struct btd_device *device,
123 gboolean update_only);
124 int device_unblock(DBusConnection *conn, struct btd_device *device,
125 gboolean silent, gboolean update_only);
126 void device_set_pnpid(struct btd_device *device, uint8_t vendor_id_src,
127 uint16_t vendor_id, uint16_t product_id,
128 uint16_t product_ver);