summaryrefslogtreecommitdiff
path: root/android/tester-gatt.c
diff options
context:
space:
mode:
authorMichael Janssen <jamuraa@chromium.org>2014-11-13 09:39:14 -0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-11-14 13:00:09 +0200
commite6b93dd2f576e210c15b6d74209a8ef91853663f (patch)
tree4bd3687ae0e28a38217e541745c2837429f66c44 /android/tester-gatt.c
parente5d2140d741a186e25cd10db9ccdd3a741a7a8bf (diff)
downloadbluez-e6b93dd2f576e210c15b6d74209a8ef91853663f.tar.gz
android/tester-gatt: Fix search single PDUs
The final PDU of the search single exchange was malformed on many of these: 0x11 instead of 0x10 in the "request opcode in error" slot. This patch fixes this bug and deduplicates the repeated PDUs by using a macro instead.
Diffstat (limited to 'android/tester-gatt.c')
-rw-r--r--android/tester-gatt.c106
1 files changed, 26 insertions, 80 deletions
diff --git a/android/tester-gatt.c b/android/tester-gatt.c
index 13e096ff9..b88eeff23 100644
--- a/android/tester-gatt.c
+++ b/android/tester-gatt.c
@@ -832,11 +832,14 @@ static struct send_resp_data send_resp_data_2 = {
.response = &response_2,
};
+#define SEARCH_SERVICE_SINGLE_SUCCESS_PDUS \
+ 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, 0x10, 0x11, 0x00, 0x0a) \
+
static struct iovec search_service[] = {
- 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, 0x10, 0x11, 0x00, 0x0a),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
end_pdu
};
@@ -857,10 +860,7 @@ static struct iovec search_service_3[] = {
};
static struct iovec get_characteristic_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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
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),
@@ -869,10 +869,7 @@ static struct iovec get_characteristic_1[] = {
};
static struct iovec 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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
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),
@@ -885,10 +882,7 @@ static struct iovec get_descriptor_1[] = {
};
static struct iovec 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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
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),
@@ -901,10 +895,7 @@ static struct iovec get_descriptor_2[] = {
};
static struct iovec 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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
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),
@@ -915,10 +906,7 @@ static struct iovec get_descriptor_3[] = {
};
static struct iovec 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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
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),
@@ -927,10 +915,7 @@ static struct iovec get_included_1[] = {
};
static struct iovec 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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x02, 0x28),
raw_pdu(0x09, 0x06, 0x02, 0x00, 0x15, 0x00, 0x19, 0x00),
raw_pdu(0x0a, 0x15, 0x00),
@@ -942,20 +927,14 @@ static struct iovec get_included_2[] = {
};
static struct iovec 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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x02, 0x28),
raw_pdu(0x01, 0x08, 0x01, 0x00, 0x0a),
end_pdu
};
static struct iovec read_characteristic_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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x03, 0x00, 0x19, 0x00),
raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
@@ -966,10 +945,7 @@ static struct iovec read_characteristic_1[] = {
};
static struct iovec read_characteristic_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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x03, 0x00, 0x19, 0x00),
raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
@@ -980,10 +956,7 @@ static struct iovec read_characteristic_2[] = {
};
static struct iovec read_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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
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),
@@ -998,10 +971,7 @@ static struct iovec read_descriptor_1[] = {
};
static struct iovec read_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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
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),
@@ -1016,10 +986,7 @@ static struct iovec read_descriptor_2[] = {
};
static struct iovec write_characteristic_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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x03, 0x00, 0x19, 0x00),
raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
@@ -1029,10 +996,7 @@ static struct iovec write_characteristic_1[] = {
};
static struct iovec write_characteristic_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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x03, 0x00, 0x19, 0x00),
raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
@@ -1043,10 +1007,7 @@ static struct iovec write_characteristic_2[] = {
};
static struct iovec write_characteristic_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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
raw_pdu(0x08, 0x01, 0x00, 0x10, 0x00, 0x03, 0x28),
raw_pdu(0x09, 0x07, 0x02, 0x00, 0x04, 0x03, 0x00, 0x19, 0x00),
raw_pdu(0x08, 0x03, 0x00, 0x10, 0x00, 0x03, 0x28),
@@ -1057,10 +1018,7 @@ static struct iovec write_characteristic_3[] = {
};
static struct iovec write_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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
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),
@@ -1075,10 +1033,7 @@ static struct iovec write_descriptor_1[] = {
};
static struct iovec write_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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
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),
@@ -1093,10 +1048,7 @@ static struct iovec write_descriptor_2[] = {
};
static struct iovec notification_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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
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),
@@ -1105,10 +1057,7 @@ static struct iovec notification_1[] = {
};
static struct iovec notification_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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
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),
@@ -1119,10 +1068,7 @@ static struct iovec notification_2[] = {
};
static struct iovec notification_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),
+ SEARCH_SERVICE_SINGLE_SUCCESS_PDUS,
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),