Skip to content

Commit 91c9d51

Browse files
committed
Refine comments and switch prefix_len to size_t
1 parent ece8352 commit 91c9d51

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

ports/nrf/common-hal/_bleio/Adapter.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ STATIC uint32_t ble_stack_enable(void) {
123123
return err_code;
124124
}
125125

126-
// Double the GATT Server attribute size to accomodate both the CircuitPython built-in service
126+
// Triple the GATT Server attribute size to accomodate both the CircuitPython built-in service
127127
// and anything the user does.
128128
memset(&ble_conf, 0, sizeof(ble_conf));
129129
ble_conf.gatts_cfg.attr_tab_size.attr_tab_size = BLE_GATTS_ATTR_TAB_SIZE_DEFAULT * 3;
@@ -163,7 +163,8 @@ STATIC bool adapter_on_ble_evt(ble_evt_t *ble_evt, void *self_in) {
163163

164164
switch (ble_evt->header.evt_id) {
165165
case BLE_GAP_EVT_CONNECTED: {
166-
// Find an empty connection
166+
// Find an empty connection. One must always be available because the SD has the same
167+
// total connection limit.
167168
bleio_connection_internal_t *connection;
168169
for (size_t i = 0; i < BLEIO_TOTAL_CONNECTION_COUNT; i++) {
169170
connection = &connections[i];
@@ -369,7 +370,7 @@ STATIC bool scan_on_ble_evt(ble_evt_t *ble_evt, void *scan_results_in) {
369370
return true;
370371
}
371372

372-
mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t* prefixes, uint8_t prefix_length, bool extended, mp_int_t buffer_size, mp_float_t timeout, mp_float_t interval, mp_float_t window, mp_int_t minimum_rssi, bool active) {
373+
mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t* prefixes, size_t prefix_length, bool extended, mp_int_t buffer_size, mp_float_t timeout, mp_float_t interval, mp_float_t window, mp_int_t minimum_rssi, bool active) {
373374
if (self->scan_results != NULL) {
374375
if (!shared_module_bleio_scanresults_get_done(self->scan_results)) {
375376
mp_raise_RuntimeError(translate("Scan already in progess. Stop with stop_scan."));

shared-bindings/_bleio/Adapter.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@
6161
//| additional functionality available after the devices establish a connection. For example, a
6262
//| BLE keyboard may advertise that it can provide key information, but not what the key info is.
6363
//|
64-
//| The built-in BLE adapter can do both parts of this process, it can scan for other device
65-
//| advertisements and it can advertise it's own data. Furthermore, Adapters can accept incoming
64+
//| The built-in BLE adapter can do both parts of this process: it can scan for other device
65+
//| advertisements and it can advertise its own data. Furthermore, Adapters can accept incoming
6666
//| connections and also initiate connections.
6767
//|
6868

@@ -207,7 +207,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_advertising_obj, bleio_adapt
207207
//| filtered and returned separately.
208208
//|
209209
//| :param sequence prefixes: Sequence of byte string prefixes to filter advertising packets
210-
//| with. A packets without an advertising structure that matches one of the prefixes are
210+
//| with. A packet without an advertising structure that matches one of the prefixes is
211211
//| ignored. Format is one byte for length (n) and n bytes of prefix and can be repeated.
212212
//| :param int buffer_size: the maximum number of advertising bytes to buffer.
213213
//| :param bool extended: When True, support extended advertising packets. Increasing buffer_size is recommended when this is set.

shared-bindings/_bleio/Adapter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ extern uint32_t _common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t
5050
extern void common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self, bool connectable, mp_float_t interval, mp_buffer_info_t *advertising_data_bufinfo, mp_buffer_info_t *scan_response_data_bufinfo);
5151
void common_hal_bleio_adapter_stop_advertising(bleio_adapter_obj_t *self);
5252

53-
mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t* prefixes, uint8_t prefix_length, bool extended, mp_int_t buffer_size, mp_float_t timeout, mp_float_t interval, mp_float_t window, mp_int_t minimum_rssi, bool active);
53+
mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t* prefixes, size_t prefix_length, bool extended, mp_int_t buffer_size, mp_float_t timeout, mp_float_t interval, mp_float_t window, mp_int_t minimum_rssi, bool active);
5454
void common_hal_bleio_adapter_stop_scan(bleio_adapter_obj_t *self);
5555

5656
bool common_hal_bleio_adapter_get_connected(bleio_adapter_obj_t *self);

shared-bindings/_bleio/Service.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@
4545
//| connections. This is known as a Service server. Client Service objects are created via
4646
//| `Connection.discover_remote_services`.
4747
//|
48-
//| To mark the Server as secondary, pass `True` as :py:data:`secondary`.
48+
//| To mark the Service as secondary, pass `True` as :py:data:`secondary`.
4949
//|
50-
//| :param UUID uuid: The uuid of the server
51-
//| :param bool secondary: If the server is a secondary one
50+
//| :param UUID uuid: The uuid of the service
51+
//| :param bool secondary: If the service is a secondary one
5252
//
5353
//| :return: the new Service
5454
//|

0 commit comments

Comments
 (0)