Initial Health Thermometer Profile implementation
Subsystems (2)
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(-)
PATCH 1/3 Initial support for Health Thermometer Profile (HTP)
--- 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
Makefile.am +5 -0
@@ -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
acinclude.m4 +6 -0
@@ -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") ])
bootstrap-configure +1 -0
@@ -31,5 +31,6 @@ fi --enable-test \ --enable-cups \ --enable-sap \ + --enable-thermometer \ --disable-pcmcia \ --disable-datafiles $*
thermometer/main.c new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
1.7.6
PATCH 2/3 Add manager files for HTP
--- 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
Makefile.am +2 -1
@@ -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
thermometer/main.c +19 -2
@@ -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,
thermometer/manager.c new file +38 -0
@@ -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: */ +}
thermometer/manager.h new file +27 -0
@@ -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 );
Signature · 1 line
1.7.6
PATCH 3/3 Add thermometer driver skeleton
--- 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
Makefile.am +2 -1
@@ -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
thermometer/manager.c +36 -2
@@ -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 ; }
thermometer/thermometer.c new file +41 -0
41 lines not on this page · raw message
thermometer/thermometer.h new file +27 -0
@@ -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);
Signature · 1 line
1.7.6
Hi Santiago,
Quoted 10 lines · Santiago Carot-Nemesio
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
Quoted 9 lines
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