Diff between 12cd2f8eee50fffc0ac981d3ee50f52dae8b41fc and 539a5603e07611d22df63ab746024bb28fda0642

Changed Files

File Additions Deletions Status
Makefile.plugins +1 -4 modified
profiles/scanparam/manager.c +0 -92 deleted
profiles/scanparam/manager.h +0 -26 deleted
profiles/scanparam/scan.c +58 -3 modified
profiles/scanparam/scan.h +0 -26 deleted

Full Patch

diff --git a/Makefile.plugins b/Makefile.plugins
index e7649f3..0688030 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -77,10 +77,7 @@ builtin_sources += profiles/gatt/main.c profiles/gatt/manager.h \
 			profiles/gatt/gas.c
 
 builtin_modules += scanparam
-builtin_sources += profiles/scanparam/main.c \
-			profiles/scanparam/manager.h \
-			profiles/scanparam/manager.c \
-			profiles/scanparam/scan.h profiles/scanparam/scan.c
+builtin_sources += profiles/scanparam/scan.c
 
 builtin_modules += deviceinfo
 builtin_sources += profiles/deviceinfo/deviceinfo.c
diff --git a/profiles/scanparam/manager.c b/profiles/scanparam/manager.c
deleted file mode 100644
index cea2b29..0000000
--- a/profiles/scanparam/manager.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- *
- *  BlueZ - Bluetooth protocol stack for Linux
- *
- *  Copyright (C) 2012  Nordic Semiconductor Inc.
- *  Copyright (C) 2012  Instituto Nokia de Tecnologia - INdT
- *
- *
- *  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 <glib.h>
-#include <bluetooth/uuid.h>
-
-#include "log.h"
-#include "adapter.h"
-#include "device.h"
-#include "profile.h"
-#include "attrib/att.h"
-#include "attrib/gattrib.h"
-#include "attrib/gatt.h"
-#include "manager.h"
-#include "scan.h"
-
-#define SCAN_PARAMETERS_UUID	"00001813-0000-1000-8000-00805f9b34fb"
-
-static gint primary_uuid_cmp(gconstpointer a, gconstpointer b)
-{
-	const struct gatt_primary *prim = a;
-	const char *uuid = b;
-
-	return g_strcmp0(prim->uuid, uuid);
-}
-
-static int scan_param_probe(struct btd_profile *p, struct btd_device *device,
-								GSList *uuids)
-{
-	GSList *primaries, *l;
-
-	DBG("Probing Scan Parameters");
-
-	primaries = btd_device_get_primaries(device);
-
-	l = g_slist_find_custom(primaries, SCAN_PARAMETERS_UUID,
-							primary_uuid_cmp);
-	if (!l)
-		return -EINVAL;
-
-	return scan_register(device, l->data);
-}
-
-static void scan_param_remove(struct btd_profile *p, struct btd_device *device)
-{
-	scan_unregister(device);
-}
-
-static struct btd_profile scan_profile = {
-	.name = "Scan Parameters Client Driver",
-	.remote_uuids = BTD_UUIDS(SCAN_PARAMETERS_UUID),
-	.device_probe = scan_param_probe,
-	.device_remove = scan_param_remove,
-};
-
-int scan_param_manager_init(void)
-{
-	return btd_profile_register(&scan_profile);
-
-}
-
-void scan_param_manager_exit(void)
-{
-	btd_profile_unregister(&scan_profile);
-}
diff --git a/profiles/scanparam/manager.h b/profiles/scanparam/manager.h
deleted file mode 100644
index 1cf2e5e..0000000
--- a/profiles/scanparam/manager.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *
- *  BlueZ - Bluetooth protocol stack for Linux
- *
- *  Copyright (C) 2012  Nordic Semiconductor Inc.
- *  Copyright (C) 2012  Instituto Nokia de Tecnologia - INdT
- *
- *
- *  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 scan_param_manager_init(void);
-void scan_param_manager_exit(void);
diff --git a/profiles/scanparam/scan.c b/profiles/scanparam/scan.c
index 849336e..d46b79f 100644
--- a/profiles/scanparam/scan.c
+++ b/profiles/scanparam/scan.c
@@ -27,18 +27,22 @@
 #endif
 
 #include <stdbool.h>
+#include <errno.h>
 
 #include <bluetooth/bluetooth.h>
 #include <bluetooth/uuid.h>
 
 #include "log.h"
+#include "plugin.h"
 #include "adapter.h"
 #include "device.h"
+#include "profile.h"
 #include "attrib/att.h"
 #include "attrib/gattrib.h"
 #include "attrib/gatt.h"
 #include "attio.h"
-#include "scan.h"
+
+#define SCAN_PARAMETERS_UUID		"00001813-0000-1000-8000-00805f9b34fb"
 
 #define SCAN_INTERVAL_WIN_UUID		0x2A4F
 #define SCAN_REFRESH_UUID		0x2A31
@@ -222,7 +226,7 @@ static void attio_disconnected_cb(gpointer user_data)
 	scan->attrib = NULL;
 }
 
-int scan_register(struct btd_device *device, struct gatt_primary *prim)
+static int scan_register(struct btd_device *device, struct gatt_primary *prim)
 {
 	struct scan *scan;
 
@@ -239,7 +243,7 @@ int scan_register(struct btd_device *device, struct gatt_primary *prim)
 	return 0;
 }
 
-void scan_unregister(struct btd_device *device)
+static void scan_unregister(struct btd_device *device)
 {
 	struct scan *scan;
 	GSList *l;
@@ -261,3 +265,54 @@ void scan_unregister(struct btd_device *device)
 	g_attrib_unref(scan->attrib);
 	g_free(scan);
 }
+
+static gint primary_uuid_cmp(gconstpointer a, gconstpointer b)
+{
+	const struct gatt_primary *prim = a;
+	const char *uuid = b;
+
+	return g_strcmp0(prim->uuid, uuid);
+}
+
+static int scan_param_probe(struct btd_profile *p, struct btd_device *device,
+								GSList *uuids)
+{
+	GSList *primaries, *l;
+
+	DBG("Probing Scan Parameters");
+
+	primaries = btd_device_get_primaries(device);
+
+	l = g_slist_find_custom(primaries, SCAN_PARAMETERS_UUID,
+							primary_uuid_cmp);
+	if (!l)
+		return -EINVAL;
+
+	return scan_register(device, l->data);
+}
+
+static void scan_param_remove(struct btd_profile *p, struct btd_device *device)
+{
+	scan_unregister(device);
+}
+
+static struct btd_profile scan_profile = {
+	.name = "Scan Parameters Client Driver",
+	.remote_uuids = BTD_UUIDS(SCAN_PARAMETERS_UUID),
+	.device_probe = scan_param_probe,
+	.device_remove = scan_param_remove,
+};
+
+static int scan_param_init(void)
+{
+	return btd_profile_register(&scan_profile);
+}
+
+static void scan_param_exit(void)
+{
+	btd_profile_unregister(&scan_profile);
+}
+
+BLUETOOTH_PLUGIN_DEFINE(scanparam, VERSION,
+			BLUETOOTH_PLUGIN_PRIORITY_DEFAULT,
+			scan_param_init, scan_param_exit)
diff --git a/profiles/scanparam/scan.h b/profiles/scanparam/scan.h
deleted file mode 100644
index 93f7edd..0000000
--- a/profiles/scanparam/scan.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *
- *  BlueZ - Bluetooth protocol stack for Linux
- *
- *  Copyright (C) 2012  Nordic Semiconductor Inc.
- *  Copyright (C) 2012  Instituto Nokia de Tecnologia - INdT
- *
- *
- *  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 scan_register(struct btd_device *device, struct gatt_primary *prim);
-void scan_unregister(struct btd_device *device);