aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSantiago Carot-Nemesio <sancane@gmail.com>2011-07-26 14:15:54 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2011-07-29 12:50:35 +0300
commite8825b76fca45b68725625819db35156009f0df5 (patch)
tree7d359e4847212c4d3c3749c98993cf69db9890f7
parent3e24f80260b044dea99916f151b235dd51f54282 (diff)
downloadbluez-e8825b76fca45b68725625819db35156009f0df5.tar.gz
bluez-e8825b76fca45b68725625819db35156009f0df5.tar.xz
bluez-e8825b76fca45b68725625819db35156009f0df5.zip
Add thermometer driver skeleton
-rw-r--r--Makefile.am3
-rw-r--r--thermometer/manager.c38
-rw-r--r--thermometer/thermometer.c41
-rw-r--r--thermometer/thermometer.h27
4 files changed, 106 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index ac8fdd42..1f30d72a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -217,7 +217,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 a243de00..4fad5ed4 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 00000000..8b521e31
--- /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 00000000..2f64e21d
--- /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);