Diff between 18abb99ecbe0f26af0b00e47b53311a56ba86ad4 and e8f5e8b7746158cb9a7ebd34940b7d3669383462

Changed Files

File Additions Deletions Status
profiles/proximity/manager.c +21 -8 modified
profiles/proximity/reporter.c +3 -2 modified
profiles/proximity/reporter.h +3 -2 modified

Full Patch

diff --git a/profiles/proximity/manager.c b/profiles/proximity/manager.c
index 6b6fdad..8b991a8 100644
--- a/profiles/proximity/manager.c
+++ b/profiles/proximity/manager.c
@@ -62,8 +62,6 @@ static int attio_device_probe(struct btd_profile *p, struct btd_device *device,
 	struct gatt_primary *linkloss, *txpower, *immediate;
 	GSList *l, *primaries;
 
-	reporter_device_probe(device);
-
 	primaries = btd_device_get_primaries(device);
 
 	l = g_slist_find_custom(primaries, IMMEDIATE_ALERT_UUID,
@@ -83,15 +81,21 @@ static void attio_device_remove(struct btd_profile *p,
 						struct btd_device *device)
 {
 	monitor_unregister(device);
-	reporter_device_remove(device);
 }
 
-static struct btd_profile pxp_profile = {
-	.name		= "Proximity GATT Driver",
-	.remote_uuids	= BTD_UUIDS(GATT_UUID, IMMEDIATE_ALERT_UUID,
+static struct btd_profile pxp_monitor_profile = {
+	.name		= "Proximity Monitor GATT Driver",
+	.remote_uuids	= BTD_UUIDS(IMMEDIATE_ALERT_UUID,
 						LINK_LOSS_UUID, TX_POWER_UUID),
 	.device_probe	= attio_device_probe,
 	.device_remove	= attio_device_remove,
+};
+
+static struct btd_profile pxp_reporter_profile = {
+	.name		= "Proximity Reporter GATT Driver",
+	.remote_uuids	= BTD_UUIDS(GATT_UUID),
+	.device_probe	= reporter_device_probe,
+	.device_remove	= reporter_device_remove,
 
 	.adapter_probe	= reporter_adapter_probe,
 	.adapter_remove	= reporter_adapter_remove,
@@ -123,10 +127,19 @@ int proximity_manager_init(GKeyFile *config)
 {
 	load_config_file(config);
 
-	return btd_profile_register(&pxp_profile);
+	if (btd_profile_register(&pxp_monitor_profile) < 0)
+		return -1;
+
+	if (btd_profile_register(&pxp_reporter_profile) < 0) {
+		btd_profile_unregister(&pxp_monitor_profile);
+		return -1;
+	}
+
+	return 0;
 }
 
 void proximity_manager_exit(void)
 {
-	btd_profile_unregister(&pxp_profile);
+	btd_profile_unregister(&pxp_monitor_profile);
+	btd_profile_unregister(&pxp_reporter_profile);
 }
diff --git a/profiles/proximity/reporter.c b/profiles/proximity/reporter.c
index 1fc42c4..6ec5f73 100644
--- a/profiles/proximity/reporter.c
+++ b/profiles/proximity/reporter.c
@@ -223,7 +223,8 @@ static void register_reporter_device(struct btd_device *device,
 	radapter->devices = g_slist_prepend(radapter->devices, device);
 }
 
-int reporter_device_probe(struct btd_device *device)
+int reporter_device_probe(struct btd_profile *p, struct btd_device *device,
+								GSList *uuids)
 {
 	struct reporter_adapter *radapter;
 	struct btd_adapter *adapter = device_get_adapter(device);
@@ -237,7 +238,7 @@ int reporter_device_probe(struct btd_device *device)
 	return 0;
 }
 
-void reporter_device_remove(struct btd_device *device)
+void reporter_device_remove(struct btd_profile *p, struct btd_device *device)
 {
 	struct reporter_adapter *radapter;
 	struct btd_adapter *adapter = device_get_adapter(device);
diff --git a/profiles/proximity/reporter.h b/profiles/proximity/reporter.h
index 95a12c0..480c668 100644
--- a/profiles/proximity/reporter.h
+++ b/profiles/proximity/reporter.h
@@ -36,8 +36,9 @@ enum {
 	HIGH_ALERT = 0x02,
 };
 
-void reporter_device_remove(struct btd_device *device);
-int reporter_device_probe(struct btd_device *device);
+void reporter_device_remove(struct btd_profile *p, struct btd_device *device);
+int reporter_device_probe(struct btd_profile *p, struct btd_device *device,
+								GSList *uuids);
 
 int reporter_adapter_probe(struct btd_profile *p, struct btd_adapter *adapter);
 void reporter_adapter_remove(struct btd_profile *p,