Hello Luiz, On 6 October 2016 at 09:23, Luiz Augusto von Dentz <luiz.dentz@xxxxxxxxx> wrote: > Hi Barry, > > On Wed, Oct 5, 2016 at 11:31 PM, Barry Byford <31baz66@xxxxxxxxx> wrote: >> Hello, >> >> I've been doing some experiments with Googles Physical Web Fatbeacon >> https://github.com/google/physical-web/issues/784#issuecomment-251571858 >> >> The experiments have been with BlueZ 5.40 using the DBus API with >> Python 3. BlueZ is advertising a connectable Eddystone beacon. When >> the Physical Web Android app connects there is one service with one >> characteristic that it is looking for. That characteristic contains a >> string that is the HTML content. >> All is working well if the web page contained in the characteristic is >> nice and short. >> However if I make the web page content slightly longer then I end up >> getting stuck in a loop where the Physical Web app is just reading the >> first part of the characteristic over and over again. > > How big is it? The spec actually limits the attribute contents to 512 > bytes. On the other hand I remember the Android App returning > different parts of the data on every read, so it essentially doing its > own fragmentation. My content is bigger than 512 bytes when it starts failing. The app is definitely making multi-read requests of my characteristic. The bit that I'm missing is how to make the beacon/service give the next chunk of content on each read. >> I'm assuming that it is not that uncommon for data to be larger than >> can be retrieved in one read although I've not been able to find an >> example. I'm a little bit at a loss as to what the ReadValue method >> should look like for this characteristic. >> Is anyone able to give me some pointers as to what I need to do to get >> this to work? > > Check out the Android physical web application: > > https://play.google.com/store/apps/details?id=physical_web.org.physicalweb&hl=en > It is that app that I'm using to connect to the beacon/service/characteristic I've created with BlueZ. I seem to be missing something obvious. The app is making multiple reads and I had expected the ReadValue to be called with an offset given in the options. This isn't the case. I've captured what options that are being given to the characteristic ReadValue when it is called: Reading value: dbus.Dictionary({dbus.String('device'): dbus.ObjectPath('/org/bluez/hci0/dev_60_51_1E_E0_17_2D', variant_level=1)}, signature=dbus.Signature('sv')) Reading value: dbus.Dictionary({dbus.String('device'): dbus.ObjectPath('/org/bluez/hci0/dev_60_51_1E_E0_17_2D', variant_level=1)}, signature=dbus.Signature('sv')) Reading value: dbus.Dictionary({dbus.String('device'): dbus.ObjectPath('/org/bluez/hci0/dev_60_51_1E_E0_17_2D', variant_level=1)}, signature=dbus.Signature('sv')) Reading value: dbus.Dictionary({dbus.String('device'): dbus.ObjectPath('/org/bluez/hci0/dev_60_51_1E_E0_17_2D', variant_level=1)}, signature=dbus.Signature('sv')) etc... The btmon log for the connection and read attempts. Bluetooth monitor ver 5.40 = New Index: 00:02:5B:03:44:07 (BR/EDR,USB,hci0) [hci0] 21:24:19.404971 @ Advertising Added: 1 < HCI Command: LE Set Advertisi.. (0x08|0x0006) plen 15 [hci0] 21:24:29.201962 Min advertising interval: 1280.000 msec (0x0800) Max advertising interval: 1280.000 msec (0x0800) Type: Connectable undirected - ADV_IND (0x00) Own address type: Public (0x00) Direct address type: Public (0x00) Direct address: 00:00:00:00:00:00 (OUI 00-00-00) Channel map: 37, 38, 39 (0x07) Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00) > HCI Event: Command Complete (0x0e) plen 4 [hci0] 21:24:29.203772 LE Set Advertising Parameters (0x08|0x0006) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Advertise... (0x08|0x000a) plen 1 [hci0] 21:24:29.203967 Advertising: Enabled (0x01) > HCI Event: Command Complete (0x0e) plen 4 [hci0] 21:24:29.205736 LE Set Advertise Enable (0x08|0x000a) ncmd 1 Status: Success (0x00) > HCI Event: LE Meta Event (0x3e) plen 19 [hci0] 21:24:35.210461 LE Connection Complete (0x01) Status: Success (0x00) Handle: 40 Role: Slave (0x01) Peer address type: Random (0x01) Peer address: 60:51:1E:E0:17:2D (Resolvable) Connection interval: 45.00 msec (0x0024) Connection latency: 0.00 msec (0x0000) Supervision timeout: 20000 msec (0x07d0) Master clock accuracy: 0x00 < ACL Data TX: Handle 40 flags 0x00 dlen 16 [hci0] 21:24:35.211145 LE L2CAP: Connection Parameter Update Request (0x12) ident 1 len 8 Min interval: 40 Max interval: 56 Slave latency: 0 Timeout multiplier: 2000 @ Device Connected: 60:51:1E:E0:17:2D (2) flags 0x0000 < ACL Data TX: Handle 40 flags 0x00 dlen 7 [hci0] 21:24:35.252343 ATT: Exchange MTU Request (0x02) len 2 Client RX MTU: 517 > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:35.297516 Num handles: 1 Handle: 40 Count: 1 > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:35.342506 Num handles: 1 Handle: 40 Count: 1 > ACL Data RX: Handle 40 flags 0x02 dlen 13 [hci0] 21:24:35.342643 ATT: Find By Type Value Request (0x06) len 8 Handle range: 0x0001-0xffff Attribute type: Primary Service (0x2800) UUID: Generic Attribute Profile (0x1801) < ACL Data TX: Handle 40 flags 0x00 dlen 9 [hci0] 21:24:35.343457 ATT: Find By Type Value Response (0x07) len 4 Handle range: 0x0006-0x0009 > ACL Data RX: Handle 40 flags 0x02 dlen 10 [hci0] 21:24:35.344035 LE L2CAP: Connection Parameter Update Response (0x13) ident 1 len 2 Result: Connection Parameters accepted (0x0000) > ACL Data RX: Handle 40 flags 0x02 dlen 7 [hci0] 21:24:35.344138 ATT: Exchange MTU Response (0x03) len 2 Server RX MTU: 517 < ACL Data TX: Handle 40 flags 0x00 dlen 11 [hci0] 21:24:35.344716 ATT: Read By Group Type Request (0x10) len 6 Handle range: 0x0001-0xffff Attribute group type: Primary Service (0x2800) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:35.387506 Num handles: 1 Handle: 40 Count: 1 > ACL Data RX: Handle 40 flags 0x02 dlen 11 [hci0] 21:24:35.431780 ATT: Read By Group Type Request (0x10) len 6 Handle range: 0x0001-0xffff Attribute group type: Primary Service (0x2800) < ACL Data TX: Handle 40 flags 0x00 dlen 18 [hci0] 21:24:35.432608 ATT: Read By Group Type Response (0x11) len 13 Attribute data length: 6 Attribute group list: 2 entries Handle range: 0x0001-0x0005 UUID: Generic Access Profile (0x1800) Handle range: 0x0006-0x0009 UUID: Generic Attribute Profile (0x1801) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:35.432535 Num handles: 1 Handle: 40 Count: 1 > ACL Data RX: Handle 40 flags 0x02 dlen 18 [hci0] 21:24:35.433165 ATT: Read By Group Type Response (0x11) len 13 Attribute data length: 6 Attribute group list: 2 entries Handle range: 0x0001-0x0005 UUID: Generic Attribute Profile (0x1801) Handle range: 0x0014-0xffff UUID: Generic Access Profile (0x1800) > HCI Event: LE Meta Event (0x3e) plen 10 [hci0] 21:24:35.609546 LE Connection Update Complete (0x03) Status: Success (0x00) Handle: 40 Connection interval: 67.50 msec (0x0036) Connection latency: 0.00 msec (0x0000) Supervision timeout: 20000 msec (0x07d0) > ACL Data RX: Handle 40 flags 0x02 dlen 13 [hci0] 21:24:35.612057 ATT: Find By Type Value Request (0x06) len 8 Handle range: 0x000a-0xffff Attribute type: Primary Service (0x2800) UUID: Generic Attribute Profile (0x1801) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:35.612548 Num handles: 1 Handle: 40 Count: 1 < ACL Data TX: Handle 40 flags 0x00 dlen 9 [hci0] 21:24:35.613006 ATT: Error Response (0x01) len 4 Find By Type Value Request (0x06) Handle: 0x000a Error: Attribute Not Found (0x0a) > ACL Data RX: Handle 40 flags 0x02 dlen 11 [hci0] 21:24:35.747199 ATT: Read By Group Type Request (0x10) len 6 Handle range: 0x000a-0xffff Attribute group type: Primary Service (0x2800) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:35.747560 Num handles: 1 Handle: 40 Count: 1 < ACL Data TX: Handle 40 flags 0x00 dlen 26 [hci0] 21:24:35.748134 ATT: Read By Group Type Response (0x11) len 21 Attribute data length: 20 Attribute group list: 1 entry Handle range: 0x000d-0x000f UUID: Unknown (ae5946d4-e587-4ba8-b6a5-a97cca6affd3) > ACL Data RX: Handle 40 flags 0x02 dlen 11 [hci0] 21:24:35.882342 ATT: Read By Type Request (0x08) len 6 Handle range: 0x0001-0x0009 Attribute type: Characteristic (0x2803) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:35.882562 Num handles: 1 Handle: 40 Count: 1 < ACL Data TX: Handle 40 flags 0x00 dlen 27 [hci0] 21:24:35.883319 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: 0x0007 Value: 200800052a > HCI Event: LE Meta Event (0x3e) plen 10 [hci0] 21:24:36.089593 LE Connection Update Complete (0x03) Status: Success (0x00) Handle: 40 Connection interval: 7.50 msec (0x0006) Connection latency: 0.00 msec (0x0000) Supervision timeout: 20000 msec (0x07d0) > ACL Data RX: Handle 40 flags 0x02 dlen 11 [hci0] 21:24:36.092488 ATT: Read By Group Type Request (0x10) len 6 Handle range: 0x0010-0xffff Attribute group type: Primary Service (0x2800) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.092693 Num handles: 1 Handle: 40 Count: 1 < ACL Data TX: Handle 40 flags 0x00 dlen 9 [hci0] 21:24:36.093376 ATT: Error Response (0x01) len 4 Read By Group Type Request (0x10) Handle: 0x0010 Error: Attribute Not Found (0x0a) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.107631 Num handles: 1 Handle: 40 Count: 1 > ACL Data RX: Handle 40 flags 0x02 dlen 11 [hci0] 21:24:36.107721 ATT: Read By Type Request (0x08) len 6 Handle range: 0x0008-0x0009 Attribute type: Characteristic (0x2803) < ACL Data TX: Handle 40 flags 0x00 dlen 9 [hci0] 21:24:36.108460 ATT: Error Response (0x01) len 4 Read By Type Request (0x08) Handle: 0x0008 Error: Attribute Not Found (0x0a) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.137603 Num handles: 1 Handle: 40 Count: 1 > ACL Data RX: Handle 40 flags 0x02 dlen 11 [hci0] 21:24:36.137743 ATT: Read By Type Request (0x08) len 6 Handle range: 0x0001-0x0005 Attribute type: Include (0x2802) < ACL Data TX: Handle 40 flags 0x00 dlen 9 [hci0] 21:24:36.138865 ATT: Error Response (0x01) len 4 Read By Type Request (0x08) Handle: 0x0001 Error: Attribute Not Found (0x0a) > ACL Data RX: Handle 40 flags 0x02 dlen 9 [hci0] 21:24:36.151625 ATT: Find Information Request (0x04) len 4 Handle range: 0x0008-0x0009 < ACL Data TX: Handle 40 flags 0x00 dlen 14 [hci0] 21:24:36.152325 ATT: Find Information Response (0x05) len 9 Format: UUID-16 (0x01) Handle: 0x0008 UUID: Service Changed (0x2a05) Handle: 0x0009 UUID: Client Characteristic Configuration (0x2902) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.152649 Num handles: 1 Handle: 40 Count: 1 > ACL Data RX: Handle 40 flags 0x02 dlen 11 [hci0] 21:24:36.166752 ATT: Read By Type Request (0x08) len 6 Handle range: 0x0001-0x0005 Attribute type: Characteristic (0x2803) < ACL Data TX: Handle 40 flags 0x00 dlen 20 [hci0] 21:24:36.167472 ATT: Read By Type Response (0x09) len 15 Attribute data length: 7 Attribute data list: 2 entries Handle: 0x0002 Value: 020300002a Handle: 0x0004 Value: 020500012a > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.167636 Num handles: 1 Handle: 40 Count: 1 > ACL Data RX: Handle 40 flags 0x02 dlen 9 [hci0] 21:24:36.181881 ATT: Write Request (0x12) len 4 Handle: 0x0009 Data: 0200 > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.182632 Num handles: 1 Handle: 40 Count: 1 < ACL Data TX: Handle 40 flags 0x00 dlen 5 [hci0] 21:24:36.182996 ATT: Write Response (0x13) len 0 > ACL Data RX: Handle 40 flags 0x02 dlen 11 [hci0] 21:24:36.197011 ATT: Read By Type Request (0x08) len 6 Handle range: 0x0005-0x0005 Attribute type: Characteristic (0x2803) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.197628 Num handles: 1 Handle: 40 Count: 1 < ACL Data TX: Handle 40 flags 0x00 dlen 9 [hci0] 21:24:36.197902 ATT: Error Response (0x01) len 4 Read By Type Request (0x08) Handle: 0x0005 Error: Attribute Not Found (0x0a) > ACL Data RX: Handle 40 flags 0x02 dlen 11 [hci0] 21:24:36.212128 ATT: Read By Type Request (0x08) len 6 Handle range: 0x0006-0x0009 Attribute type: Include (0x2802) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.212624 Num handles: 1 Handle: 40 Count: 1 < ACL Data TX: Handle 40 flags 0x00 dlen 9 [hci0] 21:24:36.213598 ATT: Error Response (0x01) len 4 Read By Type Request (0x08) Handle: 0x0006 Error: Attribute Not Found (0x0a) > ACL Data RX: Handle 40 flags 0x02 dlen 11 [hci0] 21:24:36.227253 ATT: Read By Type Request (0x08) len 6 Handle range: 0x0006-0x0009 Attribute type: Characteristic (0x2803) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.227617 Num handles: 1 Handle: 40 Count: 1 < ACL Data TX: Handle 40 flags 0x00 dlen 13 [hci0] 21:24:36.228693 ATT: Read By Type Response (0x09) len 8 Attribute data length: 7 Attribute data list: 1 entry Handle: 0x0007 Value: 200800052a > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.249536 Num handles: 1 Handle: 40 Count: 1 > ACL Data RX: Handle 40 flags 0x02 dlen 11 [hci0] 21:24:36.249900 ATT: Read By Type Request (0x08) len 6 Handle range: 0x0008-0x0009 Attribute type: Characteristic (0x2803) < ACL Data TX: Handle 40 flags 0x00 dlen 9 [hci0] 21:24:36.250687 ATT: Error Response (0x01) len 4 Read By Type Request (0x08) Handle: 0x0008 Error: Attribute Not Found (0x0a) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.264613 Num handles: 1 Handle: 40 Count: 1 > ACL Data RX: Handle 40 flags 0x02 dlen 9 [hci0] 21:24:36.265032 ATT: Find Information Request (0x04) len 4 Handle range: 0x0009-0x0009 < ACL Data TX: Handle 40 flags 0x00 dlen 10 [hci0] 21:24:36.265670 ATT: Find Information Response (0x05) len 5 Format: UUID-16 (0x01) Handle: 0x0009 UUID: Client Characteristic Configuration (0x2902) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.279612 Num handles: 1 Handle: 40 Count: 1 > ACL Data RX: Handle 40 flags 0x02 dlen 11 [hci0] 21:24:36.280146 ATT: Read By Type Request (0x08) len 6 Handle range: 0x000d-0x000f Attribute type: Include (0x2802) < ACL Data TX: Handle 40 flags 0x00 dlen 9 [hci0] 21:24:36.280771 ATT: Error Response (0x01) len 4 Read By Type Request (0x08) Handle: 0x000d Error: Attribute Not Found (0x0a) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.294616 Num handles: 1 Handle: 40 Count: 1 > ACL Data RX: Handle 40 flags 0x02 dlen 11 [hci0] 21:24:36.295275 ATT: Read By Type Request (0x08) len 6 Handle range: 0x000d-0x000f Attribute type: Characteristic (0x2803) < ACL Data TX: Handle 40 flags 0x00 dlen 27 [hci0] 21:24:36.295927 ATT: Read By Type Response (0x09) len 22 Attribute data length: 21 Attribute data list: 1 entry Handle: 0x000e Value: 020f00fa66c9c19b80cc9cca469924f017a5d1 > ACL Data RX: Handle 40 flags 0x02 dlen 11 [hci0] 21:24:36.309139 ATT: Read By Type Request (0x08) len 6 Handle range: 0x000f-0x000f Attribute type: Characteristic (0x2803) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.309637 Num handles: 1 Handle: 40 Count: 1 < ACL Data TX: Handle 40 flags 0x00 dlen 9 [hci0] 21:24:36.310143 ATT: Error Response (0x01) len 4 Read By Type Request (0x08) Handle: 0x000f Error: Attribute Not Found (0x0a) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.324618 Num handles: 1 Handle: 40 Count: 1 > ACL Data RX: Handle 40 flags 0x02 dlen 7 [hci0] 21:24:36.331766 ATT: Exchange MTU Request (0x02) len 2 Client RX MTU: 505 < ACL Data TX: Handle 40 flags 0x00 dlen 7 [hci0] 21:24:36.332463 ATT: Exchange MTU Response (0x03) len 2 Server RX MTU: 517 > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.347622 Num handles: 1 Handle: 40 Count: 1 > ACL Data RX: Handle 40 flags 0x02 dlen 7 [hci0] 21:24:36.354404 ATT: Read Request (0x0a) len 2 Handle: 0x000f < ACL Data TX: Handle 40 flags 0x00 dlen 310 [hci0] 21:24:36.367639 < ACL Data TX: Handle 40 flags 0x01 dlen 196 [hci0] 21:24:36.367737 ATT: Read Response (0x0b) len 501 Value: 3c68746d6c3e3c686561643e3c7374796c653e0a626f6479207b206261636b67726f756e642d636f6c6f723a206c696e656e3b207d0a6831207b20636f6c6f723a206d61726f6f6e3b206d617267696e2d6c6566743a20343070783b207d0a3c2f7374796c653e3c7469746c653e466174426561636f6e2044656d6f3c2f7469746c653e0a3c6d65746120636861727365743d275554462d38273e3c6d657461206e616d653d276465736372697074696f6e2720636f6e74656e743d27466174426561636f6e2044656d6f272f3e0a3c2f686561643e203c626f64793e203c68313e46617420426561636f6e3c2f68313e203c703e > HCI Event: LE Meta Event (0x3e) plen 10 [hci0] 21:24:36.375644 LE Connection Update Complete (0x03) Status: Success (0x00) Handle: 40 Connection interval: 15.00 msec (0x000c) Connection latency: 0.00 msec (0x0000) Supervision timeout: 20000 msec (0x07d0) > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.415642 Num handles: 1 Handle: 40 Count: 1 > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.422629 Num handles: 1 Handle: 40 Count: 1 > ACL Data RX: Handle 40 flags 0x02 dlen 7 [hci0] 21:24:36.437051 ATT: Read Request (0x0a) len 2 Handle: 0x000f < ACL Data TX: Handle 40 flags 0x00 dlen 310 [hci0] 21:24:36.449740 < ACL Data TX: Handle 40 flags 0x01 dlen 196 [hci0] 21:24:36.449830 ATT: Read Response (0x0b) len 501 Value: 3c68746d6c3e3c686561643e3c7374796c653e0a626f6479207b206261636b67726f756e642d636f6c6f723a206c696e656e3b207d0a6831207b20636f6c6f723a206d61726f6f6e3b206d617267696e2d6c6566743a20343070783b207d0a3c2f7374796c653e3c7469746c653e466174426561636f6e2044656d6f3c2f7469746c653e0a3c6d65746120636861727365743d275554462d38273e3c6d657461206e616d653d276465736372697074696f6e2720636f6e74656e743d27466174426561636f6e2044656d6f272f3e0a3c2f686561643e203c626f64793e203c68313e46617420426561636f6e3c2f68313e203c703e > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.486645 Num handles: 1 Handle: 40 Count: 1 > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.497638 Num handles: 1 Handle: 40 Count: 1 > ACL Data RX: Handle 40 flags 0x02 dlen 7 [hci0] 21:24:36.512169 ATT: Read Request (0x0a) len 2 Handle: 0x000f < ACL Data TX: Handle 40 flags 0x00 dlen 310 [hci0] 21:24:36.525301 < ACL Data TX: Handle 40 flags 0x01 dlen 196 [hci0] 21:24:36.525447 ATT: Read Response (0x0b) len 501 Value: 3c68746d6c3e3c686561643e3c7374796c653e0a626f6479207b206261636b67726f756e642d636f6c6f723a206c696e656e3b207d0a6831207b20636f6c6f723a206d61726f6f6e3b206d617267696e2d6c6566743a20343070783b207d0a3c2f7374796c653e3c7469746c653e466174426561636f6e2044656d6f3c2f7469746c653e0a3c6d65746120636861727365743d275554462d38273e3c6d657461206e616d653d276465736372697074696f6e2720636f6e74656e743d27466174426561636f6e2044656d6f272f3e0a3c2f686561643e203c626f64793e203c68313e46617420426561636f6e3c2f68313e203c703e > HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 21:24:36.550661 Num handles: 1 Handle: 40 Count: 1 -- 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