This patch adds a list to track the address of the active connections.
The list element contains a reference to the modem with active SLC
connections. Instead of storing a simple structure to identity the
Bluetooth address peer, the modem pointer is stored in the list since
it will be necessary to keep a reference for the SCO channel established.
This approach assumes that the remote Bluetooth device will not support
multiple active connections with multiple Bluetooth adapters available
in the same host.
---
plugins/hfp_hf_bluez5.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index 2f4a89e..abeeb4a 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -64,6 +64,7 @@ struct hfp {
};
static GHashTable *modem_hash = NULL;
+static GSList *slc_list = NULL; /* Modem with active SLC
connection */
static GDBusClient *bluez = NULL;
static guint sco_watch = 0;
@@ -88,6 +89,8 @@ static void slc_established(gpointer userdata)
hfp->msg = NULL;
ofono_info("Service level connection established");
+
+ slc_list = g_slist_prepend(slc_list, modem);
}
static void slc_failed(gpointer userdata)
@@ -124,6 +127,8 @@ static void hfp_disconnected_cb(gpointer user_data)
g_at_chat_unref(info->chat);
info->chat = NULL;
+
+ slc_list = g_slist_remove(slc_list, modem);
}
static int service_level_connection(struct ofono_modem *modem,
@@ -612,6 +617,7 @@ static void hfp_exit(void)
ofono_modem_driver_unregister(&hfp_driver);
g_dbus_client_unref(bluez);
+ g_slist_free(slc_list);
g_hash_table_destroy(modem_hash);
if (sco_watch > 0)
--
1.7.11.7
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono