BLE设备适用于ios但不适用于Android

时间:2018-02-07 08:58:51

标签: android bluetooth-lowenergy

这是我的问题 我有一个使用BLE的电子锁,它在ios上工作正常(LightBlue和我制造的应用程序)
但是在Android上,在与锁定绑定后(我输入了密码000000),我可以连接到设备,但其中一个服务(UUID:7570)变空,我无法读取或写入任何设备特征。
此外,设备在大约20秒后总是断开连接。

这是来自ios的ScreenShot

enter image description here

这是来自android的ScreenShot(空服务)

enter image description here

这是我从nRF Connect获得的日志

nRF Connect, 2018-02-07          
OHGA-ELock 60012 (68:C9:0B:15:99:0D)          
V   17:57:52.234    Connecting to 68:C9:0B:15:99:0D...          
D   17:57:52.234    gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE)          
D   17:57:52.767    [Callback] Connection state changed with status: 0 and new state: CONNECTED (2)          
I   17:57:52.767    Connected to 68:C9:0B:15:99:0D          
D   17:57:52.769    wait(1600ms)          
D   17:57:52.785    [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED          
V   17:57:54.373    Discovering services...          
D   17:57:54.373    gatt.discoverServices()          
D   17:57:54.395    [Callback] Services discovered with status: 0          
I   17:57:54.395    Services discovered          
V   17:57:54.414    Generic Access (0x1800)          
- Device Name [R] (0x2A00)          
- Appearance [R] (0x2A01)          
- Peripheral Preferred Connection Parameters [R] (0x2A04)          
Generic Attribute (0x1801)          
Unknown Service (00007570-0000-0000-0000-000000000000)          
Device Information (0x180A)          
- System ID [R] (0x2A23)          
- Model Number String [R] (0x2A24)          
- Serial Number String [R] (0x2A25)          
- Firmware Revision String [R] (0x2A26)          
- Hardware Revision String [R] (0x2A27)          
- Software Revision String [R] (0x2A28)          
- Manufacturer Name String [R] (0x2A29)  

D   17:58:10.701    [Callback] Connection state changed with status: 8 and new state: DISCONNECTED (0)  
        E   17:58:10.701    Error 8 (0x8): GATT CONN TIMEOUT   
        I   17:58:10.701    Disconnected  
        D   17:58:10.794    [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED  

我已在使用不同测试应用的不同Android手机上对其进行了测试 这是BLE设备的问题吗?

如果需要更具体的细节,请告诉我 任何帮助或建议将不胜感激。 谢谢!

1 个答案:

答案 0 :(得分:0)

  

设备在大约20秒后总是断开连接

这是因为监督超时。在Android中,它被硬编码为20秒,在此期间重新连接不起作用。有关更多信息,请了解这20秒和监督超时的内容 - Android BLE connection timeouts and GATT internal errors