Linux bluetooth development
 help / color / mirror / Atom feed
From: Jakub Tyszkowski <jakub.tyszkowski@tieto.com>
To: linux-bluetooth@vger.kernel.org
Cc: Jakub Tyszkowski <jakub.tyszkowski@tieto.com>
Subject: [PATCH 5/9] android/tester-ng: Add start discovery success cases
Date: Thu, 17 Jul 2014 10:29:52 +0200	[thread overview]
Message-ID: <1405585796-12301-5-git-send-email-jakub.tyszkowski@tieto.com> (raw)
In-Reply-To: <1405585796-12301-1-git-send-email-jakub.tyszkowski@tieto.com>

---
 android/tester-bluetooth.c | 15 +++++++++++++++
 android/tester-main.c      | 22 +++++++++++++++++++++-
 android/tester-main.h      |  1 +
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index d65917d..ea59a57 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -329,6 +329,21 @@ static struct test_case test_cases[] = {
 						&prop_test_scan_mode_none),
 		CALLBACK_ADAPTER_PROPS(&prop_test_scan_mode_none, 1),
 	),
+	TEST_CASE("Bluetooth BR/EDR Discovery Start - Success",
+		ACTION_SUCCESS(bluetooth_enable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
+		ACTION_SUCCESS(bt_start_discovery_action, NULL),
+		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
+							BT_DISCOVERY_STARTED),
+	),
+	TEST_CASE("Bluetooth BR/EDR Discovery Start - Done",
+		ACTION_SUCCESS(bluetooth_enable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
+		ACTION_SUCCESS(bt_start_discovery_action, NULL),
+		CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
+							BT_DISCOVERY_STARTED),
+		ACTION_SUCCESS(bt_start_discovery_action, NULL),
+	),
 };
 
 struct queue *get_bluetooth_tests(void)
diff --git a/android/tester-main.c b/android/tester-main.c
index 7f52083..eb588d1 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -575,13 +575,23 @@ static void adapter_properties_cb(bt_status_t status, int num_properties,
 	schedule_callback_call(step);
 }
 
+static void discovery_state_changed_cb(bt_discovery_state_t state)
+{
+	struct step *step = g_new0(struct step, 1);
+
+	step->callback = CB_BT_DISCOVERY_STATE_CHANGED;
+	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,
 	.adapter_properties_cb = adapter_properties_cb,
 	.remote_device_properties_cb = NULL,
 	.device_found_cb = NULL,
-	.discovery_state_changed_cb = NULL,
+	.discovery_state_changed_cb = discovery_state_changed_cb,
 	.pin_request_cb = NULL,
 	.ssp_request_cb = NULL,
 	.bond_state_changed_cb = NULL,
@@ -933,6 +943,16 @@ void bt_get_property_action(void)
 	verify_step(&step, NULL);
 }
 
+void bt_start_discovery_action(void)
+{
+	struct test_data *data = tester_get_data();
+	struct step step;
+
+	step.action_result.status = data->if_bluetooth->start_discovery();
+
+	verify_step(&step, NULL);
+}
+
 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 066615a..9e40907 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
@@ -217,3 +217,4 @@ void bluetooth_enable_action(void);
 void bluetooth_disable_action(void);
 void bt_set_property_action(void);
 void bt_get_property_action(void);
+void bt_start_discovery_action(void);
-- 
1.9.1


  parent reply	other threads:[~2014-07-17  8:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-17  8:29 [PATCH 1/9] android/tester-ng: Use action and callback defining macros Jakub Tyszkowski
2014-07-17  8:29 ` [PATCH 2/9] android/tester-ng: Add test declaration helper macro Jakub Tyszkowski
2014-07-17  8:29 ` [PATCH 3/9] android/tester-ng: Use array of statics instead of case pointers Jakub Tyszkowski
2014-07-17  8:29 ` [PATCH 4/9] android/tester-ng: Use test case independent naming for props Jakub Tyszkowski
2014-07-17  8:29 ` Jakub Tyszkowski [this message]
2014-07-17  8:29 ` [PATCH 6/9] android/tester-ng: Add cancel discovery cases Jakub Tyszkowski
2014-07-17  8:29 ` [PATCH 7/9] emulator: Extend le advertising function with discoverable flag Jakub Tyszkowski
2014-07-18  8:05   ` Szymon Janc
2014-07-18  8:18     ` Johan Hedberg
2014-07-17  8:29 ` [PATCH 8/9] android/tester-ng: Add remote device found case Jakub Tyszkowski
2014-07-17  8:29 ` [PATCH 9/9] android/tester: Remove old test cases Jakub Tyszkowski
2014-07-18  7:54 ` [PATCH 1/9] android/tester-ng: Use action and callback defining macros Szymon Janc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405585796-12301-5-git-send-email-jakub.tyszkowski@tieto.com \
    --to=jakub.tyszkowski@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox