[PATCH 1/4] android/tester: Wait for ACL disconnection before reconnect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We need the remote to drop its ACL before it tries to connect again.
---
 android/tester-gatt.c |  2 ++
 android/tester-main.c | 15 ++++++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/android/tester-gatt.c b/android/tester-gatt.c
index d69b027..0d99320 100644
--- a/android/tester-gatt.c
+++ b/android/tester-gatt.c
@@ -453,6 +453,8 @@ static struct test_case test_cases[] = {
 		CALLBACK_GATTC_DISCONNECT(GATT_STATUS_SUCCESS,
 						prop_emu_remotes_default_set,
 						CONN1_ID, CLIENT1_ID),
+		CALLBACK_STATE(CB_BT_ACL_STATE_CHANGED,
+						BT_ACL_STATE_DISCONNECTED),
 		ACTION_SUCCESS(gatt_client_do_listen_action, &client1_conn_req),
 		CALLBACK_STATUS(CB_GATTC_LISTEN, GATT_STATUS_SUCCESS),
 		ACTION_SUCCESS(emu_remote_connect_hci_action, NULL),
diff --git a/android/tester-main.c b/android/tester-main.c
index 5f41ff1..369a943 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -841,6 +841,19 @@ static void ssp_request_cb(bt_bdaddr_t *remote_bd_addr,
 	schedule_callback_call(step);
 }
 
+static void acl_state_changed_cb(bt_status_t status,
+					bt_bdaddr_t *remote_bd_addr,
+					bt_acl_state_t state) {
+	struct step *step = g_new0(struct step, 1);
+
+	step->callback = CB_BT_ACL_STATE_CHANGED;
+
+	step->callback_result.status = status;
+	step->callback_result.state = state;
+
+	schedule_callback_call(step);
+}
+
 static bt_callbacks_t bt_callbacks = {
 	.size = sizeof(bt_callbacks),
 	.adapter_state_changed_cb = adapter_state_changed_cb,
@@ -851,7 +864,7 @@ static bt_callbacks_t bt_callbacks = {
 	.pin_request_cb = pin_request_cb,
 	.ssp_request_cb = ssp_request_cb,
 	.bond_state_changed_cb = bond_state_changed_cb,
-	.acl_state_changed_cb = NULL,
+	.acl_state_changed_cb = acl_state_changed_cb,
 	.thread_evt_cb = NULL,
 	.dut_mode_recv_cb = NULL,
 	.le_test_mode_cb = NULL
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux