diff --git a/android/tester-main.c b/android/tester-main.c
index aebc1a1..c0f384c 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
* data is set and match it with expected result.
*/
-static bool verify_services(btgatt_srvc_id_t *a, btgatt_srvc_id_t *b)
+static bool verify_gatt_ids(btgatt_gatt_id_t *a, btgatt_gatt_id_t *b)
{
- if (a->is_primary != b->is_primary)
- return false;
- if (memcmp(&a->id.uuid, &b->id.uuid, sizeof(bt_uuid_t)))
+ if (memcmp(&a->uuid, &b->uuid, sizeof(bt_uuid_t)))
return false;
return true;
}
+static bool verify_services(btgatt_srvc_id_t *a, btgatt_srvc_id_t *b)
+{
+ if (a->is_primary != b->is_primary)
+ return false;
+
+ return verify_gatt_ids(&a->id, &b->id);
+}
+
static bool match_data(struct step *step)
{
struct test_data *data = tester_get_data();
tester_debug("Gatt service doesn't match");
return false;
}
+
+ if (exp->callback_result.characteristic) {
+ btgatt_gatt_id_t *a;
+ btgatt_gatt_id_t *b;
+ a = step->callback_result.characteristic;
+ b = exp->callback_result.characteristic;
+
+ if (!verify_gatt_ids(a, b)) {
+ tester_debug("Gatt char doesn't match");
+ return false;
+ }
+ }
+
+ if (exp->callback_result.char_prop !=
+ step->callback_result.char_prop) {
+ tester_debug("Gatt char prop doesn't match");
+ return false;
+ }
}
return true;
if (step->callback_result.service)
free(step->callback_result.service);
+ if (step->callback_result.characteristic)
+ free(step->callback_result.characteristic);
+
g_free(step);
g_atomic_int_dec_and_test(&scheduled_cbacks_num);
}
schedule_callback_call(step);
}
+static void gattc_get_characteristic_cb(int conn_id, int status,
+ btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
+ int char_prop)
+{
+ struct step *step = g_new0(struct step, 1);
+
+ step->callback = CB_GATTC_GET_CHARACTERISTIC;
+ 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.char_prop = char_prop;
+
+ 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)
.close_cb = gattc_disconnect_cb,
.search_complete_cb = gattc_search_complete_cb,
.search_result_cb = gattc_search_result_cb,
- .get_characteristic_cb = NULL,
+ .get_characteristic_cb = gattc_get_characteristic_cb,
.get_descriptor_cb = NULL,
.get_included_service_cb = NULL,
.register_for_notification_cb = NULL,
diff --git a/android/tester-main.h b/android/tester-main.h
index aa7eb2a..46aacce 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
.callback = CB_GATTC_SEARCH_COMPLETE, \
.callback_result.conn_id = cb_conn_id \
}
+#define CALLBACK_GATTC_GET_CHARACTERISTIC_CB(cb_res, cb_conn_id, cb_service, \
+ cb_char, cb_char_prop) { \
+ .callback = CB_GATTC_GET_CHARACTERISTIC, \
+ .callback_result.conn_id = cb_conn_id, \
+ .callback_result.status = cb_res, \
+ .callback_result.service = cb_service, \
+ .callback_result.characteristic = cb_char, \
+ .callback_result.char_prop = cb_char_prop \
+ }
#define CALLBACK_GATTC_DISCONNECT(cb_res, cb_prop, cb_conn_id, cb_client_id) { \
.callback = CB_GATTC_CLOSE, \
int client_id;
int conn_id;
btgatt_srvc_id_t *service;
+ btgatt_gatt_id_t *characteristic;
+ int char_prop;
btpan_control_state_t ctrl_state;
btpan_connection_state_t conn_state;