Diff between a0289e5d69bca0db8c2c8f6df144092739c94f12 and 831ae09e358b06442fb9ff9be2f2ebbbb9a1e0b3

Changed Files

File Additions Deletions Status
Makefile.plugins +1 -5 modified
profiles/thermometer/main.c +0 -47 deleted
profiles/thermometer/manager.c +0 -104 deleted
profiles/thermometer/manager.h +0 -24 deleted
profiles/thermometer/thermometer.c +74 -5 modified
profiles/thermometer/thermometer.h +0 -26 deleted

Full Patch

diff --git a/Makefile.plugins b/Makefile.plugins
index 0688030..39c5f06 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 6c1c40c..0000000
--- 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 <config.h>
-#endif
-
-#include <stdint.h>
-#include <glib.h>
-#include <errno.h>
-
-#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 167df37..0000000
--- 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 <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 "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 01e4f62..0000000
--- 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 15db33e..3bd39f2 100644
--- a/profiles/thermometer/thermometer.c
+++ b/profiles/thermometer/thermometer.c
@@ -31,16 +31,17 @@
 
 #include <gdbus/gdbus.h>
 
+#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 ca83c31..0000000
--- 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);