Services undiscoverable in Android?
See original GitHub issueHi there. Thank you for your work with this package.
I’m currently running into an issue while trying to discover services on Android devices (using nRF connect, to be specific). nRF Control seems to connect to the peripheral just fine, then during a call to discoverServices()
the result is a big fat 0. Shortly thereafter, the device disconnects. It should be noted that using LightBlue on iOS yields positive results.
I searched through previous issues and couldn’t find anything, though it seems someone outlined an issue here which may be related (?) It sounds almost identical to what I’m experiencing.
Here are some details of my setup:
- Raspberry Pi Zero W running Raspbian:
Linux 4.9.24+ #993 Wed Apr 26 17:56:54 BST 2017 armv6l GNU/Linux
- BlueZ version:
5.23
- Executed
sudo systemctl stop bluetooth
- Executed
sudo hciconfig hci0 up
(restarted a few times as well…)
It should also be noted that I am using noble in the same project, though it isn’t being utilized at the same time as bleno. Nevertheless, I went ahead and added the environment variable setting
NOBLE_MULTI_ROLE=1
Here is the relevant hcidump for the complete interaction between devices (on Android):
HCI sniffer - Bluetooth packet analyzer ver 5.23
device: hci0 snap_len: 1500 filter: 0xffffffff
2017-05-02 16:40:52.405443 > HCI Event: LE Meta Event (0x3e) plen 19
LE Connection Complete
status 0x00 handle 65, role slave
bdaddr 58:9B:0B:D8:1B:E7 (Random)
2017-05-02 16:40:52.406003 < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
41 00
2017-05-02 16:40:52.410672 > HCI Event: Command Status (0x0f) plen 4
LE Read Remote Used Features (0x08|0x0016) status 0x00 ncmd 1
2017-05-02 16:40:52.650050 > ACL data: handle 65 flags 0x02 dlen 13
ATT: Find By Type req (0x06)
start 0x0001, end 0xffff, uuid 0x2800
value 0x01 0x18
2017-05-02 16:40:52.699146 > HCI Event: LE Meta Event (0x3e) plen 12
LE Read Remote Used Features Complete
status 0x00 handle 65
Features: 0x1f 0x00 0x00 0x00 0x00 0x00 0x00 0x00
2017-05-02 16:40:52.699379 < ACL data: handle 65 flags 0x00 dlen 16
L2CAP(d): cid 0x0005 len 12 [psm 0]
12 01 08 00 28 00 38 00 00 00 D0 07
2017-05-02 16:40:52.753771 < ACL data: handle 65 flags 0x00 dlen 7
ATT: MTU req (0x02)
client rx mtu 256
2017-05-02 16:40:52.775569 < ACL data: handle 65 flags 0x00 dlen 9
ATT: Find By Type resp (0x07)
Found attr 0x0006, group end handle 0x0009
2017-05-02 16:40:52.894371 > ACL data: handle 65 flags 0x02 dlen 10
L2CAP(d): cid 0x0005 len 6 [psm 0]
13 01 02 00 00 00
2017-05-02 16:40:52.895357 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 65 packets 2
2017-05-02 16:40:52.942545 > ACL data: handle 65 flags 0x02 dlen 7
ATT: MTU resp (0x03)
server rx mtu 256
2017-05-02 16:40:52.943290 > ACL data: handle 65 flags 0x02 dlen 11
ATT: Read By Group req (0x10)
start 0x0001, end 0xffff
type-uuid 0x2800
2017-05-02 16:40:52.945061 < ACL data: handle 65 flags 0x00 dlen 9
ATT: Error (0x01)
Error: Request not supported (6)
MTU resp (0x03) on handle 0x0000
2017-05-02 16:40:52.950031 < ACL data: handle 65 flags 0x00 dlen 18
ATT: Read By Group resp (0x11)
attr handle 0x0001, end group handle 0x0005
value 0x00 0x18
attr handle 0x0006, end group handle 0x0009
value 0x01 0x18
2017-05-02 16:40:52.991838 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 65 packets 2
2017-05-02 16:40:53.088796 > ACL data: handle 65 flags 0x02 dlen 13
ATT: Find By Type req (0x06)
start 0x000a, end 0xffff, uuid 0x2800
value 0x01 0x18
2017-05-02 16:40:53.091456 < ACL data: handle 65 flags 0x00 dlen 9
ATT: Error (0x01)
Error: Attribute not found (10)
Find By Type req (0x06) on handle 0x000a
2017-05-02 16:40:53.235171 > HCI Event: Number of Completed Packets (0x13) plen 5
handle 65 packets 2
2017-05-02 16:40:54.123068 > HCI Event: LE Meta Event (0x3e) plen 10
LE Connection Update Complete
status 0x00 handle 65
interval 67.50ms, latency 0.00ms, superv. timeout 20000.00ms
2017-05-02 16:41:23.284044 > HCI Event: Disconn Complete (0x05) plen 4
status 0x00 handle 65 reason 0x13
Reason: Remote User Terminated Connection
2017-05-02 16:41:23.306257 < HCI Command: LE Set Advertise Enable (0x08|0x000a) plen 1
01
2017-05-02 16:41:23.307317 > HCI Event: Command Complete (0x0e) plen 4
LE Set Advertise Enable (0x08|0x000a) ncmd 1
status 0x00
Any and all help is appreciated, and please let me know if any further information is required. Thanks!
Edit - text file of hcidump lost formatting. Pasted in code block instead.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7
@seanfar ok, I think I know what the problem is. If you look at BLE state machines, for the most part if you start scanning you can no longer advertise and accept connections.
You might need 2 Bluetooth adapters to accomplish your goal …
@seanfar Thanks for your share
Can you show me your SetWifiCharacteristic too?