summaryrefslogtreecommitdiff
path: root/profiles/scanparam
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-12-14 13:14:37 +0200
committerJohan Hedberg <johan.hedberg@intel.com>2012-12-14 13:15:06 +0200
commit539a5603e07611d22df63ab746024bb28fda0642 (patch)
treed872d3954ddfaee23a7c48bf407f2ea0e70e3e62 /profiles/scanparam
parent12cd2f8eee50fffc0ac981d3ee50f52dae8b41fc (diff)
downloadbluez-539a5603e07611d22df63ab746024bb28fda0642.tar.gz
scanparam: Remove useless files
Diffstat (limited to 'profiles/scanparam')
-rw-r--r--profiles/scanparam/manager.c92
-rw-r--r--profiles/scanparam/manager.h26
-rw-r--r--profiles/scanparam/scan.c61
-rw-r--r--profiles/scanparam/scan.h26
4 files changed, 58 insertions, 147 deletions
diff --git a/profiles/scanparam/manager.c b/profiles/scanparam/manager.c
deleted file mode 100644
index cea2b29cc..000000000
--- 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 1cf2e5e2d..000000000
--- 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 849336e24..d46b79f4e 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 93f7edd28..000000000
--- 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);