【发布时间】:2020-02-07 00:19:41
【问题描述】:
我致力于通过 BLE 将文件从智能手机传输到外围设备。
通过 BLE 发送数据很慢(数据传输是通过覆盖一个 20 字节长的字符来实现的)。速度慢不是问题,因为文件的大小也非常小(最多 1MB)。
在琐碎的测试中,一切正常。只要我尝试在循环中自动运行文件传输(例如,出于测试目的让它整夜运行),在具有蓝牙标准 4.2 的设备上,Android 会在短时间内向 Logcat 发送以下内容:
01-24 13:44:08.411 1002 2449 10116 D vendor.qti.bluetooth@1.0-uart_controller: ReportSocFailure
01-24 13:44:08.411 1002 2449 10116 D vendor.qti.bluetooth@1.0-uart_controller: ReportSocFailure send soc failure
01-24 13:44:08.411 1002 2449 10116 E vendor.qti.bluetooth@1.0-uart_controller: Error reading data from uart
在向该输出发送垃圾邮件数秒后,以下输出被写入 Logcat,表示蓝牙正在停止/重新启动
1-24 13:44:08.428 1002 2449 2449 W vendor.qti.bluetooth@1.0-async_fd_watcher: StopThread: stopped the work thread
01-24 13:44:08.428 1002 2449 2449 D vendor.qti.bluetooth@1.0-uart_transport: userial clock off
01-24 13:44:38.527 1002 2449 2449 I vendor.qti.bluetooth@1.0-uart_transport: DeInitTransport: Transport is being closed!
01-24 13:44:38.528 1002 2449 2449 D vendor.qti.bluetooth@1.0-power_manager: SetPower: enable: 0
01-24 13:44:38.529 1002 2449 2449 D vendor.qti.bluetooth@1.0-power_manager: GetRfkillFd: rfkill_fd: 9
01-24 13:44:38.529 1002 2449 2449 D vendor.qti.bluetooth@1.0-power_manager: ControlRfkill: rfkill_fd: 9, enable: 0
01-24 13:44:38.637 1002 2449 2449 W vendor.qti.bluetooth@1.0-data_handler: controller Cleanup done
01-24 13:44:38.638 1002 2449 2449 I vendor.qti.bluetooth@1.0-data_handler: DataHandler:: joined Init thread
01-24 13:44:38.638 1002 2449 2449 E vendor.qti.bluetooth@1.0-wake_lock: Release wake lock not initialized/acquired
01-24 13:44:38.638 1002 2449 2449 D vendor.qti.bluetooth@1.0-wake_lock: CleanUp wakelock is destroyed
01-24 13:44:38.638 1002 2449 2449 W vendor.qti.bluetooth@1.0-bluetooth_hci: BluetoothHci::close, finish cleanup
01-24 13:44:38.713 u0_a3 3430 3430 D BluetoothSap: Proxy object disconnected
01-24 13:44:38.715 1000 26585 26585 D A2dpProfile: Bluetooth service disconnected
01-24 13:44:38.716 1000 26585 26585 D BluetoothSap: Proxy object disconnected
01-24 13:44:38.718 1000 26585 26585 D SapProfile: Bluetooth service disconnected
01-24 13:44:38.719 1000 26585 26585 D BluetoothInputDevice: Proxy object disconnected
01-24 13:44:38.719 10137 28340 28340 D BluetoothInputDevice: Proxy object disconnected
在这些事件之后,用于写入数据的服务重新启动,我的猜测是因为设备上的蓝牙模块也重新启动。
在蓝牙标准 4.0 的设备上一切正常,我可以让持续的文件传输运行一天,不会发生崩溃。
您对为什么会发生这种情况有任何想法或建议吗?为了与蓝牙适配器交互我使用库 RxBle
https://github.com/Polidea/RxAndroidBle
谢谢。
【问题讨论】:
-
我仍然想弄清楚您为什么要通过 BLE 传输实际文件。
-
文件传输的内容是小的二进制文件(一个最大250kB)。这些文件包含设备的固件更新。
-
嗯,它崩溃的事实显然是您特定 Android 设备中的一个错误。为什么不向制造商投诉?
标签: android bluetooth-lowenergy