linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] android/tester: Add missing AVRCP cb_table entries
@ 2014-12-08 10:35 Grzegorz Kolodziejczyk
  2014-12-08 10:35 ` [PATCH 2/5] android/tester: put gatt callback declaration in right place Grzegorz Kolodziejczyk
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-12-08 10:35 UTC (permalink / raw)
  To: linux-bluetooth

cb_table should be filled simultaneously with expected bt_callbacks
enum. Without this, debug logs can cause errors.
---
 android/tester-main.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/android/tester-main.c b/android/tester-main.c
index 33ef3ce..8f3bc3c 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -68,6 +68,14 @@ static struct {
 	DBG_CB(CB_A2DP_CONN_STATE),
 	DBG_CB(CB_A2DP_AUDIO_STATE),
 
+	/* AVRCP */
+	DBG_CB(CB_AVRCP_PLAY_STATUS_REQ),
+	DBG_CB(CB_AVRCP_PLAY_STATUS_RSP),
+	DBG_CB(CB_AVRCP_REG_NOTIF_REQ),
+	DBG_CB(CB_AVRCP_REG_NOTIF_RSP),
+	DBG_CB(CB_AVRCP_GET_ATTR_REQ),
+	DBG_CB(CB_AVRCP_GET_ATTR_RSP),
+
 	/* Gatt client */
 	DBG_CB(CB_GATTC_REGISTER_CLIENT),
 	DBG_CB(CB_GATTC_SCAN_RESULT),
-- 
1.9.3


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

* [PATCH 2/5] android/tester: put gatt callback declaration in right place
  2014-12-08 10:35 [PATCH 1/5] android/tester: Add missing AVRCP cb_table entries Grzegorz Kolodziejczyk
@ 2014-12-08 10:35 ` Grzegorz Kolodziejczyk
  2014-12-08 10:35 ` [PATCH 3/5] android/tester: remove not needed include of hal_msg.h Grzegorz Kolodziejczyk
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-12-08 10:35 UTC (permalink / raw)
  To: linux-bluetooth

Gatt callback declaration should be defined after their definitions.
This is the adopted style.
---
 android/tester-main.c | 86 +++++++++++++++++++++++++--------------------------
 1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/android/tester-main.c b/android/tester-main.c
index 8f3bc3c..429838d 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -1650,6 +1650,27 @@ static void gattc_notif_cb(int conn_id, btgatt_notify_params_t *p_data)
 	schedule_callback_verification(step);
 }
 
+static const btgatt_client_callbacks_t btgatt_client_callbacks = {
+	.register_client_cb = gattc_register_client_cb,
+	.scan_result_cb = gattc_scan_result_cb,
+	.open_cb = gattc_connect_cb,
+	.close_cb = gattc_disconnect_cb,
+	.search_complete_cb = gattc_search_complete_cb,
+	.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 = gattc_get_included_service_cb,
+	.register_for_notification_cb = gattc_register_for_notification_cb,
+	.notify_cb = gattc_notif_cb,
+	.read_characteristic_cb = gattc_read_characteristic_cb,
+	.write_characteristic_cb = gattc_write_characteristic_cb,
+	.read_descriptor_cb = gattc_read_descriptor_cb,
+	.write_descriptor_cb = gattc_write_descriptor_cb,
+	.execute_write_cb = NULL,
+	.read_remote_rssi_cb = NULL,
+	.listen_cb = gattc_listen_cb
+};
+
 static void gatts_register_server_cb(int status, int server_if,
 							bt_uuid_t *app_uuid)
 {
@@ -1862,6 +1883,28 @@ static void gatts_request_write_cb(int conn_id, int trans_id, bt_bdaddr_t *bda,
 	schedule_callback_verification(step);
 }
 
+static const btgatt_server_callbacks_t btgatt_server_callbacks = {
+	.register_server_cb = gatts_register_server_cb,
+	.connection_cb = gatts_connection_cb,
+	.service_added_cb = gatts_service_added_cb,
+	.included_service_added_cb = gatts_included_service_added_cb,
+	.characteristic_added_cb = gatts_characteristic_added_cb,
+	.descriptor_added_cb = gatts_descriptor_added_cb,
+	.service_started_cb = gatts_service_started_cb,
+	.service_stopped_cb = gatts_service_stopped_cb,
+	.service_deleted_cb = gatts_service_deleted_cb,
+	.request_read_cb = gatts_request_read_cb,
+	.request_write_cb = gatts_request_write_cb,
+	.request_exec_write_cb = NULL,
+	.response_confirmation_cb = NULL
+};
+
+static const btgatt_callbacks_t btgatt_callbacks = {
+	.size = sizeof(btgatt_callbacks),
+	.client = &btgatt_client_callbacks,
+	.server = &btgatt_server_callbacks
+};
+
 static void pan_control_state_cb(btpan_control_state_t state, int local_role,
 					bt_status_t error, const char *ifname)
 {
@@ -1989,49 +2032,6 @@ static btrc_callbacks_t btavrcp_callbacks = {
 	.get_element_attr_cb = avrcp_get_element_attr_cb,
 };
 
-static const btgatt_client_callbacks_t btgatt_client_callbacks = {
-	.register_client_cb = gattc_register_client_cb,
-	.scan_result_cb = gattc_scan_result_cb,
-	.open_cb = gattc_connect_cb,
-	.close_cb = gattc_disconnect_cb,
-	.search_complete_cb = gattc_search_complete_cb,
-	.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 = gattc_get_included_service_cb,
-	.register_for_notification_cb = gattc_register_for_notification_cb,
-	.notify_cb = gattc_notif_cb,
-	.read_characteristic_cb = gattc_read_characteristic_cb,
-	.write_characteristic_cb = gattc_write_characteristic_cb,
-	.read_descriptor_cb = gattc_read_descriptor_cb,
-	.write_descriptor_cb = gattc_write_descriptor_cb,
-	.execute_write_cb = NULL,
-	.read_remote_rssi_cb = NULL,
-	.listen_cb = gattc_listen_cb
-};
-
-static const btgatt_server_callbacks_t btgatt_server_callbacks = {
-	.register_server_cb = gatts_register_server_cb,
-	.connection_cb = gatts_connection_cb,
-	.service_added_cb = gatts_service_added_cb,
-	.included_service_added_cb = gatts_included_service_added_cb,
-	.characteristic_added_cb = gatts_characteristic_added_cb,
-	.descriptor_added_cb = gatts_descriptor_added_cb,
-	.service_started_cb = gatts_service_started_cb,
-	.service_stopped_cb = gatts_service_stopped_cb,
-	.service_deleted_cb = gatts_service_deleted_cb,
-	.request_read_cb = gatts_request_read_cb,
-	.request_write_cb = gatts_request_write_cb,
-	.request_exec_write_cb = NULL,
-	.response_confirmation_cb = NULL
-};
-
-static const btgatt_callbacks_t btgatt_callbacks = {
-	.size = sizeof(btgatt_callbacks),
-	.client = &btgatt_client_callbacks,
-	.server = &btgatt_server_callbacks
-};
-
 static bool setup_base(struct test_data *data)
 {
 	const hw_module_t *module;
-- 
1.9.3


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

* [PATCH 3/5] android/tester: remove not needed include of hal_msg.h
  2014-12-08 10:35 [PATCH 1/5] android/tester: Add missing AVRCP cb_table entries Grzegorz Kolodziejczyk
  2014-12-08 10:35 ` [PATCH 2/5] android/tester: put gatt callback declaration in right place Grzegorz Kolodziejczyk
@ 2014-12-08 10:35 ` Grzegorz Kolodziejczyk
  2014-12-08 10:35 ` [PATCH 4/5] android/tester: move bthost.h include to tester-main.h Grzegorz Kolodziejczyk
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-12-08 10:35 UTC (permalink / raw)
  To: linux-bluetooth

We shouldn't include header for one define. All test cases use internal
defines for commands as adopted.
---
 android/tester-gatt.c | 17 ++++++++---------
 android/tester-main.c |  7 +++++--
 android/tester-main.h |  1 +
 3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/android/tester-gatt.c b/android/tester-gatt.c
index e750cb3..de2a7a7 100644
--- a/android/tester-gatt.c
+++ b/android/tester-gatt.c
@@ -19,7 +19,6 @@
 
 #include "emulator/bthost.h"
 #include "tester-main.h"
-#include "hal-msg.h"
 #include "src/shared/util.h"
 
 #define ATT_HANDLE_SIZE	2
@@ -48,6 +47,8 @@
 
 #define TRANS1_ID	1
 
+#define BT_TRANSPORT_UNKNOWN		0x00
+
 #define GATT_SERVER_TRANSPORT_LE		0x01
 #define GATT_SERVER_TRANSPORT_BREDR		0x02
 #define GATT_SERVER_TRANSPORT_LE_BREDR		(0x01 | 0x02)
@@ -1172,10 +1173,9 @@ static void gatt_client_connect_action(void)
 	struct step *step = g_new0(struct step, 1);
 
 	step->action_status = data->if_gatt->client->connect(
-							conn_data->app_id,
-							&emu_remote_bdaddr_val,
-							0,
-							BT_TRANSPORT_UNKNOWN);
+						conn_data->app_id,
+						&emu_remote_bdaddr_val, 0,
+						BT_TRANSPORT_UNKNOWN);
 
 	schedule_action_verification(step);
 }
@@ -1405,10 +1405,9 @@ static void gatt_server_connect_action(void)
 	struct step *step = g_new0(struct step, 1);
 
 	step->action_status = data->if_gatt->server->connect(
-							conn_data->app_id,
-							&emu_remote_bdaddr_val,
-							0,
-							BT_TRANSPORT_UNKNOWN);
+						conn_data->app_id,
+						&emu_remote_bdaddr_val, 0,
+						BT_TRANSPORT_UNKNOWN);
 
 	schedule_action_verification(step);
 }
diff --git a/android/tester-main.c b/android/tester-main.c
index 429838d..6339b3a 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -19,7 +19,6 @@
 #include "src/shared/util.h"
 #include "emulator/bthost.h"
 #include "tester-main.h"
-#include "hal-msg.h"
 
 #include "monitor/bt.h"
 
@@ -30,6 +29,8 @@ static gint scheduled_cbacks_num;
 #define EMULATOR_SIGNAL_TIMEOUT 2 /* in seconds */
 #define EMULATOR_SIGNAL "emulator_started"
 
+#define BT_TRANSPORT_UNKNOWN	0x00
+
 static struct {
 	uint16_t cb_num;
 	const char *str;
@@ -2916,7 +2917,9 @@ void bt_create_bond_action(void)
 
 	step->action_status =
 			data->if_bluetooth->create_bond(action_data->addr,
-							BT_TRANSPORT_UNKNOWN);
+						action_data->transport_type ?
+						action_data->transport_type :
+						BT_TRANSPORT_UNKNOWN);
 
 	schedule_action_verification(step);
 }
diff --git a/android/tester-main.h b/android/tester-main.h
index 4407514..474afbb 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
@@ -606,6 +606,7 @@ struct bt_action_data {
 
 	/*Connection params*/
 	const uint8_t bearer_type;
+	const uint8_t transport_type;
 };
 
 /* bthost's l2cap server setup parameters */
-- 
1.9.3


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

* [PATCH 4/5] android/tester: move bthost.h include to tester-main.h
  2014-12-08 10:35 [PATCH 1/5] android/tester: Add missing AVRCP cb_table entries Grzegorz Kolodziejczyk
  2014-12-08 10:35 ` [PATCH 2/5] android/tester: put gatt callback declaration in right place Grzegorz Kolodziejczyk
  2014-12-08 10:35 ` [PATCH 3/5] android/tester: remove not needed include of hal_msg.h Grzegorz Kolodziejczyk
@ 2014-12-08 10:35 ` Grzegorz Kolodziejczyk
  2014-12-10 12:45   ` Szymon Janc
  2014-12-08 10:35 ` [PATCH 5/5] android/tester: add initial support for map-client tester Grzegorz Kolodziejczyk
  2014-12-10 12:43 ` [PATCH 1/5] android/tester: Add missing AVRCP cb_table entries Szymon Janc
  4 siblings, 1 reply; 11+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-12-08 10:35 UTC (permalink / raw)
  To: linux-bluetooth

bthost.h is used by all testers.
---
 android/tester-a2dp.c      | 1 -
 android/tester-avrcp.c     | 1 -
 android/tester-bluetooth.c | 1 -
 android/tester-gatt.c      | 1 -
 android/tester-hdp.c       | 1 -
 android/tester-hidhost.c   | 1 -
 android/tester-main.c      | 1 -
 android/tester-main.h      | 1 +
 android/tester-pan.c       | 1 -
 android/tester-socket.c    | 1 -
 10 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/android/tester-a2dp.c b/android/tester-a2dp.c
index 837477e..a2e7325 100644
--- a/android/tester-a2dp.c
+++ b/android/tester-a2dp.c
@@ -17,7 +17,6 @@
 
 #include <stdbool.h>
 
-#include "emulator/bthost.h"
 #include "src/shared/util.h"
 
 #include "tester-main.h"
diff --git a/android/tester-avrcp.c b/android/tester-avrcp.c
index 41a5fd3..3bda390 100644
--- a/android/tester-avrcp.c
+++ b/android/tester-avrcp.c
@@ -17,7 +17,6 @@
 
 #include <stdbool.h>
 
-#include "emulator/bthost.h"
 #include "src/shared/util.h"
 
 #include "tester-main.h"
diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index 2be824d..6586a54 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -16,7 +16,6 @@
  */
 #include <stdbool.h>
 
-#include "emulator/bthost.h"
 #include "tester-main.h"
 
 static struct queue *list; /* List of bluetooth test cases */
diff --git a/android/tester-gatt.c b/android/tester-gatt.c
index de2a7a7..d8021d7 100644
--- a/android/tester-gatt.c
+++ b/android/tester-gatt.c
@@ -17,7 +17,6 @@
 
 #include <stdbool.h>
 
-#include "emulator/bthost.h"
 #include "tester-main.h"
 #include "src/shared/util.h"
 
diff --git a/android/tester-hdp.c b/android/tester-hdp.c
index ab7666d..195171d 100644
--- a/android/tester-hdp.c
+++ b/android/tester-hdp.c
@@ -17,7 +17,6 @@
 
 #include <stdbool.h>
 
-#include "emulator/bthost.h"
 #include "tester-main.h"
 #include "android/utils.h"
 
diff --git a/android/tester-hidhost.c b/android/tester-hidhost.c
index 95befd9..6214b4f 100644
--- a/android/tester-hidhost.c
+++ b/android/tester-hidhost.c
@@ -17,7 +17,6 @@
 
 #include <stdbool.h>
 
-#include "emulator/bthost.h"
 #include "tester-main.h"
 
 #include "android/utils.h"
diff --git a/android/tester-main.c b/android/tester-main.c
index 6339b3a..06730d2 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -17,7 +17,6 @@
 #include <stdbool.h>
 
 #include "src/shared/util.h"
-#include "emulator/bthost.h"
 #include "tester-main.h"
 
 #include "monitor/bt.h"
diff --git a/android/tester-main.h b/android/tester-main.h
index 474afbb..ae65d72 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
@@ -41,6 +41,7 @@
 #include "src/shared/mgmt.h"
 #include "src/shared/queue.h"
 #include "emulator/hciemu.h"
+#include "emulator/bthost.h"
 
 #include <hardware/hardware.h>
 #include <hardware/audio.h>
diff --git a/android/tester-pan.c b/android/tester-pan.c
index aff1980..1d07b22 100644
--- a/android/tester-pan.c
+++ b/android/tester-pan.c
@@ -17,7 +17,6 @@
 
 #include <stdbool.h>
 
-#include "emulator/bthost.h"
 #include "tester-main.h"
 #include "android/utils.h"
 
diff --git a/android/tester-socket.c b/android/tester-socket.c
index c70d753..bd0260c 100644
--- a/android/tester-socket.c
+++ b/android/tester-socket.c
@@ -18,7 +18,6 @@
 #include <fcntl.h>
 #include <stdbool.h>
 
-#include "emulator/bthost.h"
 #include "tester-main.h"
 
 static struct queue *list; /* List of socket test cases */
-- 
1.9.3


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

* [PATCH 5/5] android/tester: add initial support for map-client tester
  2014-12-08 10:35 [PATCH 1/5] android/tester: Add missing AVRCP cb_table entries Grzegorz Kolodziejczyk
                   ` (2 preceding siblings ...)
  2014-12-08 10:35 ` [PATCH 4/5] android/tester: move bthost.h include to tester-main.h Grzegorz Kolodziejczyk
@ 2014-12-08 10:35 ` Grzegorz Kolodziejczyk
  2014-12-10 12:56   ` Szymon Janc
  2014-12-10 12:43 ` [PATCH 1/5] android/tester: Add missing AVRCP cb_table entries Szymon Janc
  4 siblings, 1 reply; 11+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-12-08 10:35 UTC (permalink / raw)
  To: linux-bluetooth

This adds callback, callback verification, step verification, mas
instance verification, map client profile setup handling and basic
files.
---
 android/Makefile.am         |   1 +
 android/tester-main.c       | 160 ++++++++++++++++++++++++++++++++++++++++++++
 android/tester-main.h       |  18 +++++
 android/tester-map-client.c |  43 ++++++++++++
 4 files changed, 222 insertions(+)
 create mode 100644 android/tester-map-client.c

diff --git a/android/Makefile.am b/android/Makefile.am
index 6d74c05..deea6c3 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -154,6 +154,7 @@ android_android_tester_SOURCES = emulator/hciemu.h emulator/hciemu.c \
 				android/tester-a2dp.c \
 				android/tester-avrcp.c \
 				android/tester-gatt.c \
+				android/tester-map-client.c \
 				android/tester-main.h android/tester-main.c
 android_android_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
 				-DPLUGINDIR=\""$(android_plugindir)"\"
diff --git a/android/tester-main.c b/android/tester-main.c
index 06730d2..19d25fc 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
@@ -111,6 +111,9 @@ static struct {
 	DBG_CB(CB_GATTS_REQUEST_EXEC_WRITE),
 	DBG_CB(CB_GATTS_RESPONSE_CONFIRMATION),
 
+	/* Map client */
+	DBG_CB(CB_MAP_CLIENT_GET_REMOTE_MAS_INSTANCES),
+
 	/* Emulator callbacks */
 	DBG_CB(CB_EMU_CONFIRM_SEND_DATA),
 	DBG_CB(CB_EMU_ENCRYPTION_ENABLED),
@@ -484,6 +487,40 @@ static bool match_property(bt_property_t *exp_prop, bt_property_t *rec_prop,
 	return 1;
 }
 
+static bool match_mas_inst(btmce_mas_instance_t *exp_inst,
+				btmce_mas_instance_t *rec_inst, int inst_num)
+{
+	if (exp_inst->id && (exp_inst->id != rec_inst->id)) {
+		tester_debug("Mas instance [%d] id don't match! received=%d, "
+					"expected=%d", inst_num, rec_inst->id,
+					exp_inst->id);
+		return 0;
+	}
+
+	if (exp_inst->scn && (exp_inst->scn != exp_inst->scn)) {
+		tester_debug("Mas instance [%d] scn don't match! received=%d, "
+					"expected=%d", inst_num, rec_inst->scn,
+					exp_inst->scn);
+		return 0;
+	}
+
+	if (exp_inst->msg_types && (exp_inst->msg_types !=
+							exp_inst->msg_types)) {
+		tester_debug("Mas instance [%d] message type don't match! "
+					"received=%d, expected=%d", inst_num,
+					rec_inst->scn, exp_inst->scn);
+		return 0;
+	}
+
+	if (exp_inst->p_name && memcmp(exp_inst->p_name, rec_inst->p_name,
+						strlen(exp_inst->p_name))) {
+		tester_debug("Mas instance [%d] name don't match!", inst_num);
+		return 0;
+	}
+
+	return 1;
+}
+
 static int verify_property(bt_property_t *exp_props, int exp_num_props,
 				bt_property_t *rec_props, int rec_num_props)
 {
@@ -511,6 +548,33 @@ static int verify_property(bt_property_t *exp_props, int exp_num_props,
 	return exp_prop_to_find;
 }
 
+static int verify_mas_inst(btmce_mas_instance_t *exp_inst, int exp_num_inst,
+						btmce_mas_instance_t  *rec_inst,
+						int rec_num_inst)
+{
+	int i, j;
+	int exp_inst_to_find = exp_num_inst;
+
+	for (i = 0; i < exp_num_inst; i++) {
+		for (j = 0; j < rec_num_inst; j++) {
+			if (match_mas_inst(&exp_inst[i], &rec_inst[i], i)) {
+				exp_inst_to_find--;
+				break;
+			}
+		}
+	}
+
+	if ((i == 0) && exp_num_inst) {
+		tester_warn("No mas instance was verified: %s", exp_num_inst ?
+				"unknown error!" :
+				"wrong \'.callback_result.num_properties\'?");
+
+		return 1;
+	}
+
+	return exp_inst_to_find;
+}
+
 /*
  * Check each test case step if test case expected
  * data is set and match it with expected result.
@@ -945,6 +1009,15 @@ static bool match_data(struct step *step)
 		return false;
 	}
 
+	if (exp->callback_result.mas_instances &&
+		verify_mas_inst(exp->callback_result.mas_instances,
+				exp->callback_result.num_mas_instances,
+				step->callback_result.mas_instances,
+				step->callback_result.num_mas_instances)) {
+		tester_debug("Mas instances don't match");
+		return false;
+	}
+
 	if (exp->store_srvc_handle)
 		memcpy(exp->store_srvc_handle,
 					step->callback_result.srvc_handle,
@@ -2032,6 +2105,47 @@ static btrc_callbacks_t btavrcp_callbacks = {
 	.get_element_attr_cb = avrcp_get_element_attr_cb,
 };
 
+static btmce_mas_instance_t *copy_map_instances(int num_instances,
+						btmce_mas_instance_t *instances)
+{
+	int i;
+	btmce_mas_instance_t *inst = g_new0(btmce_mas_instance_t,
+								num_instances);
+
+	for (i = 0; i < num_instances; i++) {
+		inst[i].id = instances[i].id;
+		inst[i].scn = instances[i].scn;
+		inst[i].msg_types = instances[i].msg_types;
+		inst[i].p_name = g_memdup(instances[i].p_name,
+						strlen(instances[i].p_name));
+	}
+
+	return inst;
+}
+
+static void map_client_get_remote_mas_instances_cb(bt_status_t status,
+							bt_bdaddr_t *bd_addr,
+							int num_instances,
+							btmce_mas_instance_t
+							*instances)
+{
+	struct step *step = g_new0(struct step, 1);
+
+	step->callback_result.status = status;
+	step->callback_result.num_mas_instances = num_instances;
+	step->callback_result.mas_instances = copy_map_instances(num_instances,
+								instances);
+
+	step->callback = CB_MAP_CLIENT_GET_REMOTE_MAS_INSTANCES;
+
+	schedule_callback_verification(step);
+}
+
+static btmce_callbacks_t btmap_client_callbacks = {
+	.size = sizeof(btmap_client_callbacks),
+	.remote_mas_instances_cb = map_client_get_remote_mas_instances_cb,
+};
+
 static bool setup_base(struct test_data *data)
 {
 	const hw_module_t *module;
@@ -2396,6 +2510,44 @@ static void setup_gatt(const void *test_data)
 	tester_setup_complete();
 }
 
+static void setup_map_client(const void *test_data)
+{
+	struct test_data *data = tester_get_data();
+	bt_status_t status;
+	const void *map_client;
+
+	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;
+	}
+
+	map_client = data->if_bluetooth->get_profile_interface(
+						BT_PROFILE_MAP_CLIENT_ID);
+	if (!map_client) {
+		tester_setup_failed();
+		return;
+	}
+
+	data->if_map_client = map_client;
+
+	status = data->if_map_client->init(&btmap_client_callbacks);
+	if (status != BT_STATUS_SUCCESS) {
+		data->if_map_client = NULL;
+
+		tester_setup_failed();
+		return;
+	}
+
+	tester_setup_complete();
+}
+
 static void teardown(const void *test_data)
 {
 	struct test_data *data = tester_get_data();
@@ -3101,6 +3253,13 @@ static void add_gatt_tests(void *data, void *user_data)
 	test(tc, setup_gatt, generic_test_function, teardown);
 }
 
+static void add_map_client_tests(void *data, void *user_data)
+{
+	struct test_case *tc = data;
+
+	test(tc, setup_map_client, generic_test_function, teardown);
+}
+
 int main(int argc, char *argv[])
 {
 	snprintf(exec_dir, sizeof(exec_dir), "%s", dirname(argv[0]));
@@ -3115,6 +3274,7 @@ int main(int argc, char *argv[])
 	queue_foreach(get_a2dp_tests(), add_a2dp_tests, NULL);
 	queue_foreach(get_avrcp_tests(), add_avrcp_tests, NULL);
 	queue_foreach(get_gatt_tests(), add_gatt_tests, NULL);
+	queue_foreach(get_map_client_tests(), add_map_client_tests, NULL);
 
 	if (tester_run())
 		return 1;
diff --git a/android/tester-main.h b/android/tester-main.h
index ae65d72..55f5f5d 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
@@ -55,6 +55,7 @@
 #include <hardware/bt_gatt.h>
 #include <hardware/bt_gatt_client.h>
 #include <hardware/bt_gatt_server.h>
+#include <hardware/bt_mce.h>
 
 struct pdu_set {
 	struct iovec req;
@@ -539,6 +540,9 @@ typedef enum {
 	CB_GATTS_REQUEST_EXEC_WRITE,
 	CB_GATTS_RESPONSE_CONFIRMATION,
 
+	/* Map client */
+	CB_MAP_CLIENT_GET_REMOTE_MAS_INSTANCES,
+
 	/* Emulator callbacks */
 	CB_EMU_CONFIRM_SEND_DATA,
 	CB_EMU_ENCRYPTION_ENABLED,
@@ -566,6 +570,7 @@ struct test_data {
 	struct audio_stream_out *if_stream;
 	const btrc_interface_t *if_avrcp;
 	const btgatt_interface_t *if_gatt;
+	const btmce_interface_t *if_map_client;
 
 	const void *test_data;
 	struct queue *steps;
@@ -625,6 +630,14 @@ struct emu_l2cap_cid_data {
 	bool is_sdp;
 };
 
+struct map_inst_data {
+	int32_t id;
+	int32_t scn;
+	int32_t msg_types;
+	int32_t name_len;
+	uint8_t *name;
+};
+
 /*
  * Callback data structure should be enhanced with data
  * returned by callbacks. It's used for test case step
@@ -688,6 +701,9 @@ struct bt_callback_data {
 	uint64_t rc_index;
 	uint8_t num_of_attrs;
 	btrc_element_attr_val_t *attrs;
+
+	int num_mas_instances;
+	btmce_mas_instance_t *mas_instances;
 };
 
 /*
@@ -737,6 +753,8 @@ struct queue *get_avrcp_tests(void);
 void remove_avrcp_tests(void);
 struct queue *get_gatt_tests(void);
 void remove_gatt_tests(void);
+struct queue *get_map_client_tests(void);
+void remove_map_client_tests(void);
 
 /* Generic tester API */
 void schedule_action_verification(struct step *step);
diff --git a/android/tester-map-client.c b/android/tester-map-client.c
new file mode 100644
index 0000000..a2bb08f
--- /dev/null
+++ b/android/tester-map-client.c
@@ -0,0 +1,43 @@
+/*
+ * 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 "tester-main.h"
+
+static struct queue *list; /* List of map client test cases */
+
+static struct test_case test_cases[] = {
+	TEST_CASE_BREDRLE("MAP Client Init", ACTION_SUCCESS(dummy_action, NULL),
+	),
+};
+
+struct queue *get_map_client_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_map_client_tests(void)
+{
+	queue_destroy(list, NULL);
+}
-- 
1.9.3


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

* Re: [PATCH 1/5] android/tester: Add missing AVRCP cb_table entries
  2014-12-08 10:35 [PATCH 1/5] android/tester: Add missing AVRCP cb_table entries Grzegorz Kolodziejczyk
                   ` (3 preceding siblings ...)
  2014-12-08 10:35 ` [PATCH 5/5] android/tester: add initial support for map-client tester Grzegorz Kolodziejczyk
@ 2014-12-10 12:43 ` Szymon Janc
  2014-12-11  8:50   ` Grzegorz Kolodziejczyk
  4 siblings, 1 reply; 11+ messages in thread
From: Szymon Janc @ 2014-12-10 12:43 UTC (permalink / raw)
  To: Grzegorz Kolodziejczyk; +Cc: linux-bluetooth

Hi Grzegorz,

On Monday 08 of December 2014 11:35:04 Grzegorz Kolodziejczyk wrote:
> cb_table should be filled simultaneously with expected bt_callbacks
> enum. Without this, debug logs can cause errors.
> ---
>  android/tester-main.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/android/tester-main.c b/android/tester-main.c
> index 33ef3ce..8f3bc3c 100644
> --- a/android/tester-main.c
> +++ b/android/tester-main.c
> @@ -68,6 +68,14 @@ static struct {
>  	DBG_CB(CB_A2DP_CONN_STATE),
>  	DBG_CB(CB_A2DP_AUDIO_STATE),
> 
> +	/* AVRCP */
> +	DBG_CB(CB_AVRCP_PLAY_STATUS_REQ),
> +	DBG_CB(CB_AVRCP_PLAY_STATUS_RSP),
> +	DBG_CB(CB_AVRCP_REG_NOTIF_REQ),
> +	DBG_CB(CB_AVRCP_REG_NOTIF_RSP),
> +	DBG_CB(CB_AVRCP_GET_ATTR_REQ),
> +	DBG_CB(CB_AVRCP_GET_ATTR_RSP),
> +
>  	/* Gatt client */
>  	DBG_CB(CB_GATTC_REGISTER_CLIENT),
>  	DBG_CB(CB_GATTC_SCAN_RESULT),

Patches 1-3 are now applied, thanks.

Please remember that commit message should start from capital letter. I've 
fixed this for those patches.

-- 
BR
Szymon Janc

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

* Re: [PATCH 4/5] android/tester: move bthost.h include to tester-main.h
  2014-12-08 10:35 ` [PATCH 4/5] android/tester: move bthost.h include to tester-main.h Grzegorz Kolodziejczyk
@ 2014-12-10 12:45   ` Szymon Janc
  2014-12-11  8:51     ` Grzegorz Kolodziejczyk
  0 siblings, 1 reply; 11+ messages in thread
From: Szymon Janc @ 2014-12-10 12:45 UTC (permalink / raw)
  To: Grzegorz Kolodziejczyk; +Cc: linux-bluetooth

Hi Grzegorz,

On Monday 08 of December 2014 11:35:07 Grzegorz Kolodziejczyk wrote:
> bthost.h is used by all testers.
> ---
>  android/tester-a2dp.c      | 1 -
>  android/tester-avrcp.c     | 1 -
>  android/tester-bluetooth.c | 1 -
>  android/tester-gatt.c      | 1 -
>  android/tester-hdp.c       | 1 -
>  android/tester-hidhost.c   | 1 -
>  android/tester-main.c      | 1 -
>  android/tester-main.h      | 1 +
>  android/tester-pan.c       | 1 -
>  android/tester-socket.c    | 1 -
>  10 files changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/android/tester-a2dp.c b/android/tester-a2dp.c
> index 837477e..a2e7325 100644
> --- a/android/tester-a2dp.c
> +++ b/android/tester-a2dp.c
> @@ -17,7 +17,6 @@
> 
>  #include <stdbool.h>
> 
> -#include "emulator/bthost.h"
>  #include "src/shared/util.h"
> 
>  #include "tester-main.h"
> diff --git a/android/tester-avrcp.c b/android/tester-avrcp.c
> index 41a5fd3..3bda390 100644
> --- a/android/tester-avrcp.c
> +++ b/android/tester-avrcp.c
> @@ -17,7 +17,6 @@
> 
>  #include <stdbool.h>
> 
> -#include "emulator/bthost.h"
>  #include "src/shared/util.h"
> 
>  #include "tester-main.h"
> diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
> index 2be824d..6586a54 100644
> --- a/android/tester-bluetooth.c
> +++ b/android/tester-bluetooth.c
> @@ -16,7 +16,6 @@
>   */
>  #include <stdbool.h>
> 
> -#include "emulator/bthost.h"
>  #include "tester-main.h"
> 
>  static struct queue *list; /* List of bluetooth test cases */
> diff --git a/android/tester-gatt.c b/android/tester-gatt.c
> index de2a7a7..d8021d7 100644
> --- a/android/tester-gatt.c
> +++ b/android/tester-gatt.c
> @@ -17,7 +17,6 @@
> 
>  #include <stdbool.h>
> 
> -#include "emulator/bthost.h"
>  #include "tester-main.h"
>  #include "src/shared/util.h"
> 
> diff --git a/android/tester-hdp.c b/android/tester-hdp.c
> index ab7666d..195171d 100644
> --- a/android/tester-hdp.c
> +++ b/android/tester-hdp.c
> @@ -17,7 +17,6 @@
> 
>  #include <stdbool.h>
> 
> -#include "emulator/bthost.h"
>  #include "tester-main.h"
>  #include "android/utils.h"
> 
> diff --git a/android/tester-hidhost.c b/android/tester-hidhost.c
> index 95befd9..6214b4f 100644
> --- a/android/tester-hidhost.c
> +++ b/android/tester-hidhost.c
> @@ -17,7 +17,6 @@
> 
>  #include <stdbool.h>
> 
> -#include "emulator/bthost.h"
>  #include "tester-main.h"
> 
>  #include "android/utils.h"
> diff --git a/android/tester-main.c b/android/tester-main.c
> index 6339b3a..06730d2 100644
> --- a/android/tester-main.c
> +++ b/android/tester-main.c
> @@ -17,7 +17,6 @@
>  #include <stdbool.h>
> 
>  #include "src/shared/util.h"
> -#include "emulator/bthost.h"
>  #include "tester-main.h"
> 
>  #include "monitor/bt.h"
> diff --git a/android/tester-main.h b/android/tester-main.h
> index 474afbb..ae65d72 100644
> --- a/android/tester-main.h
> +++ b/android/tester-main.h
> @@ -41,6 +41,7 @@
>  #include "src/shared/mgmt.h"
>  #include "src/shared/queue.h"
>  #include "emulator/hciemu.h"
> +#include "emulator/bthost.h"
> 
>  #include <hardware/hardware.h>
>  #include <hardware/audio.h>
> diff --git a/android/tester-pan.c b/android/tester-pan.c
> index aff1980..1d07b22 100644
> --- a/android/tester-pan.c
> +++ b/android/tester-pan.c
> @@ -17,7 +17,6 @@
> 
>  #include <stdbool.h>
> 
> -#include "emulator/bthost.h"
>  #include "tester-main.h"
>  #include "android/utils.h"
> 
> diff --git a/android/tester-socket.c b/android/tester-socket.c
> index c70d753..bd0260c 100644
> --- a/android/tester-socket.c
> +++ b/android/tester-socket.c
> @@ -18,7 +18,6 @@
>  #include <fcntl.h>
>  #include <stdbool.h>
> 
> -#include "emulator/bthost.h"
>  #include "tester-main.h"
> 
>  static struct queue *list; /* List of socket test cases */

We should do opposite. I'd prefer headers to not include other headers if 
possible. C files should include what is needed for compilation (especially 
when it is internal header).

-- 
BR
Szymon Janc

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

* Re: [PATCH 5/5] android/tester: add initial support for map-client tester
  2014-12-08 10:35 ` [PATCH 5/5] android/tester: add initial support for map-client tester Grzegorz Kolodziejczyk
@ 2014-12-10 12:56   ` Szymon Janc
  2014-12-11  8:58     ` Grzegorz Kolodziejczyk
  0 siblings, 1 reply; 11+ messages in thread
From: Szymon Janc @ 2014-12-10 12:56 UTC (permalink / raw)
  To: Grzegorz Kolodziejczyk; +Cc: linux-bluetooth

Hi Grzegorz,

Start commit message with capital letter.

On Monday 08 of December 2014 11:35:08 Grzegorz Kolodziejczyk wrote:
> This adds callback, callback verification, step verification, mas
> instance verification, map client profile setup handling and basic
> files.
> ---
>  android/Makefile.am         |   1 +
>  android/tester-main.c       | 160
> ++++++++++++++++++++++++++++++++++++++++++++ android/tester-main.h       | 
> 18 +++++
>  android/tester-map-client.c |  43 ++++++++++++
>  4 files changed, 222 insertions(+)
>  create mode 100644 android/tester-map-client.c
> 
> diff --git a/android/Makefile.am b/android/Makefile.am
> index 6d74c05..deea6c3 100644
> --- a/android/Makefile.am
> +++ b/android/Makefile.am
> @@ -154,6 +154,7 @@ android_android_tester_SOURCES = emulator/hciemu.h
> emulator/hciemu.c \ android/tester-a2dp.c \
>  				android/tester-avrcp.c \
>  				android/tester-gatt.c \
> +				android/tester-map-client.c \
>  				android/tester-main.h android/tester-main.c
>  android_android_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
>  				-DPLUGINDIR=\""$(android_plugindir)"\"
> diff --git a/android/tester-main.c b/android/tester-main.c
> index 06730d2..19d25fc 100644
> --- a/android/tester-main.c
> +++ b/android/tester-main.c
> @@ -111,6 +111,9 @@ static struct {
>  	DBG_CB(CB_GATTS_REQUEST_EXEC_WRITE),
>  	DBG_CB(CB_GATTS_RESPONSE_CONFIRMATION),
> 
> +	/* Map client */
> +	DBG_CB(CB_MAP_CLIENT_GET_REMOTE_MAS_INSTANCES),
> +
>  	/* Emulator callbacks */
>  	DBG_CB(CB_EMU_CONFIRM_SEND_DATA),
>  	DBG_CB(CB_EMU_ENCRYPTION_ENABLED),
> @@ -484,6 +487,40 @@ static bool match_property(bt_property_t *exp_prop,
> bt_property_t *rec_prop, return 1;
>  }
> 
> +static bool match_mas_inst(btmce_mas_instance_t *exp_inst,
> +				btmce_mas_instance_t *rec_inst, int inst_num)
> +{
> +	if (exp_inst->id && (exp_inst->id != rec_inst->id)) {
> +		tester_debug("Mas instance [%d] id don't match! received=%d, "
> +					"expected=%d", inst_num, rec_inst->id,
> +					exp_inst->id);

Something is wrong with this indentation. Also I'd prefer if you could try not 
breaking formatting strings.

> +		return 0;
> +	}
> +
> +	if (exp_inst->scn && (exp_inst->scn != exp_inst->scn)) {
> +		tester_debug("Mas instance [%d] scn don't match! received=%d, "
> +					"expected=%d", inst_num, rec_inst->scn,
> +					exp_inst->scn);
> +		return 0;
> +	}
> +
> +	if (exp_inst->msg_types && (exp_inst->msg_types !=
> +							exp_inst->msg_types)) {
> +		tester_debug("Mas instance [%d] message type don't match! "
> +					"received=%d, expected=%d", inst_num,
> +					rec_inst->scn, exp_inst->scn);
> +		return 0;
> +	}
> +
> +	if (exp_inst->p_name && memcmp(exp_inst->p_name, rec_inst->p_name,
> +						strlen(exp_inst->p_name))) {
> +		tester_debug("Mas instance [%d] name don't match!", inst_num);
> +		return 0;
> +	}
> +
> +	return 1;
> +}
> +
>  static int verify_property(bt_property_t *exp_props, int exp_num_props,
>  				bt_property_t *rec_props, int rec_num_props)
>  {
> @@ -511,6 +548,33 @@ static int verify_property(bt_property_t *exp_props,
> int exp_num_props, return exp_prop_to_find;
>  }
> 
> +static int verify_mas_inst(btmce_mas_instance_t *exp_inst, int
> exp_num_inst, +						btmce_mas_instance_t  *rec_inst,
> +						int rec_num_inst)
> +{

Some coding style violation here.

> +	int i, j;
> +	int exp_inst_to_find = exp_num_inst;
> +
> +	for (i = 0; i < exp_num_inst; i++) {
> +		for (j = 0; j < rec_num_inst; j++) {
> +			if (match_mas_inst(&exp_inst[i], &rec_inst[i], i)) {
> +				exp_inst_to_find--;
> +				break;
> +			}
> +		}
> +	}
> +
> +	if ((i == 0) && exp_num_inst) {
> +		tester_warn("No mas instance was verified: %s", exp_num_inst ?
> +				"unknown error!" :
> +				"wrong \'.callback_result.num_properties\'?");
> +

This is ugly. Make those messages shorter.

> +		return 1;
> +	}
> +
> +	return exp_inst_to_find;
> +}
> +
>  /*
>   * Check each test case step if test case expected
>   * data is set and match it with expected result.
> @@ -945,6 +1009,15 @@ static bool match_data(struct step *step)
>  		return false;
>  	}
> 
> +	if (exp->callback_result.mas_instances &&
> +		verify_mas_inst(exp->callback_result.mas_instances,
> +				exp->callback_result.num_mas_instances,
> +				step->callback_result.mas_instances,
> +				step->callback_result.num_mas_instances)) {
> +		tester_debug("Mas instances don't match");
> +		return false;
> +	}
> +
>  	if (exp->store_srvc_handle)
>  		memcpy(exp->store_srvc_handle,
>  					step->callback_result.srvc_handle,
> @@ -2032,6 +2105,47 @@ static btrc_callbacks_t btavrcp_callbacks = {
>  	.get_element_attr_cb = avrcp_get_element_attr_cb,
>  };
> 
> +static btmce_mas_instance_t *copy_map_instances(int num_instances,
> +						btmce_mas_instance_t *instances)
> +{
> +	int i;
> +	btmce_mas_instance_t *inst = g_new0(btmce_mas_instance_t,
> +								num_instances);

Just put this into new line.

> +
> +	for (i = 0; i < num_instances; i++) {
> +		inst[i].id = instances[i].id;
> +		inst[i].scn = instances[i].scn;
> +		inst[i].msg_types = instances[i].msg_types;
> +		inst[i].p_name = g_memdup(instances[i].p_name,
> +						strlen(instances[i].p_name));
> +	}
> +
> +	return inst;
> +}
> +
> +static void map_client_get_remote_mas_instances_cb(bt_status_t status,
> +							bt_bdaddr_t *bd_addr,
> +							int num_instances,
> +							btmce_mas_instance_t
> +							*instances)
> +{
> +	struct step *step = g_new0(struct step, 1);
> +
> +	step->callback_result.status = status;
> +	step->callback_result.num_mas_instances = num_instances;
> +	step->callback_result.mas_instances = copy_map_instances(num_instances,
> +								instances);
> +
> +	step->callback = CB_MAP_CLIENT_GET_REMOTE_MAS_INSTANCES;
> +
> +	schedule_callback_verification(step);
> +}
> +
> +static btmce_callbacks_t btmap_client_callbacks = {
> +	.size = sizeof(btmap_client_callbacks),
> +	.remote_mas_instances_cb = map_client_get_remote_mas_instances_cb,
> +};
> +
>  static bool setup_base(struct test_data *data)
>  {
>  	const hw_module_t *module;
> @@ -2396,6 +2510,44 @@ static void setup_gatt(const void *test_data)
>  	tester_setup_complete();
>  }
> 
> +static void setup_map_client(const void *test_data)
> +{
> +	struct test_data *data = tester_get_data();
> +	bt_status_t status;
> +	const void *map_client;
> +
> +	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;
> +	}
> +
> +	map_client = data->if_bluetooth->get_profile_interface(
> +						BT_PROFILE_MAP_CLIENT_ID);
> +	if (!map_client) {
> +		tester_setup_failed();
> +		return;
> +	}
> +
> +	data->if_map_client = map_client;
> +
> +	status = data->if_map_client->init(&btmap_client_callbacks);
> +	if (status != BT_STATUS_SUCCESS) {
> +		data->if_map_client = NULL;
> +
> +		tester_setup_failed();
> +		return;
> +	}
> +
> +	tester_setup_complete();
> +}
> +
>  static void teardown(const void *test_data)
>  {
>  	struct test_data *data = tester_get_data();
> @@ -3101,6 +3253,13 @@ static void add_gatt_tests(void *data, void
> *user_data) test(tc, setup_gatt, generic_test_function, teardown);
>  }
> 
> +static void add_map_client_tests(void *data, void *user_data)
> +{
> +	struct test_case *tc = data;
> +
> +	test(tc, setup_map_client, generic_test_function, teardown);
> +}
> +
>  int main(int argc, char *argv[])
>  {
>  	snprintf(exec_dir, sizeof(exec_dir), "%s", dirname(argv[0]));
> @@ -3115,6 +3274,7 @@ int main(int argc, char *argv[])
>  	queue_foreach(get_a2dp_tests(), add_a2dp_tests, NULL);
>  	queue_foreach(get_avrcp_tests(), add_avrcp_tests, NULL);
>  	queue_foreach(get_gatt_tests(), add_gatt_tests, NULL);
> +	queue_foreach(get_map_client_tests(), add_map_client_tests, NULL);
> 
>  	if (tester_run())
>  		return 1;
> diff --git a/android/tester-main.h b/android/tester-main.h
> index ae65d72..55f5f5d 100644
> --- a/android/tester-main.h
> +++ b/android/tester-main.h
> @@ -55,6 +55,7 @@
>  #include <hardware/bt_gatt.h>
>  #include <hardware/bt_gatt_client.h>
>  #include <hardware/bt_gatt_server.h>
> +#include <hardware/bt_mce.h>
> 
>  struct pdu_set {
>  	struct iovec req;
> @@ -539,6 +540,9 @@ typedef enum {
>  	CB_GATTS_REQUEST_EXEC_WRITE,
>  	CB_GATTS_RESPONSE_CONFIRMATION,
> 
> +	/* Map client */
> +	CB_MAP_CLIENT_GET_REMOTE_MAS_INSTANCES,
> +
>  	/* Emulator callbacks */
>  	CB_EMU_CONFIRM_SEND_DATA,
>  	CB_EMU_ENCRYPTION_ENABLED,
> @@ -566,6 +570,7 @@ struct test_data {
>  	struct audio_stream_out *if_stream;
>  	const btrc_interface_t *if_avrcp;
>  	const btgatt_interface_t *if_gatt;
> +	const btmce_interface_t *if_map_client;
> 
>  	const void *test_data;
>  	struct queue *steps;
> @@ -625,6 +630,14 @@ struct emu_l2cap_cid_data {
>  	bool is_sdp;
>  };
> 
> +struct map_inst_data {
> +	int32_t id;
> +	int32_t scn;
> +	int32_t msg_types;
> +	int32_t name_len;
> +	uint8_t *name;
> +};
> +
>  /*
>   * Callback data structure should be enhanced with data
>   * returned by callbacks. It's used for test case step
> @@ -688,6 +701,9 @@ struct bt_callback_data {
>  	uint64_t rc_index;
>  	uint8_t num_of_attrs;
>  	btrc_element_attr_val_t *attrs;
> +
> +	int num_mas_instances;
> +	btmce_mas_instance_t *mas_instances;
>  };
> 
>  /*
> @@ -737,6 +753,8 @@ struct queue *get_avrcp_tests(void);
>  void remove_avrcp_tests(void);
>  struct queue *get_gatt_tests(void);
>  void remove_gatt_tests(void);
> +struct queue *get_map_client_tests(void);
> +void remove_map_client_tests(void);
> 
>  /* Generic tester API */
>  void schedule_action_verification(struct step *step);
> diff --git a/android/tester-map-client.c b/android/tester-map-client.c
> new file mode 100644
> index 0000000..a2bb08f
> --- /dev/null
> +++ b/android/tester-map-client.c
> @@ -0,0 +1,43 @@
> +/*
> + * 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 "tester-main.h"
> +
> +static struct queue *list; /* List of map client test cases */
> +
> +static struct test_case test_cases[] = {
> +	TEST_CASE_BREDRLE("MAP Client Init", ACTION_SUCCESS(dummy_action, NULL),
> +	),
> +};
> +
> +struct queue *get_map_client_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;
> +

This probably makes static checkers unhappy. I'd prefer you explicitly check 
if queue_new() succeed and clean it up if push failed.

(you may also want to fix that in other testers)

> +	return list;
> +}
> +
> +void remove_map_client_tests(void)
> +{
> +	queue_destroy(list, NULL);
> +}

-- 
BR
Szymon Janc

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

* Re: [PATCH 1/5] android/tester: Add missing AVRCP cb_table entries
  2014-12-10 12:43 ` [PATCH 1/5] android/tester: Add missing AVRCP cb_table entries Szymon Janc
@ 2014-12-11  8:50   ` Grzegorz Kolodziejczyk
  0 siblings, 0 replies; 11+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-12-11  8:50 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth

Hi Szymon,

On 10 December 2014 at 13:43, Szymon Janc <szymon.janc@tieto.com> wrote:
> Hi Grzegorz,
>
> On Monday 08 of December 2014 11:35:04 Grzegorz Kolodziejczyk wrote:
>> cb_table should be filled simultaneously with expected bt_callbacks
>> enum. Without this, debug logs can cause errors.
>> ---
>>  android/tester-main.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/android/tester-main.c b/android/tester-main.c
>> index 33ef3ce..8f3bc3c 100644
>> --- a/android/tester-main.c
>> +++ b/android/tester-main.c
>> @@ -68,6 +68,14 @@ static struct {
>>       DBG_CB(CB_A2DP_CONN_STATE),
>>       DBG_CB(CB_A2DP_AUDIO_STATE),
>>
>> +     /* AVRCP */
>> +     DBG_CB(CB_AVRCP_PLAY_STATUS_REQ),
>> +     DBG_CB(CB_AVRCP_PLAY_STATUS_RSP),
>> +     DBG_CB(CB_AVRCP_REG_NOTIF_REQ),
>> +     DBG_CB(CB_AVRCP_REG_NOTIF_RSP),
>> +     DBG_CB(CB_AVRCP_GET_ATTR_REQ),
>> +     DBG_CB(CB_AVRCP_GET_ATTR_RSP),
>> +
>>       /* Gatt client */
>>       DBG_CB(CB_GATTC_REGISTER_CLIENT),
>>       DBG_CB(CB_GATTC_SCAN_RESULT),
>
> Patches 1-3 are now applied, thanks.
>
> Please remember that commit message should start from capital letter. I've
> fixed this for those patches.

I'll try to remember.
>
> --
> BR
> Szymon Janc

BR
Grzegorz Kolodziejczyk

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

* Re: [PATCH 4/5] android/tester: move bthost.h include to tester-main.h
  2014-12-10 12:45   ` Szymon Janc
@ 2014-12-11  8:51     ` Grzegorz Kolodziejczyk
  0 siblings, 0 replies; 11+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-12-11  8:51 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth

Hi Szymon,

On 10 December 2014 at 13:45, Szymon Janc <szymon.janc@tieto.com> wrote:
> Hi Grzegorz,
>
> On Monday 08 of December 2014 11:35:07 Grzegorz Kolodziejczyk wrote:
>> bthost.h is used by all testers.
>> ---
>>  android/tester-a2dp.c      | 1 -
>>  android/tester-avrcp.c     | 1 -
>>  android/tester-bluetooth.c | 1 -
>>  android/tester-gatt.c      | 1 -
>>  android/tester-hdp.c       | 1 -
>>  android/tester-hidhost.c   | 1 -
>>  android/tester-main.c      | 1 -
>>  android/tester-main.h      | 1 +
>>  android/tester-pan.c       | 1 -
>>  android/tester-socket.c    | 1 -
>>  10 files changed, 1 insertion(+), 9 deletions(-)
>>
>> diff --git a/android/tester-a2dp.c b/android/tester-a2dp.c
>> index 837477e..a2e7325 100644
>> --- a/android/tester-a2dp.c
>> +++ b/android/tester-a2dp.c
>> @@ -17,7 +17,6 @@
>>
>>  #include <stdbool.h>
>>
>> -#include "emulator/bthost.h"
>>  #include "src/shared/util.h"
>>
>>  #include "tester-main.h"
>> diff --git a/android/tester-avrcp.c b/android/tester-avrcp.c
>> index 41a5fd3..3bda390 100644
>> --- a/android/tester-avrcp.c
>> +++ b/android/tester-avrcp.c
>> @@ -17,7 +17,6 @@
>>
>>  #include <stdbool.h>
>>
>> -#include "emulator/bthost.h"
>>  #include "src/shared/util.h"
>>
>>  #include "tester-main.h"
>> diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
>> index 2be824d..6586a54 100644
>> --- a/android/tester-bluetooth.c
>> +++ b/android/tester-bluetooth.c
>> @@ -16,7 +16,6 @@
>>   */
>>  #include <stdbool.h>
>>
>> -#include "emulator/bthost.h"
>>  #include "tester-main.h"
>>
>>  static struct queue *list; /* List of bluetooth test cases */
>> diff --git a/android/tester-gatt.c b/android/tester-gatt.c
>> index de2a7a7..d8021d7 100644
>> --- a/android/tester-gatt.c
>> +++ b/android/tester-gatt.c
>> @@ -17,7 +17,6 @@
>>
>>  #include <stdbool.h>
>>
>> -#include "emulator/bthost.h"
>>  #include "tester-main.h"
>>  #include "src/shared/util.h"
>>
>> diff --git a/android/tester-hdp.c b/android/tester-hdp.c
>> index ab7666d..195171d 100644
>> --- a/android/tester-hdp.c
>> +++ b/android/tester-hdp.c
>> @@ -17,7 +17,6 @@
>>
>>  #include <stdbool.h>
>>
>> -#include "emulator/bthost.h"
>>  #include "tester-main.h"
>>  #include "android/utils.h"
>>
>> diff --git a/android/tester-hidhost.c b/android/tester-hidhost.c
>> index 95befd9..6214b4f 100644
>> --- a/android/tester-hidhost.c
>> +++ b/android/tester-hidhost.c
>> @@ -17,7 +17,6 @@
>>
>>  #include <stdbool.h>
>>
>> -#include "emulator/bthost.h"
>>  #include "tester-main.h"
>>
>>  #include "android/utils.h"
>> diff --git a/android/tester-main.c b/android/tester-main.c
>> index 6339b3a..06730d2 100644
>> --- a/android/tester-main.c
>> +++ b/android/tester-main.c
>> @@ -17,7 +17,6 @@
>>  #include <stdbool.h>
>>
>>  #include "src/shared/util.h"
>> -#include "emulator/bthost.h"
>>  #include "tester-main.h"
>>
>>  #include "monitor/bt.h"
>> diff --git a/android/tester-main.h b/android/tester-main.h
>> index 474afbb..ae65d72 100644
>> --- a/android/tester-main.h
>> +++ b/android/tester-main.h
>> @@ -41,6 +41,7 @@
>>  #include "src/shared/mgmt.h"
>>  #include "src/shared/queue.h"
>>  #include "emulator/hciemu.h"
>> +#include "emulator/bthost.h"
>>
>>  #include <hardware/hardware.h>
>>  #include <hardware/audio.h>
>> diff --git a/android/tester-pan.c b/android/tester-pan.c
>> index aff1980..1d07b22 100644
>> --- a/android/tester-pan.c
>> +++ b/android/tester-pan.c
>> @@ -17,7 +17,6 @@
>>
>>  #include <stdbool.h>
>>
>> -#include "emulator/bthost.h"
>>  #include "tester-main.h"
>>  #include "android/utils.h"
>>
>> diff --git a/android/tester-socket.c b/android/tester-socket.c
>> index c70d753..bd0260c 100644
>> --- a/android/tester-socket.c
>> +++ b/android/tester-socket.c
>> @@ -18,7 +18,6 @@
>>  #include <fcntl.h>
>>  #include <stdbool.h>
>>
>> -#include "emulator/bthost.h"
>>  #include "tester-main.h"
>>
>>  static struct queue *list; /* List of socket test cases */
>
> We should do opposite. I'd prefer headers to not include other headers if
> possible. C files should include what is needed for compilation (especially
> when it is internal header).
>
Ok, I'll do this in opposite.
> --
> BR
> Szymon Janc


BR,
Grzegorz Kolodziejczyk

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

* Re: [PATCH 5/5] android/tester: add initial support for map-client tester
  2014-12-10 12:56   ` Szymon Janc
@ 2014-12-11  8:58     ` Grzegorz Kolodziejczyk
  0 siblings, 0 replies; 11+ messages in thread
From: Grzegorz Kolodziejczyk @ 2014-12-11  8:58 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth

Hi Szymon,

On 10 December 2014 at 13:56, Szymon Janc <szymon.janc@tieto.com> wrote:
> Hi Grzegorz,
>
> Start commit message with capital letter.
>
> On Monday 08 of December 2014 11:35:08 Grzegorz Kolodziejczyk wrote:
>> This adds callback, callback verification, step verification, mas
>> instance verification, map client profile setup handling and basic
>> files.
>> ---
>>  android/Makefile.am         |   1 +
>>  android/tester-main.c       | 160
>> ++++++++++++++++++++++++++++++++++++++++++++ android/tester-main.h       |
>> 18 +++++
>>  android/tester-map-client.c |  43 ++++++++++++
>>  4 files changed, 222 insertions(+)
>>  create mode 100644 android/tester-map-client.c
>>
>> diff --git a/android/Makefile.am b/android/Makefile.am
>> index 6d74c05..deea6c3 100644
>> --- a/android/Makefile.am
>> +++ b/android/Makefile.am
>> @@ -154,6 +154,7 @@ android_android_tester_SOURCES = emulator/hciemu.h
>> emulator/hciemu.c \ android/tester-a2dp.c \
>>                               android/tester-avrcp.c \
>>                               android/tester-gatt.c \
>> +                             android/tester-map-client.c \
>>                               android/tester-main.h android/tester-main.c
>>  android_android_tester_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
>>                               -DPLUGINDIR=\""$(android_plugindir)"\"
>> diff --git a/android/tester-main.c b/android/tester-main.c
>> index 06730d2..19d25fc 100644
>> --- a/android/tester-main.c
>> +++ b/android/tester-main.c
>> @@ -111,6 +111,9 @@ static struct {
>>       DBG_CB(CB_GATTS_REQUEST_EXEC_WRITE),
>>       DBG_CB(CB_GATTS_RESPONSE_CONFIRMATION),
>>
>> +     /* Map client */
>> +     DBG_CB(CB_MAP_CLIENT_GET_REMOTE_MAS_INSTANCES),
>> +
>>       /* Emulator callbacks */
>>       DBG_CB(CB_EMU_CONFIRM_SEND_DATA),
>>       DBG_CB(CB_EMU_ENCRYPTION_ENABLED),
>> @@ -484,6 +487,40 @@ static bool match_property(bt_property_t *exp_prop,
>> bt_property_t *rec_prop, return 1;
>>  }
>>
>> +static bool match_mas_inst(btmce_mas_instance_t *exp_inst,
>> +                             btmce_mas_instance_t *rec_inst, int inst_num)
>> +{
>> +     if (exp_inst->id && (exp_inst->id != rec_inst->id)) {
>> +             tester_debug("Mas instance [%d] id don't match! received=%d, "
>> +                                     "expected=%d", inst_num, rec_inst->id,
>> +                                     exp_inst->id);
>
> Something is wrong with this indentation. Also I'd prefer if you could try not
> breaking formatting strings.
>
>> +             return 0;
>> +     }
>> +
>> +     if (exp_inst->scn && (exp_inst->scn != exp_inst->scn)) {
>> +             tester_debug("Mas instance [%d] scn don't match! received=%d, "
>> +                                     "expected=%d", inst_num, rec_inst->scn,
>> +                                     exp_inst->scn);
>> +             return 0;
>> +     }
>> +
>> +     if (exp_inst->msg_types && (exp_inst->msg_types !=
>> +                                                     exp_inst->msg_types)) {
>> +             tester_debug("Mas instance [%d] message type don't match! "
>> +                                     "received=%d, expected=%d", inst_num,
>> +                                     rec_inst->scn, exp_inst->scn);
>> +             return 0;
>> +     }
>> +
>> +     if (exp_inst->p_name && memcmp(exp_inst->p_name, rec_inst->p_name,
>> +                                             strlen(exp_inst->p_name))) {
>> +             tester_debug("Mas instance [%d] name don't match!", inst_num);
>> +             return 0;
>> +     }
>> +
>> +     return 1;
>> +}
>> +
>>  static int verify_property(bt_property_t *exp_props, int exp_num_props,
>>                               bt_property_t *rec_props, int rec_num_props)
>>  {
>> @@ -511,6 +548,33 @@ static int verify_property(bt_property_t *exp_props,
>> int exp_num_props, return exp_prop_to_find;
>>  }
>>
>> +static int verify_mas_inst(btmce_mas_instance_t *exp_inst, int
>> exp_num_inst, +                                               btmce_mas_instance_t  *rec_inst,
>> +                                             int rec_num_inst)
>> +{
>
> Some coding style violation here.
>
>> +     int i, j;
>> +     int exp_inst_to_find = exp_num_inst;
>> +
>> +     for (i = 0; i < exp_num_inst; i++) {
>> +             for (j = 0; j < rec_num_inst; j++) {
>> +                     if (match_mas_inst(&exp_inst[i], &rec_inst[i], i)) {
>> +                             exp_inst_to_find--;
>> +                             break;
>> +                     }
>> +             }
>> +     }
>> +
>> +     if ((i == 0) && exp_num_inst) {
>> +             tester_warn("No mas instance was verified: %s", exp_num_inst ?
>> +                             "unknown error!" :
>> +                             "wrong \'.callback_result.num_properties\'?");
>> +
>
> This is ugly. Make those messages shorter.
>
>> +             return 1;
>> +     }
>> +
>> +     return exp_inst_to_find;
>> +}
>> +
>>  /*
>>   * Check each test case step if test case expected
>>   * data is set and match it with expected result.
>> @@ -945,6 +1009,15 @@ static bool match_data(struct step *step)
>>               return false;
>>       }
>>
>> +     if (exp->callback_result.mas_instances &&
>> +             verify_mas_inst(exp->callback_result.mas_instances,
>> +                             exp->callback_result.num_mas_instances,
>> +                             step->callback_result.mas_instances,
>> +                             step->callback_result.num_mas_instances)) {
>> +             tester_debug("Mas instances don't match");
>> +             return false;
>> +     }
>> +
>>       if (exp->store_srvc_handle)
>>               memcpy(exp->store_srvc_handle,
>>                                       step->callback_result.srvc_handle,
>> @@ -2032,6 +2105,47 @@ static btrc_callbacks_t btavrcp_callbacks = {
>>       .get_element_attr_cb = avrcp_get_element_attr_cb,
>>  };
>>
>> +static btmce_mas_instance_t *copy_map_instances(int num_instances,
>> +                                             btmce_mas_instance_t *instances)
>> +{
>> +     int i;
>> +     btmce_mas_instance_t *inst = g_new0(btmce_mas_instance_t,
>> +                                                             num_instances);
>
> Just put this into new line.
>
>> +
>> +     for (i = 0; i < num_instances; i++) {
>> +             inst[i].id = instances[i].id;
>> +             inst[i].scn = instances[i].scn;
>> +             inst[i].msg_types = instances[i].msg_types;
>> +             inst[i].p_name = g_memdup(instances[i].p_name,
>> +                                             strlen(instances[i].p_name));
>> +     }
>> +
>> +     return inst;
>> +}
>> +
>> +static void map_client_get_remote_mas_instances_cb(bt_status_t status,
>> +                                                     bt_bdaddr_t *bd_addr,
>> +                                                     int num_instances,
>> +                                                     btmce_mas_instance_t
>> +                                                     *instances)
>> +{
>> +     struct step *step = g_new0(struct step, 1);
>> +
>> +     step->callback_result.status = status;
>> +     step->callback_result.num_mas_instances = num_instances;
>> +     step->callback_result.mas_instances = copy_map_instances(num_instances,
>> +                                                             instances);
>> +
>> +     step->callback = CB_MAP_CLIENT_GET_REMOTE_MAS_INSTANCES;
>> +
>> +     schedule_callback_verification(step);
>> +}
>> +
>> +static btmce_callbacks_t btmap_client_callbacks = {
>> +     .size = sizeof(btmap_client_callbacks),
>> +     .remote_mas_instances_cb = map_client_get_remote_mas_instances_cb,
>> +};
>> +
>>  static bool setup_base(struct test_data *data)
>>  {
>>       const hw_module_t *module;
>> @@ -2396,6 +2510,44 @@ static void setup_gatt(const void *test_data)
>>       tester_setup_complete();
>>  }
>>
>> +static void setup_map_client(const void *test_data)
>> +{
>> +     struct test_data *data = tester_get_data();
>> +     bt_status_t status;
>> +     const void *map_client;
>> +
>> +     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;
>> +     }
>> +
>> +     map_client = data->if_bluetooth->get_profile_interface(
>> +                                             BT_PROFILE_MAP_CLIENT_ID);
>> +     if (!map_client) {
>> +             tester_setup_failed();
>> +             return;
>> +     }
>> +
>> +     data->if_map_client = map_client;
>> +
>> +     status = data->if_map_client->init(&btmap_client_callbacks);
>> +     if (status != BT_STATUS_SUCCESS) {
>> +             data->if_map_client = NULL;
>> +
>> +             tester_setup_failed();
>> +             return;
>> +     }
>> +
>> +     tester_setup_complete();
>> +}
>> +
>>  static void teardown(const void *test_data)
>>  {
>>       struct test_data *data = tester_get_data();
>> @@ -3101,6 +3253,13 @@ static void add_gatt_tests(void *data, void
>> *user_data) test(tc, setup_gatt, generic_test_function, teardown);
>>  }
>>
>> +static void add_map_client_tests(void *data, void *user_data)
>> +{
>> +     struct test_case *tc = data;
>> +
>> +     test(tc, setup_map_client, generic_test_function, teardown);
>> +}
>> +
>>  int main(int argc, char *argv[])
>>  {
>>       snprintf(exec_dir, sizeof(exec_dir), "%s", dirname(argv[0]));
>> @@ -3115,6 +3274,7 @@ int main(int argc, char *argv[])
>>       queue_foreach(get_a2dp_tests(), add_a2dp_tests, NULL);
>>       queue_foreach(get_avrcp_tests(), add_avrcp_tests, NULL);
>>       queue_foreach(get_gatt_tests(), add_gatt_tests, NULL);
>> +     queue_foreach(get_map_client_tests(), add_map_client_tests, NULL);
>>
>>       if (tester_run())
>>               return 1;
>> diff --git a/android/tester-main.h b/android/tester-main.h
>> index ae65d72..55f5f5d 100644
>> --- a/android/tester-main.h
>> +++ b/android/tester-main.h
>> @@ -55,6 +55,7 @@
>>  #include <hardware/bt_gatt.h>
>>  #include <hardware/bt_gatt_client.h>
>>  #include <hardware/bt_gatt_server.h>
>> +#include <hardware/bt_mce.h>
>>
>>  struct pdu_set {
>>       struct iovec req;
>> @@ -539,6 +540,9 @@ typedef enum {
>>       CB_GATTS_REQUEST_EXEC_WRITE,
>>       CB_GATTS_RESPONSE_CONFIRMATION,
>>
>> +     /* Map client */
>> +     CB_MAP_CLIENT_GET_REMOTE_MAS_INSTANCES,
>> +
>>       /* Emulator callbacks */
>>       CB_EMU_CONFIRM_SEND_DATA,
>>       CB_EMU_ENCRYPTION_ENABLED,
>> @@ -566,6 +570,7 @@ struct test_data {
>>       struct audio_stream_out *if_stream;
>>       const btrc_interface_t *if_avrcp;
>>       const btgatt_interface_t *if_gatt;
>> +     const btmce_interface_t *if_map_client;
>>
>>       const void *test_data;
>>       struct queue *steps;
>> @@ -625,6 +630,14 @@ struct emu_l2cap_cid_data {
>>       bool is_sdp;
>>  };
>>
>> +struct map_inst_data {
>> +     int32_t id;
>> +     int32_t scn;
>> +     int32_t msg_types;
>> +     int32_t name_len;
>> +     uint8_t *name;
>> +};
>> +
>>  /*
>>   * Callback data structure should be enhanced with data
>>   * returned by callbacks. It's used for test case step
>> @@ -688,6 +701,9 @@ struct bt_callback_data {
>>       uint64_t rc_index;
>>       uint8_t num_of_attrs;
>>       btrc_element_attr_val_t *attrs;
>> +
>> +     int num_mas_instances;
>> +     btmce_mas_instance_t *mas_instances;
>>  };
>>
>>  /*
>> @@ -737,6 +753,8 @@ struct queue *get_avrcp_tests(void);
>>  void remove_avrcp_tests(void);
>>  struct queue *get_gatt_tests(void);
>>  void remove_gatt_tests(void);
>> +struct queue *get_map_client_tests(void);
>> +void remove_map_client_tests(void);
>>
>>  /* Generic tester API */
>>  void schedule_action_verification(struct step *step);
>> diff --git a/android/tester-map-client.c b/android/tester-map-client.c
>> new file mode 100644
>> index 0000000..a2bb08f
>> --- /dev/null
>> +++ b/android/tester-map-client.c
>> @@ -0,0 +1,43 @@
>> +/*
>> + * 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 "tester-main.h"
>> +
>> +static struct queue *list; /* List of map client test cases */
>> +
>> +static struct test_case test_cases[] = {
>> +     TEST_CASE_BREDRLE("MAP Client Init", ACTION_SUCCESS(dummy_action, NULL),
>> +     ),
>> +};
>> +
>> +struct queue *get_map_client_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;
>> +
>
> This probably makes static checkers unhappy. I'd prefer you explicitly check
> if queue_new() succeed and clean it up if push failed.
>
> (you may also want to fix that in other testers)
>
>> +     return list;
>> +}
>> +
>> +void remove_map_client_tests(void)
>> +{
>> +     queue_destroy(list, NULL);
>> +}

I'll take those comments into consideration and send v2.
>
> --
> BR
> Szymon Janc

BR
Grzegorz Kołodziejczyk

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

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

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-08 10:35 [PATCH 1/5] android/tester: Add missing AVRCP cb_table entries Grzegorz Kolodziejczyk
2014-12-08 10:35 ` [PATCH 2/5] android/tester: put gatt callback declaration in right place Grzegorz Kolodziejczyk
2014-12-08 10:35 ` [PATCH 3/5] android/tester: remove not needed include of hal_msg.h Grzegorz Kolodziejczyk
2014-12-08 10:35 ` [PATCH 4/5] android/tester: move bthost.h include to tester-main.h Grzegorz Kolodziejczyk
2014-12-10 12:45   ` Szymon Janc
2014-12-11  8:51     ` Grzegorz Kolodziejczyk
2014-12-08 10:35 ` [PATCH 5/5] android/tester: add initial support for map-client tester Grzegorz Kolodziejczyk
2014-12-10 12:56   ` Szymon Janc
2014-12-11  8:58     ` Grzegorz Kolodziejczyk
2014-12-10 12:43 ` [PATCH 1/5] android/tester: Add missing AVRCP cb_table entries Szymon Janc
2014-12-11  8:50   ` Grzegorz Kolodziejczyk

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