diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-11-04 14:31:40 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-11-04 14:34:53 -0700 |
commit | 7e0e08ca5396bd9e40f25fac74018963f6516c61 (patch) | |
tree | 5864520ea6feea6240bb60d0775abfb7b4888d0b | |
parent | 3a3298e29b4468bd6cbf74de6d677c052a4e960a (diff) | |
download | bluez-7e0e08ca5396bd9e40f25fac74018963f6516c61.tar.gz |
monitor/att: Add support for decoding Characteristic Declaration
This adds supports for decoding the so called Characteristic
Declaration (0x2803):
> ACL Data RX: Handle 3585 flags 0x02 dlen 76
ATT: Read By Type Response (0x09) len 71
Attribute data length: 7
Attribute data list: 10 entries
Handle: 0x0002
Value: 200300052a
Properties: 0x20
Indicate (0x20)
Value Handle: 0x0003
Value UUID: Service Changed (0x2a05)
Handle: 0x0015
Value: 021600002a
Properties: 0x02
Read (0x02)
Value Handle: 0x0016
Value UUID: Device Name (0x2a00)
Handle: 0x0017
Value: 021800012a
Properties: 0x02
Read (0x02)
Value Handle: 0x0018
Value UUID: Appearance (0x2a01)
Handle: 0x0019
Value: 021a00a62a
Properties: 0x02
Read (0x02)
Value Handle: 0x001a
Value UUID: Central Address Resolution (0x2aa6)
Handle: 0x0029
Value: 102a00372a
Properties: 0x10
Notify (0x10)
Value Handle: 0x002a
Value UUID: Heart Rate Measurement (0x2a37)
Handle: 0x002c
Value: 022d00382a
Properties: 0x02
Read (0x02)
Value Handle: 0x002d
Value UUID: Body Sensor Location (0x2a38)
Handle: 0x002e
Value: 082f00392a
Properties: 0x08
Write (0x08)
Value Handle: 0x002f
Value UUID: Heart Rate Control Point (0x2a39)
Handle: 0x0031
Value: 0a32008a2a
Properties: 0x0a
Read (0x02)
Write (0x08)
Value Handle: 0x0032
Value UUID: First Name (0x2a8a)
Handle: 0x0033
Value: 0a3400902a
Properties: 0x0a
Read (0x02)
Write (0x08)
Value Handle: 0x0034
Value UUID: Last Name (0x2a90)
Handle: 0x0035
Value: 0a36008c2a
Properties: 0x0a
Read (0x02)
Write (0x08)
Value Handle: 0x0036
Value UUID: Gender (0x2a8c)
-rw-r--r-- | monitor/att.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/monitor/att.c b/monitor/att.c index 289f4fc04..efd840d51 100644 --- a/monitor/att.c +++ b/monitor/att.c @@ -273,6 +273,46 @@ static void att_error_response(const struct l2cap_frame *frame) print_field("Error: %s (0x%2.2x)", str, pdu->error); } +static const struct bitfield_data chrc_prop_table[] = { + { 0, "Broadcast (0x01)" }, + { 1, "Read (0x02)" }, + { 2, "Write Without Response (0x04)" }, + { 3, "Write (0x08)" }, + { 4, "Notify (0x10)" }, + { 5, "Indicate (0x20)" }, + { 6, "Authorize (0x40)" }, + { 6, "Extended Properties (0x80)" }, + { } +}; + +static void print_chrc(const struct l2cap_frame *frame) +{ + uint8_t prop; + uint8_t mask; + + if (!l2cap_frame_get_u8((void *)frame, &prop)) { + print_text(COLOR_ERROR, "Property: invalid size"); + return; + } + + print_field(" Properties: 0x%2.2x", prop); + + mask = print_bitfield(6, prop, chrc_prop_table); + if (mask) + print_text(COLOR_WHITE_BG, " Unknown fields (0x%2.2x)", + mask); + + if (!l2cap_frame_print_le16((void *)frame, " Value Handle")) + return; + + print_uuid(" Value UUID", frame->data, frame->size); +} + +static void chrc_read(const struct l2cap_frame *frame) +{ + print_chrc(frame); +} + static const struct bitfield_data ccc_value_table[] = { { 0, "Notification (0x01)" }, { 1, "Indication (0x02)" }, @@ -2314,6 +2354,7 @@ struct gatt_handler { void (*write)(const struct l2cap_frame *frame); void (*notify)(const struct l2cap_frame *frame); } gatt_handlers[] = { + GATT_HANDLER(0x2803, chrc_read, NULL, NULL), GATT_HANDLER(0x2902, ccc_read, ccc_write, NULL), GATT_HANDLER(0x2bc4, ase_read, NULL, ase_notify), GATT_HANDLER(0x2bc5, ase_read, NULL, ase_notify), |