summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Lizardo <anderson.lizardo@openbossa.org>2011-09-21 08:46:09 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2011-09-22 20:05:04 +0900
commit8f769e9565430580a641302eefbcc20f6aa1b175 (patch)
tree445c6c6bcc55326dad333192761c465ba0ee1a5f
parentc70324117069bed8eb42d185a407ae58f4793eb1 (diff)
Add GATT Time Server skeleton plugin
-rw-r--r--Makefile.am6
-rw-r--r--acinclude.m46
-rwxr-xr-xbootstrap-configure1
-rw-r--r--time/main.c57
-rw-r--r--time/server.c38
-rw-r--r--time/server.h26
6 files changed, 134 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index d51907a2c..05ed56210 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -222,6 +222,12 @@ builtin_modules += gatt_example
builtin_sources += plugins/gatt-example.c
endif
+if TIMEPLUGIN
+builtin_modules += time
+builtin_sources += time/main.c \
+ time/server.h time/server.c
+endif
+
if HEALTHPLUGIN
builtin_modules += health
builtin_sources += health/hdp_main.c health/hdp_types.h \
diff --git a/acinclude.m4 b/acinclude.m4
index 3cb945963..115cd903f 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -194,6 +194,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [
network_enable=yes
sap_enable=no
proximity_enable=no
+ time_enable=no
service_enable=yes
health_enable=no
pnat_enable=no
@@ -246,6 +247,10 @@ AC_DEFUN([AC_ARG_BLUEZ], [
proximity_enable=${enableval}
])
+ AC_ARG_ENABLE(time, AC_HELP_STRING([--enable-time], [enable Time Profile plugin]), [
+ time_enable=${enableval}
+ ])
+
AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [disable serial plugin]), [
serial_enable=${enableval}
])
@@ -397,6 +402,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [
AM_CONDITIONAL(NETWORKPLUGIN, test "${network_enable}" = "yes")
AM_CONDITIONAL(SAPPLUGIN, test "${sap_enable}" = "yes")
AM_CONDITIONAL(PROXIMITYPLUGIN, test "${proximity_enable}" = "yes")
+ AM_CONDITIONAL(TIMEPLUGIN, test "${time_enable}" = "yes")
AM_CONDITIONAL(SERVICEPLUGIN, test "${service_enable}" = "yes")
AM_CONDITIONAL(HEALTHPLUGIN, test "${health_enable}" = "yes")
AM_CONDITIONAL(MCAP, test "${health_enable}" = "yes")
diff --git a/bootstrap-configure b/bootstrap-configure
index ec5d82114..65e266ff7 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
@@ -19,6 +19,7 @@ fi
--enable-capng \
--enable-gatt-example \
--enable-proximity \
+ --enable-time \
--enable-health \
--enable-tracer \
--enable-tools \
diff --git a/time/main.c b/time/main.c
new file mode 100644
index 000000000..a4de0fe59
--- /dev/null
+++ b/time/main.c
@@ -0,0 +1,57 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2011 Nokia Corporation
+ * Copyright (C) 2011 Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ * 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 "plugin.h"
+#include "hcid.h"
+#include "log.h"
+#include "server.h"
+
+static int time_init(void)
+{
+ if (!main_opts.attrib_server) {
+ DBG("Attribute server is disabled");
+ return -1;
+ }
+
+ return time_server_init();
+}
+
+static void time_exit(void)
+{
+ if (!main_opts.attrib_server)
+ return;
+
+ time_server_exit();
+}
+
+BLUETOOTH_PLUGIN_DEFINE(time, VERSION,
+ BLUETOOTH_PLUGIN_PRIORITY_DEFAULT,
+ time_init, time_exit)
diff --git a/time/server.c b/time/server.c
new file mode 100644
index 000000000..89cc460d8
--- /dev/null
+++ b/time/server.c
@@ -0,0 +1,38 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2011 Nokia Corporation
+ * Copyright (C) 2011 Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ * 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 "server.h"
+
+int time_server_init(void)
+{
+ return 0;
+}
+
+void time_server_exit(void)
+{
+}
diff --git a/time/server.h b/time/server.h
new file mode 100644
index 000000000..621bf2bf6
--- /dev/null
+++ b/time/server.h
@@ -0,0 +1,26 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2011 Nokia Corporation
+ * Copyright (C) 2011 Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ * 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 time_server_init(void);
+void time_server_exit(void);