BLE device name?
-
adv = bt.get_adv() get a ble device
but bt.resolve_adv_data(adv.data, bt.ADV_NAME_CMPL) always returns a 'None' -
Hi @DongYin,
What happens if you try to use ADV_NAME_SHORT instead of ADV_NAME_CMPL ?
-
@duffo64 said in BLE device name?:
Hi @DongYin,
What happens if you try to use ADV_NAME_SHORT instead of ADV_NAME_CMPL ?
ADV_NAME_SHORT returns 'None' too.
if i use ADV_MANUFACTURER_DATA returns " b'L\x00\x10\x02\n\x00' "
others Address type all return 'None' -
@DongYin I'm not the bluetooth expert, but I think not all devices return their name. I also get None for most devices I find in our office building, but when I test it with this BLE Peripheral simulator app, I do get the name. Maybe @daniel can confirm.
-
@DongYin BLE advertisements can only carry a certain amount of data (up to 31 bytes) and the device advertising chooses what to send. Many devices do not advertise the name.
-
-
This is what I add into my lopy so they get a name:
bluetooth.set_advertisement(name="lopy", manufacturer_data="lopy_v1")
and when I look for the lopy I do this:
from network import Bluetooth
#import time - Dont need this part for this
bt = Bluetooth()
bt.start_scan(-1)while True:
adv = bt.get_adv()
if adv and bt.resolve_adv_data(adv.data, Bluetooth.ADV_NAME_CMPL) == 'lopy':
try:
conn = bt.connect(adv.mac)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login