summaryrefslogtreecommitdiff
path: root/android/tester-gatt.c
diff options
context:
space:
mode:
authorGrzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>2014-10-03 10:44:50 +0200
committerSzymon Janc <szymon.janc@tieto.com>2014-10-06 12:41:27 +0200
commit4cc5eabb958c96f16a021b39b9c9ff3388a33791 (patch)
tree24f377084975f90bcb78c92964da2f0a7334c2de /android/tester-gatt.c
parentc7a361134d93f755421a2e737e008b5e1702a6dc (diff)
downloadbluez-4cc5eabb958c96f16a021b39b9c9ff3388a33791.tar.gz
android/tester: Add GATT server connect successful test case
It will connect to powered on and visible device.
Diffstat (limited to 'android/tester-gatt.c')
-rw-r--r--android/tester-gatt.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/android/tester-gatt.c b/android/tester-gatt.c
index b53a61a56..eedbf5614 100644
--- a/android/tester-gatt.c
+++ b/android/tester-gatt.c
@@ -28,6 +28,9 @@
#define GATT_STATUS_FAILURE 0x00000101
#define GATT_STATUS_INS_AUTH 0x08
+#define GATT_SERVER_DISCONNECTED 0
+#define GATT_SERVER_CONNECTED 1
+
#define APP1_ID 1
#define APP2_ID 2
@@ -970,6 +973,21 @@ static void gatt_server_unregister_action(void)
schedule_action_verification(step);
}
+static void gatt_server_connect_action(void)
+{
+ struct test_data *data = tester_get_data();
+ struct step *current_data_step = queue_peek_head(data->steps);
+ struct gatt_connect_data *conn_data = current_data_step->set_data;
+ 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);
+
+ 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();
@@ -2160,6 +2178,26 @@ static struct test_case test_cases[] = {
ACTION_SUCCESS(gatt_server_register_action, &app1_uuid),
CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
),
+ TEST_CASE_BREDRLE("Gatt Server - LE Connect",
+ 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_server_register_action, &app1_uuid),
+ CALLBACK_STATUS(CB_GATTS_REGISTER_SERVER, BT_STATUS_SUCCESS),
+ ACTION_SUCCESS(bt_start_discovery_action, NULL),
+ CALLBACK_STATE(CB_BT_DISCOVERY_STATE_CHANGED,
+ BT_DISCOVERY_STARTED),
+ CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_le_set, 2),
+ ACTION_SUCCESS(bt_cancel_discovery_action, NULL),
+ ACTION_SUCCESS(gatt_server_connect_action, &app1_conn_req),
+ CALLBACK_GATTS_CONNECTION(GATT_SERVER_CONNECTED,
+ prop_emu_remotes_default_set,
+ CONN1_ID, APP1_ID),
+ ACTION_SUCCESS(bluetooth_disable_action, NULL),
+ CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF),
+ ),
};
struct queue *get_gatt_tests(void)