These read-by-type PDUs are repeated multiple times throughout the code. --- android/tester-gatt.c | 63 +++++++++++++++------------------------------------ 1 file changed, 18 insertions(+), 45 deletions(-) diff --git a/android/tester-gatt.c b/android/tester-gatt.c index b88eeff..ebfa005 100644 --- a/android/tester-gatt.c +++ b/android/tester-gatt.c @@ -836,7 +836,13 @@ static struct send_resp_data send_resp_data_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, 0x10, 0x11, 0x00, 0x0a) \ + raw_pdu(0x01, 0x10, 0x11, 0x00, 0x0a) + +#define READ_BY_TYPE_SINGLE_CHARACTERISTIC_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), \ + raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a) static struct iovec search_service[] = { SEARCH_SERVICE_SINGLE_SUCCESS_PDUS, @@ -861,19 +867,13 @@ static struct iovec search_service_3[] = { static struct iovec get_characteristic_1[] = { 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), - raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a), + READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS, end_pdu }; static struct iovec get_descriptor_1[] = { 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), - raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a), + READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS, raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00), raw_pdu(0x05, 0x01, 0x04, 0x00, 0x00, 0x29), raw_pdu(0x04, 0x05, 0x00, 0x10, 0x00), @@ -883,10 +883,7 @@ static struct iovec get_descriptor_1[] = { static struct iovec get_descriptor_2[] = { 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), - raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a), + READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS, raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00), raw_pdu(0x05, 0x01, 0x04, 0x00, 0x00, 0x29, 0x05, 0x00, 0x01, 0x29), raw_pdu(0x04, 0x06, 0x00, 0x10, 0x00), @@ -896,10 +893,7 @@ static struct iovec get_descriptor_2[] = { static struct iovec get_descriptor_3[] = { 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), - raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a), + READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS, raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00), raw_pdu(0x01, 0x04, 0x01, 0x00, 0x0a), end_pdu @@ -957,10 +951,7 @@ static struct iovec read_characteristic_2[] = { static struct iovec read_descriptor_1[] = { 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), - raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a), + READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS, raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00), raw_pdu(0x05, 0x01, 0x04, 0x00, 0x00, 0x29), raw_pdu(0x04, 0x05, 0x00, 0x10, 0x00), @@ -972,10 +963,7 @@ static struct iovec read_descriptor_1[] = { static struct iovec read_descriptor_2[] = { 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), - raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a), + READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS, raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00), raw_pdu(0x05, 0x01, 0x04, 0x00, 0x00, 0x29), raw_pdu(0x04, 0x05, 0x00, 0x10, 0x00), @@ -1019,10 +1007,7 @@ static struct iovec write_characteristic_3[] = { static struct iovec write_descriptor_1[] = { 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), - raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a), + READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS, raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00), raw_pdu(0x05, 0x01, 0x04, 0x00, 0x00, 0x29), raw_pdu(0x04, 0x05, 0x00, 0x10, 0x00), @@ -1034,10 +1019,7 @@ static struct iovec write_descriptor_1[] = { static struct iovec write_descriptor_2[] = { 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), - raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a), + READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS, raw_pdu(0x04, 0x01, 0x00, 0x10, 0x00), raw_pdu(0x05, 0x01, 0x04, 0x00, 0x00, 0x29), raw_pdu(0x04, 0x05, 0x00, 0x10, 0x00), @@ -1049,19 +1031,13 @@ static struct iovec write_descriptor_2[] = { static struct iovec notification_1[] = { 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), - raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a), + READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS, end_pdu }; static struct iovec notification_2[] = { 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), - raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a), + READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS, raw_pdu(0x1d, 0x03, 0x00, 0x01), raw_pdu(0x1e), end_pdu @@ -1069,10 +1045,7 @@ static struct iovec notification_2[] = { static struct iovec notification_3[] = { 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), - raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a), + READ_BY_TYPE_SINGLE_CHARACTERISTIC_PDUS, raw_pdu(0x1b, 0x03, 0x00, 0x01), end_pdu }; -- 2.1.0.rc2.206.gedb03e5 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html