[英]Peripheral.setMTU(244) but can get only 20 bytes
I want to read more than 20 bytes of data from bluetooth to raspberry pi 3b+.我想从蓝牙读取超过 20 个字节的数据到树莓派 3b+。 I override
DefaultDelegate
and handleNotification(cHandle, data)
, and get data from handleNotification(cHandle, data)
.我覆盖
DefaultDelegate
和handleNotification(cHandle, data)
,并从handleNotification(cHandle, data)
获取数据。 Then I convert type of data from byte to hex, and I can only get 20 bytes of data.然后我将数据类型从字节转换为十六进制,我只能得到 20 个字节的数据。
Here is my code:这是我的代码:
dev = btle.Peripheral(address, 'random')
dev.setMTU(244)
My BLE peripheral device is "Nordic NRF52832".我的 BLE 外围设备是“Nordic NRF52832”。 How can I get more than 20 bytes of data?
如何获得超过 20 个字节的数据?
I think I find the reason of it.我想我找到了原因。 Library
bluepy
supports BLE4.0
but don't support BLE4.2
.库
bluepy
支持BLE4.0
但不支持BLE4.2
。 BLE4.0
and BLE4.1
can get the payload for only 20 bytes. BLE4.0
和BLE4.1
只能获得 20 字节的有效载荷。
Adding delay worked for me :添加延迟对我有用:
dev = btle.Peripheral(address, 'random')
import time
time.sleep(1)
dev.setMTU(244)
source: https://github.com/IanHarvey/bluepy/issues/325来源: https : //github.com/IanHarvey/bluepy/issues/325
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.