linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] Initial support for Health Thermometer Profile (HTP)
@ 2011-07-18 13:10 Santiago Carot-Nemesio
  2011-07-18 13:10 ` [PATCH 2/7] Add manager files for HTP Santiago Carot-Nemesio
  0 siblings, 1 reply; 7+ messages in thread
From: Santiago Carot-Nemesio @ 2011-07-18 13:10 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Santiago Carot-Nemesio

---
 Makefile.am         |    5 +++++
 acinclude.m4        |    6 ++++++
 bootstrap-configure |    1 +
 thermometer/main.c  |   45 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 57 insertions(+), 0 deletions(-)
 create mode 100644 thermometer/main.c

diff --git a/Makefile.am b/Makefile.am
index 52c49fb..4443943 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -208,6 +208,11 @@ builtin_sources += health/hdp_main.c health/hdp_types.h \
 			health/hdp_util.h health/hdp_util.c
 endif
 
+if THERMOMETERPLUGIN
+builtin_modules += thermometer
+builtin_sources += thermometer/main.c
+endif
+
 builtin_modules += hciops mgmtops
 builtin_sources += plugins/hciops.c plugins/mgmtops.c
 
diff --git a/acinclude.m4 b/acinclude.m4
index 4073f59..5d45860 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -214,6 +214,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [
 	sap_driver=dummy
 	dbusoob_enable=no
 	wiimote_enable=no
+	thermometer_enable=no
 
 	AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization], [disable code optimization]), [
 		optimization_enable=${enableval}
@@ -354,6 +355,10 @@ AC_DEFUN([AC_ARG_BLUEZ], [
 		hal_enable=${enableval}
 	])
 
+	AC_ARG_ENABLE(thermometer, AC_HELP_STRING([--enable-thermometer], [enable thermometer plugin]), [
+		thermometer_enable=${enableval}
+	])
+
 	if (test "${fortify_enable}" = "yes"); then
 		CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
 	fi
@@ -409,4 +414,5 @@ AC_DEFUN([AC_ARG_BLUEZ], [
 	AM_CONDITIONAL(MAEMO6PLUGIN, test "${maemo6_enable}" = "yes")
 	AM_CONDITIONAL(DBUSOOBPLUGIN, test "${dbusoob_enable}" = "yes")
 	AM_CONDITIONAL(WIIMOTEPLUGIN, test "${wiimote_enable}" = "yes")
+	AM_CONDITIONAL(THERMOMETERPLUGIN, test "${thermometer_enable}" = "yes")
 ])
diff --git a/bootstrap-configure b/bootstrap-configure
index 55c1049..aed9011 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
@@ -30,5 +30,6 @@ fi
 		--enable-test \
 		--enable-cups \
 		--enable-sap \
+		--enable-thermometer \
 		--disable-pcmcia \
 		--disable-datafiles $*
diff --git a/thermometer/main.c b/thermometer/main.c
new file mode 100644
index 0000000..2a73208
--- /dev/null
+++ b/thermometer/main.c
@@ -0,0 +1,45 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2011 GSyC/LibreSoft, Universidad Rey Juan Carlos.
+ *  Authors:
+ *  Santiago Carot Nemesio <sancane at gmail.com>
+ *  Jorge Fernandez Gonzalez <jorge.fernandez.gonzalez at gmail.com>
+ *
+ *  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 "plugin.h"
+
+
+static int thermometer_init(void)
+{
+	/*TODO: */
+	return 0;
+}
+
+static void thermometer_exit(void)
+{
+	/*TODO: */
+}
+
+BLUETOOTH_PLUGIN_DEFINE(thermometer, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT,
+					thermometer_init, thermometer_exit)
\ No newline at end of file
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/7] Add manager files for HTP
  2011-07-18 13:10 [PATCH 1/7] Initial support for Health Thermometer Profile (HTP) Santiago Carot-Nemesio
@ 2011-07-18 13:10 ` Santiago Carot-Nemesio
  2011-07-18 13:10   ` [PATCH 3/7] Load HTP plugin only if LE is enabled Santiago Carot-Nemesio
  0 siblings, 1 reply; 7+ messages in thread
From: Santiago Carot-Nemesio @ 2011-07-18 13:10 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Santiago Carot-Nemesio

---
 Makefile.am           |    3 ++-
 thermometer/main.c    |   21 +++++++++++++++++++--
 thermometer/manager.c |   38 ++++++++++++++++++++++++++++++++++++++
 thermometer/manager.h |   27 +++++++++++++++++++++++++++
 4 files changed, 86 insertions(+), 3 deletions(-)
 create mode 100644 thermometer/manager.c
 create mode 100644 thermometer/manager.h

diff --git a/Makefile.am b/Makefile.am
index 4443943..8c25eab 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -210,7 +210,8 @@ endif
 
 if THERMOMETERPLUGIN
 builtin_modules += thermometer
-builtin_sources += thermometer/main.c
+builtin_sources += thermometer/main.c \
+			thermometer/manager.h thermometer/manager.c
 endif
 
 builtin_modules += hciops mgmtops
diff --git a/thermometer/main.c b/thermometer/main.c
index 2a73208..33649a7 100644
--- a/thermometer/main.c
+++ b/thermometer/main.c
@@ -27,18 +27,35 @@
 #include <config.h>
 #endif
 
+#include <glib.h>
+#include <errno.h>
+#include <gdbus.h>
+
 #include "plugin.h"
+#include "manager.h"
 
+static DBusConnection *connection = NULL;
 
 static int thermometer_init(void)
 {
-	/*TODO: */
+	connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+	if (connection == NULL)
+		return -EIO;
+
+	if (thermometer_manager_init(connection) < 0) {
+		dbus_connection_unref(connection);
+		return -EIO;
+	}
+
 	return 0;
 }
 
 static void thermometer_exit(void)
 {
-	/*TODO: */
+	thermometer_manager_exit();
+
+	dbus_connection_unref(connection);
+	connection = NULL;
 }
 
 BLUETOOTH_PLUGIN_DEFINE(thermometer, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT,
diff --git a/thermometer/manager.c b/thermometer/manager.c
new file mode 100644
index 0000000..8ace3f9
--- /dev/null
+++ b/thermometer/manager.c
@@ -0,0 +1,38 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2011 GSyC/LibreSoft, Universidad Rey Juan Carlos.
+ *  Authors:
+ *  Santiago Carot Nemesio <sancane at gmail.com>
+ *  Jorge Fernandez Gonzalez <jorge.fernandez.gonzalez at gmail.com>
+ *
+ *  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 <gdbus.h>
+#include "manager.h"
+
+int thermometer_manager_init(DBusConnection *conn)
+{
+	/*TODO: */
+	return 0;
+}
+
+void thermometer_manager_exit(void)
+{
+	/*TODO: */
+}
\ No newline at end of file
diff --git a/thermometer/manager.h b/thermometer/manager.h
new file mode 100644
index 0000000..801ae5b
--- /dev/null
+++ b/thermometer/manager.h
@@ -0,0 +1,27 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2011 GSyC/LibreSoft, Universidad Rey Juan Carlos.
+ *  Authors:
+ *  Santiago Carot Nemesio <sancane at gmail.com>
+ *  Jorge Fernandez Gonzalez <jorge.fernandez.gonzalez at gmail.com>
+ *
+ *  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(DBusConnection *conn);
+void thermometer_manager_exit(void);
\ No newline at end of file
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/7] Load HTP plugin only if LE is enabled
  2011-07-18 13:10 ` [PATCH 2/7] Add manager files for HTP Santiago Carot-Nemesio
@ 2011-07-18 13:10   ` Santiago Carot-Nemesio
  2011-07-18 13:10     ` [PATCH 4/7] Register thermometer driver Santiago Carot-Nemesio
  0 siblings, 1 reply; 7+ messages in thread
From: Santiago Carot-Nemesio @ 2011-07-18 13:10 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Santiago Carot-Nemesio

---
 thermometer/main.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/thermometer/main.c b/thermometer/main.c
index 33649a7..df3f1ff 100644
--- a/thermometer/main.c
+++ b/thermometer/main.c
@@ -30,14 +30,19 @@
 #include <glib.h>
 #include <errno.h>
 #include <gdbus.h>
+#include <stdint.h>
 
 #include "plugin.h"
+#include "hcid.h"
 #include "manager.h"
 
 static DBusConnection *connection = NULL;
 
 static int thermometer_init(void)
 {
+	if (!main_opts.le)
+		return -EINVAL;
+
 	connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
 	if (connection == NULL)
 		return -EIO;
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/7] Register thermometer driver
  2011-07-18 13:10   ` [PATCH 3/7] Load HTP plugin only if LE is enabled Santiago Carot-Nemesio
@ 2011-07-18 13:10     ` Santiago Carot-Nemesio
  2011-07-18 13:10       ` [PATCH 5/7] Add thermometer driver skeleton Santiago Carot-Nemesio
  0 siblings, 1 reply; 7+ messages in thread
From: Santiago Carot-Nemesio @ 2011-07-18 13:10 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Santiago Carot-Nemesio

---
 thermometer/main.c    |    1 +
 thermometer/manager.c |   40 ++++++++++++++++++++++++++++++++++++++--
 2 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/thermometer/main.c b/thermometer/main.c
index df3f1ff..29d9478 100644
--- a/thermometer/main.c
+++ b/thermometer/main.c
@@ -32,6 +32,7 @@
 #include <gdbus.h>
 #include <stdint.h>
 
+#include "log.h"
 #include "plugin.h"
 #include "hcid.h"
 #include "manager.h"
diff --git a/thermometer/manager.c b/thermometer/manager.c
index 8ace3f9..988bd57 100644
--- a/thermometer/manager.c
+++ b/thermometer/manager.c
@@ -24,15 +24,51 @@
  */
 
 #include <gdbus.h>
+
+#include "adapter.h"
+#include "device.h"
+#include "log.h"
 #include "manager.h"
 
+#define HEALTH_THERMOMETER_SVC_UUID	0x1809
+#define HEALTH_THERMOMETER_UUID		"00001809-0000-1000-8000-00805f9b34fb"
+
+static DBusConnection *connection = NULL;
+
+static int thermometer_driver_probe(struct btd_device *device, GSList *uuids)
+{
+	/* TODO; */
+	return 0;
+}
+
+static void thermometer_driver_remove(struct btd_device *device)
+{
+	/* TODO: */
+}
+
+static struct btd_device_driver thermometer_device_driver = {
+	.name	= "thermometer-device-driver",
+	.uuids	= BTD_UUIDS(HEALTH_THERMOMETER_UUID),
+	.probe	= thermometer_driver_probe,
+	.remove	= thermometer_driver_remove
+};
+
 int thermometer_manager_init(DBusConnection *conn)
 {
-	/*TODO: */
+	int ret;
+
+	ret = btd_register_device_driver(&thermometer_device_driver);
+	if (ret < 0)
+                return ret;
+
+	connection = dbus_connection_ref(conn);
 	return 0;
 }
 
 void thermometer_manager_exit(void)
 {
-	/*TODO: */
+	btd_unregister_device_driver(&thermometer_device_driver);
+
+	dbus_connection_unref(connection);
+	connection = NULL;
 }
\ No newline at end of file
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/7] Add thermometer driver skeleton
  2011-07-18 13:10     ` [PATCH 4/7] Register thermometer driver Santiago Carot-Nemesio
@ 2011-07-18 13:10       ` Santiago Carot-Nemesio
  2011-07-18 13:10         ` [PATCH 6/7] Initial steps to manage thermometer objects Santiago Carot-Nemesio
  0 siblings, 1 reply; 7+ messages in thread
From: Santiago Carot-Nemesio @ 2011-07-18 13:10 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Santiago Carot-Nemesio

---
 Makefile.am               |    3 ++-
 thermometer/manager.c     |   10 +++-------
 thermometer/thermometer.c |   41 +++++++++++++++++++++++++++++++++++++++++
 thermometer/thermometer.h |   30 ++++++++++++++++++++++++++++++
 4 files changed, 76 insertions(+), 8 deletions(-)
 create mode 100644 thermometer/thermometer.c
 create mode 100644 thermometer/thermometer.h

diff --git a/Makefile.am b/Makefile.am
index 8c25eab..4a7f34f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -211,7 +211,8 @@ endif
 if THERMOMETERPLUGIN
 builtin_modules += thermometer
 builtin_sources += thermometer/main.c \
-			thermometer/manager.h thermometer/manager.c
+			thermometer/manager.h thermometer/manager.c \
+			thermometer/thermometer.h thermometer/thermometer.c
 endif
 
 builtin_modules += hciops mgmtops
diff --git a/thermometer/manager.c b/thermometer/manager.c
index 988bd57..b5fba4c 100644
--- a/thermometer/manager.c
+++ b/thermometer/manager.c
@@ -27,23 +27,19 @@
 
 #include "adapter.h"
 #include "device.h"
-#include "log.h"
+#include "thermometer.h"
 #include "manager.h"
 
-#define HEALTH_THERMOMETER_SVC_UUID	0x1809
-#define HEALTH_THERMOMETER_UUID		"00001809-0000-1000-8000-00805f9b34fb"
-
 static DBusConnection *connection = NULL;
 
 static int thermometer_driver_probe(struct btd_device *device, GSList *uuids)
 {
-	/* TODO; */
-	return 0;
+	return thermometer_register(connection, device);
 }
 
 static void thermometer_driver_remove(struct btd_device *device)
 {
-	/* TODO: */
+	thermometer_unregister(device);
 }
 
 static struct btd_device_driver thermometer_device_driver = {
diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
new file mode 100644
index 0000000..a05d37d
--- /dev/null
+++ b/thermometer/thermometer.c
@@ -0,0 +1,41 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2011 GSyC/LibreSoft, Universidad Rey Juan Carlos.
+ *  Authors:
+ *  Santiago Carot Nemesio <sancane at gmail.com>
+ *  Jorge Fernandez Gonzalez <jorge.fernandez.gonzalez at gmail.com>
+ *
+ *  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 <gdbus.h>
+
+#include "adapter.h"
+#include "device.h"
+#include "thermometer.h"
+
+int thermometer_register(DBusConnection *connection, struct btd_device *device)
+{
+	/* TODO: Register Health Thermometer Interface */
+	return 0;
+}
+
+void thermometer_unregister(struct btd_device *device)
+{
+	/* TODO: Unregister Health Thermometer Interface */
+}
\ No newline at end of file
diff --git a/thermometer/thermometer.h b/thermometer/thermometer.h
new file mode 100644
index 0000000..28c9d18
--- /dev/null
+++ b/thermometer/thermometer.h
@@ -0,0 +1,30 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2011 GSyC/LibreSoft, Universidad Rey Juan Carlos.
+ *  Authors:
+ *  Santiago Carot Nemesio <sancane at gmail.com>
+ *  Jorge Fernandez Gonzalez <jorge.fernandez.gonzalez at gmail.com>
+ *
+ *  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
+ *
+ */
+
+#define HEALTH_THERMOMETER_SVC_UUID	0x1809
+#define HEALTH_THERMOMETER_UUID		"00001809-0000-1000-8000-00805f9b34fb"
+
+int thermometer_register(DBusConnection *connection, struct btd_device *device);
+void thermometer_unregister(struct btd_device *device);
\ No newline at end of file
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 6/7] Initial steps to manage thermometer objects
  2011-07-18 13:10       ` [PATCH 5/7] Add thermometer driver skeleton Santiago Carot-Nemesio
@ 2011-07-18 13:10         ` Santiago Carot-Nemesio
  2011-07-18 13:10           ` [PATCH 7/7] Release resources allocated when the thermometer plugin is stopped Santiago Carot-Nemesio
  0 siblings, 1 reply; 7+ messages in thread
From: Santiago Carot-Nemesio @ 2011-07-18 13:10 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Santiago Carot-Nemesio

---
 thermometer/thermometer.c |   63 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+), 0 deletions(-)

diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index a05d37d..b8c0b82 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -27,15 +27,78 @@
 
 #include "adapter.h"
 #include "device.h"
+#include "log.h"
 #include "thermometer.h"
 
+struct thermometer {
+	DBusConnection		*conn;	/* The connection to the bus */
+	struct btd_device	*dev;	/* Device reference */
+	gint			ref;	/* Reference counter */
+};
+
+static GSList *thermometers = NULL;
+
+static struct thermometer *thermometer_ref(struct thermometer *t)
+{
+	t->ref++;
+
+	DBG("%p: ref=%d", t, t->ref);
+
+	return t;
+}
+
+static void thermometer_unref(struct thermometer *t)
+{
+	t->ref--;
+
+	DBG("%p: ref=%d", t, t->ref);
+
+	if (t->ref > 0)
+		return;
+
+	dbus_connection_unref(t->conn);
+	btd_device_unref(t->dev);
+	g_free(t);
+}
+
+static gint cmp_device(gconstpointer a, gconstpointer b)
+{
+	const struct thermometer *t = a;
+	const struct btd_device *dev = b;
+
+	if (dev == t->dev)
+		return 0;
+
+	return -1;
+}
+
 int thermometer_register(DBusConnection *connection, struct btd_device *device)
 {
+	struct thermometer *t;
+
+	t = g_new0(struct thermometer, 1);
+	t->conn = dbus_connection_ref(connection);
+	t->dev = btd_device_ref(device);
+
 	/* TODO: Register Health Thermometer Interface */
+
+	thermometers = g_slist_prepend(thermometers, thermometer_ref(t));
+
 	return 0;
 }
 
 void thermometer_unregister(struct btd_device *device)
 {
+	struct thermometer *t;
+	GSList *l;
+
+	l = g_slist_find_custom(thermometers, device, cmp_device);
+	if (!l)
+		return;
+
 	/* TODO: Unregister Health Thermometer Interface */
+
+	t = l->data;
+	thermometers = g_slist_remove(thermometers, t);
+	thermometer_unref(t);
 }
\ No newline at end of file
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 7/7] Release resources allocated when the thermometer plugin is stopped
  2011-07-18 13:10         ` [PATCH 6/7] Initial steps to manage thermometer objects Santiago Carot-Nemesio
@ 2011-07-18 13:10           ` Santiago Carot-Nemesio
  0 siblings, 0 replies; 7+ messages in thread
From: Santiago Carot-Nemesio @ 2011-07-18 13:10 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Santiago Carot-Nemesio

---
 thermometer/manager.c     |    1 +
 thermometer/thermometer.c |    6 ++++++
 thermometer/thermometer.h |    4 +++-
 3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/thermometer/manager.c b/thermometer/manager.c
index b5fba4c..3ca8f5a 100644
--- a/thermometer/manager.c
+++ b/thermometer/manager.c
@@ -64,6 +64,7 @@ int thermometer_manager_init(DBusConnection *conn)
 void thermometer_manager_exit(void)
 {
 	btd_unregister_device_driver(&thermometer_device_driver);
+	thermometer_stop();
 
 	dbus_connection_unref(connection);
 	connection = NULL;
diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index b8c0b82..56ba471 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -101,4 +101,10 @@ void thermometer_unregister(struct btd_device *device)
 	t = l->data;
 	thermometers = g_slist_remove(thermometers, t);
 	thermometer_unref(t);
+}
+
+void thermometer_stop()
+{
+	g_slist_free_full(thermometers, (GDestroyNotify) thermometer_unref);
+	thermometers = NULL;
 }
\ No newline at end of file
diff --git a/thermometer/thermometer.h b/thermometer/thermometer.h
index 28c9d18..f55f2c0 100644
--- a/thermometer/thermometer.h
+++ b/thermometer/thermometer.h
@@ -27,4 +27,6 @@
 #define HEALTH_THERMOMETER_UUID		"00001809-0000-1000-8000-00805f9b34fb"
 
 int thermometer_register(DBusConnection *connection, struct btd_device *device);
-void thermometer_unregister(struct btd_device *device);
\ No newline at end of file
+void thermometer_unregister(struct btd_device *device);
+
+void thermometer_stop();
\ No newline at end of file
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-07-18 13:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-18 13:10 [PATCH 1/7] Initial support for Health Thermometer Profile (HTP) Santiago Carot-Nemesio
2011-07-18 13:10 ` [PATCH 2/7] Add manager files for HTP Santiago Carot-Nemesio
2011-07-18 13:10   ` [PATCH 3/7] Load HTP plugin only if LE is enabled Santiago Carot-Nemesio
2011-07-18 13:10     ` [PATCH 4/7] Register thermometer driver Santiago Carot-Nemesio
2011-07-18 13:10       ` [PATCH 5/7] Add thermometer driver skeleton Santiago Carot-Nemesio
2011-07-18 13:10         ` [PATCH 6/7] Initial steps to manage thermometer objects Santiago Carot-Nemesio
2011-07-18 13:10           ` [PATCH 7/7] Release resources allocated when the thermometer plugin is stopped Santiago Carot-Nemesio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).