Skip to content

Commit 7c2c26d

Browse files
committed
add timeout to start_advertising
1 parent aee83fb commit 7c2c26d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

adafruit_ble/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,16 @@ def __init__(self, adapter=None):
162162
self._current_advertisement = None
163163
self._connection_cache = {}
164164

165-
def start_advertising(self, advertisement, scan_response=None, interval=0.1):
165+
def start_advertising(self, advertisement, scan_response=None, interval=0.1, timeout=0):
166166
"""
167167
Starts advertising the given advertisement.
168168
169169
:param buf scan_response: scan response data packet bytes.
170170
If ``None``, a default scan response will be generated that includes
171171
`BLERadio.name` and `BLERadio.tx_power`.
172172
:param float interval: advertising interval, in seconds
173+
:param int timeout: advertising timeout in seconds.
174+
If 0, no timeout.
173175
"""
174176
advertisement_bytes = bytes(advertisement)
175177
scan_response_bytes = b""
@@ -184,6 +186,7 @@ def start_advertising(self, advertisement, scan_response=None, interval=0.1):
184186
scan_response=scan_response_bytes,
185187
connectable=advertisement.connectable,
186188
interval=interval,
189+
timeout=timeout,
187190
)
188191

189192
def stop_advertising(self):

0 commit comments

Comments
 (0)