Refine comments and switch prefix_len to size_t

This commit is contained in:
Scott Shawcroft 2019-10-22 23:09:56 -07:00
parent ece8352126
commit 91c9d519ae
No known key found for this signature in database
GPG Key ID: 9349BC7E64B1921E
4 changed files with 11 additions and 10 deletions

View File

@ -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."));

View File

@ -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.

View File

@ -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);

View File

@ -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
//|