All of lore.kernel.org
 help / color / mirror / Atom feed
* Initial Health Thermometer Profile implementation
@ 2011-07-26 12:15 Santiago Carot-Nemesio
  2011-07-26 12:15 ` [PATCH 1/3] Initial support for Health Thermometer Profile (HTP) Santiago Carot-Nemesio
  2011-07-29 10:00 ` Initial Health Thermometer Profile implementation Johan Hedberg
  0 siblings, 2 replies; 5+ messages in thread
From: Santiago Carot-Nemesio @ 2011-07-26 12:15 UTC (permalink / raw)
  To: linux-bluetooth

The following patches don't require the previously submitted patches.

Adds the plugin and device driver for Health Thermometer Profile.
Not more functionality is added in these patches at the moment,
they are the starting point for the HTP implementation.

[PATCH 1/3] Initial support for Health Thermometer Profile (HTP)
[PATCH 2/3] Add manager files for HTP
[PATCH 3/3] Add thermometer driver skeleton

 Makefile.am               |    7 ++++
 acinclude.m4              |    6 ++++
 bootstrap-configure       |    1 +
 thermometer/main.c        |   62 ++++++++++++++++++++++++++++++++++++++
 thermometer/manager.c     |   72 +++++++++++++++++++++++++++++++++++++++++++++
 thermometer/manager.h     |   27 +++++++++++++++++
 thermometer/thermometer.c |   41 +++++++++++++++++++++++++
 thermometer/thermometer.h |   27 +++++++++++++++++
 8 files changed, 243 insertions(+), 0 deletions(-)


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

* [PATCH 1/3] Initial support for Health Thermometer Profile (HTP)
  2011-07-26 12:15 Initial Health Thermometer Profile implementation Santiago Carot-Nemesio
@ 2011-07-26 12:15 ` Santiago Carot-Nemesio
  2011-07-26 12:15   ` [PATCH 2/3] Add manager files for HTP Santiago Carot-Nemesio
  2011-07-29 10:00 ` Initial Health Thermometer Profile implementation Johan Hedberg
  1 sibling, 1 reply; 5+ messages in thread
From: Santiago Carot-Nemesio @ 2011-07-26 12:15 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 f61c9a8..99b48d9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -215,6 +215,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 68ece35..3cb9459 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -215,6 +215,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}
@@ -359,6 +360,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
@@ -415,4 +420,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 b0020cb..ec5d821 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
@@ -31,5 +31,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..c47d396
--- /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)
-- 
1.7.6


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

* [PATCH 2/3] Add manager files for HTP
  2011-07-26 12:15 ` [PATCH 1/3] Initial support for Health Thermometer Profile (HTP) Santiago Carot-Nemesio
@ 2011-07-26 12:15   ` Santiago Carot-Nemesio
  2011-07-26 12:15     ` [PATCH 3/3] Add thermometer driver skeleton Santiago Carot-Nemesio
  0 siblings, 1 reply; 5+ messages in thread
From: Santiago Carot-Nemesio @ 2011-07-26 12:15 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 99b48d9..87b21a6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -217,7 +217,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 c47d396..4a0ea34 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..a243de0
--- /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: */
+}
diff --git a/thermometer/manager.h b/thermometer/manager.h
new file mode 100644
index 0000000..8cf6fd0
--- /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);
-- 
1.7.6


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

* [PATCH 3/3] Add thermometer driver skeleton
  2011-07-26 12:15   ` [PATCH 2/3] Add manager files for HTP Santiago Carot-Nemesio
@ 2011-07-26 12:15     ` Santiago Carot-Nemesio
  0 siblings, 0 replies; 5+ messages in thread
From: Santiago Carot-Nemesio @ 2011-07-26 12:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Santiago Carot-Nemesio

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

diff --git a/Makefile.am b/Makefile.am
index 87b21a6..2735728 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -218,7 +218,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 a243de0..4fad5ed 100644
--- a/thermometer/manager.c
+++ b/thermometer/manager.c
@@ -24,15 +24,49 @@
  */
 
 #include <gdbus.h>
+
+#include "adapter.h"
+#include "device.h"
+#include "thermometer.h"
 #include "manager.h"
 
+#define HEALTH_THERMOMETER_UUID		"00001809-0000-1000-8000-00805f9b34fb"
+
+static DBusConnection *connection = NULL;
+
+static int thermometer_driver_probe(struct btd_device *device, GSList *uuids)
+{
+	return thermometer_register(connection, device);
+}
+
+static void thermometer_driver_remove(struct btd_device *device)
+{
+	thermometer_unregister(device);
+}
+
+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;
 }
diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
new file mode 100644
index 0000000..8b521e3
--- /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 */
+}
diff --git a/thermometer/thermometer.h b/thermometer/thermometer.h
new file mode 100644
index 0000000..2f64e21
--- /dev/null
+++ b/thermometer/thermometer.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_register(DBusConnection *connection, struct btd_device *device);
+void thermometer_unregister(struct btd_device *device);
-- 
1.7.6


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

* Re: Initial Health Thermometer Profile implementation
  2011-07-26 12:15 Initial Health Thermometer Profile implementation Santiago Carot-Nemesio
  2011-07-26 12:15 ` [PATCH 1/3] Initial support for Health Thermometer Profile (HTP) Santiago Carot-Nemesio
@ 2011-07-29 10:00 ` Johan Hedberg
  1 sibling, 0 replies; 5+ messages in thread
From: Johan Hedberg @ 2011-07-29 10:00 UTC (permalink / raw)
  To: Santiago Carot-Nemesio; +Cc: linux-bluetooth

Hi Santiago,

On Tue, Jul 26, 2011, Santiago Carot-Nemesio wrote:
> The following patches don't require the previously submitted patches.
> 
> Adds the plugin and device driver for Health Thermometer Profile.
> Not more functionality is added in these patches at the moment,
> they are the starting point for the HTP implementation.
> 
> [PATCH 1/3] Initial support for Health Thermometer Profile (HTP)
> [PATCH 2/3] Add manager files for HTP
> [PATCH 3/3] Add thermometer driver skeleton
> 
>  Makefile.am               |    7 ++++
>  acinclude.m4              |    6 ++++
>  bootstrap-configure       |    1 +
>  thermometer/main.c        |   62 ++++++++++++++++++++++++++++++++++++++
>  thermometer/manager.c     |   72 +++++++++++++++++++++++++++++++++++++++++++++
>  thermometer/manager.h     |   27 +++++++++++++++++
>  thermometer/thermometer.c |   41 +++++++++++++++++++++++++
>  thermometer/thermometer.h |   27 +++++++++++++++++
>  8 files changed, 243 insertions(+), 0 deletions(-)

These three patches have been applied. However, I went ahead and pushed
another patch on top of them which removes the per-file author info from
thermometer/* and health/*. This information isn't present anywhere else
in the source tree, it becomes a pain to maintain in the long run, and
it's already covered by the AUTHORS file and the git commit history (you
can use e.g. git blame to see who has been working on a specific file).

Johan

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-26 12:15 Initial Health Thermometer Profile implementation Santiago Carot-Nemesio
2011-07-26 12:15 ` [PATCH 1/3] Initial support for Health Thermometer Profile (HTP) Santiago Carot-Nemesio
2011-07-26 12:15   ` [PATCH 2/3] Add manager files for HTP Santiago Carot-Nemesio
2011-07-26 12:15     ` [PATCH 3/3] Add thermometer driver skeleton Santiago Carot-Nemesio
2011-07-29 10:00 ` Initial Health Thermometer Profile implementation Johan Hedberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.