Skip to content

Commit 9a3d45e

Browse files
committed
Add extended, connectable and scannable error.
Related to adafruit/Adafruit_CircuitPython_BLE#44
1 parent 10183d5 commit 9a3d45e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

shared-bindings/_bleio/Adapter.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
#include "py/objproperty.h"
3131
#include "py/runtime.h"
32+
#include "shared-bindings/_bleio/__init__.h"
3233
#include "shared-bindings/_bleio/Address.h"
3334
#include "shared-bindings/_bleio/Adapter.h"
3435

@@ -185,7 +186,12 @@ STATIC mp_obj_t bleio_adapter_start_advertising(mp_uint_t n_args, const mp_obj_t
185186
ADV_INTERVAL_MIN_STRING, ADV_INTERVAL_MAX_STRING);
186187
}
187188

188-
common_hal_bleio_adapter_start_advertising(self, args[ARG_connectable].u_bool, interval,
189+
bool connectable = args[ARG_connectable].u_bool;
190+
if (data_bufinfo.len > 31 && connectable && scan_response_bufinfo.len > 0) {
191+
mp_raise_bleio_BluetoothError(translate("Cannot have scan responses for extended, connectable advertisements."));
192+
}
193+
194+
common_hal_bleio_adapter_start_advertising(self, connectable, interval,
189195
&data_bufinfo, &scan_response_bufinfo);
190196

191197
return mp_const_none;

0 commit comments

Comments
 (0)