linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH_v2 0/8] Add PAN test cases
@ 2014-08-05 11:19 Ravi kumar Veeramally
  2014-08-05 11:19 ` [PATCH_v2 1/8] android/tester: Add PAN init test case Ravi kumar Veeramally
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Ravi kumar Veeramally @ 2014-08-05 11:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Ravi kumar Veeramally

v2: Fixed comments.

Ravi kumar Veeramally (8):
  android/tester: Add PAN init test case
  android/tester: Add PAN Connect test case
  android/tester: Add PAN Disconnect test case
  android/tester: Add PAN Get Local Role test case
  android/pan: Notify control state callback on HAL .enable call
  android/tester: Add PAN Enable NAP test case
  android/tester: Add PAN Enable PANU test case
  android/tester: Add PAN Enable None test case

 android/Makefile.am   |   1 +
 android/pan.c         |  21 +++--
 android/tester-main.c | 109 +++++++++++++++++++++
 android/tester-main.h |  29 ++++++
 android/tester-pan.c  | 256 ++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 409 insertions(+), 7 deletions(-)
 create mode 100644 android/tester-pan.c

-- 
1.9.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH_v2 1/8] android/tester: Add PAN init test case
  2014-08-05 11:19 [PATCH_v2 0/8] Add PAN test cases Ravi kumar Veeramally
@ 2014-08-05 11:19 ` Ravi kumar Veeramally
  2014-08-05 11:19 ` [PATCH_v2 2/8] android/tester: Add PAN Connect " Ravi kumar Veeramally
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Ravi kumar Veeramally @ 2014-08-05 11:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Ravi kumar Veeramally

---
 android/Makefile.am   |   1 +
 android/tester-main.c | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++
 android/tester-main.h |  29 ++++++++++++++
 android/tester-pan.c  |  48 ++++++++++++++++++++++
 4 files changed, 187 insertions(+)
 create mode 100644 android/tester-pan.c

diff --git a/android/Makefile.am b/android/Makefile.am
index a3067bb..79f6a0d 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -157,6 +157,7 @@ android_android_tester_SOURCES = emulator/btdev.h emulator/btdev.c \
 				android/tester-bluetooth.c \
 				android/tester-socket.c \
 				android/tester-hidhost.c \
+				android/tester-pan.c \
 				android/tester-gatt.c \
 				android/tester-main.h android/tester-main.c
 
diff --git a/android/tester-main.c b/android/tester-main.c
index ba1ae9f..203a1b6 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -443,6 +443,30 @@ static bool match_data(struct step *step)
 			return false;
 		}
 
+		if (exp->callback_result.ctrl_state !=
+					step->callback_result.ctrl_state) {
+			tester_debug("Callback ctrl state don't match");
+			return false;
+		}
+
+		if (exp->callback_result.conn_state !=
+					step->callback_result.conn_state) {
+			tester_debug("Callback connection state don't match");
+			return false;
+		}
+
+		if (exp->callback_result.local_role !=
+					step->callback_result.local_role) {
+			tester_debug("Callback local_role don't match");
+			return false;
+		}
+
+		if (exp->callback_result.remote_role !=
+					step->callback_result.remote_role) {
+			tester_debug("Callback remote_role don't match");
+			return false;
+		}
+
 		if (exp->callback_result.pairing_variant !=
 					step->callback_result.pairing_variant) {
 			tester_debug("Callback pairing result don't match");
@@ -963,6 +987,42 @@ static void gattc_listen_cb(int status, int server_if)
 	schedule_callback_call(step);
 }
 
+static void pan_control_state_cb(btpan_control_state_t state,
+					bt_status_t error, int local_role,
+							const char *ifname)
+{
+	struct step *step = g_new0(struct step, 1);
+
+	step->callback = CB_PAN_CONTROL_STATE;
+	step->callback_result.state = local_role;
+	step->callback_result.ctrl_state = error;
+	step->callback_result.local_role = state;
+
+	schedule_callback_call(step);
+}
+
+static void pan_connection_state_cb(btpan_connection_state_t state,
+					bt_status_t error,
+					const bt_bdaddr_t *bd_addr,
+					int local_role, int remote_role)
+{
+	struct step *step = g_new0(struct step, 1);
+
+	step->callback = CB_PAN_CONNECTION_STATE;
+	step->callback_result.state = error;
+	step->callback_result.conn_state = state;
+	step->callback_result.local_role = local_role;
+	step->callback_result.remote_role = remote_role;
+
+	schedule_callback_call(step);
+}
+
+static btpan_callbacks_t btpan_callbacks = {
+	.size = sizeof(btpan_callbacks),
+	.control_state_cb = pan_control_state_cb,
+	.connection_state_cb = pan_connection_state_cb,
+};
+
 static const btgatt_client_callbacks_t btgatt_client_callbacks = {
 	.register_client_cb = gattc_register_client_cb,
 	.scan_result_cb = gattc_scan_result_cb,
@@ -1154,6 +1214,42 @@ static void setup_hidhost(const void *test_data)
 	tester_setup_complete();
 }
 
+static void setup_pan(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+	bt_status_t status;
+	const void *pan;
+
+	if (!setup_base(data)) {
+		tester_setup_failed();
+		return;
+	}
+
+	status = data->if_bluetooth->init(&bt_callbacks);
+	if (status != BT_STATUS_SUCCESS) {
+		data->if_bluetooth = NULL;
+		tester_setup_failed();
+		return;
+	}
+
+	pan = data->if_bluetooth->get_profile_interface(BT_PROFILE_PAN_ID);
+	if (!pan) {
+		tester_setup_failed();
+		return;
+	}
+
+	data->if_pan = pan;
+
+	status = data->if_pan->init(&btpan_callbacks);
+	if (status != BT_STATUS_SUCCESS) {
+		data->if_pan = NULL;
+		tester_setup_failed();
+		return;
+	}
+
+	tester_setup_complete();
+}
+
 static void setup_gatt(const void *test_data)
 {
 	struct test_data *data = tester_get_data();
@@ -1208,6 +1304,11 @@ static void teardown(const void *test_data)
 		data->if_hid = NULL;
 	}
 
+	if (data->if_pan) {
+		data->if_pan->cleanup();
+		data->if_pan = NULL;
+	}
+
 	if (data->if_bluetooth) {
 		data->if_bluetooth->cleanup();
 		data->if_bluetooth = NULL;
@@ -1650,6 +1751,13 @@ static void add_hidhost_tests(void *data, void *user_data)
 	test(tc, setup_hidhost, generic_test_function, teardown);
 }
 
+static void add_pan_tests(void *data, void *user_data)
+{
+	struct test_case *tc = data;
+
+	test(tc, setup_pan, generic_test_function, teardown);
+}
+
 static void add_gatt_tests(void *data, void *user_data)
 {
 	struct test_case *tc = data;
@@ -1666,6 +1774,7 @@ int main(int argc, char *argv[])
 	queue_foreach(get_bluetooth_tests(), add_bluetooth_tests, NULL);
 	queue_foreach(get_socket_tests(), add_socket_tests, NULL);
 	queue_foreach(get_hidhost_tests(), add_hidhost_tests, NULL);
+	queue_foreach(get_pan_tests(), add_pan_tests, NULL);
 	queue_foreach(get_gatt_tests(), add_gatt_tests, NULL);
 
 	if (tester_run())
diff --git a/android/tester-main.h b/android/tester-main.h
index 778bdc4..5a5cba4 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
@@ -46,6 +46,7 @@
 #include <hardware/bluetooth.h>
 #include <hardware/bt_sock.h>
 #include <hardware/bt_hh.h>
+#include <hardware/bt_pan.h>
 #include <hardware/bt_gatt.h>
 #include <hardware/bt_gatt_client.h>
 #include <hardware/bt_gatt_server.h>
@@ -145,6 +146,22 @@
 		.callback_result.client_id = cb_client_id, \
 	}
 
+#define CALLBACK_PAN_CTRL_STATE(cb, cb_res, cb_state, cb_local_role) { \
+		.callback = cb, \
+		.callback_result.status = cb_res, \
+		.callback_result.ctrl_state = cb_state, \
+		.callback_result.local_role = cb_local_role, \
+	}
+
+#define CALLBACK_PAN_CONN_STATE(cb, cb_res, cb_state, cb_local_role, \
+							cb_remote_role) { \
+		.callback = cb, \
+		.callback_result.status = cb_res, \
+		.callback_result.conn_state = cb_state, \
+		.callback_result.local_role = cb_local_role, \
+		.callback_result.remote_role = cb_remote_role, \
+	}
+
 #define CALLBACK_DEVICE_PROPS(props, prop_cnt) \
 	CALLBACK_PROPS(CB_BT_REMOTE_DEVICE_PROPERTIES, props, prop_cnt)
 
@@ -200,6 +217,10 @@ typedef enum {
 	CB_HH_GET_REPORT,
 	CB_HH_VIRTUAL_UNPLUG,
 
+	/* PAN cb */
+	CB_PAN_CONTROL_STATE,
+	CB_PAN_CONNECTION_STATE,
+
 	/* Gatt client */
 	CB_GATTC_REGISTER_CLIENT,
 	CB_GATTC_SCAN_RESULT,
@@ -245,6 +266,7 @@ struct test_data {
 	const bt_interface_t *if_bluetooth;
 	const btsock_interface_t *if_sock;
 	const bthh_interface_t *if_hid;
+	const btpan_interface_t *if_pan;
 	const btgatt_interface_t *if_gatt;
 
 	const void *test_data;
@@ -310,6 +332,11 @@ struct bt_callback_data {
 
 	int client_id;
 	int conn_id;
+
+	btpan_control_state_t ctrl_state;
+	btpan_connection_state_t conn_state;
+	int local_role;
+	int remote_role;
 };
 
 /*
@@ -341,6 +368,8 @@ struct queue *get_socket_tests(void);
 void remove_socket_tests(void);
 struct queue *get_hidhost_tests(void);
 void remove_hidhost_tests(void);
+struct queue *get_pan_tests(void);
+void remove_pan_tests(void);
 struct queue *get_gatt_tests(void);
 void remove_gatt_tests(void);
 
diff --git a/android/tester-pan.c b/android/tester-pan.c
new file mode 100644
index 0000000..caead9c
--- /dev/null
+++ b/android/tester-pan.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2014 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdbool.h>
+
+#include "emulator/bthost.h"
+#include "tester-main.h"
+#include "android/utils.h"
+
+static struct queue *list; /* List of pan test cases */
+
+static struct test_case test_cases[] = {
+	TEST_CASE_BREDRLE("PAN Init",
+		ACTION_SUCCESS(dummy_action, NULL),
+	),
+};
+
+struct queue *get_pan_tests(void)
+{
+	uint16_t i = 0;
+
+	list = queue_new();
+
+	for (; i < sizeof(test_cases) / sizeof(test_cases[0]); ++i)
+		if (!queue_push_tail(list, &test_cases[i]))
+			return NULL;
+
+	return list;
+}
+
+void remove_pan_tests(void)
+{
+	queue_destroy(list, NULL);
+}
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH_v2 2/8] android/tester: Add PAN Connect test case
  2014-08-05 11:19 [PATCH_v2 0/8] Add PAN test cases Ravi kumar Veeramally
  2014-08-05 11:19 ` [PATCH_v2 1/8] android/tester: Add PAN init test case Ravi kumar Veeramally
@ 2014-08-05 11:19 ` Ravi kumar Veeramally
  2014-08-05 11:19 ` [PATCH_v2 3/8] android/tester: Add PAN Disconnect " Ravi kumar Veeramally
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Ravi kumar Veeramally @ 2014-08-05 11:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Ravi kumar Veeramally

---
 android/tester-pan.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)

diff --git a/android/tester-pan.c b/android/tester-pan.c
index caead9c..df0e4ec 100644
--- a/android/tester-pan.c
+++ b/android/tester-pan.c
@@ -23,10 +23,89 @@
 
 static struct queue *list; /* List of pan test cases */
 
+struct emu_cid_data {
+	uint16_t nap_handle;
+	uint16_t nap_cid;
+};
+
+struct emu_cid_data cid_data;
+static uint8_t pan_conn_req_pdu[] = {0x01, 0x01, 0x02, 0x11, 0x16, 0x11, 0x15};
+static uint8_t pan_conn_rsp_pdu[] = {0x01, 0x02, 0x00, 0x00};
+
+static void pan_nap_cid_hook_cb(const void *data, uint16_t len, void *user_data)
+{
+	struct test_data *t_data = tester_get_data();
+	struct emu_cid_data *cid_data = user_data;
+	struct bthost *bthost = hciemu_client_get_host(t_data->hciemu);
+
+	if (!memcmp((uint8_t *) data, pan_conn_req_pdu,
+						sizeof(pan_conn_req_pdu)))
+		bthost_send_cid(bthost, cid_data->nap_handle, cid_data->nap_cid,
+				pan_conn_rsp_pdu, sizeof(pan_conn_rsp_pdu));
+}
+
+static void pan_connect_request_cb(uint16_t handle, uint16_t cid,
+							void *user_data)
+{
+	struct test_data *data = tester_get_data();
+	struct bthost *bthost = hciemu_client_get_host(data->hciemu);
+
+	cid_data.nap_handle = handle;
+	cid_data.nap_cid = cid;
+
+	bthost_add_cid_hook(bthost, handle, cid, pan_nap_cid_hook_cb,
+								&cid_data);
+}
+
+static struct emu_set_l2cap_data l2cap_setup_data = {
+	.psm = 15,
+	.func = pan_connect_request_cb,
+	.user_data = NULL,
+};
+
+static void pan_connect_action(void)
+{
+	struct test_data *data = tester_get_data();
+	const uint8_t *pan_addr = hciemu_get_client_bdaddr(data->hciemu);
+	struct step *step = g_new0(struct step, 1);
+	bt_bdaddr_t bdaddr;
+
+	bdaddr2android((const bdaddr_t *) pan_addr, &bdaddr);
+
+	step->action_status = data->if_pan->connect(&bdaddr,
+					BTPAN_ROLE_PANU, BTPAN_ROLE_PANNAP);
+
+	schedule_action_verification(step);
+}
+
 static struct test_case test_cases[] = {
 	TEST_CASE_BREDRLE("PAN Init",
 		ACTION_SUCCESS(dummy_action, NULL),
 	),
+	TEST_CASE_BREDRLE("PAN Connect - Success",
+		ACTION_SUCCESS(bluetooth_enable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
+		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
+		ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
+		ACTION_SUCCESS(emu_add_l2cap_server_action, &l2cap_setup_data),
+		ACTION_SUCCESS(pan_connect_action, NULL),
+		CALLBACK_PAN_CONN_STATE(CB_PAN_CONNECTION_STATE,
+					BT_STATUS_SUCCESS,
+					BTPAN_STATE_CONNECTING,
+					BTPAN_ROLE_PANU, BTPAN_ROLE_PANNAP),
+		CALLBACK_PAN_CTRL_STATE(CB_PAN_CONTROL_STATE, BT_STATUS_SUCCESS,
+					BTPAN_STATE_ENABLED, BTPAN_ROLE_PANU),
+		CALLBACK_PAN_CONN_STATE(CB_PAN_CONNECTION_STATE,
+					BT_STATUS_SUCCESS,
+					BTPAN_STATE_CONNECTED,
+					BTPAN_ROLE_PANU, BTPAN_ROLE_PANNAP),
+		ACTION_SUCCESS(bluetooth_disable_action, NULL),
+		CALLBACK_PAN_CONN_STATE(CB_PAN_CONNECTION_STATE,
+					BT_STATUS_SUCCESS,
+					BTPAN_STATE_DISCONNECTED,
+					BTPAN_ROLE_PANU, BTPAN_ROLE_PANNAP),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
+	),
 };
 
 struct queue *get_pan_tests(void)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH_v2 3/8] android/tester: Add PAN Disconnect test case
  2014-08-05 11:19 [PATCH_v2 0/8] Add PAN test cases Ravi kumar Veeramally
  2014-08-05 11:19 ` [PATCH_v2 1/8] android/tester: Add PAN init test case Ravi kumar Veeramally
  2014-08-05 11:19 ` [PATCH_v2 2/8] android/tester: Add PAN Connect " Ravi kumar Veeramally
@ 2014-08-05 11:19 ` Ravi kumar Veeramally
  2014-08-05 11:19 ` [PATCH_v2 4/8] android/tester: Add PAN Get Local Role " Ravi kumar Veeramally
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Ravi kumar Veeramally @ 2014-08-05 11:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Ravi kumar Veeramally

---
 android/tester-pan.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/android/tester-pan.c b/android/tester-pan.c
index df0e4ec..848cc83 100644
--- a/android/tester-pan.c
+++ b/android/tester-pan.c
@@ -78,6 +78,20 @@ static void pan_connect_action(void)
 	schedule_action_verification(step);
 }
 
+static void pan_disconnect_action(void)
+{
+	struct test_data *data = tester_get_data();
+	const uint8_t *pan_addr = hciemu_get_client_bdaddr(data->hciemu);
+	struct step *step = g_new0(struct step, 1);
+	bt_bdaddr_t bdaddr;
+
+	bdaddr2android((const bdaddr_t *) pan_addr, &bdaddr);
+
+	step->action_status = data->if_pan->disconnect(&bdaddr);
+
+	schedule_action_verification(step);
+}
+
 static struct test_case test_cases[] = {
 	TEST_CASE_BREDRLE("PAN Init",
 		ACTION_SUCCESS(dummy_action, NULL),
@@ -106,6 +120,32 @@ static struct test_case test_cases[] = {
 					BTPAN_ROLE_PANU, BTPAN_ROLE_PANNAP),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
 	),
+	TEST_CASE_BREDRLE("PAN Disconnect - Success",
+		ACTION_SUCCESS(bluetooth_enable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
+		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
+		ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
+		ACTION_SUCCESS(emu_add_l2cap_server_action, &l2cap_setup_data),
+		ACTION_SUCCESS(pan_connect_action, NULL),
+		CALLBACK_PAN_CONN_STATE(CB_PAN_CONNECTION_STATE,
+					BT_STATUS_SUCCESS,
+					BTPAN_STATE_CONNECTING,
+					BTPAN_ROLE_PANU, BTPAN_ROLE_PANNAP),
+		CALLBACK_PAN_CTRL_STATE(CB_PAN_CONTROL_STATE, BT_STATUS_SUCCESS,
+					BTPAN_STATE_ENABLED, BTPAN_ROLE_PANU),
+		CALLBACK_PAN_CONN_STATE(CB_PAN_CONNECTION_STATE,
+					BT_STATUS_SUCCESS,
+					BTPAN_STATE_CONNECTED,
+					BTPAN_ROLE_PANU, BTPAN_ROLE_PANNAP),
+		ACTION_SUCCESS(pan_disconnect_action, NULL),
+		CALLBACK_PAN_CONN_STATE(CB_PAN_CONNECTION_STATE,
+					BT_STATUS_SUCCESS,
+					BTPAN_STATE_DISCONNECTED,
+					BTPAN_ROLE_PANU, BTPAN_ROLE_PANNAP),
+		ACTION_SUCCESS(bluetooth_disable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
+	),
+
 };
 
 struct queue *get_pan_tests(void)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH_v2 4/8] android/tester: Add PAN Get Local Role test case
  2014-08-05 11:19 [PATCH_v2 0/8] Add PAN test cases Ravi kumar Veeramally
                   ` (2 preceding siblings ...)
  2014-08-05 11:19 ` [PATCH_v2 3/8] android/tester: Add PAN Disconnect " Ravi kumar Veeramally
@ 2014-08-05 11:19 ` Ravi kumar Veeramally
  2014-08-05 11:19 ` [PATCH_v2 5/8] android/pan: Notify control state callback on HAL .enable call Ravi kumar Veeramally
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Ravi kumar Veeramally @ 2014-08-05 11:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Ravi kumar Veeramally

---
 android/tester-pan.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/android/tester-pan.c b/android/tester-pan.c
index 848cc83..abf4b34 100644
--- a/android/tester-pan.c
+++ b/android/tester-pan.c
@@ -92,6 +92,25 @@ static void pan_disconnect_action(void)
 	schedule_action_verification(step);
 }
 
+static void pan_get_local_role_action(void)
+{
+	struct test_data *data = tester_get_data();
+	const uint8_t *pan_addr = hciemu_get_client_bdaddr(data->hciemu);
+	struct step *step = g_new0(struct step, 1);
+	bt_bdaddr_t bdaddr;
+	int role;
+
+	bdaddr2android((const bdaddr_t *) pan_addr, &bdaddr);
+
+	role = data->if_pan->get_local_role();
+	if (role == BTPAN_ROLE_PANU)
+		step->action_status = BT_STATUS_SUCCESS;
+	else
+		step->action_status = BT_STATUS_FAIL;
+
+	schedule_action_verification(step);
+}
+
 static struct test_case test_cases[] = {
 	TEST_CASE_BREDRLE("PAN Init",
 		ACTION_SUCCESS(dummy_action, NULL),
@@ -145,7 +164,31 @@ static struct test_case test_cases[] = {
 		ACTION_SUCCESS(bluetooth_disable_action, NULL),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
 	),
-
+	TEST_CASE_BREDRLE("PAN GetLocalRole - Success",
+		ACTION_SUCCESS(bluetooth_enable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON),
+		ACTION_SUCCESS(emu_setup_powered_remote_action, NULL),
+		ACTION_SUCCESS(emu_set_ssp_mode_action, NULL),
+		ACTION_SUCCESS(emu_add_l2cap_server_action, &l2cap_setup_data),
+		ACTION_SUCCESS(pan_connect_action, NULL),
+		CALLBACK_PAN_CONN_STATE(CB_PAN_CONNECTION_STATE,
+					BT_STATUS_SUCCESS,
+					BTPAN_STATE_CONNECTING,
+					BTPAN_ROLE_PANU, BTPAN_ROLE_PANNAP),
+		CALLBACK_PAN_CTRL_STATE(CB_PAN_CONTROL_STATE, BT_STATUS_SUCCESS,
+					BTPAN_STATE_ENABLED, BTPAN_ROLE_PANU),
+		CALLBACK_PAN_CONN_STATE(CB_PAN_CONNECTION_STATE,
+					BT_STATUS_SUCCESS,
+					BTPAN_STATE_CONNECTED,
+					BTPAN_ROLE_PANU, BTPAN_ROLE_PANNAP),
+		ACTION_SUCCESS(pan_get_local_role_action, NULL),
+		ACTION_SUCCESS(bluetooth_disable_action, NULL),
+		CALLBACK_PAN_CONN_STATE(CB_PAN_CONNECTION_STATE,
+					BT_STATUS_SUCCESS,
+					BTPAN_STATE_DISCONNECTED,
+					BTPAN_ROLE_PANU, BTPAN_ROLE_PANNAP),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
+	),
 };
 
 struct queue *get_pan_tests(void)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH_v2 5/8] android/pan: Notify control state callback on HAL .enable call
  2014-08-05 11:19 [PATCH_v2 0/8] Add PAN test cases Ravi kumar Veeramally
                   ` (3 preceding siblings ...)
  2014-08-05 11:19 ` [PATCH_v2 4/8] android/tester: Add PAN Get Local Role " Ravi kumar Veeramally
@ 2014-08-05 11:19 ` Ravi kumar Veeramally
  2014-08-05 11:19 ` [PATCH_v2 6/8] android/tester: Add PAN Enable NAP test case Ravi kumar Veeramally
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Ravi kumar Veeramally @ 2014-08-05 11:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Ravi kumar Veeramally

---
 android/pan.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/android/pan.c b/android/pan.c
index c11ee29..d8572cc 100644
--- a/android/pan.c
+++ b/android/pan.c
@@ -255,7 +255,8 @@ static void bt_pan_notify_conn_state(struct pan_device *dev, uint8_t state)
 		pan_device_remove(dev);
 }
 
-static void bt_pan_notify_ctrl_state(struct pan_device *dev, uint8_t state)
+static void bt_pan_notify_ctrl_state(struct pan_device *dev, uint8_t state,
+								uint8_t status)
 {
 	struct hal_ev_pan_ctrl_state ev;
 
@@ -263,13 +264,13 @@ static void bt_pan_notify_ctrl_state(struct pan_device *dev, uint8_t state)
 
 	ev.state = state;
 	ev.local_role = local_role;
-	ev.status = HAL_STATUS_SUCCESS;
+	ev.status = status;
 
 	memset(ev.name, 0, sizeof(ev.name));
 
 	if (local_role == HAL_PAN_ROLE_NAP)
 		memcpy(ev.name, BNEP_BRIDGE, sizeof(BNEP_BRIDGE));
-	else
+	else if (local_role == HAL_PAN_ROLE_PANU)
 		memcpy(ev.name, dev->iface, sizeof(dev->iface));
 
 	ipc_send_notif(hal_ipc, HAL_SERVICE_ID_PAN, HAL_EV_PAN_CTRL_STATE,
@@ -301,7 +302,7 @@ static void bnep_conn_cb(char *iface, int err, void *data)
 
 	DBG("%s connected", dev->iface);
 
-	bt_pan_notify_ctrl_state(dev, HAL_PAN_CTRL_ENABLED);
+	bt_pan_notify_ctrl_state(dev, HAL_PAN_CTRL_ENABLED, HAL_STATUS_SUCCESS);
 	bt_pan_notify_conn_state(dev, HAL_PAN_STATE_CONNECTED);
 }
 
@@ -534,7 +535,7 @@ static gboolean nap_setup_cb(GIOChannel *chan, GIOCondition cond,
 	g_io_channel_unref(dev->io);
 	dev->io = NULL;
 
-	bt_pan_notify_ctrl_state(dev, HAL_PAN_CTRL_ENABLED);
+	bt_pan_notify_ctrl_state(dev, HAL_PAN_CTRL_ENABLED, HAL_STATUS_SUCCESS);
 	bt_pan_notify_conn_state(dev, HAL_PAN_STATE_CONNECTED);
 
 	return FALSE;
@@ -648,7 +649,7 @@ static int register_nap_server(void)
 static void bt_pan_enable(const void *buf, uint16_t len)
 {
 	const struct hal_cmd_pan_enable *cmd = buf;
-	uint8_t status;
+	uint8_t status, state;
 	int err;
 
 	DBG("");
@@ -665,8 +666,10 @@ static void bt_pan_enable(const void *buf, uint16_t len)
 	case HAL_PAN_ROLE_NAP:
 		break;
 	case HAL_PAN_ROLE_NONE:
+		local_role = HAL_PAN_ROLE_NONE;
 		status = HAL_STATUS_SUCCESS;
-		goto reply;
+		state = HAL_PAN_CTRL_DISABLED;
+		goto notify;
 	default:
 		status = HAL_STATUS_UNSUPPORTED;
 		goto reply;
@@ -681,6 +684,10 @@ static void bt_pan_enable(const void *buf, uint16_t len)
 	}
 
 	status = HAL_STATUS_SUCCESS;
+	state = HAL_PAN_CTRL_ENABLED;
+
+notify:
+	bt_pan_notify_ctrl_state(NULL, state, status);
 
 reply:
 	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_PAN, HAL_OP_PAN_ENABLE, status);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH_v2 6/8] android/tester: Add PAN Enable NAP test case
  2014-08-05 11:19 [PATCH_v2 0/8] Add PAN test cases Ravi kumar Veeramally
                   ` (4 preceding siblings ...)
  2014-08-05 11:19 ` [PATCH_v2 5/8] android/pan: Notify control state callback on HAL .enable call Ravi kumar Veeramally
@ 2014-08-05 11:19 ` Ravi kumar Veeramally
  2014-08-05 11:19 ` [PATCH_v2 7/8] android/tester: Add PAN Enable PANU " Ravi kumar Veeramally
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Ravi kumar Veeramally @ 2014-08-05 11:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Ravi kumar Veeramally

---
 android/tester-pan.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/android/tester-pan.c b/android/tester-pan.c
index abf4b34..74ced79 100644
--- a/android/tester-pan.c
+++ b/android/tester-pan.c
@@ -111,6 +111,16 @@ static void pan_get_local_role_action(void)
 	schedule_action_verification(step);
 }
 
+static void pan_enable_nap_action(void)
+{
+	struct test_data *data = tester_get_data();
+	struct step *step = g_new0(struct step, 1);
+
+	step->action_status = data->if_pan->enable(BTPAN_ROLE_PANNAP);
+
+	schedule_action_verification(step);
+}
+
 static struct test_case test_cases[] = {
 	TEST_CASE_BREDRLE("PAN Init",
 		ACTION_SUCCESS(dummy_action, NULL),
@@ -189,6 +199,11 @@ static struct test_case test_cases[] = {
 					BTPAN_ROLE_PANU, BTPAN_ROLE_PANNAP),
 		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
 	),
+	TEST_CASE_BREDRLE("PAN Enable NAP - Success",
+		ACTION_SUCCESS(pan_enable_nap_action, NULL),
+		CALLBACK_PAN_CTRL_STATE(CB_PAN_CONTROL_STATE, BT_STATUS_SUCCESS,
+					BTPAN_STATE_ENABLED, BTPAN_ROLE_PANNAP),
+	),
 };
 
 struct queue *get_pan_tests(void)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH_v2 7/8] android/tester: Add PAN Enable PANU test case
  2014-08-05 11:19 [PATCH_v2 0/8] Add PAN test cases Ravi kumar Veeramally
                   ` (5 preceding siblings ...)
  2014-08-05 11:19 ` [PATCH_v2 6/8] android/tester: Add PAN Enable NAP test case Ravi kumar Veeramally
@ 2014-08-05 11:19 ` Ravi kumar Veeramally
  2014-08-05 11:19 ` [PATCH_v2 8/8] android/tester: Add PAN Enable None " Ravi kumar Veeramally
  2014-08-06  7:40 ` [PATCH_v2 0/8] Add PAN test cases Johan Hedberg
  8 siblings, 0 replies; 10+ messages in thread
From: Ravi kumar Veeramally @ 2014-08-05 11:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Ravi kumar Veeramally

---
 android/tester-pan.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/android/tester-pan.c b/android/tester-pan.c
index 74ced79..96d1ba9 100644
--- a/android/tester-pan.c
+++ b/android/tester-pan.c
@@ -121,6 +121,16 @@ static void pan_enable_nap_action(void)
 	schedule_action_verification(step);
 }
 
+static void pan_enable_panu_action(void)
+{
+	struct test_data *data = tester_get_data();
+	struct step *step = g_new0(struct step, 1);
+
+	step->action_status = data->if_pan->enable(BTPAN_ROLE_PANU);
+
+	schedule_action_verification(step);
+}
+
 static struct test_case test_cases[] = {
 	TEST_CASE_BREDRLE("PAN Init",
 		ACTION_SUCCESS(dummy_action, NULL),
@@ -204,6 +214,9 @@ static struct test_case test_cases[] = {
 		CALLBACK_PAN_CTRL_STATE(CB_PAN_CONTROL_STATE, BT_STATUS_SUCCESS,
 					BTPAN_STATE_ENABLED, BTPAN_ROLE_PANNAP),
 	),
+	TEST_CASE_BREDRLE("PAN Enable PANU - Success",
+		ACTION(BT_STATUS_UNSUPPORTED, pan_enable_panu_action, NULL),
+	),
 };
 
 struct queue *get_pan_tests(void)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH_v2 8/8] android/tester: Add PAN Enable None test case
  2014-08-05 11:19 [PATCH_v2 0/8] Add PAN test cases Ravi kumar Veeramally
                   ` (6 preceding siblings ...)
  2014-08-05 11:19 ` [PATCH_v2 7/8] android/tester: Add PAN Enable PANU " Ravi kumar Veeramally
@ 2014-08-05 11:19 ` Ravi kumar Veeramally
  2014-08-06  7:40 ` [PATCH_v2 0/8] Add PAN test cases Johan Hedberg
  8 siblings, 0 replies; 10+ messages in thread
From: Ravi kumar Veeramally @ 2014-08-05 11:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Ravi kumar Veeramally

---
 android/tester-pan.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/android/tester-pan.c b/android/tester-pan.c
index 96d1ba9..b679a12 100644
--- a/android/tester-pan.c
+++ b/android/tester-pan.c
@@ -131,6 +131,16 @@ static void pan_enable_panu_action(void)
 	schedule_action_verification(step);
 }
 
+static void pan_enable_none_action(void)
+{
+	struct test_data *data = tester_get_data();
+	struct step *step = g_new0(struct step, 1);
+
+	step->action_status = data->if_pan->enable(BTPAN_ROLE_NONE);
+
+	schedule_action_verification(step);
+}
+
 static struct test_case test_cases[] = {
 	TEST_CASE_BREDRLE("PAN Init",
 		ACTION_SUCCESS(dummy_action, NULL),
@@ -217,6 +227,14 @@ static struct test_case test_cases[] = {
 	TEST_CASE_BREDRLE("PAN Enable PANU - Success",
 		ACTION(BT_STATUS_UNSUPPORTED, pan_enable_panu_action, NULL),
 	),
+	TEST_CASE_BREDRLE("PAN Enable NONE - Success",
+		ACTION_SUCCESS(pan_enable_nap_action, NULL),
+		CALLBACK_PAN_CTRL_STATE(CB_PAN_CONTROL_STATE, BT_STATUS_SUCCESS,
+					BTPAN_STATE_ENABLED, BTPAN_ROLE_PANNAP),
+		ACTION_SUCCESS(pan_enable_none_action, NULL),
+		CALLBACK_PAN_CTRL_STATE(CB_PAN_CONTROL_STATE, BT_STATUS_SUCCESS,
+					BTPAN_STATE_DISABLED, BTPAN_ROLE_NONE),
+	),
 };
 
 struct queue *get_pan_tests(void)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH_v2 0/8] Add PAN test cases
  2014-08-05 11:19 [PATCH_v2 0/8] Add PAN test cases Ravi kumar Veeramally
                   ` (7 preceding siblings ...)
  2014-08-05 11:19 ` [PATCH_v2 8/8] android/tester: Add PAN Enable None " Ravi kumar Veeramally
@ 2014-08-06  7:40 ` Johan Hedberg
  8 siblings, 0 replies; 10+ messages in thread
From: Johan Hedberg @ 2014-08-06  7:40 UTC (permalink / raw)
  To: Ravi kumar Veeramally; +Cc: linux-bluetooth

Hi Ravi,

On Tue, Aug 05, 2014, Ravi kumar Veeramally wrote:
> v2: Fixed comments.
> 
> Ravi kumar Veeramally (8):
>   android/tester: Add PAN init test case
>   android/tester: Add PAN Connect test case
>   android/tester: Add PAN Disconnect test case
>   android/tester: Add PAN Get Local Role test case
>   android/pan: Notify control state callback on HAL .enable call
>   android/tester: Add PAN Enable NAP test case
>   android/tester: Add PAN Enable PANU test case
>   android/tester: Add PAN Enable None test case
> 
>  android/Makefile.am   |   1 +
>  android/pan.c         |  21 +++--
>  android/tester-main.c | 109 +++++++++++++++++++++
>  android/tester-main.h |  29 ++++++
>  android/tester-pan.c  | 256 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  5 files changed, 409 insertions(+), 7 deletions(-)
>  create mode 100644 android/tester-pan.c

All patches in this set have been applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-08-06  7:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-05 11:19 [PATCH_v2 0/8] Add PAN test cases Ravi kumar Veeramally
2014-08-05 11:19 ` [PATCH_v2 1/8] android/tester: Add PAN init test case Ravi kumar Veeramally
2014-08-05 11:19 ` [PATCH_v2 2/8] android/tester: Add PAN Connect " Ravi kumar Veeramally
2014-08-05 11:19 ` [PATCH_v2 3/8] android/tester: Add PAN Disconnect " Ravi kumar Veeramally
2014-08-05 11:19 ` [PATCH_v2 4/8] android/tester: Add PAN Get Local Role " Ravi kumar Veeramally
2014-08-05 11:19 ` [PATCH_v2 5/8] android/pan: Notify control state callback on HAL .enable call Ravi kumar Veeramally
2014-08-05 11:19 ` [PATCH_v2 6/8] android/tester: Add PAN Enable NAP test case Ravi kumar Veeramally
2014-08-05 11:19 ` [PATCH_v2 7/8] android/tester: Add PAN Enable PANU " Ravi kumar Veeramally
2014-08-05 11:19 ` [PATCH_v2 8/8] android/tester: Add PAN Enable None " Ravi kumar Veeramally
2014-08-06  7:40 ` [PATCH_v2 0/8] Add PAN test cases Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).