diff --git a/android/tester-main.c b/android/tester-main.c
index 60ccac7..aebc1a1 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
* Check each test case step if test case expected
* data is set and match it with expected result.
*/
+
+static bool verify_services(btgatt_srvc_id_t *a, btgatt_srvc_id_t *b)
+{
+ if (a->is_primary != b->is_primary)
+ return false;
+
+ if (memcmp(&a->id.uuid, &b->id.uuid, sizeof(bt_uuid_t)))
+ return false;
+
+ return true;
+}
+
static bool match_data(struct step *step)
{
struct test_data *data = tester_get_data();
tester_debug("Gatt properties don't match");
return false;
}
+
+ if (exp->callback_result.service &&
+ !verify_services(step->callback_result.service,
+ exp->callback_result.service)) {
+ tester_debug("Gatt service doesn't match");
+ return false;
+ }
}
return true;
if (step->callback_result.properties)
free_properties(step);
+ if (step->callback_result.service)
+ free(step->callback_result.service);
+
g_free(step);
g_atomic_int_dec_and_test(&scheduled_cbacks_num);
}
schedule_callback_call(step);
}
+static void gattc_search_result_cb(int conn_id, btgatt_srvc_id_t *srvc_id)
+{
+ struct step *step = g_new0(struct step, 1);
+
+ step->callback = CB_GATTC_SEARCH_RESULT;
+ step->callback_result.conn_id = conn_id;
+ step->callback_result.service = g_memdup(srvc_id, sizeof(*srvc_id));
+
+ schedule_callback_call(step);
+}
+
+static void gattc_search_complete_cb(int conn_id, int status)
+{
+ struct step *step = g_new0(struct step, 1);
+
+ step->callback = CB_GATTC_SEARCH_COMPLETE;
+ step->callback_result.conn_id = conn_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)
.scan_result_cb = gattc_scan_result_cb,
.open_cb = gattc_connect_cb,
.close_cb = gattc_disconnect_cb,
- .search_complete_cb = NULL,
- .search_result_cb = NULL,
+ .search_complete_cb = gattc_search_complete_cb,
+ .search_result_cb = gattc_search_result_cb,
.get_characteristic_cb = NULL,
.get_descriptor_cb = NULL,
.get_included_service_cb = NULL,
if (!(data->steps = queue_new()))
return false;
+ data->pdus = queue_new();
+ if (!data->pdus) {
+ queue_destroy(data->steps, NULL);
+ return false;
+ }
+
return true;
}
queue_destroy(data->steps, NULL);
data->steps = NULL;
+ queue_destroy(data->pdus, NULL);
+ data->pdus = NULL;
+
if (data->if_gatt) {
data->if_gatt->cleanup();
data->if_gatt = NULL;
diff --git a/android/tester-main.h b/android/tester-main.h
index f7e3c90..aa7eb2a 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
.callback_result.client_id = cb_client_id, \
}
+#define CALLBACK_GATTC_SEARCH_RESULT(cb_conn_id, cb_service) { \
+ .callback = CB_GATTC_SEARCH_RESULT, \
+ .callback_result.conn_id = cb_conn_id, \
+ .callback_result.service = cb_service \
+ }
+
+#define CALLBACK_GATTC_SEARCH_COMPLETE(cb_res, cb_conn_id) { \
+ .callback = CB_GATTC_SEARCH_COMPLETE, \
+ .callback_result.conn_id = cb_conn_id \
+ }
+
#define CALLBACK_GATTC_DISCONNECT(cb_res, cb_prop, cb_conn_id, cb_client_id) { \
.callback = CB_GATTC_CLOSE, \
.callback_result.status = cb_res, \
guint signalfd;
uint16_t mgmt_index;
pid_t bluetoothd_pid;
+
+ struct queue *pdus;
};
/*
int client_id;
int conn_id;
+ btgatt_srvc_id_t *service;
btpan_control_state_t ctrl_state;
btpan_connection_state_t conn_state;