简体   繁体   English

BLE设备可在iOS上使用,但不能在Android上使用

[英]BLE device works on ios but not on Android

Here's my problem 这是我的问题
I have an electronic lock that uses BLE, it works fine on ios(Both LightBlue & the app I made) 我有一个使用BLE的电子锁,它在ios上正常工作(LightBlue和我制作的应用程序)
But on Android, after bonding with the lock(I entered the pin code 000000), I can connect to the device, but one of the Service (UUID:7570) becomes empty, and I can't read or write to any characteristic. 但是在Android上,用锁绑定(我输入的密码为000000)后,我可以连接到设备,但是其中一个服务(UUID:7570)变为空,并且我无法读取或写入任何特征。
Also the device always gets disconnected after about 20 seconds. 此外,设备始终会在约20秒后断开连接。

This is the ScreenShot from ios 这是来自iOS的ScreenShot

在此处输入图片说明

This is the ScreenShot from android (with empty Service) 这是来自Android的ScreenShot(带有空服务)

在此处输入图片说明

Here's the log I got from nRF Connect 这是我从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  

I've tested it on different Android phones with different testing apps. 我已经在具有不同测试应用程序的不同Android手机上对其进行了测试。
Is there a chance this is an issue of the BLE device? 是否有可能是BLE设备的问题?

Please let me know if more specific details are needed. 如果需要更多具体细节,请告诉我。
Any help or suggestion would be appreciated. 任何帮助或建议,将不胜感激。 Thanks! 谢谢!

the device always gets disconnected after about 20 seconds 约20秒后,设备始终会断开连接

This is because of the supervision timeout . 这是因为监督超时 In Android it is hardcoded to 20 seconds during which a re-connect doesn't work. 在Android中,它被硬编码为20秒,在此期间无法重新连接。 For more information to know what this 20 seconds and supervision timeout take a look here- Android BLE connection timeouts and GATT internal errors 要了解更多信息以了解这20秒和监管超时,请看这里-Android BLE连接超时和GATT内部错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM