diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2019-10-22 23:09:56 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2019-10-22 23:09:56 -0700 |
| commit | 91c9d519ae74923eec7f95dd606f83555a21f751 (patch) | |
| tree | 45df5b6e493a34d028d9c489ecf569d66826a582 | |
| parent | ece8352126e34c5437080e9343f469f2f5e1bfe9 (diff) | |
Refine comments and switch prefix_len to size_t
| -rw-r--r-- | ports/nrf/common-hal/_bleio/Adapter.c | 7 | ||||
| -rw-r--r-- | shared-bindings/_bleio/Adapter.c | 6 | ||||
| -rw-r--r-- | shared-bindings/_bleio/Adapter.h | 2 | ||||
| -rw-r--r-- | shared-bindings/_bleio/Service.c | 6 |
4 files changed, 11 insertions, 10 deletions
diff --git a/ports/nrf/common-hal/_bleio/Adapter.c b/ports/nrf/common-hal/_bleio/Adapter.c index 41189a86d..295a42d63 100644 --- a/ports/nrf/common-hal/_bleio/Adapter.c +++ b/ports/nrf/common-hal/_bleio/Adapter.c @@ -123,7 +123,7 @@ STATIC uint32_t ble_stack_enable(void) { return err_code; } - // Double the GATT Server attribute size to accomodate both the CircuitPython built-in service + // Triple the GATT Server attribute size to accomodate both the CircuitPython built-in service // and anything the user does. memset(&ble_conf, 0, sizeof(ble_conf)); 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) { switch (ble_evt->header.evt_id) { case BLE_GAP_EVT_CONNECTED: { - // Find an empty connection + // Find an empty connection. One must always be available because the SD has the same + // total connection limit. bleio_connection_internal_t *connection; for (size_t i = 0; i < BLEIO_TOTAL_CONNECTION_COUNT; i++) { connection = &connections[i]; @@ -369,7 +370,7 @@ STATIC bool scan_on_ble_evt(ble_evt_t *ble_evt, void *scan_results_in) { return true; } -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) { +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) { if (self->scan_results != NULL) { if (!shared_module_bleio_scanresults_get_done(self->scan_results)) { mp_raise_RuntimeError(translate("Scan already in progess. Stop with stop_scan.")); diff --git a/shared-bindings/_bleio/Adapter.c b/shared-bindings/_bleio/Adapter.c index 01dba0491..a64167e5a 100644 --- a/shared-bindings/_bleio/Adapter.c +++ b/shared-bindings/_bleio/Adapter.c @@ -61,8 +61,8 @@ //| additional functionality available after the devices establish a connection. For example, a //| BLE keyboard may advertise that it can provide key information, but not what the key info is. //| -//| The built-in BLE adapter can do both parts of this process, it can scan for other device -//| advertisements and it can advertise it's own data. Furthermore, Adapters can accept incoming +//| The built-in BLE adapter can do both parts of this process: it can scan for other device +//| advertisements and it can advertise its own data. Furthermore, Adapters can accept incoming //| connections and also initiate connections. //| @@ -207,7 +207,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_advertising_obj, bleio_adapt //| filtered and returned separately. //| //| :param sequence prefixes: Sequence of byte string prefixes to filter advertising packets -//| with. A packets without an advertising structure that matches one of the prefixes are +//| with. A packet without an advertising structure that matches one of the prefixes is //| ignored. Format is one byte for length (n) and n bytes of prefix and can be repeated. //| :param int buffer_size: the maximum number of advertising bytes to buffer. //| :param bool extended: When True, support extended advertising packets. Increasing buffer_size is recommended when this is set. diff --git a/shared-bindings/_bleio/Adapter.h b/shared-bindings/_bleio/Adapter.h index 95d19cb31..2ff77f755 100644 --- a/shared-bindings/_bleio/Adapter.h +++ b/shared-bindings/_bleio/Adapter.h @@ -50,7 +50,7 @@ extern uint32_t _common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t 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); void common_hal_bleio_adapter_stop_advertising(bleio_adapter_obj_t *self); -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); +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); void common_hal_bleio_adapter_stop_scan(bleio_adapter_obj_t *self); bool common_hal_bleio_adapter_get_connected(bleio_adapter_obj_t *self); diff --git a/shared-bindings/_bleio/Service.c b/shared-bindings/_bleio/Service.c index 68605cec0..52dea592e 100644 --- a/shared-bindings/_bleio/Service.c +++ b/shared-bindings/_bleio/Service.c @@ -45,10 +45,10 @@ //| connections. This is known as a Service server. Client Service objects are created via //| `Connection.discover_remote_services`. //| -//| To mark the Server as secondary, pass `True` as :py:data:`secondary`. +//| To mark the Service as secondary, pass `True` as :py:data:`secondary`. //| -//| :param UUID uuid: The uuid of the server -//| :param bool secondary: If the server is a secondary one +//| :param UUID uuid: The uuid of the service +//| :param bool secondary: If the service is a secondary one // //| :return: the new Service //| |
