diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-12-14 13:08:18 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-12-14 13:08:18 +0200 |
commit | 12cd2f8eee50fffc0ac981d3ee50f52dae8b41fc (patch) | |
tree | 3fa2918feb08d1404bc257cc8c1d74cac8891377 /profiles/deviceinfo | |
parent | e1cbe31eaa4d1d687d6bbc87ab42c4bfa1b70c84 (diff) | |
download | bluez-12cd2f8eee50fffc0ac981d3ee50f52dae8b41fc.tar.gz |
deviceinfo: Remove useless files
Diffstat (limited to 'profiles/deviceinfo')
-rw-r--r-- | profiles/deviceinfo/deviceinfo.c | 62 | ||||
-rw-r--r-- | profiles/deviceinfo/deviceinfo.h | 24 | ||||
-rw-r--r-- | profiles/deviceinfo/manager.c | 85 | ||||
-rw-r--r-- | profiles/deviceinfo/manager.h | 24 |
4 files changed, 59 insertions, 136 deletions
diff --git a/profiles/deviceinfo/deviceinfo.c b/profiles/deviceinfo/deviceinfo.c index da27df824..d7891f548 100644 --- a/profiles/deviceinfo/deviceinfo.c +++ b/profiles/deviceinfo/deviceinfo.c @@ -25,18 +25,20 @@ #endif #include <stdbool.h> +#include <errno.h> #include <glib.h> #include <bluetooth/uuid.h> +#include "plugin.h" #include "adapter.h" #include "device.h" +#include "profile.h" #include "attrib/gattrib.h" #include "attio.h" #include "attrib/att.h" #include "attrib/gatt.h" #include "log.h" -#include "deviceinfo.h" #define PNP_ID_SIZE 7 @@ -163,7 +165,8 @@ static void attio_disconnected_cb(gpointer user_data) d->attrib = NULL; } -int deviceinfo_register(struct btd_device *device, struct gatt_primary *prim) +static int deviceinfo_register(struct btd_device *device, + struct gatt_primary *prim) { struct deviceinfo *d; @@ -180,7 +183,7 @@ int deviceinfo_register(struct btd_device *device, struct gatt_primary *prim) return 0; } -void deviceinfo_unregister(struct btd_device *device) +static void deviceinfo_unregister(struct btd_device *device) { struct deviceinfo *d; GSList *l; @@ -194,3 +197,56 @@ void deviceinfo_unregister(struct btd_device *device) deviceinfo_free(d); } + +static gint primary_uuid_cmp(gconstpointer a, gconstpointer b) +{ + const struct gatt_primary *prim = a; + const char *uuid = b; + + return g_strcmp0(prim->uuid, uuid); +} + +static int deviceinfo_driver_probe(struct btd_profile *p, + struct btd_device *device, + GSList *uuids) +{ + struct gatt_primary *prim; + GSList *primaries, *l; + + primaries = btd_device_get_primaries(device); + + l = g_slist_find_custom(primaries, DEVICE_INFORMATION_UUID, + primary_uuid_cmp); + if (l == NULL) + return -EINVAL; + + prim = l->data; + + return deviceinfo_register(device, prim); +} + +static void deviceinfo_driver_remove(struct btd_profile *p, + struct btd_device *device) +{ + deviceinfo_unregister(device); +} + +static struct btd_profile deviceinfo_profile = { + .name = "deviceinfo", + .remote_uuids = BTD_UUIDS(DEVICE_INFORMATION_UUID), + .device_probe = deviceinfo_driver_probe, + .device_remove = deviceinfo_driver_remove +}; + +static int deviceinfo_init(void) +{ + return btd_profile_register(&deviceinfo_profile); +} + +static void deviceinfo_exit(void) +{ + btd_profile_unregister(&deviceinfo_profile); +} + +BLUETOOTH_PLUGIN_DEFINE(deviceinfo, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT, + deviceinfo_init, deviceinfo_exit) diff --git a/profiles/deviceinfo/deviceinfo.h b/profiles/deviceinfo/deviceinfo.h deleted file mode 100644 index 7a804a5c8..000000000 --- a/profiles/deviceinfo/deviceinfo.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - * Copyright (C) 2012 Texas Instruments, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -int deviceinfo_register(struct btd_device *device, struct gatt_primary *prim); -void deviceinfo_unregister(struct btd_device *device); diff --git a/profiles/deviceinfo/manager.c b/profiles/deviceinfo/manager.c deleted file mode 100644 index 8eab62c4d..000000000 --- a/profiles/deviceinfo/manager.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - * Copyright (C) 2012 Texas Instruments, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#include <glib.h> -#include <errno.h> -#include <stdbool.h> -#include <bluetooth/uuid.h> - -#include "adapter.h" -#include "device.h" -#include "profile.h" -#include "attrib/att.h" -#include "attrib/gattrib.h" -#include "attrib/gatt.h" -#include "deviceinfo.h" -#include "manager.h" - -static gint primary_uuid_cmp(gconstpointer a, gconstpointer b) -{ - const struct gatt_primary *prim = a; - const char *uuid = b; - - return g_strcmp0(prim->uuid, uuid); -} - -static int deviceinfo_driver_probe(struct btd_profile *p, - struct btd_device *device, - GSList *uuids) -{ - struct gatt_primary *prim; - GSList *primaries, *l; - - primaries = btd_device_get_primaries(device); - - l = g_slist_find_custom(primaries, DEVICE_INFORMATION_UUID, - primary_uuid_cmp); - if (l == NULL) - return -EINVAL; - - prim = l->data; - - return deviceinfo_register(device, prim); -} - -static void deviceinfo_driver_remove(struct btd_profile *p, - struct btd_device *device) -{ - deviceinfo_unregister(device); -} - -static struct btd_profile deviceinfo_profile = { - .name = "deviceinfo", - .remote_uuids = BTD_UUIDS(DEVICE_INFORMATION_UUID), - .device_probe = deviceinfo_driver_probe, - .device_remove = deviceinfo_driver_remove -}; - -int deviceinfo_manager_init(void) -{ - return btd_profile_register(&deviceinfo_profile); -} - -void deviceinfo_manager_exit(void) -{ - btd_profile_unregister(&deviceinfo_profile); -} diff --git a/profiles/deviceinfo/manager.h b/profiles/deviceinfo/manager.h deleted file mode 100644 index 0f742ca9b..000000000 --- a/profiles/deviceinfo/manager.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - * Copyright (C) 2012 Texas Instruments, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -int deviceinfo_manager_init(void); -void deviceinfo_manager_exit(void); |