简体   繁体   中英

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+. I override DefaultDelegate and handleNotification(cHandle, data) , and get data from handleNotification(cHandle, data) . Then I convert type of data from byte to hex, and I can only get 20 bytes of data.

Here is my code:

dev = btle.Peripheral(address, 'random')
dev.setMTU(244)

My BLE peripheral device is "Nordic NRF52832". How can I get more than 20 bytes of data?

I think I find the reason of it. Library bluepy supports BLE4.0 but don't support BLE4.2 . BLE4.0 and BLE4.1 can get the payload for only 20 bytes.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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