From 831ae09e358b06442fb9ff9be2f2ebbbb9a1e0b3 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Fri, 14 Dec 2012 13:28:18 +0200 Subject: [PATCH] thermometer: Remove useless files --- Makefile.plugins | 6 +- profiles/thermometer/main.c | 47 ------------- profiles/thermometer/manager.c | 104 ----------------------------- profiles/thermometer/manager.h | 24 ------- profiles/thermometer/thermometer.c | 79 ++++++++++++++++++++-- profiles/thermometer/thermometer.h | 26 -------- 6 files changed, 75 insertions(+), 211 deletions(-) delete mode 100644 profiles/thermometer/main.c delete mode 100644 profiles/thermometer/manager.c delete mode 100644 profiles/thermometer/manager.h delete mode 100644 profiles/thermometer/thermometer.h diff --git a/Makefile.plugins b/Makefile.plugins index 068803025..39c5f06c7 100644 --- a/Makefile.plugins +++ b/Makefile.plugins @@ -102,11 +102,7 @@ builtin_sources += profiles/proximity/main.c profiles/proximity/manager.h \ profiles/proximity/immalert.c builtin_modules += thermometer -builtin_sources += profiles/thermometer/main.c \ - profiles/thermometer/manager.h \ - profiles/thermometer/manager.c \ - profiles/thermometer/thermometer.h \ - profiles/thermometer/thermometer.c +builtin_sources += profiles/thermometer/thermometer.c builtin_modules += heartrate builtin_sources += profiles/heartrate/main.c \ diff --git a/profiles/thermometer/main.c b/profiles/thermometer/main.c deleted file mode 100644 index 6c1c40cdc..000000000 --- a/profiles/thermometer/main.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - * Copyright (C) 2011 GSyC/LibreSoft, Universidad Rey Juan Carlos. - * - * 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 thermometer_init(void) -{ - return thermometer_manager_init(); -} - -static void thermometer_exit(void) -{ - thermometer_manager_exit(); -} - -BLUETOOTH_PLUGIN_DEFINE(thermometer, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT, - thermometer_init, thermometer_exit) diff --git a/profiles/thermometer/manager.c b/profiles/thermometer/manager.c deleted file mode 100644 index 167df3725..000000000 --- a/profiles/thermometer/manager.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - * Copyright (C) 2011 GSyC/LibreSoft, Universidad Rey Juan Carlos. - * - * 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 "adapter.h" -#include "device.h" -#include "profile.h" -#include "attrib/att.h" -#include "attrib/gattrib.h" -#include "attrib/gatt.h" -#include "thermometer.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 thermometer_device_probe(struct btd_profile *p, - struct btd_device *device, - GSList *uuids) -{ - struct gatt_primary *tattr; - GSList *primaries, *l; - - primaries = btd_device_get_primaries(device); - - l = g_slist_find_custom(primaries, HEALTH_THERMOMETER_UUID, - primary_uuid_cmp); - if (l == NULL) - return -EINVAL; - - tattr = l->data; - - return thermometer_register(device, tattr); -} - -static void thermometer_device_remove(struct btd_profile *p, - struct btd_device *device) -{ - thermometer_unregister(device); -} - -static int thermometer_adapter_probe(struct btd_profile *p, - struct btd_adapter *adapter) -{ - return thermometer_adapter_register(adapter); -} - -static void thermometer_adapter_remove(struct btd_profile *p, - struct btd_adapter *adapter) -{ - thermometer_adapter_unregister(adapter); -} - -static struct btd_profile thermometer_profile = { - .name = "Health Thermometer GATT driver", - .remote_uuids = BTD_UUIDS(HEALTH_THERMOMETER_UUID), - .device_probe = thermometer_device_probe, - .device_remove = thermometer_device_remove, - .adapter_probe = thermometer_adapter_probe, - .adapter_remove = thermometer_adapter_remove -}; - -int thermometer_manager_init(void) -{ - int ret; - - ret = btd_profile_register(&thermometer_profile); - if (ret < 0) - return ret; - - return 0; -} - -void thermometer_manager_exit(void) -{ - btd_profile_unregister(&thermometer_profile); -} diff --git a/profiles/thermometer/manager.h b/profiles/thermometer/manager.h deleted file mode 100644 index 01e4f62e6..000000000 --- a/profiles/thermometer/manager.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - * Copyright (C) 2011 GSyC/LibreSoft, Universidad Rey Juan Carlos. - * - * 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 thermometer_manager_init(void); -void thermometer_manager_exit(void); diff --git a/profiles/thermometer/thermometer.c b/profiles/thermometer/thermometer.c index 15db33ef9..3bd39f2a7 100644 --- a/profiles/thermometer/thermometer.c +++ b/profiles/thermometer/thermometer.c @@ -31,16 +31,17 @@ #include +#include "plugin.h" #include "dbus-common.h" #include "adapter.h" #include "device.h" +#include "profile.h" #include "error.h" #include "log.h" #include "attrib/gattrib.h" #include "attio.h" #include "attrib/att.h" #include "attrib/gatt.h" -#include "thermometer.h" #define THERMOMETER_INTERFACE "org.bluez.Thermometer1" #define THERMOMETER_MANAGER_INTERFACE "org.bluez.ThermometerManager1" @@ -1154,7 +1155,8 @@ static void attio_disconnected_cb(gpointer user_data) t->attrib = NULL; } -int thermometer_register(struct btd_device *device, struct gatt_primary *tattr) +static int thermometer_register(struct btd_device *device, + struct gatt_primary *tattr) { const gchar *path = device_get_path(device); struct thermometer *t; @@ -1192,7 +1194,7 @@ int thermometer_register(struct btd_device *device, struct gatt_primary *tattr) return 0; } -void thermometer_unregister(struct btd_device *device) +static void thermometer_unregister(struct btd_device *device) { struct thermometer *t; struct btd_adapter *adapter; @@ -1234,7 +1236,7 @@ static const GDBusMethodTable thermometer_manager_methods[] = { { } }; -int thermometer_adapter_register(struct btd_adapter *adapter) +static int thermometer_adapter_register(struct btd_adapter *adapter) { struct thermometer_adapter *tadapter; @@ -1258,7 +1260,7 @@ int thermometer_adapter_register(struct btd_adapter *adapter) return 0; } -void thermometer_adapter_unregister(struct btd_adapter *adapter) +static void thermometer_adapter_unregister(struct btd_adapter *adapter) { struct thermometer_adapter *tadapter; @@ -1272,3 +1274,70 @@ void thermometer_adapter_unregister(struct btd_adapter *adapter) adapter_get_path(tadapter->adapter), THERMOMETER_MANAGER_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 thermometer_device_probe(struct btd_profile *p, + struct btd_device *device, + GSList *uuids) +{ + struct gatt_primary *tattr; + GSList *primaries, *l; + + primaries = btd_device_get_primaries(device); + + l = g_slist_find_custom(primaries, HEALTH_THERMOMETER_UUID, + primary_uuid_cmp); + if (l == NULL) + return -EINVAL; + + tattr = l->data; + + return thermometer_register(device, tattr); +} + +static void thermometer_device_remove(struct btd_profile *p, + struct btd_device *device) +{ + thermometer_unregister(device); +} + +static int thermometer_adapter_probe(struct btd_profile *p, + struct btd_adapter *adapter) +{ + return thermometer_adapter_register(adapter); +} + +static void thermometer_adapter_remove(struct btd_profile *p, + struct btd_adapter *adapter) +{ + thermometer_adapter_unregister(adapter); +} + +static struct btd_profile thermometer_profile = { + .name = "Health Thermometer GATT driver", + .remote_uuids = BTD_UUIDS(HEALTH_THERMOMETER_UUID), + .device_probe = thermometer_device_probe, + .device_remove = thermometer_device_remove, + .adapter_probe = thermometer_adapter_probe, + .adapter_remove = thermometer_adapter_remove +}; + +static int thermometer_init(void) +{ + return btd_profile_register(&thermometer_profile); +} + +static void thermometer_exit(void) +{ + btd_profile_unregister(&thermometer_profile); +} + +BLUETOOTH_PLUGIN_DEFINE(thermometer, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT, + thermometer_init, thermometer_exit) diff --git a/profiles/thermometer/thermometer.h b/profiles/thermometer/thermometer.h deleted file mode 100644 index ca83c3199..000000000 --- a/profiles/thermometer/thermometer.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * - * BlueZ - Bluetooth protocol stack for Linux - * - * Copyright (C) 2011 GSyC/LibreSoft, Universidad Rey Juan Carlos. - * - * 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 thermometer_register(struct btd_device *device, struct gatt_primary *tattr); -void thermometer_unregister(struct btd_device *device); -int thermometer_adapter_register(struct btd_adapter *adapter); -void thermometer_adapter_unregister(struct btd_adapter *adapter); -- 2.47.3