Diff between 1156c04dbc0a257e05e0eb68b07dd9ccf86e5903 and 2935c04e3d17e9ec1d8f34471af24a0645feb1f5

Changed Files

File Additions Deletions Status
Makefile.am +1 -1 modified
Makefile.plugins +0 -3 modified
Makefile.tools +1 -1 modified
doc/oob-api.txt +0 -89 deleted
plugins/dbusoob.c +0 -354 deleted
test/test-oob +0 -90 deleted

Full Patch

diff --git a/Makefile.am b/Makefile.am
index d312ac2..b72a306 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -196,7 +196,7 @@ EXTRA_DIST += doc/adapter-api.txt doc/device-api.txt doc/profile-api.txt \
 		doc/network-api.txt doc/health-api.txt \
 		doc/sap-api.txt doc/media-api.txt doc/assigned-numbers.txt \
 		doc/supported-features.txt doc/alert-api.txt doc/mgmt-api.txt \
-		doc/oob-api.txt doc/proximity-api.txt doc/heartrate-api.txt \
+		doc/proximity-api.txt doc/heartrate-api.txt \
 		doc/thermometer-api.txt doc/audio-telephony-design.txt \
 		doc/cyclingspeed-api.txt
 
diff --git a/Makefile.plugins b/Makefile.plugins
index 73055ef..4b12313 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -14,9 +14,6 @@ builtin_sources += plugins/gatt-example.c
 endif
 
 if EXPERIMENTAL
-builtin_modules += dbusoob
-builtin_sources += plugins/dbusoob.c
-
 builtin_modules += neard
 builtin_sources += plugins/neard.c
 
diff --git a/Makefile.tools b/Makefile.tools
index 0d782a6..df63cd1 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -198,7 +198,7 @@ test_scripts += test/sap_client.py test/bluezutils.py \
 		test/test-discovery test/test-manager test/test-adapter \
 		test/test-device test/test-service test/simple-agent \
 		test/simple-service test/simple-endpoint test/test-sap-server \
-		test/test-oob test/test-proximity \
+		test/test-proximity \
 		test/test-thermometer test/test-profile test/test-health \
 		test/test-health-sink test/service-record.dtd \
 		test/service-did.xml test/service-spp.xml test/service-opp.xml \
diff --git a/doc/oob-api.txt b/doc/oob-api.txt
deleted file mode 100644
index a196442..0000000
--- a/doc/oob-api.txt
+++ /dev/null
@@ -1,89 +0,0 @@
-BlueZ D-Bus Out Of Band Pairing API description
-===============================================
-
-Copyright (C) 2011  Szymon Janc <szymon.janc@tieto.com> for ST-Ericsson
-Copyright (C) 2012  Tieto Poland
-
-Currently only Secure Simple Pairing is supported. This might change when white
-paper describing OOB pairing for Bluetooth Low Energy will become available.
-
-Out Of Band hierarchy
-=====================
-
-Service		org.bluez
-Interface	org.bluez.OutOfBand1
-Object path	[variable prefix]/{hci0,hci1,...}
-
-Methods		dict ReadLocalData()
-
-			This method reads local OOB data from adapter. Return
-			value is a dictionary. Following keys are possible:
-
-			array{byte} Hash:
-
-					16 bytes hash blob.
-
-			array{byte} Randomizer:
-
-					16 bytes randomizer blob.
-
-			Other data that can be transmitted via OOB mechanism
-			can be obtained from org.bluez.Adapter1 interface.
-
-			Note: This method will generate and return new data
-			every time it is called. Data received in previous
-			calls is invalidated and cannot be used for pairing.
-
-			Possible errors: org.bluez.Error.Failed
-					 org.bluez.Error.InProgress
-					 org.bluez.Error.NotSupported
-
-		object AddRemoteData(string address, dict data)
-
-			This method adds new Out Of Band data for
-			specified address. If data for specified address
-			already exists it will be overwritten with new one.
-			If device object with given address does not exist yet
-			it will be created.
-
-			Returns the object path of device for given address.
-
-			All data is optional.
-
-			possible keys:
-
-				array{byte} Hash:
-
-					16 bytes hash blob, it is used as is
-					so the size and byte order must match.
-
-				array{byte} Randomizer:
-
-					16 bytes randomizer blob, it is used as
-					is so the size and byte order must
-					match. If Randomizer is provided Hash
-					also needs to be provided.
-
-				uint32 Class:
-
-					The Bluetooth class of device of the
-					remote device.
-
-				string Name:
-
-					Remote device name.
-
-			Possible errors: org.bluez.Error.Failed
-					 org.bluez.Error.InvalidArguments
-					 org.bluez.Error.AlreadyExists
-					 org.bluez.Error.NotSupported
-
-		void RemoveRemoteData(string address)
-
-			This method removes Out Of Band data for specified
-			address. If data for specified address does not exist
-			nothing is removed.
-
-			Possible errors: org.bluez.Error.Failed
-					 org.bluez.Error.InvalidArguments
-					 org.bluez.Error.NotSupported
diff --git a/plugins/dbusoob.c b/plugins/dbusoob.c
deleted file mode 100644
index 887a610..0000000
--- a/plugins/dbusoob.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- *
- *  BlueZ - Bluetooth protocol stack for Linux
- *
- *  Copyright (C) 2011  ST-Ericsson SA
- *
- *  Author: Szymon Janc <szymon.janc@tieto.com> for ST-Ericsson
- *
- *
- *  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 <stdbool.h>
-
-#include <errno.h>
-#include <gdbus/gdbus.h>
-
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/hci.h>
-#include <bluetooth/sdp.h>
-
-#include "plugin.h"
-#include "log.h"
-#include "adapter.h"
-#include "device.h"
-#include "manager.h"
-#include "dbus-common.h"
-#include "error.h"
-#include "storage.h"
-
-#define OOB_INTERFACE	"org.bluez.OutOfBand1"
-
-struct oob_data {
-	char *addr;
-	uint8_t *hash;
-	uint8_t *randomizer;
-	uint32_t class;
-	const char *name;
-};
-
-static void read_local_data_complete(struct btd_adapter *adapter, uint8_t *hash,
-				uint8_t *randomizer, void *user_data)
-{
-	struct DBusMessage *reply;
-	DBusMessageIter iter;
-	DBusMessageIter dict;
-	DBusMessage *msg = user_data;
-
-	DBG("");
-
-	if (!hash || !randomizer) {
-		reply = btd_error_failed(msg, "Failed to read local OOB data");
-		goto done;
-	}
-
-	reply = dbus_message_new_method_return(msg);
-	if (!reply)
-		goto done;
-
-	dbus_message_iter_init_append(reply, &iter);
-
-	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
-			DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
-			DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
-			DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
-
-	dict_append_array(&dict, "Hash", DBUS_TYPE_BYTE, &hash, 16);
-	dict_append_array(&dict, "Randomizer", DBUS_TYPE_BYTE, &randomizer, 16);
-
-	dbus_message_iter_close_container(&iter, &dict);
-
-done:
-	dbus_message_unref(msg);
-
-	if (!reply) {
-		error("Couldn't allocate D-Bus message");
-		return;
-	}
-
-	if (!g_dbus_send_message(btd_get_dbus_connection(), reply))
-		error("D-Bus send failed");
-}
-
-static DBusMessage *read_local_data(DBusConnection *conn, DBusMessage *msg,
-								void *data)
-{
-	struct btd_adapter *adapter = data;
-	struct oob_handler *handler;
-
-	if (!btd_adapter_ssp_enabled(adapter))
-		return btd_error_not_supported(msg);
-
-	if (btd_adapter_check_oob_handler(adapter))
-		return btd_error_in_progress(msg);
-
-	if (btd_adapter_read_local_oob_data(adapter))
-		return btd_error_failed(msg, "Request failed.");
-
-	handler = g_new0(struct oob_handler, 1);
-	handler->read_local_cb = read_local_data_complete;
-	handler->user_data = dbus_message_ref(msg);
-
-	btd_adapter_set_oob_handler(adapter, handler);
-
-	return NULL;
-}
-
-static gboolean parse_data(DBusMessageIter *data, struct oob_data *remote_data)
-{
-	while (dbus_message_iter_get_arg_type(data) == DBUS_TYPE_DICT_ENTRY) {
-		const char *key;
-		DBusMessageIter value, entry;
-		int var;
-
-		dbus_message_iter_recurse(data, &entry);
-		dbus_message_iter_get_basic(&entry, &key);
-
-		dbus_message_iter_next(&entry);
-		dbus_message_iter_recurse(&entry, &value);
-
-		var = dbus_message_iter_get_arg_type(&value);
-		if (strcasecmp(key, "Hash") == 0) {
-			DBusMessageIter array;
-			int size;
-
-			if (var != DBUS_TYPE_ARRAY)
-				return FALSE;
-
-			dbus_message_iter_recurse(&value, &array);
-			dbus_message_iter_get_fixed_array(&array,
-						&remote_data->hash, &size);
-
-			if (size != 16)
-				return FALSE;
-		} else if (strcasecmp(key, "Randomizer") == 0) {
-			DBusMessageIter array;
-			int size;
-
-			if (var != DBUS_TYPE_ARRAY)
-				return FALSE;
-
-			dbus_message_iter_recurse(&value, &array);
-			dbus_message_iter_get_fixed_array(&array,
-						&remote_data->randomizer,
-						&size);
-
-			if (size != 16)
-				return FALSE;
-		} else if (strcasecmp(key, "Class") == 0) {
-			if (var != DBUS_TYPE_UINT32)
-				return FALSE;
-
-			dbus_message_iter_get_basic(&value,
-							&remote_data->class);
-		} else if (strcasecmp(key, "Name") == 0) {
-			if (var != DBUS_TYPE_STRING)
-				return FALSE;
-
-			dbus_message_iter_get_basic(&value,
-							&remote_data->name);
-		}
-
-		dbus_message_iter_next(data);
-	}
-
-	if (dbus_message_iter_get_arg_type(data) != DBUS_TYPE_INVALID)
-		return FALSE;
-
-	/* If randomizer is provided, hash also needs to be provided. */
-	if (remote_data->randomizer && !remote_data->hash)
-		return FALSE;
-
-	return TRUE;
-}
-
-static gboolean store_data(struct btd_adapter *adapter,
-				struct btd_device *device,
-				struct oob_data *data)
-{
-	bdaddr_t bdaddr;
-
-	str2ba(data->addr, &bdaddr);
-
-	if (data->hash) {
-		if (btd_adapter_add_remote_oob_data(adapter, &bdaddr,
-					data->hash, data->randomizer) < 0)
-			return FALSE;
-	}
-
-	if (data->class)
-		device_set_class(device, data->class);
-
-	if (data->name) {
-		adapter_store_cached_name(adapter_get_address(adapter),
-							&bdaddr, data->name);
-		device_set_name(device, data->name);
-	}
-
-	return TRUE;
-}
-
-static DBusMessage *add_remote_data(DBusConnection *conn, DBusMessage *msg,
-							void *user_data)
-{
-	struct btd_adapter *adapter = user_data;
-	DBusMessageIter args;
-	DBusMessageIter data;
-	struct oob_data remote_data;
-	struct btd_device *device;
-	DBusMessage *reply;
-	const char *dev_path;
-
-	if (!btd_adapter_ssp_enabled(adapter))
-		return btd_error_not_supported(msg);
-
-	memset(&remote_data, 0, sizeof(remote_data));
-
-	dbus_message_iter_init(msg, &args);
-
-	dbus_message_iter_get_basic(&args, &remote_data.addr);
-	dbus_message_iter_next(&args);
-
-	if (bachk(remote_data.addr) < 0)
-		return btd_error_invalid_args(msg);
-
-	device = adapter_get_device(adapter, remote_data.addr, BDADDR_BREDR);
-	if (!device)
-		return btd_error_failed(msg, "Creating device object failed");
-
-	if (device_is_paired(device))
-		return btd_error_already_exists(msg);
-
-	dbus_message_iter_recurse(&args, &data);
-
-	/*
-	 * TODO
-	 * Should device object be destroyed if parsing or storing failed?
-	 */
-
-	if (!parse_data(&data, &remote_data))
-		return btd_error_invalid_args(msg);
-
-	if (!store_data(adapter, device, &remote_data))
-		return btd_error_failed(msg, "Request failed");
-
-	reply = dbus_message_new_method_return(msg);
-	if (!reply)
-		return NULL;
-
-	dev_path = device_get_path(device);
-
-	dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH, &dev_path,
-							DBUS_TYPE_INVALID);
-
-	return reply;
-}
-
-static DBusMessage *remove_remote_data(DBusConnection *conn, DBusMessage *msg,
-								void *data)
-{
-	struct btd_adapter *adapter = data;
-	const char *addr;
-	bdaddr_t bdaddr;
-
-	if (!btd_adapter_ssp_enabled(adapter))
-		return btd_error_not_supported(msg);
-
-	if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &addr,
-			DBUS_TYPE_INVALID))
-		return btd_error_invalid_args(msg);
-
-	if (str2ba(addr, &bdaddr) < 0)
-		return btd_error_invalid_args(msg);
-
-	if (btd_adapter_remove_remote_oob_data(adapter, &bdaddr))
-		return btd_error_failed(msg, "Request failed");
-
-	return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
-}
-
-static const GDBusMethodTable oob_methods[] = {
-	{ GDBUS_METHOD("AddRemoteData",
-			GDBUS_ARGS({ "address", "s" }, { "data", "a{sv}"}),
-			GDBUS_ARGS({ "device", "o" }),
-			add_remote_data) },
-	{ GDBUS_METHOD("RemoveRemoteData",
-			GDBUS_ARGS({ "address", "s" }), NULL,
-			remove_remote_data) },
-	{ GDBUS_ASYNC_METHOD("ReadLocalData",
-			NULL, GDBUS_ARGS({ "data", "a{sv}" }),
-			read_local_data) },
-	{ }
-};
-
-static int oob_probe(struct btd_adapter *adapter)
-{
-	const char *path = adapter_get_path(adapter);
-
-	if (!g_dbus_register_interface(btd_get_dbus_connection(),
-					path, OOB_INTERFACE,
-					oob_methods, NULL, NULL,
-					adapter, NULL)) {
-			error("OOB interface init failed on path %s", path);
-			return -EIO;
-		}
-
-	return 0;
-}
-
-static void oob_remove(struct btd_adapter *adapter)
-{
-	g_dbus_unregister_interface(btd_get_dbus_connection(),
-				adapter_get_path(adapter), OOB_INTERFACE);
-}
-
-static struct btd_adapter_driver oob_driver = {
-	.name	= "oob",
-	.probe	= oob_probe,
-	.remove	= oob_remove,
-};
-
-static int dbusoob_init(void)
-{
-	DBG("Setup dbusoob plugin");
-
-	return btd_register_adapter_driver(&oob_driver);
-}
-
-static void dbusoob_exit(void)
-{
-	DBG("Cleanup dbusoob plugin");
-
-	btd_unregister_adapter_driver(&oob_driver);
-}
-
-BLUETOOTH_PLUGIN_DEFINE(dbusoob, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT,
-						dbusoob_init, dbusoob_exit)
diff --git a/test/test-oob b/test/test-oob
deleted file mode 100755
index 681540b..0000000
--- a/test/test-oob
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/python
-
-from __future__ import absolute_import, print_function, unicode_literals
-
-import gobject
-
-import dbus.mainloop.glib
-import bluezutils
-
-BUS_NAME = 'org.bluez'
-OOB_INTERFACE = 'org.bluez.OutOfBand1'
-
-def create_device_reply(device):
-	print("Pairing succeed!")
-	mainloop.quit()
-
-def create_device_error(error):
-	print("Pairing failed.")
-	mainloop.quit()
-
-if __name__ == '__main__':
-	dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
-
-	mainloop = gobject.MainLoop()
-
-	bus = dbus.SystemBus()
-
-	managed_objects = bluezutils.get_managed_objects()
-	adapter0 = bluezutils.find_adapter_in_objects(managed_objects, "hci0")
-	adapter1 = bluezutils.find_adapter_in_objects(managed_objects, "hci1")
-
-	adapter0_path = adapter0.object_path
-	adapter1_path = adapter1.object_path
-
-	adapter0_address = managed_objects[adapter0_path][
-					bluezutils.ADAPTER_INTERFACE]["Address"]
-	adapter1_address = managed_objects[adapter1_path][
-					bluezutils.ADAPTER_INTERFACE]["Address"]
-
-	print("Adapters:")
-	print("    hci0: " + adapter0_address)
-	print("    hci1: " + adapter1_address)
-	print()
-
-	print("Removing any existing bond...")
-
-	try:
-		dev = bluezutils.find_device_in_objects(managed_objects,
-							adapter1_address,
-							adapter0_address)
-		adapter0.RemoveDevice(dev.object_path)
-	except:
-		pass
-
-	try:
-		dev = bluezutils.find_device_in_objects(managed_objects,
-							adapter0_address,
-							adapter1_address)
-		adapter1.RemoveDevice(dev.object_path)
-	except:
-		pass
-
-	print("Done.")
-	print()
-	print("Reading local Out of Band data...")
-
-	oob_adapter0 = dbus.Interface(bus.get_object(BUS_NAME,
-					adapter0_path), OOB_INTERFACE)
-	oob_adapter1 = dbus.Interface(bus.get_object(BUS_NAME,
-					adapter1_path), OOB_INTERFACE)
-
-	oob0 = oob_adapter0.ReadLocalData()
-	oob1 = oob_adapter1.ReadLocalData()
-
-	print("Done.")
-	print()
-	print("Exchanging Out of Band data...")
-
-	oob_adapter0.AddRemoteData(adapter1_address, oob1)
-	oob_adapter1.AddRemoteData(adapter0_address, oob0)
-
-	print("Done.")
-	print()
-	print("Starting to pair.")
-	adapter1.CreatePairedDevice(adapter0_address, "/test/agent_oob",
-					"DisplayYesNo",
-					reply_handler=create_device_reply,
-					error_handler=create_device_error)
-
-	mainloop.run()