[PATCH 2/2] android/tester: Add function to set default ssp handler

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

 



In most test cases pairing can be performed but is not part of test
case, and shouldn't have impact on test case result. This helper set
defult handler, which will always accept SSP requests.
---
 android/tester-a2dp.c |  3 +++
 android/tester-main.c | 21 +++++++++++++++++++++
 android/tester-main.h |  1 +
 android/tester-pan.c  |  3 +++
 4 files changed, 28 insertions(+)

diff --git a/android/tester-a2dp.c b/android/tester-a2dp.c
index 3d006bc..6d4043b 100644
--- a/android/tester-a2dp.c
+++ b/android/tester-a2dp.c
@@ -186,6 +186,7 @@ static struct test_case test_cases[] = {
 		ACTION_SUCCESS(dummy_action, NULL),
 	),
 	TEST_CASE_BREDRLE("A2DP Connect - Success",
+		ACTION_SUCCESS(set_default_ssp_request_handler, NULL),
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -202,6 +203,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
 	),
 	TEST_CASE_BREDRLE("A2DP Disconnect - Success",
+		ACTION_SUCCESS(set_default_ssp_request_handler, NULL),
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -221,6 +223,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
 	),
 	TEST_CASE_BREDRLE("A2DP Resume - Success",
+		ACTION_SUCCESS(set_default_ssp_request_handler, NULL),
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
diff --git a/android/tester-main.c b/android/tester-main.c
index 369a943..21ad25e 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -1895,6 +1895,27 @@ void bt_remove_bond_action(void)
 	schedule_action_verification(step);
 }
 
+static void default_ssp_req_cb(bt_bdaddr_t *remote_bd_addr, bt_bdname_t *name,
+				uint32_t cod, bt_ssp_variant_t pairing_variant,
+				uint32_t pass_key)
+{
+	struct test_data *t_data = tester_get_data();
+
+	t_data->if_bluetooth->ssp_reply(remote_bd_addr, pairing_variant, true,
+								pass_key);
+}
+
+void set_default_ssp_request_handler(void)
+{
+	struct step *step = g_new0(struct step, 1);
+
+	bt_callbacks.ssp_request_cb = default_ssp_req_cb;
+
+	step->action_status = BT_STATUS_SUCCESS;
+
+	schedule_action_verification(step);
+}
+
 static void generic_test_function(const void *test_data)
 {
 	struct test_data *data = tester_get_data();
diff --git a/android/tester-main.h b/android/tester-main.h
index b76ae2e..847501c 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
@@ -443,3 +443,4 @@ void bt_pin_reply_accept_action(void);
 void bt_ssp_reply_accept_action(void);
 void bt_cancel_bond_action(void);
 void bt_remove_bond_action(void);
+void set_default_ssp_request_handler(void);
diff --git a/android/tester-pan.c b/android/tester-pan.c
index c293022..8d41d34 100644
--- a/android/tester-pan.c
+++ b/android/tester-pan.c
@@ -147,6 +147,7 @@ static struct test_case test_cases[] = {
 		ACTION_SUCCESS(dummy_action, NULL),
 	),
 	TEST_CASE_BREDRLE("PAN Connect - Success",
+		ACTION_SUCCESS(set_default_ssp_request_handler, NULL),
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -171,6 +172,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
 	),
 	TEST_CASE_BREDRLE("PAN Disconnect - Success",
+		ACTION_SUCCESS(set_default_ssp_request_handler, NULL),
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
@@ -196,6 +198,7 @@ static struct test_case test_cases[] = {
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
 	),
 	TEST_CASE_BREDRLE("PAN GetLocalRole - Success",
+		ACTION_SUCCESS(set_default_ssp_request_handler, NULL),
 		ACTION_SUCCESS(bluetooth_enable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
 		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
-- 
1.9.0

--
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