扫描大量BLE标签

时间:2013-12-04 07:52:08

标签: bluetooth-lowenergy android-bluetooth

我一直在寻找在单次扫描中扫描大量BLE标签(StickNFind)的可能性。我注意到,当我扫描10秒钟时,我可以轻松地检测到大约20个BLE。当我将扫描间隔增加到大约30秒并尝试扫描大量BLE标签时,例如200个标签,我在LogCat中看到有关缓冲区溢出(GKI_exception)的错误。这个问题发生在核心Android库的某个地方,我无法调试。附加了确切的错误日志。

11-27 11:39:30.542: D/dalvikvm(1017): GC_CONCURRENT freed 412K, 8% free 9039K/9760K, paused 1ms+1ms, total 16ms
11-27 11:39:30.552: D/BtGatt.GattService(1017): onScanResult() - address=E8:C6:AD:6F:BC:22, rssi=-76
11-27 11:39:30.552: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.552: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=10
11-27 11:39:30.552: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=n96 len=3 dev_type=2
11-27 11:39:30.552: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.562: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.562: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.562: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.562: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.592: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.592: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.602: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.602: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: GKI_exception(): Task State Table
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [0] task name [BTU] state [1]
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [1] task name [BTIF] state [1]
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [2] task name [A2DP-MEDIA] state [0]
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: GKI_exception 65524 getbuf: out of buffers#####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: 
11-27 11:39:30.602: E/GKI_LINUX(1017): ********************************************************************
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: * GKI_exception(): 65524 getbuf: out of buffers
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: ********************************************************************
11-27 11:39:30.602: E/GKI_LINUX(1017): #####
11-27 11:39:30.602: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.602: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.602: D/BtGatt.GattService(1017): onScanResult() - address=F7:09:63:BC:66:D0, rssi=-78
11-27 11:39:30.602: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.602: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.602: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.602: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=11
11-27 11:39:30.602: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=WWW.JAALEE.COM len=14 dev_type=2
11-27 11:39:30.602: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.672: D/BtGatt.GattService(1017): onScanResult() - address=78:C5:E5:6E:CE:D0, rssi=-86
11-27 11:39:30.672: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.672: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=12
11-27 11:39:30.672: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=WWW.JAALEE.COM len=14 dev_type=2
11-27 11:39:30.672: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.682: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.682: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.682: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.682: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.702: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.702: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.702: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.702: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.702: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: GKI_exception(): Task State Table
11-27 11:39:30.702: E/GKI_LINUX(1017): #####
11-27 11:39:30.702: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [0] task name [BTU] state [1]
11-27 11:39:30.702: E/GKI_LINUX(1017): #####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [1] task name [BTIF] state [1]
11-27 11:39:30.712: E/GKI_LINUX(1017): #####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: TASK ID [2] task name [A2DP-MEDIA] state [0]
11-27 11:39:30.712: E/GKI_LINUX(1017): #####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: GKI_exception 65524 getbuf: out of buffers#####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: 
11-27 11:39:30.712: E/GKI_LINUX(1017): ********************************************************************
11-27 11:39:30.712: E/GKI_LINUX(1017): #####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: * GKI_exception(): 65524 getbuf: out of buffers
11-27 11:39:30.712: E/GKI_LINUX(1017): #####
11-27 11:39:30.712: E/GKI_LINUX(1017): ##### ERROR : GKI_exception: ********************************************************************
11-27 11:39:30.712: E/GKI_LINUX(1017): #####
11-27 11:39:30.732: D/dalvikvm(1017): GC_CONCURRENT freed 385K, 8% free 9038K/9760K, paused 7ms+1ms, total 20ms
11-27 11:39:30.742: D/BtGatt.GattService(1017): onScanResult() - address=78:C5:E5:6E:CF:35, rssi=-94
11-27 11:39:30.742: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.742: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.742: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=13
11-27 11:39:30.742: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=n8B len=3 dev_type=2
11-27 11:39:30.772: D/BtGatt.GattService(1017): onScanResult() - address=FC:A6:B0:A0:32:B6, rssi=-73
11-27 11:39:30.772: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.772: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.772: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=14
11-27 11:39:30.772: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=WWW.JAALEE.COM len=14 dev_type=2
11-27 11:39:30.802: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.802: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.802: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.802: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.802: D/BtGatt.GattService(1017): onScanResult() - address=78:C5:E5:6E:CE:C2, rssi=-76
11-27 11:39:30.802: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.802: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.802: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=15
11-27 11:39:30.812: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=WWW.JAALEE.COM len=14 dev_type=2
11-27 11:39:30.822: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.822: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.822: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.822: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.842: D/BtGatt.GattService(1017): onScanResult() - address=78:C5:E5:6E:CF:2D, rssi=-76
11-27 11:39:30.842: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.842: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.842: D/BtGatt.btif(1017): btif_gattc_upstreams_evt: Event 4096
11-27 11:39:30.842: D/BtGatt.btif(1017): btif_gattc_add_remote_bdaddr device overwrite idx=16
11-27 11:39:30.842: D/BtGatt.btif(1017): btif_gattc_update_properties BLE device name=s8E len=3 dev_type=2
11-27 11:39:30.842: I/bt-hci(1017): BLE HCI(id=62) event = 0x02)
11-27 11:39:30.842: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.842: I/bt-hci(1017): btu_ble_process_adv_pkt
11-27 11:39:30.902: D/btif_config_util(1017): btif_config_save_file(L153): in file name:/data/misc/bluedroid/bt_config.new
11-27 11:39:30.902: D/dalvikvm(1017): GC_CONCURRENT freed 480K, 8% free 9038K/9760K, paused 2ms+2ms, total 20ms

出现此类问题的原因是什么?如何解决?

提前致谢!

1 个答案:

答案 0 :(得分:4)

我认为没有办法完全解决这个问题,但是你可以做的一件事就是减少发生这种错误的可能性,那就是在onLeScan-callback中做尽可能少的工作。它是从系统内部的专用蓝牙线程调用的。根据我的经验,如果你在这个回调/线程中做了很多工作,你提到的错误会更频繁地发生。

编辑:我提交了一份错误报告:https://code.google.com/p/android/issues/detail?id=65455