Bluetooth (BLE) gap_advertise fails on multiple UUID's... #9294
-
Hello, from ble_advertising import advertising_payload as adpl
import ubluetooth
ble = ubluetooth.BLE()
ble.active(True)
p1 = adpl(name='Test_A',services=[ubluetooth.UUID(0x181A)],)
p2 = adpl(name='Test_B',services=[ubluetooth.UUID("6E400001-B5A3-F393-E0A9-E50E24DCCA9E")],)
p3 = adpl(name='Test_AC',services=[ubluetooth.UUID(0x181A), ubluetooth.UUID(0x1801)],)
p4 = adpl(name='Test_AB',services=[ubluetooth.UUID(0x181A), ubluetooth.UUID("6E400001-B5A3-F393-E0A9-E50E24DCCA9E")],)
ble.gap_advertise(30000, adv_data=p1) # Works
ble.gap_advertise(30000, adv_data=p2) # Works
ble.gap_advertise(30000, adv_data=p3) # Works
ble.gap_advertise(30000, adv_data=p4) # FAILS!! Last line results in:
I suspect the advertising packet is overflowing, yet don't believe this is correct. What am I missing?? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This is exactly what's happening. >>> print(len(p1), len(p2), len(p3), len(p4))
15 29 20 34 BLE advertising payloads max length is 31. You should either put some of your data into the scan response instead. Or use |
Beta Was this translation helpful? Give feedback.
-
May I know are you trying to have multiple advertisements? |
Beta Was this translation helpful? Give feedback.
This is exactly what's happening.
BLE advertising payloads max length is 31.
You should either put some of your data into the scan response instead.
Or use
aioble
which does this automatically.