From 8bec4a69161f9cbf97cd2d9f1b04be4331149fd8 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Fri, 14 Dec 2012 13:34:33 +0200 Subject: [PATCH] heartrate: Remove useless files --- Makefile.plugins | 6 +-- profiles/heartrate/heartrate.c | 76 ++++++++++++++++++++++++-- profiles/heartrate/heartrate.h | 27 ---------- profiles/heartrate/main.c | 47 ---------------- profiles/heartrate/manager.c | 97 ---------------------------------- profiles/heartrate/manager.h | 24 --------- 6 files changed, 72 insertions(+), 205 deletions(-) delete mode 100644 profiles/heartrate/heartrate.h delete mode 100644 profiles/heartrate/main.c delete mode 100644 profiles/heartrate/manager.c delete mode 100644 profiles/heartrate/manager.h diff --git a/Makefile.plugins b/Makefile.plugins index 39c5f06c7..f1f300aa0 100644 --- a/Makefile.plugins +++ b/Makefile.plugins @@ -105,11 +105,7 @@ builtin_modules += thermometer builtin_sources += profiles/thermometer/thermometer.c builtin_modules += heartrate -builtin_sources += profiles/heartrate/main.c \ - profiles/heartrate/manager.c \ - profiles/heartrate/manager.h \ - profiles/heartrate/heartrate.c \ - profiles/heartrate/heartrate.h +builtin_sources += profiles/heartrate/heartrate.c builtin_modules += cyclingspeed builtin_sources += profiles/cyclingspeed/cyclingspeed.c diff --git a/profiles/heartrate/heartrate.c b/profiles/heartrate/heartrate.c index f4edf097c..d76295ef2 100644 --- a/profiles/heartrate/heartrate.c +++ b/profiles/heartrate/heartrate.c @@ -30,16 +30,17 @@ #include #include +#include "plugin.h" #include "adapter.h" #include "dbus-common.h" #include "device.h" +#include "profile.h" #include "error.h" #include "attrib/gattrib.h" #include "attrib/att.h" #include "attrib/gatt.h" #include "attio.h" #include "log.h" -#include "heartrate.h" #define HEART_RATE_INTERFACE "org.bluez.HeartRate1" #define HEART_RATE_MANAGER_INTERFACE "org.bluez.HeartRateManager1" @@ -721,7 +722,7 @@ static const GDBusPropertyTable heartrate_device_properties[] = { { } }; -int heartrate_adapter_register(struct btd_adapter *adapter) +static int heartrate_adapter_register(struct btd_adapter *adapter) { struct heartrate_adapter *hradapter; @@ -745,7 +746,7 @@ int heartrate_adapter_register(struct btd_adapter *adapter) return 0; } -void heartrate_adapter_unregister(struct btd_adapter *adapter) +static void heartrate_adapter_unregister(struct btd_adapter *adapter) { struct heartrate_adapter *hradapter; @@ -760,7 +761,7 @@ void heartrate_adapter_unregister(struct btd_adapter *adapter) HEART_RATE_MANAGER_INTERFACE); } -int heartrate_device_register(struct btd_device *device, +static int heartrate_device_register(struct btd_device *device, struct gatt_primary *prim) { struct btd_adapter *adapter; @@ -803,7 +804,7 @@ int heartrate_device_register(struct btd_device *device, return 0; } -void heartrate_device_unregister(struct btd_device *device) +static void heartrate_device_unregister(struct btd_device *device) { struct btd_adapter *adapter; struct heartrate_adapter *hradapter; @@ -827,3 +828,68 @@ void heartrate_device_unregister(struct btd_device *device) g_dbus_unregister_interface(btd_get_dbus_connection(), device_get_path(device), HEART_RATE_INTERFACE); } + +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 heartrate_adapter_probe(struct btd_profile *p, + struct btd_adapter *adapter) +{ + return heartrate_adapter_register(adapter); +} + +static void heartrate_adapter_remove(struct btd_profile *p, + struct btd_adapter *adapter) +{ + heartrate_adapter_unregister(adapter); +} + +static int heartrate_device_probe(struct btd_profile *p, + struct btd_device *device, GSList *uuids) +{ + GSList *primaries; + GSList *l; + + primaries = btd_device_get_primaries(device); + + l = g_slist_find_custom(primaries, HEART_RATE_UUID, primary_uuid_cmp); + if (l == NULL) + return -EINVAL; + + return heartrate_device_register(device, l->data); +} + +static void heartrate_device_remove(struct btd_profile *p, + struct btd_device *device) +{ + heartrate_device_unregister(device); +} + +static struct btd_profile hrp_profile = { + .name = "Heart Rate GATT Driver", + .remote_uuids = BTD_UUIDS(HEART_RATE_UUID), + + .device_probe = heartrate_device_probe, + .device_remove = heartrate_device_remove, + + .adapter_probe = heartrate_adapter_probe, + .adapter_remove = heartrate_adapter_remove, +}; + +static int heartrate_init(void) +{ + return btd_profile_register(&hrp_profile); +} + +static void heartrate_exit(void) +{ + btd_profile_unregister(&hrp_profile); +} + +BLUETOOTH_PLUGIN_DEFINE(heartrate, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT, + heartrate_init, heartrate_exit) diff --git a/profiles/heartrate/heartrate.h b/profiles/heartrate/heartrate.h deleted file mode 100644 index 064939d64..000000000 --- a/profiles/heartrate/heartrate.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - * Copyright (C) 2012 Tieto Poland - * - * 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 heartrate_adapter_register(struct btd_adapter *adapter); -void heartrate_adapter_unregister(struct btd_adapter *adapter); -int heartrate_device_register(struct btd_device *device, - struct gatt_primary *prim); -void heartrate_device_unregister(struct btd_device *device); diff --git a/profiles/heartrate/main.c b/profiles/heartrate/main.c deleted file mode 100644 index 80a6ba421..000000000 --- a/profiles/heartrate/main.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - * Copyright (C) 2012 Tieto Poland - * - * 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 - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include - -#include "plugin.h" -#include "manager.h" -#include "hcid.h" -#include "log.h" - -static int heartrate_init(void) -{ - return heartrate_manager_init(); -} - -static void heartrate_exit(void) -{ - heartrate_manager_exit(); -} - -BLUETOOTH_PLUGIN_DEFINE(heartrate, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT, - heartrate_init, heartrate_exit) diff --git a/profiles/heartrate/manager.c b/profiles/heartrate/manager.c deleted file mode 100644 index b939a2a61..000000000 --- a/profiles/heartrate/manager.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - * Copyright (C) 2012 Tieto Poland - * - * 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 -#include -#include -#include - -#include "adapter.h" -#include "device.h" -#include "profile.h" -#include "attrib/att.h" -#include "attrib/gattrib.h" -#include "attrib/gatt.h" -#include "heartrate.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 heartrate_adapter_probe(struct btd_profile *p, - struct btd_adapter *adapter) -{ - return heartrate_adapter_register(adapter); -} - -static void heartrate_adapter_remove(struct btd_profile *p, - struct btd_adapter *adapter) -{ - heartrate_adapter_unregister(adapter); -} - -static int heartrate_device_probe(struct btd_profile *p, - struct btd_device *device, GSList *uuids) -{ - GSList *primaries; - GSList *l; - - primaries = btd_device_get_primaries(device); - - l = g_slist_find_custom(primaries, HEART_RATE_UUID, primary_uuid_cmp); - if (l == NULL) - return -EINVAL; - - return heartrate_device_register(device, l->data); -} - -static void heartrate_device_remove(struct btd_profile *p, - struct btd_device *device) -{ - heartrate_device_unregister(device); -} - -static struct btd_profile hrp_profile = { - .name = "Heart Rate GATT Driver", - .remote_uuids = BTD_UUIDS(HEART_RATE_UUID), - - .device_probe = heartrate_device_probe, - .device_remove = heartrate_device_remove, - - .adapter_probe = heartrate_adapter_probe, - .adapter_remove = heartrate_adapter_remove, -}; - -int heartrate_manager_init(void) -{ - return btd_profile_register(&hrp_profile); -} - -void heartrate_manager_exit(void) -{ - btd_profile_unregister(&hrp_profile); -} diff --git a/profiles/heartrate/manager.h b/profiles/heartrate/manager.h deleted file mode 100644 index de799f658..000000000 --- a/profiles/heartrate/manager.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - * Copyright (C) 2012 Tieto Poland - * - * 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 heartrate_manager_init(void); -void heartrate_manager_exit(void); -- 2.47.3