Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH 01/14] android/tester: Fix characteristic instance ID
@ 2014-09-11  6:08 Marcin Kraglak
  2014-09-11  6:08 ` [PATCH 02/14] android/tester: Add GATT Get Characteristic 2 test case Marcin Kraglak
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: Marcin Kraglak @ 2014-09-11  6:08 UTC (permalink / raw)
  To: linux-bluetooth

Characteristics instance id starts from 1.
---
 android/tester-gatt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/android/tester-gatt.c b/android/tester-gatt.c
index 2067ec3..1507803 100644
--- a/android/tester-gatt.c
+++ b/android/tester-gatt.c
@@ -148,7 +148,7 @@ static btgatt_srvc_id_t service_2 = {
 };
 
 static btgatt_gatt_id_t characteristic_1 = {
-	.inst_id = 0,
+	.inst_id = 1,
 	.uuid.uu = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
 			0x00, 0x10, 0x00, 0x00,  0x19, 0x00, 0x00, 0x00}
 };
-- 
1.9.3


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

* [PATCH 02/14] android/tester: Add GATT Get Characteristic 2 test case
  2014-09-11  6:08 [PATCH 01/14] android/tester: Fix characteristic instance ID Marcin Kraglak
@ 2014-09-11  6:08 ` Marcin Kraglak
  2014-09-11  6:08 ` [PATCH 03/14] android/gatt: Fix sending callback in get_characteristic Marcin Kraglak
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marcin Kraglak @ 2014-09-11  6:08 UTC (permalink / raw)
  To: linux-bluetooth

It tests getting characteristics of non existing service.
---
 android/tester-gatt.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/android/tester-gatt.c b/android/tester-gatt.c
index 1507803..b847c5f 100644
--- a/android/tester-gatt.c
+++ b/android/tester-gatt.c
@@ -158,6 +158,11 @@ static struct get_char_data get_char_data_1 = {
 	.service = &service_1
 };
 
+static struct get_char_data get_char_data_2 = {
+	.conn_id = CONN1_ID,
+	.service = &service_2
+};
+
 static struct pdu search_service[] = {
 	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
 	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
@@ -717,6 +722,34 @@ 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("Gatt Client - Get Characteristic 2",
+		ACTION_SUCCESS(init_pdus, get_characteristic_1),
+		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_set_connect_cb_action, gatt_conn_cb),
+		ACTION_SUCCESS(gatt_client_register_action, &client_app_uuid),
+		CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
+		ACTION_SUCCESS(gatt_client_start_scan_action,
+							INT_TO_PTR(CLIENT1_ID)),
+		CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
+		ACTION_SUCCESS(gatt_client_stop_scan_action,
+							INT_TO_PTR(CLIENT1_ID)),
+		ACTION_SUCCESS(gatt_client_connect_action,
+							&client1_conn_req),
+		CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
+						prop_emu_remotes_default_set,
+						CONN1_ID, CLIENT1_ID),
+		ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
+		CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
+		ACTION_FAIL(gatt_client_get_characteristic_action,
+							&get_char_data_2),
+		CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_FAILURE,
+				CONN1_ID, &service_2, NULL, 0),
+		ACTION_SUCCESS(bluetooth_disable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
+	),
 };
 
 struct queue *get_gatt_tests(void)
-- 
1.9.3


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

* [PATCH 03/14] android/gatt: Fix sending callback in get_characteristic
  2014-09-11  6:08 [PATCH 01/14] android/tester: Fix characteristic instance ID Marcin Kraglak
  2014-09-11  6:08 ` [PATCH 02/14] android/tester: Add GATT Get Characteristic 2 test case Marcin Kraglak
@ 2014-09-11  6:08 ` Marcin Kraglak
  2014-09-11  6:08 ` [PATCH 04/14] android/tester: Add support for GATT Get Descriptor callback Marcin Kraglak
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marcin Kraglak @ 2014-09-11  6:08 UTC (permalink / raw)
  To: linux-bluetooth

Notification should be send to client in case of error.
---
 android/gatt.c | 50 +++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 37 insertions(+), 13 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index fb29339..f16d365 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -2517,28 +2517,49 @@ reply:
 			HAL_OP_GATT_CLIENT_GET_INCLUDED_SERVICE, status);
 }
 
-static void send_client_char_notify(const struct characteristic *ch,
-					int32_t conn_id,
-					const struct service *service)
+static void send_client_char_notify(const struct hal_gatt_srvc_id *service,
+					const struct hal_gatt_gatt_id *charac,
+					int32_t char_prop, int32_t conn_id)
 {
 	struct hal_ev_gatt_client_get_characteristic ev;
 
-	memset(&ev, 0, sizeof(ev));
-	ev.status = ch ? GATT_SUCCESS : GATT_FAILURE;
+	ev.conn_id = conn_id;
 
-	if (ch) {
-		ev.char_prop = ch->ch.properties;
-		element_id_to_hal_gatt_id(&ch->id, &ev.char_id);
+	if (charac) {
+		memcpy(&ev.char_id, charac, sizeof(struct hal_gatt_gatt_id));
+		ev.char_prop = char_prop;
+		ev.status = GATT_SUCCESS;
+	} else {
+		memset(&ev.char_id, 0, sizeof(struct hal_gatt_gatt_id));
+		ev.char_prop = 0;
+		ev.status = GATT_FAILURE;
 	}
 
-	ev.conn_id = conn_id;
-	element_id_to_hal_srvc_id(&service->id, service->primary, &ev.srvc_id);
+	memcpy(&ev.srvc_id, service, sizeof(struct hal_gatt_srvc_id));
 
 	ipc_send_notif(hal_ipc, HAL_SERVICE_ID_GATT,
 					HAL_EV_GATT_CLIENT_GET_CHARACTERISTIC,
 					sizeof(ev), &ev);
 }
 
+static void convert_send_client_char_notify(const struct characteristic *ch,
+					int32_t conn_id,
+					const struct service *service)
+{
+	struct hal_gatt_srvc_id srvc;
+	struct hal_gatt_gatt_id charac;
+
+	element_id_to_hal_srvc_id(&service->id, service->primary, &srvc);
+
+	if (ch) {
+		element_id_to_hal_gatt_id(&ch->id, &charac);
+		send_client_char_notify(&srvc, &charac, ch->ch.properties,
+								conn_id);
+	} else {
+		send_client_char_notify(&srvc, NULL, 0, conn_id);
+	}
+}
+
 static void cache_all_srvc_chars(struct service *srvc, GSList *characteristics)
 {
 	uint16_t inst_id = 0;
@@ -2604,8 +2625,8 @@ static void discover_char_cb(uint8_t status, GSList *characteristics,
 	if (queue_isempty(srvc->chars))
 		cache_all_srvc_chars(srvc, characteristics);
 
-	send_client_char_notify(queue_peek_head(srvc->chars), data->conn_id,
-									srvc);
+	convert_send_client_char_notify(queue_peek_head(srvc->chars),
+							data->conn_id, srvc);
 
 	free(data);
 }
@@ -2671,11 +2692,14 @@ static void handle_client_get_characteristic(const void *buf, uint16_t len)
 	else
 		ch = queue_peek_head(srvc->chars);
 
-	send_client_char_notify(ch, conn->id, srvc);
+	convert_send_client_char_notify(ch, conn->id, srvc);
 
 	status = HAL_STATUS_SUCCESS;
 
 done:
+	if (status != HAL_STATUS_SUCCESS)
+		send_client_char_notify(&cmd->srvc_id, NULL, 0, cmd->conn_id);
+
 	ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_GATT,
 				HAL_OP_GATT_CLIENT_GET_CHARACTERISTIC, status);
 }
-- 
1.9.3


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

* [PATCH 04/14] android/tester: Add support for GATT Get Descriptor callback
  2014-09-11  6:08 [PATCH 01/14] android/tester: Fix characteristic instance ID Marcin Kraglak
  2014-09-11  6:08 ` [PATCH 02/14] android/tester: Add GATT Get Characteristic 2 test case Marcin Kraglak
  2014-09-11  6:08 ` [PATCH 03/14] android/gatt: Fix sending callback in get_characteristic Marcin Kraglak
@ 2014-09-11  6:08 ` Marcin Kraglak
  2014-09-11  6:08 ` [PATCH 05/14] android/tester: Add GATT Get Descriptor 1 test case Marcin Kraglak
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marcin Kraglak @ 2014-09-11  6:08 UTC (permalink / raw)
  To: linux-bluetooth

Service and verify GATTT Client Get Descriptor callback.
---
 android/tester-main.c | 35 ++++++++++++++++++++++++++++++++++-
 android/tester-main.h | 11 +++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/android/tester-main.c b/android/tester-main.c
index 297aadb..39a6b5a 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -572,6 +572,18 @@ static bool match_data(struct step *step)
 			tester_debug("Gatt char prop doesn't match");
 			return false;
 		}
+
+		if (exp->callback_result.descriptor) {
+			btgatt_gatt_id_t *a;
+			btgatt_gatt_id_t *b;
+			a = step->callback_result.descriptor;
+			b = exp->callback_result.descriptor;
+
+			if (!verify_gatt_ids(a, b)) {
+				tester_debug("Gatt desc doesn't match");
+				return false;
+			}
+		}
 	}
 
 	return true;
@@ -662,6 +674,9 @@ static void destroy_callback_step(void *data)
 	if (step->callback_result.characteristic)
 		free(step->callback_result.characteristic);
 
+	if (step->callback_result.descriptor)
+		free(step->callback_result.descriptor);
+
 	g_free(step);
 	g_atomic_int_dec_and_test(&scheduled_cbacks_num);
 }
@@ -1117,6 +1132,24 @@ static void gattc_get_characteristic_cb(int conn_id, int status,
 	schedule_callback_call(step);
 }
 
+static void gattc_get_descriptor_cb(int conn_id, int status,
+			btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
+			btgatt_gatt_id_t *descr_id)
+{
+	struct step *step = g_new0(struct step, 1);
+
+	step->callback = CB_GATTC_GET_DESCRIPTOR;
+	step->callback_result.status = status;
+	step->callback_result.conn_id = conn_id;
+	step->callback_result.service = g_memdup(srvc_id, sizeof(*srvc_id));
+	step->callback_result.characteristic = g_memdup(char_id,
+							sizeof(*char_id));
+	step->callback_result.descriptor = g_memdup(descr_id,
+							sizeof(*descr_id));
+
+	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)
@@ -1224,7 +1257,7 @@ static const btgatt_client_callbacks_t btgatt_client_callbacks = {
 	.search_complete_cb = gattc_search_complete_cb,
 	.search_result_cb = gattc_search_result_cb,
 	.get_characteristic_cb = gattc_get_characteristic_cb,
-	.get_descriptor_cb = NULL,
+	.get_descriptor_cb = gattc_get_descriptor_cb,
 	.get_included_service_cb = NULL,
 	.register_for_notification_cb = NULL,
 	.notify_cb = NULL,
diff --git a/android/tester-main.h b/android/tester-main.h
index 6cad803..d69d5ca 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
@@ -155,6 +155,16 @@
 		.callback_result.char_prop = cb_char_prop \
 	}
 
+#define CALLBACK_GATTC_GET_DESCRIPTOR(cb_res, cb_conn_id, cb_service, \
+						cb_char, cb_desc) { \
+		.callback = CB_GATTC_GET_DESCRIPTOR, \
+		.callback_result.conn_id = cb_conn_id, \
+		.callback_result.status = cb_res, \
+		.callback_result.service = cb_service, \
+		.callback_result.characteristic = cb_char, \
+		.callback_result.descriptor = cb_desc \
+	}
+
 #define CALLBACK_GATTC_DISCONNECT(cb_res, cb_prop, cb_conn_id, cb_client_id) { \
 		.callback = CB_GATTC_CLOSE, \
 		.callback_result.status = cb_res, \
@@ -396,6 +406,7 @@ struct bt_callback_data {
 	int conn_id;
 	btgatt_srvc_id_t *service;
 	btgatt_gatt_id_t *characteristic;
+	btgatt_gatt_id_t *descriptor;
 	int char_prop;
 
 	btpan_control_state_t ctrl_state;
-- 
1.9.3


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

* [PATCH 05/14] android/tester: Add GATT Get Descriptor 1 test case
  2014-09-11  6:08 [PATCH 01/14] android/tester: Fix characteristic instance ID Marcin Kraglak
                   ` (2 preceding siblings ...)
  2014-09-11  6:08 ` [PATCH 04/14] android/tester: Add support for GATT Get Descriptor callback Marcin Kraglak
@ 2014-09-11  6:08 ` Marcin Kraglak
  2014-09-11  6:08 ` [PATCH 06/14] android/tester: Add GATT Get Descriptor 2 " Marcin Kraglak
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marcin Kraglak @ 2014-09-11  6:08 UTC (permalink / raw)
  To: linux-bluetooth

It tests searching for descriptors in characteristic.
---
 android/tester-gatt.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)

diff --git a/android/tester-gatt.c b/android/tester-gatt.c
index b847c5f..c52a632 100644
--- a/android/tester-gatt.c
+++ b/android/tester-gatt.c
@@ -78,6 +78,13 @@ struct get_char_data {
 	btgatt_srvc_id_t *service;
 };
 
+struct get_desc_data {
+	const int conn_id;
+	btgatt_srvc_id_t *service;
+	btgatt_gatt_id_t *characteristic;
+	btgatt_gatt_id_t *desc;
+};
+
 static bt_uuid_t client2_app_uuid = {
 	.uu = { 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
 				0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 },
@@ -153,6 +160,12 @@ static btgatt_gatt_id_t characteristic_1 = {
 			0x00, 0x10, 0x00, 0x00,  0x19, 0x00, 0x00, 0x00}
 };
 
+static btgatt_gatt_id_t desc_1 = {
+	.inst_id = 1,
+	.uuid.uu = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
+			0x00, 0x10, 0x00, 0x00,  0x00, 0x29, 0x00, 0x00}
+};
+
 static struct get_char_data get_char_data_1 = {
 	.conn_id = CONN1_ID,
 	.service = &service_1
@@ -163,6 +176,12 @@ static struct get_char_data get_char_data_2 = {
 	.service = &service_2
 };
 
+static struct get_desc_data get_desc_data_1 = {
+	.conn_id = CONN1_ID,
+	.service = &service_1,
+	.characteristic = &characteristic_1,
+};
+
 static struct pdu search_service[] = {
 	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
 	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
@@ -199,6 +218,22 @@ static struct pdu get_characteristic_1[] = {
 	end_pdu
 };
 
+static struct pdu get_descriptor_1[] = {
+	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
+	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
+	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
+	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
+	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
+	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x00, 0x00, 0x19, 0x00),
+	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
+	raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a),
+	raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00),
+	raw_pdu(0x05, 0x01, 0x04, 0x00, 0x00, 0x29),
+	raw_pdu(0x04, 0x05, 0x00, 0x10, 0x00),
+	raw_pdu(0x01, 0x04, 0x05, 0x00, 0x0a),
+	end_pdu
+};
+
 static void gatt_client_register_action(void)
 {
 	struct test_data *data = tester_get_data();
@@ -326,6 +361,23 @@ static void gatt_client_get_characteristic_action(void)
 	schedule_action_verification(step);
 }
 
+static void gatt_client_get_descriptor(void)
+{
+	struct test_data *data = tester_get_data();
+	struct step *current_data_step = queue_peek_head(data->steps);
+	struct get_desc_data *get_desc = current_data_step->set_data;
+	const btgatt_client_interface_t *client = data->if_gatt->client;
+	struct step *step = g_new0(struct step, 1);
+	int status;
+
+	status = client->get_descriptor(get_desc->conn_id, get_desc->service,
+						get_desc->characteristic,
+						get_desc->desc);
+	step->action_status = status;
+
+	schedule_action_verification(step);
+}
+
 static void gatt_cid_hook_cb(const void *data, uint16_t len, void *user_data)
 {
 	struct test_data *t_data = tester_get_data();
@@ -750,6 +802,37 @@ 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("Gatt Client - Get Descriptor 1",
+		ACTION_SUCCESS(init_pdus, get_descriptor_1),
+		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_set_connect_cb_action, gatt_conn_cb),
+		ACTION_SUCCESS(gatt_client_register_action, &client_app_uuid),
+		CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
+		ACTION_SUCCESS(gatt_client_start_scan_action,
+							INT_TO_PTR(CLIENT1_ID)),
+		CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
+		ACTION_SUCCESS(gatt_client_stop_scan_action,
+							INT_TO_PTR(CLIENT1_ID)),
+		ACTION_SUCCESS(gatt_client_connect_action,
+							&client1_conn_req),
+		CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
+						prop_emu_remotes_default_set,
+						CONN1_ID, CLIENT1_ID),
+		ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
+		CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
+		ACTION_SUCCESS(gatt_client_get_characteristic_action,
+							&get_char_data_1),
+		CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
+				CONN1_ID, &service_1, &characteristic_1, 4),
+		ACTION_SUCCESS(gatt_client_get_descriptor, &get_desc_data_1),
+		CALLBACK_GATTC_GET_DESCRIPTOR(GATT_STATUS_SUCCESS, CONN1_ID,
+				&service_1, &characteristic_1, &desc_1),
+		ACTION_SUCCESS(bluetooth_disable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
+	),
 };
 
 struct queue *get_gatt_tests(void)
-- 
1.9.3


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

* [PATCH 06/14] android/tester: Add GATT Get Descriptor 2 test case
  2014-09-11  6:08 [PATCH 01/14] android/tester: Fix characteristic instance ID Marcin Kraglak
                   ` (3 preceding siblings ...)
  2014-09-11  6:08 ` [PATCH 05/14] android/tester: Add GATT Get Descriptor 1 test case Marcin Kraglak
@ 2014-09-11  6:08 ` Marcin Kraglak
  2014-09-11  6:08 ` [PATCH 07/14] android/gatt: Fix descripors instance IDs Marcin Kraglak
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marcin Kraglak @ 2014-09-11  6:08 UTC (permalink / raw)
  To: linux-bluetooth

It tests searching muliple descriptors in characteristic.
---
 android/tester-gatt.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/android/tester-gatt.c b/android/tester-gatt.c
index c52a632..db48a87 100644
--- a/android/tester-gatt.c
+++ b/android/tester-gatt.c
@@ -166,6 +166,12 @@ static btgatt_gatt_id_t desc_1 = {
 			0x00, 0x10, 0x00, 0x00,  0x00, 0x29, 0x00, 0x00}
 };
 
+static btgatt_gatt_id_t desc_2 = {
+	.inst_id = 2,
+	.uuid.uu = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
+			0x00, 0x10, 0x00, 0x00,  0x01, 0x29, 0x00, 0x00}
+};
+
 static struct get_char_data get_char_data_1 = {
 	.conn_id = CONN1_ID,
 	.service = &service_1
@@ -182,6 +188,13 @@ static struct get_desc_data get_desc_data_1 = {
 	.characteristic = &characteristic_1,
 };
 
+static struct get_desc_data get_desc_data_2 = {
+	.conn_id = CONN1_ID,
+	.service = &service_1,
+	.characteristic = &characteristic_1,
+	.desc = &desc_1,
+};
+
 static struct pdu search_service[] = {
 	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
 	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
@@ -234,6 +247,22 @@ static struct pdu get_descriptor_1[] = {
 	end_pdu
 };
 
+static struct pdu get_descriptor_2[] = {
+	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
+	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
+	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
+	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
+	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
+	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x00, 0x00, 0x19, 0x00),
+	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
+	raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a),
+	raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00),
+	raw_pdu(0x05, 0x01, 0x04, 0x00, 0x00, 0x29, 0x05, 0x00, 0x01, 0x29),
+	raw_pdu(0x04, 0x06, 0x00, 0x10, 0x00),
+	raw_pdu(0x01, 0x04, 0x06, 0x00, 0x0a),
+	end_pdu
+};
+
 static void gatt_client_register_action(void)
 {
 	struct test_data *data = tester_get_data();
@@ -833,6 +862,41 @@ 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("Gatt Client - Get Descriptor 2",
+		ACTION_SUCCESS(init_pdus, get_descriptor_2),
+		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_set_connect_cb_action, gatt_conn_cb),
+		ACTION_SUCCESS(gatt_client_register_action, &client_app_uuid),
+		CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
+
+		ACTION_SUCCESS(gatt_client_start_scan_action,
+							INT_TO_PTR(CLIENT1_ID)),
+		CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
+		ACTION_SUCCESS(gatt_client_stop_scan_action,
+							INT_TO_PTR(CLIENT1_ID)),
+		ACTION_SUCCESS(gatt_client_connect_action,
+							&client1_conn_req),
+		CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
+						prop_emu_remotes_default_set,
+						CONN1_ID, CLIENT1_ID),
+		ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
+		CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
+		ACTION_SUCCESS(gatt_client_get_characteristic_action,
+							&get_char_data_1),
+		CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
+				CONN1_ID, &service_1, &characteristic_1, 4),
+		ACTION_SUCCESS(gatt_client_get_descriptor, &get_desc_data_1),
+		CALLBACK_GATTC_GET_DESCRIPTOR(GATT_STATUS_SUCCESS, CONN1_ID,
+				&service_1, &characteristic_1, &desc_1),
+		ACTION_SUCCESS(gatt_client_get_descriptor, &get_desc_data_2),
+		CALLBACK_GATTC_GET_DESCRIPTOR(GATT_STATUS_SUCCESS, CONN1_ID,
+					&service_1, &characteristic_1, &desc_2),
+		ACTION_SUCCESS(bluetooth_disable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
+	),
 };
 
 struct queue *get_gatt_tests(void)
-- 
1.9.3


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

* [PATCH 07/14] android/gatt: Fix descripors instance IDs
  2014-09-11  6:08 [PATCH 01/14] android/tester: Fix characteristic instance ID Marcin Kraglak
                   ` (4 preceding siblings ...)
  2014-09-11  6:08 ` [PATCH 06/14] android/tester: Add GATT Get Descriptor 2 " Marcin Kraglak
@ 2014-09-11  6:08 ` Marcin Kraglak
  2014-09-11  6:08 ` [PATCH 08/14] android/tester: Add GATT Get Descriptor 3 test case Marcin Kraglak
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marcin Kraglak @ 2014-09-11  6:08 UTC (permalink / raw)
  To: linux-bluetooth

First descriptor should have instance ID with 1.
---
 android/gatt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/android/gatt.c b/android/gatt.c
index f16d365..4ef2b5f 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -2760,7 +2760,7 @@ static void gatt_discover_desc_cb(guint8 status, GSList *descs,
 		bt_string_to_uuid(&uuid, desc->uuid);
 		bt_uuid_to_uuid128(&uuid, &descr->id.uuid);
 
-		descr->id.instance = i++;
+		descr->id.instance = ++i;
 		descr->handle = desc->handle;
 
 		DBG("attr handle = 0x%04x, uuid: %s", desc->handle, desc->uuid);
-- 
1.9.3


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

* [PATCH 08/14] android/tester: Add GATT Get Descriptor 3 test case
  2014-09-11  6:08 [PATCH 01/14] android/tester: Fix characteristic instance ID Marcin Kraglak
                   ` (5 preceding siblings ...)
  2014-09-11  6:08 ` [PATCH 07/14] android/gatt: Fix descripors instance IDs Marcin Kraglak
@ 2014-09-11  6:08 ` Marcin Kraglak
  2014-09-11  6:08 ` [PATCH 09/14] android/gatt: Fix sending Get Descriptor callback Marcin Kraglak
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marcin Kraglak @ 2014-09-11  6:08 UTC (permalink / raw)
  To: linux-bluetooth

No descriptors will be found in this test case.
---
 android/tester-gatt.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/android/tester-gatt.c b/android/tester-gatt.c
index db48a87..19e86fe 100644
--- a/android/tester-gatt.c
+++ b/android/tester-gatt.c
@@ -263,6 +263,20 @@ static struct pdu get_descriptor_2[] = {
 	end_pdu
 };
 
+static struct pdu get_descriptor_3[] = {
+	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
+	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
+	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
+	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
+	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
+	raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x00, 0x00, 0x19, 0x00),
+	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
+	raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a),
+	raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00),
+	raw_pdu(0x01, 0x04, 0x01, 0x00, 0x0a),
+	end_pdu
+};
+
 static void gatt_client_register_action(void)
 {
 	struct test_data *data = tester_get_data();
@@ -897,6 +911,38 @@ 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("Gatt Client - Get Descriptor 3",
+		ACTION_SUCCESS(init_pdus, get_descriptor_3),
+		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_set_connect_cb_action, gatt_conn_cb),
+		ACTION_SUCCESS(gatt_client_register_action, &client_app_uuid),
+		CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
+
+		ACTION_SUCCESS(gatt_client_start_scan_action,
+							INT_TO_PTR(CLIENT1_ID)),
+		CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
+		ACTION_SUCCESS(gatt_client_stop_scan_action,
+							INT_TO_PTR(CLIENT1_ID)),
+		ACTION_SUCCESS(gatt_client_connect_action,
+							&client1_conn_req),
+		CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
+						prop_emu_remotes_default_set,
+						CONN1_ID, CLIENT1_ID),
+		ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
+		CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
+		ACTION_SUCCESS(gatt_client_get_characteristic_action,
+							&get_char_data_1),
+		CALLBACK_GATTC_GET_CHARACTERISTIC_CB(GATT_STATUS_SUCCESS,
+				CONN1_ID, &service_1, &characteristic_1, 4),
+		ACTION_SUCCESS(gatt_client_get_descriptor, &get_desc_data_1),
+		CALLBACK_GATTC_GET_DESCRIPTOR(GATT_STATUS_FAILURE, CONN1_ID,
+				&service_1, &characteristic_1, NULL),
+		ACTION_SUCCESS(bluetooth_disable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
+	),
 };
 
 struct queue *get_gatt_tests(void)
-- 
1.9.3


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

* [PATCH 09/14] android/gatt: Fix sending Get Descriptor callback
  2014-09-11  6:08 [PATCH 01/14] android/tester: Fix characteristic instance ID Marcin Kraglak
                   ` (6 preceding siblings ...)
  2014-09-11  6:08 ` [PATCH 08/14] android/tester: Add GATT Get Descriptor 3 test case Marcin Kraglak
@ 2014-09-11  6:08 ` Marcin Kraglak
  2014-09-11  6:08 ` [PATCH 10/14] android/tester: Add support for GATT Get Included Service callback Marcin Kraglak
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marcin Kraglak @ 2014-09-11  6:08 UTC (permalink / raw)
  To: linux-bluetooth

GATT_STATUS_SUCCESS or GATT_STATUS_FAILURE should be send in this
callback.
---
 android/gatt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 4ef2b5f..5a1d215 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -2772,9 +2772,9 @@ static void gatt_discover_desc_cb(guint8 status, GSList *descs,
 reply:
 	descr = queue_peek_head(ch->descriptors);
 
-	send_client_descr_notify(status, conn->id, srvc->primary, &srvc->id,
-						&ch->id,
-						descr ? &descr->id : NULL);
+	send_client_descr_notify(status ? GATT_FAILURE : GATT_SUCCESS, conn->id,
+					srvc->primary, &srvc->id, &ch->id,
+					descr ? &descr->id : NULL);
 
 	free(data);
 }
-- 
1.9.3


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

* [PATCH 10/14] android/tester: Add support for GATT Get Included Service callback
  2014-09-11  6:08 [PATCH 01/14] android/tester: Fix characteristic instance ID Marcin Kraglak
                   ` (7 preceding siblings ...)
  2014-09-11  6:08 ` [PATCH 09/14] android/gatt: Fix sending Get Descriptor callback Marcin Kraglak
@ 2014-09-11  6:08 ` Marcin Kraglak
  2014-09-11  6:08 ` [PATCH 11/14] android/tester: Add GATT Get Included Service 1 test case Marcin Kraglak
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marcin Kraglak @ 2014-09-11  6:08 UTC (permalink / raw)
  To: linux-bluetooth

Service and verify GATT Client Get Included Service callback.
---
 android/tester-main.c | 28 +++++++++++++++++++++++++++-
 android/tester-main.h | 10 ++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/android/tester-main.c b/android/tester-main.c
index 39a6b5a..4513fcb 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -584,6 +584,14 @@ static bool match_data(struct step *step)
 				return false;
 			}
 		}
+
+		if (exp->callback_result.included) {
+			if (!verify_services(step->callback_result.included,
+					exp->callback_result.included)) {
+				tester_debug("Gatt include srvc doesn't match");
+				return false;
+			}
+		}
 	}
 
 	return true;
@@ -677,6 +685,9 @@ static void destroy_callback_step(void *data)
 	if (step->callback_result.descriptor)
 		free(step->callback_result.descriptor);
 
+	if (step->callback_result.included)
+		free(step->callback_result.included);
+
 	g_free(step);
 	g_atomic_int_dec_and_test(&scheduled_cbacks_num);
 }
@@ -1150,6 +1161,21 @@ static void gattc_get_descriptor_cb(int conn_id, int status,
 	schedule_callback_call(step);
 }
 
+static void gattc_get_included_service_cb(int conn_id, int status,
+		btgatt_srvc_id_t *srvc_id, btgatt_srvc_id_t *incl_srvc_id)
+{
+	struct step *step = g_new0(struct step, 1);
+
+	step->callback = CB_GATTC_GET_INCLUDED_SERVICE;
+	step->callback_result.status = status;
+	step->callback_result.conn_id = conn_id;
+	step->callback_result.service = g_memdup(srvc_id, sizeof(*srvc_id));
+	step->callback_result.included = g_memdup(incl_srvc_id,
+							sizeof(*srvc_id));
+
+	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)
@@ -1258,7 +1284,7 @@ static const btgatt_client_callbacks_t btgatt_client_callbacks = {
 	.search_result_cb = gattc_search_result_cb,
 	.get_characteristic_cb = gattc_get_characteristic_cb,
 	.get_descriptor_cb = gattc_get_descriptor_cb,
-	.get_included_service_cb = NULL,
+	.get_included_service_cb = gattc_get_included_service_cb,
 	.register_for_notification_cb = NULL,
 	.notify_cb = NULL,
 	.read_characteristic_cb = NULL,
diff --git a/android/tester-main.h b/android/tester-main.h
index d69d5ca..6f59330 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
@@ -165,6 +165,15 @@
 		.callback_result.descriptor = cb_desc \
 	}
 
+#define CALLBACK_GATTC_GET_INCLUDED(cb_res, cb_conn_id, cb_service, \
+							cb_incl) { \
+		.callback = CB_GATTC_GET_INCLUDED_SERVICE, \
+		.callback_result.conn_id = cb_conn_id, \
+		.callback_result.status = cb_res, \
+		.callback_result.service = cb_service, \
+		.callback_result.included = cb_incl, \
+	}
+
 #define CALLBACK_GATTC_DISCONNECT(cb_res, cb_prop, cb_conn_id, cb_client_id) { \
 		.callback = CB_GATTC_CLOSE, \
 		.callback_result.status = cb_res, \
@@ -407,6 +416,7 @@ struct bt_callback_data {
 	btgatt_srvc_id_t *service;
 	btgatt_gatt_id_t *characteristic;
 	btgatt_gatt_id_t *descriptor;
+	btgatt_srvc_id_t *included;
 	int char_prop;
 
 	btpan_control_state_t ctrl_state;
-- 
1.9.3


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

* [PATCH 11/14] android/tester: Add GATT Get Included Service 1 test case
  2014-09-11  6:08 [PATCH 01/14] android/tester: Fix characteristic instance ID Marcin Kraglak
                   ` (8 preceding siblings ...)
  2014-09-11  6:08 ` [PATCH 10/14] android/tester: Add support for GATT Get Included Service callback Marcin Kraglak
@ 2014-09-11  6:08 ` Marcin Kraglak
  2014-09-11  6:08 ` [PATCH 12/14] android/tester: Add GATT Get Included Service 2 " Marcin Kraglak
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marcin Kraglak @ 2014-09-11  6:08 UTC (permalink / raw)
  To: linux-bluetooth

Verify if included service with 16-bit UUID can be found.
---
 android/tester-gatt.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

diff --git a/android/tester-gatt.c b/android/tester-gatt.c
index 19e86fe..2dce3a3 100644
--- a/android/tester-gatt.c
+++ b/android/tester-gatt.c
@@ -85,6 +85,12 @@ struct get_desc_data {
 	btgatt_gatt_id_t *desc;
 };
 
+struct get_incl_data {
+	const int conn_id;
+	btgatt_srvc_id_t *service;
+	btgatt_srvc_id_t *start_service;
+};
+
 static bt_uuid_t client2_app_uuid = {
 	.uu = { 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
 				0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 },
@@ -154,6 +160,15 @@ static btgatt_srvc_id_t service_2 = {
 	}
 };
 
+static btgatt_srvc_id_t included_1 = {
+	.is_primary = false,
+	.id = {
+		.inst_id = 1,
+		.uuid.uu = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
+			0x00, 0x10, 0x00, 0x00,  0xff, 0xfe, 0x00, 0x00},
+	}
+};
+
 static btgatt_gatt_id_t characteristic_1 = {
 	.inst_id = 1,
 	.uuid.uu = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
@@ -195,6 +210,11 @@ static struct get_desc_data get_desc_data_2 = {
 	.desc = &desc_1,
 };
 
+struct get_incl_data get_incl_data_1 = {
+	.conn_id = CONN1_ID,
+	.service = &service_1
+};
+
 static struct pdu search_service[] = {
 	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
 	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
@@ -277,6 +297,18 @@ static struct pdu get_descriptor_3[] = {
 	end_pdu
 };
 
+static struct pdu get_included_1[] = {
+	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
+	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
+	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
+	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
+	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x02, 0x28),
+	raw_pdu(0x09, 0x08, 0x02, 0x00, 0x15, 0x00, 0x19, 0x00, 0xff, 0xfe),
+	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x02, 0x28),
+	raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a),
+	end_pdu
+};
+
 static void gatt_client_register_action(void)
 {
 	struct test_data *data = tester_get_data();
@@ -421,6 +453,23 @@ static void gatt_client_get_descriptor(void)
 	schedule_action_verification(step);
 }
 
+static void gatt_client_get_included(void)
+{
+	struct test_data *data = tester_get_data();
+	struct step *current_data_step = queue_peek_head(data->steps);
+	struct get_incl_data *get_incl = current_data_step->set_data;
+	const btgatt_client_interface_t *client = data->if_gatt->client;
+	struct step *step = g_new0(struct step, 1);
+	int status;
+
+	status = client->get_included_service(get_incl->conn_id,
+				get_incl->service, get_incl->start_service);
+
+	step->action_status = status;
+
+	schedule_action_verification(step);
+}
+
 static void gatt_cid_hook_cb(const void *data, uint16_t len, void *user_data)
 {
 	struct test_data *t_data = tester_get_data();
@@ -943,6 +992,34 @@ 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("Gatt Client - Get Included Service 1",
+		ACTION_SUCCESS(init_pdus, get_included_1),
+		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_set_connect_cb_action, gatt_conn_cb),
+		ACTION_SUCCESS(gatt_client_register_action, &client_app_uuid),
+		CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
+
+		ACTION_SUCCESS(gatt_client_start_scan_action,
+							INT_TO_PTR(CLIENT1_ID)),
+		CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
+		ACTION_SUCCESS(gatt_client_stop_scan_action,
+							INT_TO_PTR(CLIENT1_ID)),
+		ACTION_SUCCESS(gatt_client_connect_action,
+							&client1_conn_req),
+		CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
+						prop_emu_remotes_default_set,
+						CONN1_ID, CLIENT1_ID),
+		ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
+		CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
+		ACTION_SUCCESS(gatt_client_get_included, &get_incl_data_1),
+		CALLBACK_GATTC_GET_INCLUDED(GATT_STATUS_SUCCESS, CONN1_ID,
+						&service_1, &included_1),
+		ACTION_SUCCESS(bluetooth_disable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
+	),
 };
 
 struct queue *get_gatt_tests(void)
-- 
1.9.3


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

* [PATCH 12/14] android/tester: Add GATT Get Included Service 2 test case
  2014-09-11  6:08 [PATCH 01/14] android/tester: Fix characteristic instance ID Marcin Kraglak
                   ` (9 preceding siblings ...)
  2014-09-11  6:08 ` [PATCH 11/14] android/tester: Add GATT Get Included Service 1 test case Marcin Kraglak
@ 2014-09-11  6:08 ` Marcin Kraglak
  2014-09-11  6:08 ` [PATCH 13/14] android/tester: Add GATT Get Included Service 3 " Marcin Kraglak
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: Marcin Kraglak @ 2014-09-11  6:08 UTC (permalink / raw)
  To: linux-bluetooth

It will test searching include services with 128 bit UUID.
---
 android/tester-gatt.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/android/tester-gatt.c b/android/tester-gatt.c
index 2dce3a3..89f3574 100644
--- a/android/tester-gatt.c
+++ b/android/tester-gatt.c
@@ -169,6 +169,15 @@ static btgatt_srvc_id_t included_1 = {
 	}
 };
 
+static btgatt_srvc_id_t included_2 = {
+	.is_primary = false,
+	.id = {
+		.inst_id = 1,
+		.uuid.uu = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+				0x08, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10},
+	}
+};
+
 static btgatt_gatt_id_t characteristic_1 = {
 	.inst_id = 1,
 	.uuid.uu = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
@@ -309,6 +318,21 @@ static struct pdu get_included_1[] = {
 	end_pdu
 };
 
+static struct pdu get_included_2[] = {
+	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
+	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
+	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
+	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
+	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x02, 0x28),
+	raw_pdu(0x09, 0x06, 0x02, 0x00, 0x15, 0x00, 0x19, 0x00),
+	raw_pdu(0x0a, 0x15, 0x00),
+	raw_pdu(0x0b, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+				0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10),
+	raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x02, 0x28),
+	raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a),
+	end_pdu
+};
+
 static void gatt_client_register_action(void)
 {
 	struct test_data *data = tester_get_data();
@@ -1020,6 +1044,34 @@ 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("Gatt Client - Get Included Service 2 (128 bit UUID)",
+		ACTION_SUCCESS(init_pdus, get_included_2),
+		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_set_connect_cb_action, gatt_conn_cb),
+		ACTION_SUCCESS(gatt_client_register_action, &client_app_uuid),
+		CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
+
+		ACTION_SUCCESS(gatt_client_start_scan_action,
+							INT_TO_PTR(CLIENT1_ID)),
+		CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
+		ACTION_SUCCESS(gatt_client_stop_scan_action,
+							INT_TO_PTR(CLIENT1_ID)),
+		ACTION_SUCCESS(gatt_client_connect_action,
+							&client1_conn_req),
+		CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
+						prop_emu_remotes_default_set,
+						CONN1_ID, CLIENT1_ID),
+		ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
+		CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
+		ACTION_SUCCESS(gatt_client_get_included, &get_incl_data_1),
+		CALLBACK_GATTC_GET_INCLUDED(GATT_STATUS_SUCCESS, CONN1_ID,
+						&service_1, &included_2),
+		ACTION_SUCCESS(bluetooth_disable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
+	),
 };
 
 struct queue *get_gatt_tests(void)
-- 
1.9.3


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

* [PATCH 13/14] android/tester: Add GATT Get Included Service 3 test case
  2014-09-11  6:08 [PATCH 01/14] android/tester: Fix characteristic instance ID Marcin Kraglak
                   ` (10 preceding siblings ...)
  2014-09-11  6:08 ` [PATCH 12/14] android/tester: Add GATT Get Included Service 2 " Marcin Kraglak
@ 2014-09-11  6:08 ` Marcin Kraglak
  2014-09-11  6:08 ` [PATCH 14/14] android/tester: Verify GATT instace IDs in callbacks Marcin Kraglak
  2014-09-11  8:32 ` [PATCH 01/14] android/tester: Fix characteristic instance ID Szymon Janc
  13 siblings, 0 replies; 15+ messages in thread
From: Marcin Kraglak @ 2014-09-11  6:08 UTC (permalink / raw)
  To: linux-bluetooth

No included service should be returned in this case.
---
 android/tester-gatt.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/android/tester-gatt.c b/android/tester-gatt.c
index 89f3574..560031e 100644
--- a/android/tester-gatt.c
+++ b/android/tester-gatt.c
@@ -333,6 +333,16 @@ static struct pdu get_included_2[] = {
 	end_pdu
 };
 
+static struct pdu get_included_3[] = {
+	raw_pdu(0x10, 0x01, 0x00, 0xff, 0xff, 0x00, 0x28),
+	raw_pdu(0x11, 0x06, 0x01, 0x00, 0x10, 0x00, 0x00, 0x18),
+	raw_pdu(0x10, 0x11, 0x00, 0xff, 0xff, 0x00, 0x28),
+	raw_pdu(0x01, 0x11, 0x11, 0x00, 0x0a),
+	raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x02, 0x28),
+	raw_pdu(0x01, 0x08, 0x01, 0x00, 0x0a),
+	end_pdu
+};
+
 static void gatt_client_register_action(void)
 {
 	struct test_data *data = tester_get_data();
@@ -1072,6 +1082,34 @@ 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("Gatt Client - Get Included Service 3",
+		ACTION_SUCCESS(init_pdus, get_included_3),
+		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_set_connect_cb_action, gatt_conn_cb),
+		ACTION_SUCCESS(gatt_client_register_action, &client_app_uuid),
+		CALLBACK_STATUS(CB_GATTC_REGISTER_CLIENT, BT_STATUS_SUCCESS),
+
+		ACTION_SUCCESS(gatt_client_start_scan_action,
+							INT_TO_PTR(CLIENT1_ID)),
+		CLLBACK_GATTC_SCAN_RES(prop_emu_remotes_default_set, 1, TRUE),
+		ACTION_SUCCESS(gatt_client_stop_scan_action,
+							INT_TO_PTR(CLIENT1_ID)),
+		ACTION_SUCCESS(gatt_client_connect_action,
+							&client1_conn_req),
+		CALLBACK_GATTC_CONNECT(GATT_STATUS_SUCCESS,
+						prop_emu_remotes_default_set,
+						CONN1_ID, CLIENT1_ID),
+		ACTION_SUCCESS(gatt_client_search_services, &search_services_1),
+		CALLBACK_GATTC_SEARCH_COMPLETE(GATT_STATUS_SUCCESS, CONN1_ID),
+		ACTION_SUCCESS(gatt_client_get_included, &get_incl_data_1),
+		CALLBACK_GATTC_GET_INCLUDED(GATT_STATUS_FAILURE, CONN1_ID,
+						&service_1, NULL),
+		ACTION_SUCCESS(bluetooth_disable_action, NULL),
+		CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
+	),
 };
 
 struct queue *get_gatt_tests(void)
-- 
1.9.3


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

* [PATCH 14/14] android/tester: Verify GATT instace IDs in callbacks
  2014-09-11  6:08 [PATCH 01/14] android/tester: Fix characteristic instance ID Marcin Kraglak
                   ` (11 preceding siblings ...)
  2014-09-11  6:08 ` [PATCH 13/14] android/tester: Add GATT Get Included Service 3 " Marcin Kraglak
@ 2014-09-11  6:08 ` Marcin Kraglak
  2014-09-11  8:32 ` [PATCH 01/14] android/tester: Fix characteristic instance ID Szymon Janc
  13 siblings, 0 replies; 15+ messages in thread
From: Marcin Kraglak @ 2014-09-11  6:08 UTC (permalink / raw)
  To: linux-bluetooth

---
 android/tester-main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/android/tester-main.c b/android/tester-main.c
index 4513fcb..385c00d 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -402,6 +402,9 @@ static bool verify_gatt_ids(btgatt_gatt_id_t *a, btgatt_gatt_id_t *b)
 	if (memcmp(&a->uuid, &b->uuid, sizeof(bt_uuid_t)))
 		return false;
 
+	if (a->inst_id != b->inst_id)
+		return false;
+
 	return true;
 }
 
-- 
1.9.3


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

* Re: [PATCH 01/14] android/tester: Fix characteristic instance ID
  2014-09-11  6:08 [PATCH 01/14] android/tester: Fix characteristic instance ID Marcin Kraglak
                   ` (12 preceding siblings ...)
  2014-09-11  6:08 ` [PATCH 14/14] android/tester: Verify GATT instace IDs in callbacks Marcin Kraglak
@ 2014-09-11  8:32 ` Szymon Janc
  13 siblings, 0 replies; 15+ messages in thread
From: Szymon Janc @ 2014-09-11  8:32 UTC (permalink / raw)
  To: Marcin Kraglak; +Cc: linux-bluetooth

Hi Marcin,

On Thursday 11 of September 2014 08:08:39 Marcin Kraglak wrote:
> Characteristics instance id starts from 1.
> ---
>  android/tester-gatt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/android/tester-gatt.c b/android/tester-gatt.c
> index 2067ec3..1507803 100644
> --- a/android/tester-gatt.c
> +++ b/android/tester-gatt.c
> @@ -148,7 +148,7 @@ static btgatt_srvc_id_t service_2 = {
>  };
>  
>  static btgatt_gatt_id_t characteristic_1 = {
> -	.inst_id = 0,
> +	.inst_id = 1,
>  	.uuid.uu = {0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
>  			0x00, 0x10, 0x00, 0x00,  0x19, 0x00, 0x00, 0x00}
>  };

All patches applied, thanks. 

-- 
Best regards, 
Szymon Janc

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

end of thread, other threads:[~2014-09-11  8:32 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-11  6:08 [PATCH 01/14] android/tester: Fix characteristic instance ID Marcin Kraglak
2014-09-11  6:08 ` [PATCH 02/14] android/tester: Add GATT Get Characteristic 2 test case Marcin Kraglak
2014-09-11  6:08 ` [PATCH 03/14] android/gatt: Fix sending callback in get_characteristic Marcin Kraglak
2014-09-11  6:08 ` [PATCH 04/14] android/tester: Add support for GATT Get Descriptor callback Marcin Kraglak
2014-09-11  6:08 ` [PATCH 05/14] android/tester: Add GATT Get Descriptor 1 test case Marcin Kraglak
2014-09-11  6:08 ` [PATCH 06/14] android/tester: Add GATT Get Descriptor 2 " Marcin Kraglak
2014-09-11  6:08 ` [PATCH 07/14] android/gatt: Fix descripors instance IDs Marcin Kraglak
2014-09-11  6:08 ` [PATCH 08/14] android/tester: Add GATT Get Descriptor 3 test case Marcin Kraglak
2014-09-11  6:08 ` [PATCH 09/14] android/gatt: Fix sending Get Descriptor callback Marcin Kraglak
2014-09-11  6:08 ` [PATCH 10/14] android/tester: Add support for GATT Get Included Service callback Marcin Kraglak
2014-09-11  6:08 ` [PATCH 11/14] android/tester: Add GATT Get Included Service 1 test case Marcin Kraglak
2014-09-11  6:08 ` [PATCH 12/14] android/tester: Add GATT Get Included Service 2 " Marcin Kraglak
2014-09-11  6:08 ` [PATCH 13/14] android/tester: Add GATT Get Included Service 3 " Marcin Kraglak
2014-09-11  6:08 ` [PATCH 14/14] android/tester: Verify GATT instace IDs in callbacks Marcin Kraglak
2014-09-11  8:32 ` [PATCH 01/14] android/tester: Fix characteristic instance ID Szymon Janc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox