diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index 4e10f24..9511ea8 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
{
uint8_t pdu[4];
unsigned int att_id;
+ uint16_t properties = notify_data->chrc->properties;
assert(notify_data->chrc->ccc_handle);
memset(pdu, 0, sizeof(pdu));
put_le16(notify_data->chrc->ccc_handle, pdu);
if (enable) {
- /* Try to enable notifications and/or indications based on
+ /* Try to enable notifications or indications based on
* whatever the characteristic supports.
*/
- if (notify_data->chrc->properties & BT_GATT_CHRC_PROP_NOTIFY)
+ if (properties & BT_GATT_CHRC_PROP_NOTIFY)
pdu[2] = 0x01;
-
- if (notify_data->chrc->properties & BT_GATT_CHRC_PROP_INDICATE)
- pdu[2] |= 0x02;
+ else if (properties & BT_GATT_CHRC_PROP_INDICATE)
+ pdu[2] = 0x02;
if (!pdu[2])
return false;
diff --git a/unit/test-gatt.c b/unit/test-gatt.c
index 4aa87d0..6a47268 100644
--- a/unit/test-gatt.c
+++ b/unit/test-gatt.c
#define CHARACTERISTIC_DISC_SMALL_DB \
raw_pdu(0x08, 0x01, 0x00, 0xff, 0xff, 0x03, 0x28), \
raw_pdu(0x09, 0x07, 0x02, 0x00, 0xb2, 0x03, 0x00, 0x29, \
- 0x2a), \
- raw_pdu(0x08, 0x03, 0x00, 0xff, 0xff, 0x03, 0x28), \
+ 0x2a, 0x07, 0x00, 0x22, 0x08, 0x00, 0x28, 0x2a),\
+ raw_pdu(0x08, 0x08, 0x00, 0xff, 0xff, 0x03, 0x28), \
raw_pdu(0x09, 0x07, 0x12, 0xf0, 0x02, 0x13, 0xf0, 0x00, \
0x2a), \
raw_pdu(0x08, 0x13, 0xf0, 0xff, 0xff, 0x03, 0x28), \
raw_pdu(0x01, 0x08, 0x18, 0xf0, 0x0a)
#define DESCRIPTOR_DISC_SMALL_DB \
- raw_pdu(0x04, 0x04, 0x00, 0x10, 0x00), \
+ raw_pdu(0x04, 0x04, 0x00, 0x06, 0x00), \
raw_pdu(0x05, 0x01, 0x04, 0x00, 0x02, 0x29, 0x05, 0x00, \
0x01, 0x29), \
- raw_pdu(0x04, 0x06, 0x00, 0x10, 0x00), \
- raw_pdu(0x01, 0x04, 0x06, 0x00, 0x0a), \
+ raw_pdu(0x04, 0x06, 0x00, 0x06, 0x00), \
+ raw_pdu(0x05, 0x01, 0x06, 0x00, 0x00, 0x29), \
+ raw_pdu(0x0a, 0x06, 0x00), \
+ raw_pdu(0x0b, 0x01, 0x00), \
+ raw_pdu(0x04, 0x09, 0x00, 0x10, 0x00), \
+ raw_pdu(0x05, 0x01, 0x09, 0x00, 0x02, 0x29), \
+ raw_pdu(0x04, 0x0a, 0x00, 0x10, 0x00), \
+ raw_pdu(0x01, 0x04, 0x0a, 0x00, 0x0a), \
raw_pdu(0x04, 0x16, 0xf0, 0x16, 0xf0), \
raw_pdu(0x05, 0x01, 0x16, 0xf0, 0x00, 0x29), \
raw_pdu(0x0a, 0x16, 0xf0), \
"Manufacturer Name"),
DESCRIPTOR(GATT_CHARAC_EXT_PROPER_UUID, BT_ATT_PERM_READ, 0x01,
0x00),
+ CHARACTERISTIC_STR(GATT_CHARAC_SOFTWARE_REVISION_STRING,
+ BT_ATT_PERM_READ,
+ BT_GATT_CHRC_PROP_READ |
+ BT_GATT_CHRC_PROP_INDICATE,
+ "5.59"),
+ DESCRIPTOR(GATT_CLIENT_CHARAC_CFG_UUID, BT_ATT_PERM_READ
+ | BT_ATT_PERM_WRITE, 0x00, 0x00),
PRIMARY_SERVICE(0xF010, GAP_UUID, 9),
INCLUDE(0x0001),
}
static const struct test_step test_indication_1 = {
- .handle = 0x0003,
+ .handle = 0x0008,
.func = test_indication,
.value = read_data_1,
.length = 0x03,
raw_pdu(0x03, 0x00, 0x02),
raw_pdu(0x08, 0x01, 0x00, 0x0f, 0x00, 0x03, 0x28),
raw_pdu(0x09, 0x07, 0x02, 0x00, 0xb2, 0x03, 0x00, 0x29,
- 0x2a),
- raw_pdu(0x08, 0x03, 0x00, 0x0f, 0x00, 0x03, 0x28),
- raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a));
+ 0x2a, 0x07, 0x00, 0x22, 0x08, 0x00,
+ 0x28, 0x2a),
+ raw_pdu(0x08, 0x08, 0x00, 0x0f, 0x00, 0x03, 0x28),
+ raw_pdu(0x01, 0x08, 0x08, 0x00, 0x0a));
define_test_server("/TP/GAD/SR/BV-04-C/large-1", test_server,
ts_large_db_1, NULL,
raw_pdu(0x03, 0x00, 0x02),
raw_pdu(0x08, 0x01, 0x00, 0x0f, 0x00, 0x03, 0x28),
raw_pdu(0x09, 0x07, 0x02, 0x00, 0xb2, 0x03, 0x00, 0x29,
- 0x2a),
- raw_pdu(0x08, 0x03, 0x00, 0x0f, 0x00, 0x03, 0x28),
- raw_pdu(0x01, 0x08, 0x03, 0x00, 0x0a));
+ 0x2a, 0x07, 0x00, 0x22, 0x08, 0x00,
+ 0x28, 0x2a),
+ raw_pdu(0x08, 0x08, 0x00, 0x0f, 0x00, 0x03, 0x28),
+ raw_pdu(0x01, 0x08, 0x08, 0x00, 0x0a));
define_test_server("/TP/GAD/SR/BV-05-C/large-1", test_server,
ts_large_db_1, NULL,
&test_notification_1,
CLIENT_INIT_PDUS,
SMALL_DB_DISCOVERY_PDUS,
- raw_pdu(0x12, 0x04, 0x00, 0x03, 0x00),
+ raw_pdu(0x12, 0x04, 0x00, 0x01, 0x00),
raw_pdu(0x13),
raw_pdu(),
raw_pdu(0x1B, 0x03, 0x00, 0x01, 0x02, 0x03));
&test_indication_1,
CLIENT_INIT_PDUS,
SMALL_DB_DISCOVERY_PDUS,
- raw_pdu(0x12, 0x04, 0x00, 0x03, 0x00),
+ raw_pdu(0x12, 0x09, 0x00, 0x02, 0x00),
raw_pdu(0x13),
raw_pdu(),
raw_pdu(0x1D, 0x03, 0x00, 0x01, 0x02, 0x03),