1 /* 2 * 3 * BlueZ - Bluetooth protocol stack for Linux 4 * 5 * Copyright (C) 2006-2007 Nokia Corporation 6 * Copyright (C) 2004-2008 Marcel Holtmann <marcel@holtmann.org> 7 * 8 * 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. 13 * 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. 18 * 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 22 * 23 */ 24 25 #define DEVICE_INTERFACE "org.bluez.Device" 26 27 struct btd_device { 28 char *path; 29 bdaddr_t src; 30 bdaddr_t dst; 31 }; 32 33 struct device { 34 struct btd_device dev; 35 gchar *address; 36 gchar *path; 37 struct adapter *adapter; 38 GSList *uuids; 39 GSList *drivers; 40 gboolean temporary; 41 struct agent *agent; 42 guint disconn_timer; 43 int discov_active; /* Service discovery active */ 44 char *discov_requestor; /* discovery requestor unique name */ 45 guint discov_listener; 46 47 /* For Secure Simple Pairing */ 48 uint8_t cap; 49 uint8_t auth; 50 }; 51 52 struct device *device_create(DBusConnection *conn, struct adapter *adapter, 53 const gchar *address); 54 void device_remove(DBusConnection *conn, struct device *device); 55 gint device_address_cmp(struct device *device, const gchar *address); 56 int device_browse(struct device *device, DBusConnection *conn, 57 DBusMessage *msg, uuid_t *search); 58 void device_probe_drivers(struct device *device, GSList *uuids); 59 60 #define BTD_UUIDS(args...) ((const char *[]) { args, NULL } ) 61 62 struct btd_device_driver { 63 const char *name; 64 const char **uuids; 65 int (*probe) (struct btd_device *device); 66 void (*remove) (struct btd_device *device); 67 }; 68 69 int btd_register_device_driver(struct btd_device_driver *driver); 70 void btd_unregister_device_driver(struct btd_device_driver *driver); 71