Skip to content

Commit 2505ce2

Browse files
committed
Do not add a scan response when using extended advertising.
1 parent 27e6cb7 commit 2505ce2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

adafruit_ble/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,16 @@ def start_advertising(self, advertisement, scan_response=None, interval=0.1):
164164
`BLERadio.name` and `BLERadio.tx_power`.
165165
:param float interval: advertising interval, in seconds
166166
"""
167-
if not scan_response:
167+
advertisement_bytes = bytes(advertisement)
168+
scan_response_bytes = b""
169+
if not scan_response and len(advertisement_bytes) <= 31:
168170
scan_response = Advertisement()
169171
scan_response.complete_name = self.name
170172
scan_response.tx_power = self.tx_power
171-
self._adapter.start_advertising(bytes(advertisement),
172-
scan_response=bytes(scan_response),
173+
if scan_response:
174+
scan_response_bytes = bytes(scan_response)
175+
self._adapter.start_advertising(advertisement_bytes,
176+
scan_response=scan_response_bytes,
173177
connectable=advertisement.connectable,
174178
interval=interval)
175179

0 commit comments

Comments
 (0)