Thursday, May 19, 2016

[RR Bluetooth] gatttool - What HCI Commands are Sent by gatttool (5) char-read-hnd, char-read-uuid

According to BT Spec Core 4.2, 4.8 CHARACTERISTIC VALUE READ

There are four sub-procedures that can be used to read a Characteristic Value: Read Characteristic Value, Read Using Characteristic UUID, Read Long Characteristic Values, and Read Multiple Characteristic Values.

it looks like gatttool only support the first two.

char-read-hnd   <handle>                       Characteristics Value/Descriptor Read by handle

This sub-procedure is used to read a Characteristic Value from a server when the client knows the Characteristic Value Handle

Read Request


< ACL Data TX: Handle 71 flags 0x00 dlen 7                      [hci0] 3.380041
      ATT: Read Request (0x0a) len 2
        Handle: 0x0001

< 02 47 00 07 00 03 00 04 00 0A 01 00 

> HCI Event: Number of Completed Packets (0x13) plen 5          [hci0] 4.003567
        Num handles: 1
        Handle: 71
        Count: 1
 > 04 13 05 01 47 00 01 00 

Read Response


> ACL Data RX: Handle 71 flags 0x02 dlen 7                      [hci0] 4.072557
      ATT: Read Response (0x0b) len 2
        Value: 0018

> 02 47 20 07 00 03 00 04 00 0B 00 18 

char-read-uuid  <UUID> [start hnd] [end hnd]   Characteristics Value/Descriptor Read by UUID


This sub-procedure is used to read a Characteristic Value from a server when the client only knows the characteristic UUID and does not know the handle of the characteristic. (4.8.2 Read Using Characteristic UUID @ Core 4.2) This is typically the handle range for the service in which the characteristic belongs.


Read By Type Request


< ACL Data TX: Handle 71 flags 0x00 dlen 11                     [hci0] 7.468811
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x0001-0x000b
        Attribute type: Characteristic (0x2803)

< 02 47 00 0B 00 07 00 04 00
08 01 00 0B 00 03 28 

> HCI Event: Number of Completed Packets (0x13) plen 5          [hci0] 7.513950
        Num handles: 1
        Handle: 71
        Count: 1
> 04 13 05 01 47 00 01 00 

Read By Type Response



> ACL Data RX: Handle 71 flags 0x02 dlen 27                     [hci0] 7.583487
      ATT: Read By Type Response (0x09) len 22
        Attribute data length: 7
        Attribute data list: 3 entries
        Handle: 0x0002
        Value: 020300002a
        Handle: 0x0004
        Value: 020500012a
        Handle: 0x0006
        Value: 020700022a


> 02 47 20 1B 00 17 00 04 00
09 07 02 00 02 03 00 00 2A 04 00
  02 05 00 01 2A 06 00 02 07 00 02 2A 


Note: the Read Blob Request would be used to read the remaining octets of a
long attribute value.



No comments:

Post a Comment