gpt4 book ai didi

Android 4.4.4 Moto G Bluetooth LE 重新连接问题

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:57:08 24 4
gpt4 key购买 nike

我有一个应用程序在运行 Android 4.3 的三星 S3 上运行良好,但我在运行 4.4.4 的 Moto G 上遇到问题

我的 BLE 外围设备在应用程序使用过程中连接和断开连接多次。这工作正常,但有时会出现应用程序/手机不再重新连接到外围设备的情况。

所有 gatt 命令都在主线程上运行,eg.

final BluetoothGatt gat = gatt;
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
// This code will be executed on the main thread
if (Looper.myLooper() == Looper.getMainLooper()) {
Log.e(TAG, "mGattCallback disconnect2: NOW ON MAIN THREAD :)");
}
gat.disconnect();
}
});

并且外围设备断开连接正常。当发生这种情况并且我无法再重新连接到外围设备时,我会收到大量这样的日志:

04-07 16:57:56.798: I/bt-hci(2127): BLE HCI(id=62) event = 0x02)
04-07 16:57:56.798: I/bt-hci(2127): btu_ble_process_adv_pkt
04-07 16:57:56.833: I/bt-hci(2127): BLE HCI(id=62) event = 0x02)
04-07 16:57:56.833: I/bt-hci(2127): btu_ble_process_adv_pkt
04-07 16:57:56.871: I/bt-hci(2127): BLE HCI(id=62) event = 0x02)
04-07 16:57:56.871: I/bt-hci(2127): btu_ble_process_adv_pkt
04-07 16:57:56.906: I/bt-hci(2127): BLE HCI(id=62) event = 0x02)
04-07 16:57:56.906: I/bt-hci(2127): btu_ble_process_adv_pkt
04-07 16:57:56.941: I/bt-hci(2127): BLE HCI(id=62) event = 0x02)
04-07 16:57:56.941: I/bt-hci(2127): btu_ble_process_adv_pkt
04-07 16:57:56.977: I/bt-hci(2127): BLE HCI(id=62) event = 0x02)
04-07 16:57:56.977: I/bt-hci(2127): btu_ble_process_adv_pkt
04-07 16:57:57.016: I/bt-hci(2127): BLE HCI(id=62) event = 0x02)
04-07 16:57:57.016: I/bt-hci(2127): btu_ble_process_adv_pkt

我需要退出该应用程序,关闭蓝牙然后重新打开,以便它再次开始正常工作。

有任何已知问题、提示或建议吗?

谢谢

编辑------------经过更多测试后,似乎让应用程序继续运行,最终我得到以下日志,然后我的外围设备可以再次重新连接:

04-13 19:11:53.973: I/bt-hci(2034): BLE HCI(id=62) event = 0x02)
04-13 19:11:53.973: I/bt-hci(2034): btu_ble_process_adv_pkt
04-13 19:11:54.076: I/bt-hci(2034): BLE HCI(id=62) event = 0x02)
04-13 19:11:54.076: I/bt-hci(2034): btu_ble_process_adv_pkt
04-13 19:11:55.986: I/bt-hci(2034): BLE HCI(id=62) event = 0x02)
04-13 19:11:55.986: I/bt-hci(2034): btu_ble_process_adv_pkt
04-13 19:11:56.087: I/bt-hci(2034): BLE HCI(id=62) event = 0x02)
04-13 19:11:56.087: I/bt-hci(2034): btu_ble_process_adv_pkt
04-13 19:11:56.629: I/bt-hci(2034): BLE HCI(id=62) event = 0x02)
04-13 19:11:56.629: I/bt-hci(2034): btu_ble_process_adv_pkt
04-13 19:11:56.734: I/bt-hci(2034): BLE HCI(id=62) event = 0x02)
04-13 19:11:56.734: I/bt-hci(2034): btu_ble_process_adv_pkt
04-13 19:11:58.925: D/MDMCTBK(275): reply_len: 40 reply is = IFNAME=wlan0 <3>CTRL-EVENT-SCAN-RESULTS
04-13 19:11:58.925: D/MDMCTBK(275): Event received = CTRL-EVENT-SCAN-RESULTS
04-13 19:11:58.926: D/WifiStateMachine(1010): handleMessage: E msg.what=147461
04-13 19:11:58.926: D/WifiStateMachine(1010): processMsg: DisconnectedState
04-13 19:11:58.926: D/WifiStateMachine(1010): processMsg: ConnectModeState
04-13 19:11:58.926: D/WifiStateMachine(1010): processMsg: DriverStartedState
04-13 19:11:58.927: D/WifiStateMachine(1010): processMsg: SupplicantStartedState
04-13 19:11:58.928: D/TCMD(4253): NL - Read 56 bytes from update socket.
04-13 19:11:58.928: D/TCMD(4253): NL - message type is RTM_NEWLINK
04-13 19:11:58.928: D/TCMD(4253): Listening for incoming client connection request
04-13 19:35:18.787: V/AlarmManager(1010): sending alarm Alarm{42b84cc0 type 2 com.google.android.gms}
04-13 19:35:18.787: V/AlarmManager(1010): sending alarm Alarm{42b83a00 type 0 android}
04-13 19:11:58.941: D/WifiStateMachine(1010): handleMessage: X
04-13 19:12:00.615: D/WifiStateMachine(1010): handleMessage: E msg.what=131143
04-13 19:12:00.615: D/WifiStateMachine(1010): processMsg: DisconnectedState
04-13 19:12:00.616: D/WifiStateMachine(1010): processMsg: ConnectModeState
04-13 19:12:00.617: D/WifiStateMachine(1010): processMsg: DriverStartedState
04-13 19:12:00.628: D/WifiStateMachine(1010): handleMessage: X
04-13 19:12:01.425: D/MDMCTBK(275): reply_len: 40 reply is = IFNAME=wlan0 <3>CTRL-EVENT-BSS-REMOVED 1
04-13 19:12:01.425: D/MDMCTBK(275): Event received = CTRL-EVENT-BSS-REMOVED 1
04-13 19:12:01.425: D/MDMCTBK(275): reply_len: 40 reply is = IFNAME=wlan0 <3>CTRL-EVENT-SCAN-RESULTS
04-13 19:12:01.425: D/MDMCTBK(275): Event received = CTRL-EVENT-SCAN-RESULTS
04-13 19:12:01.425: D/WifiStateMachine(1010): handleMessage: E msg.what=147461
04-13 19:12:01.426: D/WifiStateMachine(1010): processMsg: DisconnectedState
04-13 19:12:01.426: D/WifiStateMachine(1010): processMsg: ConnectModeState
04-13 19:12:01.426: D/WifiStateMachine(1010): processMsg: DriverStartedState
04-13 19:12:01.426: D/WifiStateMachine(1010): processMsg: SupplicantStartedState
04-13 19:12:01.428: D/MDMCTBK(275): reply_len: 40 reply is = IFNAME=p2p0 <3>CTRL-EVENT-BSS-REMOVED 1
04-13 19:12:01.428: D/MDMCTBK(275): Event received = CTRL-EVENT-BSS-REMOVED 1
04-13 19:12:01.428: D/TCMD(4253): NL - Read 56 bytes from update socket.
04-13 19:12:01.428: D/TCMD(4253): NL - message type is RTM_NEWLINK
04-13 19:12:01.428: D/TCMD(4253): Listening for incoming client connection request
04-13 19:12:01.444: D/WifiStateMachine(1010): handleMessage: X

貌似和WiFi有关?!

最佳答案

我认为不会有像“使用主线程”这样简单的答案,一切都很好。但我可以给你一些我在使用糟糕的 Android BLE 时收集到的提示:

  • BT 堆栈在不同的手机上会有所不同,不幸的是,如果我们谈论 BLE,Moto G 是最糟糕的手机之一……有多糟糕? Tile 应用程序甚至在其 F.A.Q What Android phones will Tile work with 中声明:

will work only with Samsung Galaxy S5, HTC One M8, HTC One, LG Nexus 4, LG Nexus 5, LG Nexus 6, Samsung Note 4, Motorola Moto X and certainly will not work with Moto G

Bluedroid continues to mature and stabilize; there were 565 commits to the bluedroid project alone from 4.4 -> 5.0, compared with 52 commits from 4.3 -> 4.4, and 47 commits from 4.2 -> 4.3.* This is an area of heavy activity within AOSP right now.

关于Android 4.4.4 Moto G Bluetooth LE 重新连接问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29495989/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com