All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 0/3] Initial Proximity Monitor implementation
@ 2011-07-13 12:37 Claudio Takahasi
  2011-07-13 12:37 ` [PATCH BlueZ 1/3] Add Proximity Profile plugin skeleton Claudio Takahasi
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Claudio Takahasi @ 2011-07-13 12:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

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

Adds the plugin and device driver for Proximity Monitor. Service is not
functional yet.

Claudio Takahasi (3):
  Add Proximity Profile plugin skeleton
  Add Proximity Monitor skeleton
  Add Link Loss device driver skeleton

 Makefile.am         |    7 ++++
 acinclude.m4        |    6 ++++
 bootstrap-configure |    1 +
 proximity/main.c    |   60 ++++++++++++++++++++++++++++++++++++
 proximity/manager.c |   84 +++++++++++++++++++++++++++++++++++++++++++++++++++
 proximity/manager.h |   26 ++++++++++++++++
 proximity/monitor.c |   84 +++++++++++++++++++++++++++++++++++++++++++++++++++
 proximity/monitor.h |   26 ++++++++++++++++
 8 files changed, 294 insertions(+), 0 deletions(-)
 create mode 100644 proximity/main.c
 create mode 100644 proximity/manager.c
 create mode 100644 proximity/manager.h
 create mode 100644 proximity/monitor.c
 create mode 100644 proximity/monitor.h

-- 
1.7.6


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

* [PATCH BlueZ 1/3] Add Proximity Profile plugin skeleton
  2011-07-13 12:37 [PATCH BlueZ 0/3] Initial Proximity Monitor implementation Claudio Takahasi
@ 2011-07-13 12:37 ` Claudio Takahasi
  2011-07-13 12:37 ` [PATCH BlueZ 2/3] Add Proximity Monitor skeleton Claudio Takahasi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Claudio Takahasi @ 2011-07-13 12:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

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

diff --git a/Makefile.am b/Makefile.am
index 5f54b5b..0fd52fd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -190,6 +190,11 @@ builtin_sources += network/main.c \
 			network/connection.h network/connection.c
 endif
 
+if PROXIMITYPLUGIN
+builtin_modules += proximity
+builtin_sources += proximity/main.c
+endif
+
 if SERVICEPLUGIN
 builtin_modules += service
 builtin_sources += plugins/service.c
diff --git a/acinclude.m4 b/acinclude.m4
index af97cce..d613086 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -193,6 +193,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [
 	serial_enable=yes
 	network_enable=yes
 	sap_enable=no
+	proximity_enable=no
 	service_enable=yes
 	health_enable=no
 	pnat_enable=no
@@ -239,6 +240,10 @@ AC_DEFUN([AC_ARG_BLUEZ], [
 	])
 	AC_SUBST([SAP_DRIVER], [sap-${sap_driver}.c])
 
+	AC_ARG_ENABLE(proximity, AC_HELP_STRING([--enable-proximity], [enable proximity plugin]), [
+		proximity_enable=${enableval}
+	])
+
 	AC_ARG_ENABLE(serial, AC_HELP_STRING([--disable-serial], [disable serial plugin]), [
 		serial_enable=${enableval}
 	])
@@ -381,6 +386,7 @@ AC_DEFUN([AC_ARG_BLUEZ], [
 	AM_CONDITIONAL(SERIALPLUGIN, test "${serial_enable}" = "yes")
 	AM_CONDITIONAL(NETWORKPLUGIN, test "${network_enable}" = "yes")
 	AM_CONDITIONAL(SAPPLUGIN, test "${sap_enable}" = "yes")
+	AM_CONDITIONAL(PROXIMITYPLUGIN, test "${proximity_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 55c1049..b0020cb 100755
--- a/bootstrap-configure
+++ b/bootstrap-configure
@@ -18,6 +18,7 @@ fi
 		--libexecdir=/lib \
 		--enable-capng \
 		--enable-gatt-example \
+		--enable-proximity \
 		--enable-health \
 		--enable-tracer \
 		--enable-tools \
diff --git a/proximity/main.c b/proximity/main.c
new file mode 100644
index 0000000..dccd619
--- /dev/null
+++ b/proximity/main.c
@@ -0,0 +1,42 @@
+/*
+ *
+ *  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 "plugin.h"
+
+static int proximity_init(void)
+{
+	return 0;
+}
+
+static void proximity_exit(void)
+{
+}
+
+BLUETOOTH_PLUGIN_DEFINE(proximity, VERSION,
+			BLUETOOTH_PLUGIN_PRIORITY_DEFAULT,
+			proximity_init, proximity_exit)
-- 
1.7.6


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

* [PATCH BlueZ 2/3] Add Proximity Monitor skeleton
  2011-07-13 12:37 [PATCH BlueZ 0/3] Initial Proximity Monitor implementation Claudio Takahasi
  2011-07-13 12:37 ` [PATCH BlueZ 1/3] Add Proximity Profile plugin skeleton Claudio Takahasi
@ 2011-07-13 12:37 ` Claudio Takahasi
  2011-07-13 12:37 ` [PATCH BlueZ 3/3] Add Link Loss device driver skeleton Claudio Takahasi
  2011-07-26  8:16 ` [PATCH BlueZ 0/3] Initial Proximity Monitor implementation Johan Hedberg
  3 siblings, 0 replies; 5+ messages in thread
From: Claudio Takahasi @ 2011-07-13 12:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

Registers hard-coded D-Bus object path for Proximity Monitor and
exports GetProperties and SetProperty.
---
 Makefile.am         |    4 ++-
 proximity/main.c    |   18 +++++++++++
 proximity/manager.c |   59 +++++++++++++++++++++++++++++++++++
 proximity/manager.h |   26 ++++++++++++++++
 proximity/monitor.c |   84 +++++++++++++++++++++++++++++++++++++++++++++++++++
 proximity/monitor.h |   26 ++++++++++++++++
 6 files changed, 216 insertions(+), 1 deletions(-)
 create mode 100644 proximity/manager.c
 create mode 100644 proximity/manager.h
 create mode 100644 proximity/monitor.c
 create mode 100644 proximity/monitor.h

diff --git a/Makefile.am b/Makefile.am
index 0fd52fd..293a8cc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -192,7 +192,9 @@ endif
 
 if PROXIMITYPLUGIN
 builtin_modules += proximity
-builtin_sources += proximity/main.c
+builtin_sources += proximity/main.c \
+			proximity/manager.h proximity/manager.c \
+			proximity/monitor.h proximity/monitor.c
 endif
 
 if SERVICEPLUGIN
diff --git a/proximity/main.c b/proximity/main.c
index dccd619..ee7e4fb 100644
--- a/proximity/main.c
+++ b/proximity/main.c
@@ -26,15 +26,33 @@
 #include <config.h>
 #endif
 
+#include <errno.h>
+
+#include <gdbus.h>
+
 #include "plugin.h"
+#include "manager.h"
+
+static DBusConnection *connection = NULL;
 
 static int proximity_init(void)
 {
+	connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+	if (connection == NULL)
+		return -EIO;
+
+	if (proximity_manager_init(connection) < 0) {
+		dbus_connection_unref(connection);
+		return -EIO;
+	}
+
 	return 0;
 }
 
 static void proximity_exit(void)
 {
+	proximity_manager_exit();
+	dbus_connection_unref(connection);
 }
 
 BLUETOOTH_PLUGIN_DEFINE(proximity, VERSION,
diff --git a/proximity/manager.c b/proximity/manager.c
new file mode 100644
index 0000000..795bdee
--- /dev/null
+++ b/proximity/manager.c
@@ -0,0 +1,59 @@
+/*
+ *
+ *  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 <gdbus.h>
+
+#include "monitor.h"
+#include "manager.h"
+
+static DBusConnection *connection = NULL;
+
+int proximity_manager_init(DBusConnection *conn)
+{
+	int ret;
+	/* TODO: Add Proximity Monitor/Reporter config */
+
+	/* TODO: Register Proximity Monitor/Reporter drivers */
+
+	connection = dbus_connection_ref(conn);
+
+	ret = monitor_register(connection);
+
+	if (ret < 0) {
+		dbus_connection_unref(connection);
+		return ret;
+	}
+
+	return 0;
+}
+
+void proximity_manager_exit(void)
+{
+	monitor_unregister(connection);
+	dbus_connection_unref(connection);
+}
diff --git a/proximity/manager.h b/proximity/manager.h
new file mode 100644
index 0000000..7557a68
--- /dev/null
+++ b/proximity/manager.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 proximity_manager_init(DBusConnection *conn);
+void proximity_manager_exit(void);
diff --git a/proximity/monitor.c b/proximity/monitor.c
new file mode 100644
index 0000000..4928c7a
--- /dev/null
+++ b/proximity/monitor.c
@@ -0,0 +1,84 @@
+/*
+ *
+ *  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 <gdbus.h>
+
+#include "log.h"
+
+#include "monitor.h"
+
+#define PROXIMITY_INTERFACE "org.bluez.Proximity"
+#define PROXIMITY_PATH "/org/bluez/proximity"
+
+static DBusMessage *get_properties(DBusConnection *conn,
+					DBusMessage *msg, void *data)
+{
+	return dbus_message_new_method_return(msg);
+}
+
+static DBusMessage *set_property(DBusConnection *conn,
+					DBusMessage *msg, void *data)
+{
+	return dbus_message_new_method_return(msg);
+}
+
+static GDBusMethodTable monitor_methods[] = {
+	{ "GetProperties",	"",	"a{sv}",	get_properties	},
+	{ "SetProperty",	"sv",	"",		set_property,
+						G_DBUS_METHOD_FLAG_ASYNC},
+	{ }
+};
+
+static GDBusSignalTable monitor_signals[] = {
+	{ "PropertyChanged",	"sv"	},
+	{ }
+};
+
+int monitor_register(DBusConnection *conn)
+{
+	int ret = -1;
+
+	if (g_dbus_register_interface(conn, PROXIMITY_PATH,
+					PROXIMITY_INTERFACE,
+					monitor_methods, monitor_signals,
+					NULL, NULL, NULL) == TRUE) {
+		DBG("Registered interface %s on path %s", PROXIMITY_INTERFACE,
+							PROXIMITY_PATH);
+		ret = 0;
+
+	}
+
+	error("D-Bus failed to register %s interface", PROXIMITY_INTERFACE);
+
+	return ret;
+}
+
+void monitor_unregister(DBusConnection *conn)
+{
+	g_dbus_unregister_interface(conn, PROXIMITY_PATH, PROXIMITY_INTERFACE);
+}
diff --git a/proximity/monitor.h b/proximity/monitor.h
new file mode 100644
index 0000000..d4913ac
--- /dev/null
+++ b/proximity/monitor.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 monitor_register(DBusConnection *conn);
+void monitor_unregister(DBusConnection *conn);
-- 
1.7.6


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

* [PATCH BlueZ 3/3] Add Link Loss device driver skeleton
  2011-07-13 12:37 [PATCH BlueZ 0/3] Initial Proximity Monitor implementation Claudio Takahasi
  2011-07-13 12:37 ` [PATCH BlueZ 1/3] Add Proximity Profile plugin skeleton Claudio Takahasi
  2011-07-13 12:37 ` [PATCH BlueZ 2/3] Add Proximity Monitor skeleton Claudio Takahasi
@ 2011-07-13 12:37 ` Claudio Takahasi
  2011-07-26  8:16 ` [PATCH BlueZ 0/3] Initial Proximity Monitor implementation Johan Hedberg
  3 siblings, 0 replies; 5+ messages in thread
From: Claudio Takahasi @ 2011-07-13 12:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Claudio Takahasi

---
 proximity/manager.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/proximity/manager.c b/proximity/manager.c
index 795bdee..4b07108 100644
--- a/proximity/manager.c
+++ b/proximity/manager.c
@@ -26,19 +26,43 @@
 #include <config.h>
 #endif
 
+#include <glib.h>
 #include <gdbus.h>
 
+#include "adapter.h"
+#include "device.h"
 #include "monitor.h"
 #include "manager.h"
 
+#define LINK_LOSS_UUID "00001803-0000-1000-8000-00805f9b34fb"
+
 static DBusConnection *connection = NULL;
 
+static int attio_device_probe(struct btd_device *device, GSList *uuids)
+{
+	return 0;
+}
+
+static void attio_device_remove(struct btd_device *device)
+{
+}
+
+static struct btd_device_driver monitor_driver = {
+	.name = "Proximity GATT Driver",
+	.uuids = BTD_UUIDS(LINK_LOSS_UUID),
+	.probe = attio_device_probe,
+	.remove = attio_device_remove,
+};
+
 int proximity_manager_init(DBusConnection *conn)
 {
 	int ret;
 	/* TODO: Add Proximity Monitor/Reporter config */
 
 	/* TODO: Register Proximity Monitor/Reporter drivers */
+	ret = btd_register_device_driver(&monitor_driver);
+	if (ret < 0)
+		return ret;
 
 	connection = dbus_connection_ref(conn);
 
@@ -55,5 +79,6 @@ int proximity_manager_init(DBusConnection *conn)
 void proximity_manager_exit(void)
 {
 	monitor_unregister(connection);
+	btd_unregister_device_driver(&monitor_driver);
 	dbus_connection_unref(connection);
 }
-- 
1.7.6


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

* Re: [PATCH BlueZ 0/3] Initial Proximity Monitor implementation
  2011-07-13 12:37 [PATCH BlueZ 0/3] Initial Proximity Monitor implementation Claudio Takahasi
                   ` (2 preceding siblings ...)
  2011-07-13 12:37 ` [PATCH BlueZ 3/3] Add Link Loss device driver skeleton Claudio Takahasi
@ 2011-07-26  8:16 ` Johan Hedberg
  3 siblings, 0 replies; 5+ messages in thread
From: Johan Hedberg @ 2011-07-26  8:16 UTC (permalink / raw)
  To: Claudio Takahasi; +Cc: linux-bluetooth

Hi Claudio,

On Wed, Jul 13, 2011, Claudio Takahasi wrote:
> The following patches don't require the previously submitted patches.
> 
> Adds the plugin and device driver for Proximity Monitor. Service is not
> functional yet.
> 
> Claudio Takahasi (3):
>   Add Proximity Profile plugin skeleton
>   Add Proximity Monitor skeleton
>   Add Link Loss device driver skeleton
> 
>  Makefile.am         |    7 ++++
>  acinclude.m4        |    6 ++++
>  bootstrap-configure |    1 +
>  proximity/main.c    |   60 ++++++++++++++++++++++++++++++++++++
>  proximity/manager.c |   84 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  proximity/manager.h |   26 ++++++++++++++++
>  proximity/monitor.c |   84 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  proximity/monitor.h |   26 ++++++++++++++++
>  8 files changed, 294 insertions(+), 0 deletions(-)
>  create mode 100644 proximity/main.c
>  create mode 100644 proximity/manager.c
>  create mode 100644 proximity/manager.h
>  create mode 100644 proximity/monitor.c
>  create mode 100644 proximity/monitor.h

All three patches have been applied. Thanks.

Johan

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

end of thread, other threads:[~2011-07-26  8:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-13 12:37 [PATCH BlueZ 0/3] Initial Proximity Monitor implementation Claudio Takahasi
2011-07-13 12:37 ` [PATCH BlueZ 1/3] Add Proximity Profile plugin skeleton Claudio Takahasi
2011-07-13 12:37 ` [PATCH BlueZ 2/3] Add Proximity Monitor skeleton Claudio Takahasi
2011-07-13 12:37 ` [PATCH BlueZ 3/3] Add Link Loss device driver skeleton Claudio Takahasi
2011-07-26  8:16 ` [PATCH BlueZ 0/3] Initial Proximity Monitor 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.