From b45b7749fd0a3efec18073ae84f893078d0216d0 Mon Sep 17 00:00:00 2001 From: Milanka Ringwald Date: Thu, 3 Jun 2021 11:35:40 +0200 Subject: [PATCH] MISRAC2012-Rule-8.3_b: match function declaration and definition --- 3rd-party/rijndael/rijndael.c | 8 +- .../embedded/btstack_uart_block_embedded.c | 6 +- src/ble/att_db.c | 18 +-- src/ble/gatt_client.c | 70 +++++------ src/ble/gatt_client.h | 112 +++++++++--------- src/ble/sm.h | 15 ++- src/btstack_crypto.c | 14 +-- src/btstack_crypto.h | 8 +- src/btstack_linked_list.c | 6 +- src/btstack_memory.h | 8 +- src/btstack_run_loop.c | 112 +++++++++--------- src/btstack_run_loop.h | 18 +-- src/btstack_util.c | 60 +++++----- src/btstack_util.h | 40 +++---- src/gap.h | 11 +- src/hci.c | 16 +-- src/hci.h | 8 +- src/hci_dump.c | 20 ++-- src/hci_transport_h4.c | 10 +- src/l2cap.c | 10 +- src/l2cap.h | 8 +- tool/btstack_memory_generator.py | 4 +- 22 files changed, 295 insertions(+), 287 deletions(-) diff --git a/3rd-party/rijndael/rijndael.c b/3rd-party/rijndael/rijndael.c index ed21e00663..19492de031 100644 --- a/3rd-party/rijndael/rijndael.c +++ b/3rd-party/rijndael/rijndael.c @@ -715,7 +715,7 @@ static const u32 rcon[] = * * @return the number of rounds for the given cipher key size. */ -int rijndaelSetupEncrypt(u32 *rk, const u8 *key, int keybits) +int rijndaelSetupEncrypt(uint32_t *rk, const uint8_t *key, int keybits) { u32 * rk_ = rk; @@ -820,7 +820,7 @@ int rijndaelSetupEncrypt(u32 *rk, const u8 *key, int keybits) * * @return the number of rounds for the given cipher key size. */ -int rijndaelSetupDecrypt(u32 *rk, const u8 *key, int keybits) +int rijndaelSetupDecrypt(uint32_t *rk, const uint8_t *key, int keybits) { u32 * rk_ = rk; int nrounds, i, j; @@ -865,7 +865,7 @@ int rijndaelSetupDecrypt(u32 *rk, const u8 *key, int keybits) } #endif -void rijndaelEncrypt(const u32 *rk, int nrounds, const u8 plaintext[16], u8 ciphertext[16]) +void rijndaelEncrypt(const uint32_t *rk, int nrounds, const uint8_t plaintext[16], uint8_t ciphertext[16]) { const u32 * rk_ = rk; @@ -1060,7 +1060,7 @@ void rijndaelEncrypt(const u32 *rk, int nrounds, const u8 plaintext[16], u8 ciph } #ifdef ENABLE_RIJNDAEL_DECRYPT -void rijndaelDecrypt(const u32 *rk, int nrounds, const u8 ciphertext[16], u8 plaintext[16]) +void rijndaelDecrypt(const uint32_t *rk, int nrounds, const uint8_t ciphertext[16], uint8_t plaintext[16]) { const u32 * rk_ = rk; diff --git a/platform/embedded/btstack_uart_block_embedded.c b/platform/embedded/btstack_uart_block_embedded.c index 4398cd1502..0ac77c2a72 100644 --- a/platform/embedded/btstack_uart_block_embedded.c +++ b/platform/embedded/btstack_uart_block_embedded.c @@ -50,7 +50,7 @@ #include "hal_uart_dma.h" // uart config -static const btstack_uart_config_t * uart_config; +static const btstack_uart_config_t * uart_configuration; // data source for integration with BTstack Runloop static btstack_data_source_t transport_data_source; @@ -81,7 +81,7 @@ static void btstack_uart_cts_pulse(void){ } static int btstack_uart_embedded_init(const btstack_uart_config_t * config){ - uart_config = config; + uart_configuration = config; hal_uart_dma_set_block_received(&btstack_uart_block_received); hal_uart_dma_set_block_sent(&btstack_uart_block_sent); return 0; @@ -116,7 +116,7 @@ static void btstack_uart_embedded_process(btstack_data_source_t *ds, btstack_dat static int btstack_uart_embedded_open(void){ hal_uart_dma_init(); - hal_uart_dma_set_baud(uart_config->baudrate); + hal_uart_dma_set_baud(uart_configuration->baudrate); // set up polling data_source btstack_run_loop_set_data_source_handler(&transport_data_source, &btstack_uart_embedded_process); diff --git a/src/ble/att_db.c b/src/ble/att_db.c index 46587ae438..430aee2939 100644 --- a/src/ble/att_db.c +++ b/src/ble/att_db.c @@ -89,7 +89,7 @@ typedef struct att_iterator { static void att_persistent_ccc_cache(att_iterator_t * it); -static uint8_t const * att_db = NULL; +static uint8_t const * att_database = NULL; static att_read_callback_t att_read_callback = NULL; static att_write_callback_t att_write_callback = NULL; static int att_prepare_write_error_code = 0; @@ -100,7 +100,7 @@ static uint16_t att_persistent_ccc_handle; static uint16_t att_persistent_ccc_uuid16; static void att_iterator_init(att_iterator_t *it){ - it->att_ptr = att_db; + it->att_ptr = att_database; } static bool att_iterator_has_next(att_iterator_t *it){ @@ -208,7 +208,7 @@ void att_set_db(uint8_t const * db){ } log_info("att_set_db %p", db); // ignore db version - att_db = &db[1]; + att_database = &db[1]; } void att_set_read_callback(att_read_callback_t callback){ @@ -223,7 +223,7 @@ void att_dump_attributes(void){ att_iterator_t it; att_iterator_init(&it); uint8_t uuid128[16]; - log_info("att_dump_attributes, table %p", att_db); + log_info("att_dump_attributes, table %p", att_database); while (att_iterator_has_next(&it)){ att_iterator_fetch_next(&it); if (it.handle == 0u) { @@ -1165,24 +1165,24 @@ static uint16_t prepare_handle_value(att_connection_t * att_connection, // MARK: ATT_HANDLE_VALUE_NOTIFICATION 0x1b uint16_t att_prepare_handle_value_notification(att_connection_t * att_connection, - uint16_t handle, + uint16_t attribute_handle, const uint8_t *value, uint16_t value_len, uint8_t * response_buffer){ response_buffer[0] = ATT_HANDLE_VALUE_NOTIFICATION; - return prepare_handle_value(att_connection, handle, value, value_len, response_buffer); + return prepare_handle_value(att_connection, attribute_handle, value, value_len, response_buffer); } // MARK: ATT_HANDLE_VALUE_INDICATION 0x1d uint16_t att_prepare_handle_value_indication(att_connection_t * att_connection, - uint16_t handle, + uint16_t attribute_handle, const uint8_t *value, uint16_t value_len, uint8_t * response_buffer){ response_buffer[0] = ATT_HANDLE_VALUE_INDICATION; - return prepare_handle_value(att_connection, handle, value, value_len, response_buffer); + return prepare_handle_value(att_connection, attribute_handle, value, value_len, response_buffer); } // MARK: Dispatcher @@ -1522,7 +1522,7 @@ static uint8_t btp_permissions_for_flags(uint16_t flags){ } uint16_t btp_att_get_attributes_by_uuid16(uint16_t start_handle, uint16_t end_handle, uint16_t uuid16, uint8_t * response_buffer, uint16_t response_buffer_size){ - log_info("btp_att_get_attributes_by_uuid16 %04x from 0x%04x to 0x%04x, db %p", uuid16, start_handle, end_handle, att_db); + log_info("btp_att_get_attributes_by_uuid16 %04x from 0x%04x to 0x%04x, db %p", uuid16, start_handle, end_handle, att_database); att_dump_attributes(); uint8_t num_attributes = 0; diff --git a/src/ble/gatt_client.c b/src/ble/gatt_client.c index 5e951b992c..b780e9a7a0 100644 --- a/src/ble/gatt_client.c +++ b/src/ble/gatt_client.c @@ -1813,13 +1813,13 @@ static void att_signed_write_handle_cmac_result(uint8_t hash[8]){ } } -uint8_t gatt_client_signed_write_without_response(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t handle, uint16_t message_len, uint8_t * message){ +uint8_t gatt_client_signed_write_without_response(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t message_len, uint8_t * message){ gatt_client_t * gatt_client = gatt_client_provide_context_for_handle(con_handle); if (gatt_client == NULL) return BTSTACK_MEMORY_ALLOC_FAILED; if (is_ready(gatt_client) == 0) return GATT_CLIENT_IN_WRONG_STATE; gatt_client->callback = callback; - gatt_client->attribute_handle = handle; + gatt_client->attribute_handle = value_handle; gatt_client->attribute_length = message_len; gatt_client->attribute_value = message; gatt_client->gatt_client_state = P_W4_IDENTITY_RESOLVING; @@ -1873,7 +1873,7 @@ uint8_t gatt_client_discover_primary_services_by_uuid128(btstack_packet_handler_ return ERROR_CODE_SUCCESS; } -uint8_t gatt_client_discover_characteristics_for_service(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t *service){ +uint8_t gatt_client_discover_characteristics_for_service(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t * service){ gatt_client_t * gatt_client = gatt_client_provide_context_for_handle_and_start_timer(con_handle); if (gatt_client == NULL) return BTSTACK_MEMORY_ALLOC_FAILED; if (is_ready(gatt_client) == 0) return GATT_CLIENT_IN_WRONG_STATE; @@ -1888,7 +1888,7 @@ uint8_t gatt_client_discover_characteristics_for_service(btstack_packet_handler_ return ERROR_CODE_SUCCESS; } -uint8_t gatt_client_find_included_services_for_service(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t *service){ +uint8_t gatt_client_find_included_services_for_service(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t * service){ gatt_client_t * gatt_client = gatt_client_provide_context_for_handle_and_start_timer(con_handle); if (gatt_client == NULL) return BTSTACK_MEMORY_ALLOC_FAILED; if (is_ready(gatt_client) == 0) return GATT_CLIENT_IN_WRONG_STATE; @@ -1936,15 +1936,15 @@ uint8_t gatt_client_discover_characteristics_for_handle_range_by_uuid128(btstack } -uint8_t gatt_client_discover_characteristics_for_service_by_uuid16(btstack_packet_handler_t callback, uint16_t handle, gatt_client_service_t *service, uint16_t uuid16){ - return gatt_client_discover_characteristics_for_handle_range_by_uuid16(callback, handle, service->start_group_handle, service->end_group_handle, uuid16); +uint8_t gatt_client_discover_characteristics_for_service_by_uuid16(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t * service, uint16_t uuid16){ + return gatt_client_discover_characteristics_for_handle_range_by_uuid16(callback, con_handle, service->start_group_handle, service->end_group_handle, uuid16); } -uint8_t gatt_client_discover_characteristics_for_service_by_uuid128(btstack_packet_handler_t callback, uint16_t handle, gatt_client_service_t *service, const uint8_t * uuid128){ - return gatt_client_discover_characteristics_for_handle_range_by_uuid128(callback, handle, service->start_group_handle, service->end_group_handle, uuid128); +uint8_t gatt_client_discover_characteristics_for_service_by_uuid128(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t * service, const uint8_t * uuid128){ + return gatt_client_discover_characteristics_for_handle_range_by_uuid128(callback, con_handle, service->start_group_handle, service->end_group_handle, uuid128); } -uint8_t gatt_client_discover_characteristic_descriptors(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t *characteristic){ +uint8_t gatt_client_discover_characteristic_descriptors(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t * characteristic){ gatt_client_t * gatt_client = gatt_client_provide_context_for_handle_and_start_timer(con_handle); if (gatt_client == NULL) return BTSTACK_MEMORY_ALLOC_FAILED; if (is_ready(gatt_client) == 0) return GATT_CLIENT_IN_WRONG_STATE; @@ -2009,29 +2009,29 @@ uint8_t gatt_client_read_value_of_characteristics_by_uuid128(btstack_packet_hand } -uint8_t gatt_client_read_value_of_characteristic(btstack_packet_handler_t callback, uint16_t handle, gatt_client_characteristic_t *characteristic){ - return gatt_client_read_value_of_characteristic_using_value_handle(callback, handle, characteristic->value_handle); +uint8_t gatt_client_read_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t * characteristic){ + return gatt_client_read_value_of_characteristic_using_value_handle(callback, con_handle, characteristic->value_handle); } -uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle, uint16_t offset){ +uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t offset){ gatt_client_t * gatt_client = gatt_client_provide_context_for_handle_and_start_timer(con_handle); if (gatt_client == NULL) return BTSTACK_MEMORY_ALLOC_FAILED; if (is_ready(gatt_client) == 0) return GATT_CLIENT_IN_WRONG_STATE; gatt_client->callback = callback; - gatt_client->attribute_handle = characteristic_value_handle; + gatt_client->attribute_handle = value_handle; gatt_client->attribute_offset = offset; gatt_client->gatt_client_state = P_W2_SEND_READ_BLOB_QUERY; gatt_client_run(); return ERROR_CODE_SUCCESS; } -uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle){ - return gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(callback, con_handle, characteristic_value_handle, 0); +uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle){ + return gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(callback, con_handle, value_handle, 0); } -uint8_t gatt_client_read_long_value_of_characteristic(btstack_packet_handler_t callback, uint16_t handle, gatt_client_characteristic_t *characteristic){ - return gatt_client_read_long_value_of_characteristic_using_value_handle(callback, handle, characteristic->value_handle); +uint8_t gatt_client_read_long_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t * characteristic){ + return gatt_client_read_long_value_of_characteristic_using_value_handle(callback, con_handle, characteristic->value_handle); } uint8_t gatt_client_read_multiple_characteristic_values(btstack_packet_handler_t callback, hci_con_handle_t con_handle, int num_value_handles, uint16_t * value_handles){ @@ -2057,7 +2057,7 @@ uint8_t gatt_client_write_value_of_characteristic_without_response(hci_con_handl return att_write_request(ATT_WRITE_COMMAND, gatt_client->con_handle, value_handle, value_length, value); } -uint8_t gatt_client_write_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t * data){ +uint8_t gatt_client_write_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t * value){ gatt_client_t * gatt_client = gatt_client_provide_context_for_handle_and_start_timer(con_handle); if (gatt_client == NULL) return BTSTACK_MEMORY_ALLOC_FAILED; if (is_ready(gatt_client) == 0) return GATT_CLIENT_IN_WRONG_STATE; @@ -2065,13 +2065,13 @@ uint8_t gatt_client_write_value_of_characteristic(btstack_packet_handler_t callb gatt_client->callback = callback; gatt_client->attribute_handle = value_handle; gatt_client->attribute_length = value_length; - gatt_client->attribute_value = data; + gatt_client->attribute_value = value; gatt_client->gatt_client_state = P_W2_SEND_WRITE_CHARACTERISTIC_VALUE; gatt_client_run(); return ERROR_CODE_SUCCESS; } -uint8_t gatt_client_write_long_value_of_characteristic_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t offset, uint16_t value_length, uint8_t * data){ +uint8_t gatt_client_write_long_value_of_characteristic_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t offset, uint16_t value_length, uint8_t * value){ gatt_client_t * gatt_client = gatt_client_provide_context_for_handle_and_start_timer(con_handle); if (gatt_client == NULL) return BTSTACK_MEMORY_ALLOC_FAILED; if (is_ready(gatt_client) == 0) return GATT_CLIENT_IN_WRONG_STATE; @@ -2080,7 +2080,7 @@ uint8_t gatt_client_write_long_value_of_characteristic_with_offset(btstack_packe gatt_client->attribute_handle = value_handle; gatt_client->attribute_length = value_length; gatt_client->attribute_offset = offset; - gatt_client->attribute_value = data; + gatt_client->attribute_value = value; gatt_client->gatt_client_state = P_W2_PREPARE_WRITE; gatt_client_run(); return ERROR_CODE_SUCCESS; @@ -2172,16 +2172,16 @@ uint8_t gatt_client_read_long_characteristic_descriptor(btstack_packet_handler_t return gatt_client_read_long_characteristic_descriptor_using_descriptor_handle(callback, con_handle, descriptor->handle); } -uint8_t gatt_client_write_characteristic_descriptor_using_descriptor_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle, uint16_t length, uint8_t * data){ +uint8_t gatt_client_write_characteristic_descriptor_using_descriptor_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle, uint16_t value_length, uint8_t * value){ gatt_client_t * gatt_client = gatt_client_provide_context_for_handle_and_start_timer(con_handle); if (gatt_client == NULL) return BTSTACK_MEMORY_ALLOC_FAILED; if (is_ready(gatt_client) == 0) return GATT_CLIENT_IN_WRONG_STATE; gatt_client->callback = callback; gatt_client->attribute_handle = descriptor_handle; - gatt_client->attribute_length = length; + gatt_client->attribute_length = value_length; gatt_client->attribute_offset = 0; - gatt_client->attribute_value = data; + gatt_client->attribute_value = value; gatt_client->gatt_client_state = P_W2_SEND_WRITE_CHARACTERISTIC_DESCRIPTOR; gatt_client_run(); return ERROR_CODE_SUCCESS; @@ -2191,42 +2191,42 @@ uint8_t gatt_client_write_characteristic_descriptor(btstack_packet_handler_t cal return gatt_client_write_characteristic_descriptor_using_descriptor_handle(callback, con_handle, descriptor->handle, length, value); } -uint8_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle, uint16_t offset, uint16_t length, uint8_t * data){ +uint8_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle, uint16_t offset, uint16_t value_length, uint8_t * value){ gatt_client_t * gatt_client = gatt_client_provide_context_for_handle_and_start_timer(con_handle); if (gatt_client == NULL) return BTSTACK_MEMORY_ALLOC_FAILED; if (is_ready(gatt_client) == 0) return GATT_CLIENT_IN_WRONG_STATE; gatt_client->callback = callback; gatt_client->attribute_handle = descriptor_handle; - gatt_client->attribute_length = length; + gatt_client->attribute_length = value_length; gatt_client->attribute_offset = offset; - gatt_client->attribute_value = data; + gatt_client->attribute_value = value; gatt_client->gatt_client_state = P_W2_PREPARE_WRITE_CHARACTERISTIC_DESCRIPTOR; gatt_client_run(); return ERROR_CODE_SUCCESS; } -uint8_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle, uint16_t length, uint8_t * data){ - return gatt_client_write_long_characteristic_descriptor_using_descriptor_handle_with_offset(callback, con_handle, descriptor_handle, 0, length, data ); +uint8_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle, uint16_t value_length, uint8_t * value){ + return gatt_client_write_long_characteristic_descriptor_using_descriptor_handle_with_offset(callback, con_handle, descriptor_handle, 0, value_length, value); } -uint8_t gatt_client_write_long_characteristic_descriptor(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * value){ - return gatt_client_write_long_characteristic_descriptor_using_descriptor_handle(callback, con_handle, descriptor->handle, length, value); +uint8_t gatt_client_write_long_characteristic_descriptor(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_descriptor_t * descriptor, uint16_t value_length, uint8_t * value){ + return gatt_client_write_long_characteristic_descriptor_using_descriptor_handle(callback, con_handle, descriptor->handle, value_length, value); } /** * @brief -> gatt complete event */ -uint8_t gatt_client_prepare_write(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t offset, uint16_t length, uint8_t * data){ +uint8_t gatt_client_prepare_write(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t offset, uint16_t value_length, uint8_t * value){ gatt_client_t * gatt_client = gatt_client_provide_context_for_handle_and_start_timer(con_handle); if (gatt_client == NULL) return BTSTACK_MEMORY_ALLOC_FAILED; if (is_ready(gatt_client) == 0) return GATT_CLIENT_IN_WRONG_STATE; gatt_client->callback = callback; gatt_client->attribute_handle = attribute_handle; - gatt_client->attribute_length = length; + gatt_client->attribute_length = value_length; gatt_client->attribute_offset = offset; - gatt_client->attribute_value = data; + gatt_client->attribute_value = value; gatt_client->gatt_client_state = P_W2_PREPARE_WRITE_SINGLE; gatt_client_run(); return ERROR_CODE_SUCCESS; @@ -2261,7 +2261,7 @@ uint8_t gatt_client_cancel_write(btstack_packet_handler_t callback, hci_con_hand return ERROR_CODE_SUCCESS; } -void gatt_client_deserialize_service(const uint8_t *packet, int offset, gatt_client_service_t *service){ +void gatt_client_deserialize_service(const uint8_t *packet, int offset, gatt_client_service_t * service){ service->start_group_handle = little_endian_read_16(packet, offset); service->end_group_handle = little_endian_read_16(packet, offset + 2); reverse_128(&packet[offset + 4], service->uuid128); diff --git a/src/ble/gatt_client.h b/src/ble/gatt_client.h index cd4b05b1c9..461fe8b535 100644 --- a/src/ble/gatt_client.h +++ b/src/ble/gatt_client.h @@ -319,7 +319,7 @@ uint8_t gatt_client_discover_primary_services_by_uuid128(btstack_packet_handler_ * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready * ERROR_CODE_SUCCESS , if query is successfully registered */ -uint8_t gatt_client_find_included_services_for_service(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t *service); +uint8_t gatt_client_find_included_services_for_service(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t * service); /** * @brief Discovers all characteristics within the specified service. For each found characteristic, an le_characteristics_event_t with type set to GATT_EVENT_CHARACTERISTIC_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery. @@ -330,7 +330,7 @@ uint8_t gatt_client_find_included_services_for_service(btstack_packet_handler_t * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready * ERROR_CODE_SUCCESS , if query is successfully registered */ -uint8_t gatt_client_discover_characteristics_for_service(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t *service); +uint8_t gatt_client_discover_characteristics_for_service(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t * service); /** * @brief The following four functions are used to discover all characteristics within the specified service or handle range, and return those that match the given UUID. For each found characteristic, an le_characteristic_event_t with type set to GATT_EVENT_CHARACTERISTIC_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery. @@ -368,7 +368,7 @@ uint8_t gatt_client_discover_characteristics_for_handle_range_by_uuid128(btstack * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready * ERROR_CODE_SUCCESS , if query is successfully registered */ -uint8_t gatt_client_discover_characteristics_for_service_by_uuid16(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t *service, uint16_t uuid16); +uint8_t gatt_client_discover_characteristics_for_service_by_uuid16(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t * service, uint16_t uuid16); /** * @brief The following four functions are used to discover all characteristics within the specified service or handle range, and return those that match the given UUID. For each found characteristic, an le_characteristic_event_t with type set to GATT_EVENT_CHARACTERISTIC_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery. @@ -380,7 +380,7 @@ uint8_t gatt_client_discover_characteristics_for_service_by_uuid16(btstack_packe * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready * ERROR_CODE_SUCCESS , if query is successfully registered */ -uint8_t gatt_client_discover_characteristics_for_service_by_uuid128(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t *service, const uint8_t * uuid128); +uint8_t gatt_client_discover_characteristics_for_service_by_uuid128(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_service_t * service, const uint8_t * uuid128); /** * @brief Discovers attribute handle and UUID of a characteristic descriptor within the specified characteristic. For each found descriptor, an le_characteristic_descriptor_event_t with type set to GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of discovery. @@ -391,7 +391,7 @@ uint8_t gatt_client_discover_characteristics_for_service_by_uuid128(btstack_pack * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready * ERROR_CODE_SUCCESS , if query is successfully registered */ -uint8_t gatt_client_discover_characteristic_descriptors(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t *characteristic); +uint8_t gatt_client_discover_characteristic_descriptors(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t * characteristic); /** * @brief Reads the characteristic value using the characteristic's value handle. If the characteristic value is found, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read. @@ -402,18 +402,18 @@ uint8_t gatt_client_discover_characteristic_descriptors(btstack_packet_handler_t * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready * ERROR_CODE_SUCCESS , if query is successfully registered */ -uint8_t gatt_client_read_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t *characteristic); +uint8_t gatt_client_read_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t * characteristic); /** * @brief Reads the characteristic value using the characteristic's value handle. If the characteristic value is found, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read. * @param callback * @param con_handle - * @param characteristic_value_handle + * @param value_handle * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready * ERROR_CODE_SUCCESS , if query is successfully registered */ -uint8_t gatt_client_read_value_of_characteristic_using_value_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle); +uint8_t gatt_client_read_value_of_characteristic_using_value_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle); /** * @brief Reads the characteric value of all characteristics with the uuid. For each found, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read. @@ -450,30 +450,30 @@ uint8_t gatt_client_read_value_of_characteristics_by_uuid128(btstack_packet_hand * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready * ERROR_CODE_SUCCESS , if query is successfully registered */ -uint8_t gatt_client_read_long_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t *characteristic); +uint8_t gatt_client_read_long_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t * characteristic); /** * @brief Reads the long characteristic value using the characteristic's value handle. The value will be returned in several blobs. For each blob, an le_characteristic_value_event_t with type set to GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT and updated value offset will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, mark the end of read. * @param callback * @param con_handle - * @param characteristic_value_handle + * @param value_handle * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready * ERROR_CODE_SUCCESS , if query is successfully registered */ -uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle); +uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle); /** * @brief Reads the long characteristic value using the characteristic's value handle. The value will be returned in several blobs. For each blob, an le_characteristic_value_event_t with type set to GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT and updated value offset will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, mark the end of read. * @param callback * @param con_handle - * @param characteristic_value_handle + * @param value_handle * @param offset * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready * ERROR_CODE_SUCCESS , if query is successfully registered */ -uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle, uint16_t offset); +uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t offset); /* * @brief Read multiple characteristic values @@ -487,15 +487,15 @@ uint8_t gatt_client_read_multiple_characteristic_values(btstack_packet_handler_t /** * @brief Writes the characteristic value using the characteristic's value handle without an acknowledgment that the write was successfully performed. * @param con_handle - * @param characteristic_value_handle - * @param length of data - * @param data is not copied, make sure memory is accessible until write is done + * @param value_handle + * @param value_length + * @param value is not copied, make sure memory is accessible until write is done * @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found * GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready * BTSTACK_ACL_BUFFERS_FULL , if L2CAP cannot send, there are no free ACL slots * ERROR_CODE_SUCCESS , if query is successfully registered */ -uint8_t gatt_client_write_value_of_characteristic_without_response(hci_con_handle_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data); +uint8_t gatt_client_write_value_of_characteristic_without_response(hci_con_handle_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t * value); /** * @brief Writes the authenticated characteristic value using the characteristic's value handle without an acknowledgment that the write was successfully performed. @@ -509,60 +509,60 @@ uint8_t gatt_client_write_value_of_characteristic_without_response(hci_con_handl * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready * ERROR_CODE_SUCCESS if query is successfully registered */ -uint8_t gatt_client_signed_write_without_response(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t message_len, uint8_t * message); +uint8_t gatt_client_signed_write_without_response(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t message_len, uint8_t * message); /** * @brief Writes the characteristic value using the characteristic's value handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes). * @param callback * @param con_handle - * @param characteristic_value_handle - * @param length of data - * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received + * @param value_handle + * @param value_length + * @param value is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready * ERROR_CODE_SUCCESS if query is successfully registered */ -uint8_t gatt_client_write_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data); +uint8_t gatt_client_write_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t * value); /** * @brief Writes the characteristic value using the characteristic's value handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes). * @param callback * @param con_handle - * @param characteristic_value_handle - * @param length of data - * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received + * @param value_handle + * @param value_length + * @param value is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready * ERROR_CODE_SUCCESS if query is successfully registered */ -uint8_t gatt_client_write_long_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data); +uint8_t gatt_client_write_long_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t * value); /** * @brief Writes the characteristic value using the characteristic's value handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes). * @param callback * @param con_handle - * @param characteristic_value_handle + * @param value_handle * @param offset of value - * @param length of data - * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received + * @param value_length + * @param value is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready * ERROR_CODE_SUCCESS if query is successfully registered */ -uint8_t gatt_client_write_long_value_of_characteristic_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle, uint16_t offset, uint16_t length, uint8_t * data); +uint8_t gatt_client_write_long_value_of_characteristic_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t offset, uint16_t value_length, uint8_t * value); /** * @brief Writes of the long characteristic value using the characteristic's value handle. It uses server response to validate that the write was correctly received. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes). * @param callback * @param con_handle - * @param characteristic_value_handle - * @param length of data - * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received + * @param value_handle + * @param value_length + * @param value is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready * ERROR_CODE_SUCCESS if query is successfully registered */ -uint8_t gatt_client_reliable_write_long_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle, uint16_t length, uint8_t * data); +uint8_t gatt_client_reliable_write_long_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t * value); /** * @brief Reads the characteristic descriptor using its handle. If the characteristic descriptor is found, an le_characteristic_descriptor_event_t with type set to GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read. @@ -573,7 +573,7 @@ uint8_t gatt_client_reliable_write_long_value_of_characteristic(btstack_packet_h * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready * ERROR_CODE_SUCCESS if query is successfully registered */ -uint8_t gatt_client_read_characteristic_descriptor(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_descriptor_t * descriptor); +uint8_t gatt_client_read_characteristic_descriptor(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_descriptor_t * descriptor); /** * @brief Reads the characteristic descriptor using its handle. If the characteristic descriptor is found, an le_characteristic_descriptor_event_t with type set to GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read. @@ -590,12 +590,12 @@ uint8_t gatt_client_read_characteristic_descriptor_using_descriptor_handle(btsta * @brief Reads the long characteristic descriptor using its handle. It will be returned in several blobs. For each blob, an le_characteristic_descriptor_event_t with type set to GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read. * @param callback * @param con_handle - * @param descriptor_handle + * @param descriptor * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready * ERROR_CODE_SUCCESS if query is successfully registered */ -uint8_t gatt_client_read_long_characteristic_descriptor(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_descriptor_t * descriptor); +uint8_t gatt_client_read_long_characteristic_descriptor(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_descriptor_t * descriptor); /** * @brief Reads the long characteristic descriptor using its handle. It will be returned in several blobs. For each blob, an le_characteristic_descriptor_event_t with type set to GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of read. @@ -625,52 +625,52 @@ uint8_t gatt_client_read_long_characteristic_descriptor_using_descriptor_handle_ * @param callback * @param con_handle * @param descriptor - * @param length of data - * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received + * @param value_length + * @param value is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready * ERROR_CODE_SUCCESS if query is successfully registered */ -uint8_t gatt_client_write_characteristic_descriptor(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * data); +uint8_t gatt_client_write_characteristic_descriptor(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_descriptor_t * descriptor, uint16_t value_length, uint8_t * value); /** * @brief Writes the characteristic descriptor using its handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes). * @param callback * @param con_handle * @param descriptor_handle - * @param length of data - * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received + * @param value_length + * @param value is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready * ERROR_CODE_SUCCESS if query is successfully registered */ -uint8_t gatt_client_write_characteristic_descriptor_using_descriptor_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle, uint16_t length, uint8_t * data); +uint8_t gatt_client_write_characteristic_descriptor_using_descriptor_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle, uint16_t value_length, uint8_t * value); /** * @brief Writes the characteristic descriptor using its handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes). * @param callback * @param con_handle * @param descriptor - * @param length of data - * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received + * @param value_length + * @param value is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready * ERROR_CODE_SUCCESS if query is successfully registered */ -uint8_t gatt_client_write_long_characteristic_descriptor(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * data); +uint8_t gatt_client_write_long_characteristic_descriptor(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_descriptor_t * descriptor, uint16_t value_length, uint8_t * value); /** * @brief Writes the characteristic descriptor using its handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes). * @param callback * @param con_handle * @param descriptor_handle - * @param length of data - * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received + * @param value_length + * @param value is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready * ERROR_CODE_SUCCESS if query is successfully registered */ -uint8_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle, uint16_t length, uint8_t * data); +uint8_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle, uint16_t value_length, uint8_t * value); /** * @brief Writes the characteristic descriptor using its handle. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes). @@ -678,13 +678,13 @@ uint8_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle * @param con_handle * @param descriptor_handle * @param offset of value - * @param length of data - * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received + * @param value_length + * @param value is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received * @return status BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle is found * GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready * ERROR_CODE_SUCCESS if query is successfully registered */ -uint8_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle, uint16_t offset, uint16_t length, uint8_t * data); +uint8_t gatt_client_write_long_characteristic_descriptor_using_descriptor_handle_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t descriptor_handle, uint16_t offset, uint16_t value_length, uint8_t * value); /** * @brief Writes the client characteristic configuration of the specified characteristic. It is used to subscribe for notifications or indications of the characteristic value. @@ -733,10 +733,10 @@ uint8_t gatt_client_request_can_write_without_response_event(btstack_packet_hand * @param con_handle * @param attribute_handle * @param offset of value - * @param length of data - * @param data is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received + * @param value_length + * @param value is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received */ -uint8_t gatt_client_prepare_write(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t offset, uint16_t length, uint8_t * data); +uint8_t gatt_client_prepare_write(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t offset, uint16_t value_length, uint8_t * value); /** * @brief Commit transactional write. GATT_EVENT_QUERY_COMPLETE is received. @@ -756,7 +756,7 @@ uint8_t gatt_client_cancel_write(btstack_packet_handler_t callback, hci_con_hand // used by generated btstack_event.c -void gatt_client_deserialize_service(const uint8_t *packet, int offset, gatt_client_service_t *service); +void gatt_client_deserialize_service(const uint8_t *packet, int offset, gatt_client_service_t * service); void gatt_client_deserialize_characteristic(const uint8_t * packet, int offset, gatt_client_characteristic_t * characteristic); void gatt_client_deserialize_characteristic_descriptor(const uint8_t * packet, int offset, gatt_client_characteristic_descriptor_t * descriptor); diff --git a/src/ble/sm.h b/src/ble/sm.h index c615a33b7b..a478ffd51c 100644 --- a/src/ble/sm.h +++ b/src/ble/sm.h @@ -68,18 +68,18 @@ void sm_init(void); /** * @brief Set secret ER key for key generation as described in Core V4.0, Vol 3, Part G, 5.2.2 * @note If not set and btstack_tlv is configured, ER key is generated and stored in TLV by SM - * @param er + * @param er key */ void sm_set_er(sm_key_t er); /** * @brief Set secret IR key for key generation as described in Core V4.0, Vol 3, Part G, 5.2.2 * @note If not set and btstack_tlv is configured, IR key is generated and stored in TLV by SM + * @param ir key */ void sm_set_ir(sm_key_t ir); /** - * * @brief Registers OOB Data Callback. The callback should set the oob_data and return 1 if OOB data is availble * @param get_oob_data_callback */ @@ -87,6 +87,7 @@ void sm_register_oob_data_callback( int (*get_oob_data_callback)(uint8_t address /** * @brief Add event packet handler. + * @param callback_handler */ void sm_add_event_handler(btstack_packet_callback_registration_t * callback_handler); @@ -203,12 +204,14 @@ int sm_cmac_ready(void); */ void sm_cmac_signed_write_start(const sm_key_t key, uint8_t opcode, uint16_t attribute_handle, uint16_t message_len, const uint8_t * message, uint32_t sign_counter, void (*done_callback)(uint8_t * hash)); -/* +/** * @brief Match address against bonded devices + * @param address_type + * @param address * @return 0 if successfully added to lookup queue * @note Triggers SM_IDENTITY_RESOLVING_* events */ -int sm_address_resolution_lookup(uint8_t addr_type, bd_addr_t addr); +int sm_address_resolution_lookup(uint8_t address_type, bd_addr_t address); /** * @brief Get Identity Resolving state @@ -220,10 +223,10 @@ irk_lookup_state_t sm_identity_resolving_state(hci_con_handle_t con_handle); /** * @brief Identify device in LE Device DB. - * @param handle + * @param con_handle * @return index from le_device_db or -1 if not found/identified */ -int sm_le_device_index(hci_con_handle_t con_handle ); +int sm_le_device_index(hci_con_handle_t con_handle); /** * @brief Use fixec passkey for Legacy and SC instead of generating a random number diff --git a/src/btstack_crypto.c b/src/btstack_crypto.c index 3a4cb626b3..3362937faa 100644 --- a/src/btstack_crypto.c +++ b/src/btstack_crypto.c @@ -1222,12 +1222,12 @@ void btstack_crypto_aes128_cmac_message(btstack_crypto_aes128_cmac_t * request, btstack_crypto_run(); } -void btstack_crypto_aes128_cmac_zero(btstack_crypto_aes128_cmac_t * request, uint16_t len, const uint8_t * message, uint8_t * hash, void (* callback)(void * arg), void * callback_arg){ +void btstack_crypto_aes128_cmac_zero(btstack_crypto_aes128_cmac_t * request, uint16_t size, const uint8_t * message, uint8_t * hash, void (* callback)(void * arg), void * callback_arg){ request->btstack_crypto.context_callback.callback = callback; request->btstack_crypto.context_callback.context = callback_arg; request->btstack_crypto.operation = BTSTACK_CRYPTO_CMAC_MESSAGE; request->key = zero; - request->size = len; + request->size = size; request->data.message = message; request->hash = hash; btstack_linked_list_add_tail(&btstack_crypto_operations, (btstack_linked_item_t*) request); @@ -1317,14 +1317,14 @@ void btstack_crypto_ccm_get_authentication_value(btstack_crypto_ccm_t * request, (void)memcpy(authentication_value, request->x_i, request->auth_len); } -void btstack_crypto_ccm_encrypt_block(btstack_crypto_ccm_t * request, uint16_t block_len, const uint8_t * plaintext, uint8_t * ciphertext, void (* callback)(void * arg), void * callback_arg){ +void btstack_crypto_ccm_encrypt_block(btstack_crypto_ccm_t * request, uint16_t len, const uint8_t * plaintext, uint8_t * ciphertext, void (* callback)(void * arg), void * callback_arg){ #ifdef DEBUG_CCM - printf("\nbtstack_crypto_ccm_encrypt_block, len %u\n", block_len); + printf("\nbtstack_crypto_ccm_encrypt_block, len %u\n", len); #endif request->btstack_crypto.context_callback.callback = callback; request->btstack_crypto.context_callback.context = callback_arg; request->btstack_crypto.operation = BTSTACK_CRYPTO_CCM_ENCRYPT_BLOCK; - request->block_len = block_len; + request->block_len = len; request->input = plaintext; request->output = ciphertext; if (request->state != CCM_CALCULATE_X1){ @@ -1334,11 +1334,11 @@ void btstack_crypto_ccm_encrypt_block(btstack_crypto_ccm_t * request, uint16_t b btstack_crypto_run(); } -void btstack_crypto_ccm_decrypt_block(btstack_crypto_ccm_t * request, uint16_t block_len, const uint8_t * ciphertext, uint8_t * plaintext, void (* callback)(void * arg), void * callback_arg){ +void btstack_crypto_ccm_decrypt_block(btstack_crypto_ccm_t * request, uint16_t len, const uint8_t * ciphertext, uint8_t * plaintext, void (* callback)(void * arg), void * callback_arg){ request->btstack_crypto.context_callback.callback = callback; request->btstack_crypto.context_callback.context = callback_arg; request->btstack_crypto.operation = BTSTACK_CRYPTO_CCM_DECRYPT_BLOCK; - request->block_len = block_len; + request->block_len = len; request->input = ciphertext; request->output = plaintext; if (request->state != CCM_CALCULATE_X1){ diff --git a/src/btstack_crypto.h b/src/btstack_crypto.h index c5723ac989..f0e372a703 100644 --- a/src/btstack_crypto.h +++ b/src/btstack_crypto.h @@ -174,24 +174,24 @@ void btstack_crypto_aes128_cmac_generator(btstack_crypto_aes128_cmac_t * request * Calculate Cipher-based Message Authentication Code (CMAC) using AES128 and complete message * @param request * @param key (16 bytes) - * @param len of message + * @param size of message * @param message * @param hash result * @param callback * @param callback_arg */ -void btstack_crypto_aes128_cmac_message(btstack_crypto_aes128_cmac_t * request, const uint8_t * key, uint16_t len, const uint8_t * message, uint8_t * hash, void (* callback)(void * arg), void * callback_arg); +void btstack_crypto_aes128_cmac_message(btstack_crypto_aes128_cmac_t * request, const uint8_t * key, uint16_t size, const uint8_t * message, uint8_t * hash, void (* callback)(void * arg), void * callback_arg); /** * Calculate AES128-CMAC with key ZERO and complete message * @param request - * @param len of message + * @param size of message * @param message * @param hash * @param callback * @param callback_arg */ -void btstack_crypto_aes128_cmac_zero(btstack_crypto_aes128_cmac_t * request, uint16_t len, const uint8_t * message, uint8_t * hash, void (* callback)(void * arg), void * callback_arg); +void btstack_crypto_aes128_cmac_zero(btstack_crypto_aes128_cmac_t * request, uint16_t size, const uint8_t * message, uint8_t * hash, void (* callback)(void * arg), void * callback_arg); /** * Generate Elliptic Curve Public/Private Key Pair (FIPS P-256) diff --git a/src/btstack_linked_list.c b/src/btstack_linked_list.c index 39e5f4c85e..bfc513b24f 100644 --- a/src/btstack_linked_list.c +++ b/src/btstack_linked_list.c @@ -140,10 +140,10 @@ btstack_linked_item_t * btstack_linked_list_pop(btstack_linked_list_t * list){ // Linked List Iterator implementation // -void btstack_linked_list_iterator_init(btstack_linked_list_iterator_t * it, btstack_linked_list_t * head){ +void btstack_linked_list_iterator_init(btstack_linked_list_iterator_t * it, btstack_linked_list_t * list){ it->advance_on_next = 0; - it->prev = (btstack_linked_item_t*) head; - it->curr = * head; + it->prev = (btstack_linked_item_t*) list; + it->curr = * list; } bool btstack_linked_list_iterator_has_next(btstack_linked_list_iterator_t * it){ diff --git a/src/btstack_memory.h b/src/btstack_memory.h index a890bdae9c..087f7c4577 100644 --- a/src/btstack_memory.h +++ b/src/btstack_memory.h @@ -35,10 +35,12 @@ * */ -/** - * @title BTstack Memory Management + + +/* + * btstack_memory.h * - * BTstack memory management is performed via configurable memory pools. + * @brief BTstack memory management using configurable memory pools * */ diff --git a/src/btstack_run_loop.c b/src/btstack_run_loop.c index 54ce9be149..fbd48957e0 100644 --- a/src/btstack_run_loop.c +++ b/src/btstack_run_loop.c @@ -68,46 +68,46 @@ void btstack_run_loop_base_init(void){ btstack_run_loop_base_data_sources = NULL; } -void btstack_run_loop_base_add_data_source(btstack_data_source_t *ds){ - btstack_linked_list_add(&btstack_run_loop_base_data_sources, (btstack_linked_item_t *) ds); +void btstack_run_loop_base_add_data_source(btstack_data_source_t * data_source){ + btstack_linked_list_add(&btstack_run_loop_base_data_sources, (btstack_linked_item_t *) data_source); } -bool btstack_run_loop_base_remove_data_source(btstack_data_source_t *ds){ - return btstack_linked_list_remove(&btstack_run_loop_base_data_sources, (btstack_linked_item_t *) ds); +bool btstack_run_loop_base_remove_data_source(btstack_data_source_t * data_source){ + return btstack_linked_list_remove(&btstack_run_loop_base_data_sources, (btstack_linked_item_t *) data_source); } -void btstack_run_loop_base_enable_data_source_callbacks(btstack_data_source_t * ds, uint16_t callback_types){ - ds->flags |= callback_types; +void btstack_run_loop_base_enable_data_source_callbacks(btstack_data_source_t * data_source, uint16_t callback_types){ + data_source->flags |= callback_types; } -void btstack_run_loop_base_disable_data_source_callbacks(btstack_data_source_t * ds, uint16_t callback_types){ - ds->flags &= ~callback_types; +void btstack_run_loop_base_disable_data_source_callbacks(btstack_data_source_t * data_source, uint16_t callback_types){ + data_source->flags &= ~callback_types; } -bool btstack_run_loop_base_remove_timer(btstack_timer_source_t *ts){ - return btstack_linked_list_remove(&btstack_run_loop_base_timers, (btstack_linked_item_t *) ts); +bool btstack_run_loop_base_remove_timer(btstack_timer_source_t * timer){ + return btstack_linked_list_remove(&btstack_run_loop_base_timers, (btstack_linked_item_t *) timer); } -void btstack_run_loop_base_add_timer(btstack_timer_source_t *ts){ +void btstack_run_loop_base_add_timer(btstack_timer_source_t * timer){ btstack_linked_item_t *it; for (it = (btstack_linked_item_t *) &btstack_run_loop_base_timers; it->next ; it = it->next){ btstack_timer_source_t * next = (btstack_timer_source_t *) it->next; - btstack_assert(next != ts); - int32_t delta = btstack_time_delta(ts->timeout, next->timeout); + btstack_assert(next != timer); + int32_t delta = btstack_time_delta(timer->timeout, next->timeout); if (delta < 0) break; } - ts->item.next = it->next; - it->next = (btstack_linked_item_t *) ts; + timer->item.next = it->next; + it->next = (btstack_linked_item_t *) timer; } void btstack_run_loop_base_process_timers(uint32_t now){ // process timers, exit when timeout is in the future while (btstack_run_loop_base_timers) { - btstack_timer_source_t * ts = (btstack_timer_source_t *) btstack_run_loop_base_timers; - int32_t delta = btstack_time_delta(ts->timeout, now); + btstack_timer_source_t * timer = (btstack_timer_source_t *) btstack_run_loop_base_timers; + int32_t delta = btstack_time_delta(timer->timeout, now); if (delta > 0) break; - btstack_run_loop_base_remove_timer(ts); - ts->process(ts); + btstack_run_loop_base_remove_timer(timer); + timer->process(timer); } } @@ -116,8 +116,8 @@ void btstack_run_loop_base_dump_timer(void){ btstack_linked_item_t *it; uint16_t i = 0; for (it = (btstack_linked_item_t *) btstack_run_loop_base_timers; it ; it = it->next){ - btstack_timer_source_t *ts = (btstack_timer_source_t*) it; - log_info("timer %u (%p): timeout %" PRIu32 "u\n", i, ts, ts->timeout); + btstack_timer_source_t * timer = (btstack_timer_source_t*) it; + log_info("timer %u (%p): timeout %" PRIu32 "u\n", i, timer, timer->timeout); } #endif @@ -128,8 +128,8 @@ void btstack_run_loop_base_dump_timer(void){ */ int32_t btstack_run_loop_base_get_time_until_timeout(uint32_t now){ if (btstack_run_loop_base_timers == NULL) return -1; - btstack_timer_source_t * ts = (btstack_timer_source_t *) btstack_run_loop_base_timers; - uint32_t list_timeout = ts->timeout; + btstack_timer_source_t * timer = (btstack_timer_source_t *) btstack_run_loop_base_timers; + uint32_t list_timeout = timer->timeout; int32_t delta = btstack_time_delta(list_timeout, now); if (delta < 0){ delta = 0; @@ -155,96 +155,96 @@ void btstack_run_loop_base_poll_data_sources(void){ // main implementation -void btstack_run_loop_set_timer_handler(btstack_timer_source_t *ts, void (*process)(btstack_timer_source_t *_ts)){ - ts->process = process; +void btstack_run_loop_set_timer_handler(btstack_timer_source_t * timer, void (*process)(btstack_timer_source_t * _timer)){ + timer->process = process; }; -void btstack_run_loop_set_data_source_handler(btstack_data_source_t *ds, void (*process)(btstack_data_source_t *_ds, btstack_data_source_callback_type_t callback_type)){ - ds->process = process; +void btstack_run_loop_set_data_source_handler(btstack_data_source_t * data_source, void (*process)(btstack_data_source_t *_data_source, btstack_data_source_callback_type_t callback_type)){ + data_source->process = process; }; -void btstack_run_loop_set_data_source_fd(btstack_data_source_t *ds, int fd){ - ds->source.fd = fd; +void btstack_run_loop_set_data_source_fd(btstack_data_source_t * data_source, int fd){ + data_source->source.fd = fd; } -int btstack_run_loop_get_data_source_fd(btstack_data_source_t *ds){ - return ds->source.fd; +int btstack_run_loop_get_data_source_fd(btstack_data_source_t * data_source){ + return data_source->source.fd; } -void btstack_run_loop_set_data_source_handle(btstack_data_source_t *ds, void * handle){ - ds->source.handle = handle; +void btstack_run_loop_set_data_source_handle(btstack_data_source_t * data_source, void * handle){ + data_source->source.handle = handle; } -void * btstack_run_loop_get_data_source_handle(btstack_data_source_t *ds){ - return ds->source.handle; +void * btstack_run_loop_get_data_source_handle(btstack_data_source_t * data_source){ + return data_source->source.handle; } -void btstack_run_loop_enable_data_source_callbacks(btstack_data_source_t *ds, uint16_t callbacks){ +void btstack_run_loop_enable_data_source_callbacks(btstack_data_source_t * data_source, uint16_t callbacks){ btstack_assert(the_run_loop != NULL); btstack_assert(the_run_loop->enable_data_source_callbacks != NULL); - the_run_loop->enable_data_source_callbacks(ds, callbacks); + the_run_loop->enable_data_source_callbacks(data_source, callbacks); } -void btstack_run_loop_disable_data_source_callbacks(btstack_data_source_t *ds, uint16_t callbacks){ +void btstack_run_loop_disable_data_source_callbacks(btstack_data_source_t * data_source, uint16_t callbacks){ btstack_assert(the_run_loop != NULL); btstack_assert(the_run_loop->enable_data_source_callbacks != NULL); - the_run_loop->disable_data_source_callbacks(ds, callbacks); + the_run_loop->disable_data_source_callbacks(data_source, callbacks); } /** * Add data_source to run_loop */ -void btstack_run_loop_add_data_source(btstack_data_source_t *ds){ +void btstack_run_loop_add_data_source(btstack_data_source_t * data_source){ btstack_assert(the_run_loop != NULL); btstack_assert(the_run_loop->enable_data_source_callbacks != NULL); - btstack_assert(ds->process != NULL); - the_run_loop->add_data_source(ds); + btstack_assert(data_source->process != NULL); + the_run_loop->add_data_source(data_source); } /** * Remove data_source from run loop */ -int btstack_run_loop_remove_data_source(btstack_data_source_t *ds){ +int btstack_run_loop_remove_data_source(btstack_data_source_t * data_source){ btstack_assert(the_run_loop != NULL); btstack_assert(the_run_loop->disable_data_source_callbacks != NULL); - btstack_assert(ds->process != NULL); - return the_run_loop->remove_data_source(ds); + btstack_assert(data_source->process != NULL); + return the_run_loop->remove_data_source(data_source); } -void btstack_run_loop_set_timer(btstack_timer_source_t *a, uint32_t timeout_in_ms){ +void btstack_run_loop_set_timer(btstack_timer_source_t * timer, uint32_t timeout_in_ms){ btstack_assert(the_run_loop != NULL); - the_run_loop->set_timer(a, timeout_in_ms); + the_run_loop->set_timer(timer, timeout_in_ms); } /** * @brief Set context for this timer */ -void btstack_run_loop_set_timer_context(btstack_timer_source_t *ts, void * context){ - ts->context = context; +void btstack_run_loop_set_timer_context(btstack_timer_source_t * timer, void * context){ + timer->context = context; } /** * @brief Get context for this timer */ -void * btstack_run_loop_get_timer_context(btstack_timer_source_t *ts){ - return ts->context; +void * btstack_run_loop_get_timer_context(btstack_timer_source_t * timer){ + return timer->context; } /** * Add timer to run_loop (keep list sorted) */ -void btstack_run_loop_add_timer(btstack_timer_source_t *ts){ +void btstack_run_loop_add_timer(btstack_timer_source_t * timer){ btstack_assert(the_run_loop != NULL); - btstack_assert(ts->process != NULL); - the_run_loop->add_timer(ts); + btstack_assert(timer->process != NULL); + the_run_loop->add_timer(timer); } /** * Remove timer from run loop */ -int btstack_run_loop_remove_timer(btstack_timer_source_t *ts){ +int btstack_run_loop_remove_timer(btstack_timer_source_t * timer){ btstack_assert(the_run_loop != NULL); - return the_run_loop->remove_timer(ts); + return the_run_loop->remove_timer(timer); } /** diff --git a/src/btstack_run_loop.h b/src/btstack_run_loop.h index 2423224faa..775b4ecb20 100644 --- a/src/btstack_run_loop.h +++ b/src/btstack_run_loop.h @@ -167,16 +167,16 @@ bool btstack_run_loop_base_remove_data_source(btstack_data_source_t * data_sourc /** * @brief Enable callbacks for a data source * @param data_source to remove - * @param callback types to enable + * @param callback_types to enable */ -void btstack_run_loop_base_enable_data_source_callbacks(btstack_data_source_t * data_source, uint16_t callbacks); +void btstack_run_loop_base_enable_data_source_callbacks(btstack_data_source_t * data_source, uint16_t callback_types); /** * @brief Enable callbacks for a data source * @param data_source to remove - * @param callback types to disable + * @param callback_types to disable */ -void btstack_run_loop_base_disable_data_source_callbacks(btstack_data_source_t * data_source, uint16_t callbacks); +void btstack_run_loop_base_disable_data_source_callbacks(btstack_data_source_t * data_source, uint16_t callback_types); /** * @brief Poll data sources. It calls the procss function for all data sources where DATA_SOURCE_CALLBACK_POLL is set @@ -196,22 +196,22 @@ void btstack_run_loop_init(const btstack_run_loop_t * run_loop); /** * @brief Set timer based on current time in milliseconds. */ -void btstack_run_loop_set_timer(btstack_timer_source_t * ts, uint32_t timeout_in_ms); +void btstack_run_loop_set_timer(btstack_timer_source_t * timer, uint32_t timeout_in_ms); /** * @brief Set callback that will be executed when timer expires. */ -void btstack_run_loop_set_timer_handler(btstack_timer_source_t * ts, void (*process)(btstack_timer_source_t *_ts)); +void btstack_run_loop_set_timer_handler(btstack_timer_source_t * timer, void (*process)(btstack_timer_source_t * _timer)); /** * @brief Set context for this timer */ -void btstack_run_loop_set_timer_context(btstack_timer_source_t * ts, void * context); +void btstack_run_loop_set_timer_context(btstack_timer_source_t * timer, void * context); /** * @brief Get context for this timer */ -void * btstack_run_loop_get_timer_context(btstack_timer_source_t * ts); +void * btstack_run_loop_get_timer_context(btstack_timer_source_t * timer); /** * @brief Add timer source. @@ -238,7 +238,7 @@ void btstack_run_loop_timer_dump(void); /** * @brief Set data source callback. */ -void btstack_run_loop_set_data_source_handler(btstack_data_source_t * data_source, void (*process)(btstack_data_source_t *_ds, btstack_data_source_callback_type_t callback_type)); +void btstack_run_loop_set_data_source_handler(btstack_data_source_t * data_source, void (*process)(btstack_data_source_t * _data_source, btstack_data_source_callback_type_t callback_type)); /** * @brief Set data source file descriptor. diff --git a/src/btstack_util.c b/src/btstack_util.c index 4d01ad1fc0..1a1818471e 100644 --- a/src/btstack_util.c +++ b/src/btstack_util.c @@ -80,20 +80,20 @@ uint32_t little_endian_read_32(const uint8_t * buffer, int position){ return ((uint32_t) buffer[position]) | (((uint32_t)buffer[position+1]) << 8) | (((uint32_t)buffer[position+2]) << 16) | (((uint32_t) buffer[position+3]) << 24); } -void little_endian_store_16(uint8_t *buffer, uint16_t position, uint16_t value){ +void little_endian_store_16(uint8_t * buffer, uint16_t position, uint16_t value){ uint16_t pos = position; buffer[pos++] = (uint8_t)value; buffer[pos++] = (uint8_t)(value >> 8); } -void little_endian_store_24(uint8_t *buffer, uint16_t position, uint32_t value){ +void little_endian_store_24(uint8_t * buffer, uint16_t position, uint32_t value){ uint16_t pos = position; buffer[pos++] = (uint8_t)(value); buffer[pos++] = (uint8_t)(value >> 8); buffer[pos++] = (uint8_t)(value >> 16); } -void little_endian_store_32(uint8_t *buffer, uint16_t position, uint32_t value){ +void little_endian_store_32(uint8_t * buffer, uint16_t position, uint32_t value){ uint16_t pos = position; buffer[pos++] = (uint8_t)(value); buffer[pos++] = (uint8_t)(value >> 8); @@ -101,32 +101,32 @@ void little_endian_store_32(uint8_t *buffer, uint16_t position, uint32_t value){ buffer[pos++] = (uint8_t)(value >> 24); } -uint32_t big_endian_read_16( const uint8_t * buffer, int position) { +uint32_t big_endian_read_16(const uint8_t * buffer, int position) { return (uint16_t)(((uint16_t) buffer[position+1]) | (((uint16_t)buffer[position]) << 8)); } -uint32_t big_endian_read_24( const uint8_t * buffer, int position) { +uint32_t big_endian_read_24(const uint8_t * buffer, int position) { return ( ((uint32_t)buffer[position+2]) | (((uint32_t)buffer[position+1]) << 8) | (((uint32_t) buffer[position]) << 16)); } -uint32_t big_endian_read_32( const uint8_t * buffer, int position) { +uint32_t big_endian_read_32(const uint8_t * buffer, int position) { return ((uint32_t) buffer[position+3]) | (((uint32_t)buffer[position+2]) << 8) | (((uint32_t)buffer[position+1]) << 16) | (((uint32_t) buffer[position]) << 24); } -void big_endian_store_16(uint8_t *buffer, uint16_t position, uint16_t value){ +void big_endian_store_16(uint8_t * buffer, uint16_t position, uint16_t value){ uint16_t pos = position; buffer[pos++] = (uint8_t)(value >> 8); buffer[pos++] = (uint8_t)(value); } -void big_endian_store_24(uint8_t *buffer, uint16_t position, uint32_t value){ +void big_endian_store_24(uint8_t * buffer, uint16_t position, uint32_t value){ uint16_t pos = position; buffer[pos++] = (uint8_t)(value >> 16); buffer[pos++] = (uint8_t)(value >> 8); buffer[pos++] = (uint8_t)(value); } -void big_endian_store_32(uint8_t *buffer, uint16_t position, uint32_t value){ +void big_endian_store_32(uint8_t * buffer, uint16_t position, uint32_t value){ uint16_t pos = position; buffer[pos++] = (uint8_t)(value >> 24); buffer[pos++] = (uint8_t)(value >> 16); @@ -135,28 +135,28 @@ void big_endian_store_32(uint8_t *buffer, uint16_t position, uint32_t value){ } // general swap/endianess utils -void reverse_bytes(const uint8_t *src, uint8_t *dst, int len){ +void reverse_bytes(const uint8_t * src, uint8_t * dest, int len){ int i; for (i = 0; i < len; i++) - dst[len - 1 - i] = src[i]; + dest[len - 1 - i] = src[i]; } -void reverse_24(const uint8_t * src, uint8_t * dst){ - reverse_bytes(src, dst, 3); +void reverse_24(const uint8_t * src, uint8_t * dest){ + reverse_bytes(src, dest, 3); } -void reverse_48(const uint8_t * src, uint8_t * dst){ - reverse_bytes(src, dst, 6); +void reverse_48(const uint8_t * src, uint8_t * dest){ + reverse_bytes(src, dest, 6); } -void reverse_56(const uint8_t * src, uint8_t * dst){ - reverse_bytes(src, dst, 7); +void reverse_56(const uint8_t * src, uint8_t * dest){ + reverse_bytes(src, dest, 7); } -void reverse_64(const uint8_t * src, uint8_t * dst){ - reverse_bytes(src, dst, 8); +void reverse_64(const uint8_t * src, uint8_t * dest){ + reverse_bytes(src, dest, 8); } -void reverse_128(const uint8_t * src, uint8_t * dst){ - reverse_bytes(src, dst, 16); +void reverse_128(const uint8_t * src, uint8_t * dest){ + reverse_bytes(src, dest, 16); } -void reverse_256(const uint8_t * src, uint8_t * dst){ - reverse_bytes(src, dst, 32); +void reverse_256(const uint8_t * src, uint8_t * dest){ + reverse_bytes(src, dest, 32); } void reverse_bd_addr(const bd_addr_t src, bd_addr_t dest){ @@ -208,7 +208,7 @@ int nibble_for_char(char c){ } #ifdef ENABLE_PRINTF_HEXDUMP -void printf_hexdump(const void *data, int size){ +void printf_hexdump(const void * data, int size){ char buffer[4]; buffer[2] = ' '; buffer[3] = 0; @@ -260,7 +260,7 @@ static void log_hexdump(int level, const void * data, int size){ } #endif -void log_debug_hexdump(const void *data, int size){ +void log_debug_hexdump(const void * data, int size){ #ifdef ENABLE_LOG_DEBUG log_hexdump(HCI_DUMP_LOG_LEVEL_DEBUG, data, size); #else @@ -269,7 +269,7 @@ void log_debug_hexdump(const void *data, int size){ #endif } -void log_info_hexdump(const void *data, int size){ +void log_info_hexdump(const void * data, int size){ #ifdef ENABLE_LOG_INFO log_hexdump(HCI_DUMP_LOG_LEVEL_INFO, data, size); #else @@ -302,9 +302,9 @@ void log_info_key(const char * name, sm_key_t key){ const uint8_t bluetooth_base_uuid[] = { 0x00, 0x00, 0x00, 0x00, /* - */ 0x00, 0x00, /* - */ 0x10, 0x00, /* - */ 0x80, 0x00, /* - */ 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB }; -void uuid_add_bluetooth_prefix(uint8_t *uuid, uint32_t shortUUID){ - (void)memcpy(uuid, bluetooth_base_uuid, 16); - big_endian_store_32(uuid, 0, shortUUID); +void uuid_add_bluetooth_prefix(uint8_t * uuid128, uint32_t shortUUID){ + (void)memcpy(uuid128, bluetooth_base_uuid, 16); + big_endian_store_32(uuid128, 0, shortUUID); } int uuid_has_bluetooth_prefix(const uint8_t * uuid128){ @@ -392,7 +392,7 @@ int sscanf_bd_addr(const char * addr_string, bd_addr_t addr){ return result; } -uint32_t btstack_atoi(const char *str){ +uint32_t btstack_atoi(const char * str){ const char * the_string = str; uint32_t val = 0; while (true){ diff --git a/src/btstack_util.h b/src/btstack_util.h index d9d53c6d70..441a7bf4fb 100644 --- a/src/btstack_util.h +++ b/src/btstack_util.h @@ -109,9 +109,9 @@ uint32_t little_endian_read_32(const uint8_t * buffer, int position); * @param position in buffer * @param value */ -void little_endian_store_16(uint8_t *buffer, uint16_t position, uint16_t value); -void little_endian_store_24(uint8_t *buffer, uint16_t position, uint32_t value); -void little_endian_store_32(uint8_t *buffer, uint16_t position, uint32_t value); +void little_endian_store_16(uint8_t * buffer, uint16_t position, uint16_t value); +void little_endian_store_24(uint8_t * buffer, uint16_t position, uint32_t value); +void little_endian_store_32(uint8_t * buffer, uint16_t position, uint32_t value); /** * @brief Read 16/24/32 bit big endian value from buffer @@ -119,9 +119,9 @@ void little_endian_store_32(uint8_t *buffer, uint16_t position, uint32_t value); * @param position in buffer * @return value */ -uint32_t big_endian_read_16( const uint8_t * buffer, int position); -uint32_t big_endian_read_24( const uint8_t * buffer, int position); -uint32_t big_endian_read_32( const uint8_t * buffer, int position); +uint32_t big_endian_read_16(const uint8_t * buffer, int position); +uint32_t big_endian_read_24(const uint8_t * buffer, int position); +uint32_t big_endian_read_32(const uint8_t * buffer, int position); /** * @brief Write 16/32 bit big endian value into buffer @@ -129,9 +129,9 @@ uint32_t big_endian_read_32( const uint8_t * buffer, int position); * @param position in buffer * @param value */ -void big_endian_store_16(uint8_t *buffer, uint16_t position, uint16_t value); -void big_endian_store_24(uint8_t *buffer, uint16_t position, uint32_t value); -void big_endian_store_32(uint8_t *buffer, uint16_t position, uint32_t value); +void big_endian_store_16(uint8_t * buffer, uint16_t position, uint16_t value); +void big_endian_store_24(uint8_t * buffer, uint16_t position, uint32_t value); +void big_endian_store_32(uint8_t * buffer, uint16_t position, uint32_t value); /** @@ -165,19 +165,19 @@ static inline int btstack_is_little_endian(void){ * @param dest * @param len */ -void reverse_bytes (const uint8_t *src, uint8_t * dest, int len); +void reverse_bytes(const uint8_t * src, uint8_t * dest, int len); /** * @brief Wrapper around reverse_bytes for common buffer sizes * @param src * @param dest */ -void reverse_24 (const uint8_t *src, uint8_t * dest); -void reverse_48 (const uint8_t *src, uint8_t * dest); -void reverse_56 (const uint8_t *src, uint8_t * dest); -void reverse_64 (const uint8_t *src, uint8_t * dest); -void reverse_128(const uint8_t *src, uint8_t * dest); -void reverse_256(const uint8_t *src, uint8_t * dest); +void reverse_24 (const uint8_t * src, uint8_t * dest); +void reverse_48 (const uint8_t * src, uint8_t * dest); +void reverse_56 (const uint8_t * src, uint8_t * dest); +void reverse_64 (const uint8_t * src, uint8_t * dest); +void reverse_128(const uint8_t * src, uint8_t * dest); +void reverse_256(const uint8_t * src, uint8_t * dest); void reverse_bd_addr(const bd_addr_t src, bd_addr_t dest); @@ -211,7 +211,7 @@ void bd_addr_copy(bd_addr_t dest, const bd_addr_t src); /** * @brief Use printf to write hexdump as single line of data */ -void printf_hexdump(const void *data, int size); +void printf_hexdump(const void * data, int size); /** * @brief Create human readable representation for UUID128 @@ -262,7 +262,7 @@ int uuid_has_bluetooth_prefix(const uint8_t * uuid128); * @param str to parse * @return value */ -uint32_t btstack_atoi(const char *str); +uint32_t btstack_atoi(const char * str); /** * @brief Return number of digits of a uint32 number @@ -282,8 +282,8 @@ int count_set_bits_uint32(uint32_t x); * CRC8 functions using ETSI TS 101 369 V6.3.0. * Only used by RFCOMM */ -uint8_t btstack_crc8_check(uint8_t *data, uint16_t len, uint8_t check_sum); -uint8_t btstack_crc8_calc(uint8_t *data, uint16_t len); +uint8_t btstack_crc8_check(uint8_t * data, uint16_t len, uint8_t check_sum); +uint8_t btstack_crc8_calc(uint8_t * data, uint16_t len); /* API_END */ diff --git a/src/gap.h b/src/gap.h index 39ce58cc20..d31e616df8 100644 --- a/src/gap.h +++ b/src/gap.h @@ -557,20 +557,20 @@ uint8_t gap_connect_cancel(void); /** * @brief Auto Connection Establishment - Start Connecting to device * @deprecated Please setup Whitelist with gap_whitelist_* and start connecting with gap_connect_with_whitelist - * @param address_typ + * @param address_type * @param address * @returns 0 if ok */ -uint8_t gap_auto_connection_start(bd_addr_type_t address_typ, const bd_addr_t address); +uint8_t gap_auto_connection_start(bd_addr_type_t address_type, const bd_addr_t address); /** * @brief Auto Connection Establishment - Stop Connecting to device * @deprecated Please setup Whitelist with gap_whitelist_* and start connecting with gap_connect_with_whitelist - * @param address_typ + * @param address_type * @param address * @returns 0 if ok */ -uint8_t gap_auto_connection_stop(bd_addr_type_t address_typ, const bd_addr_t address); +uint8_t gap_auto_connection_stop(bd_addr_type_t address_type, const bd_addr_t address); /** * @brief Auto Connection Establishment - Stop everything @@ -592,9 +592,10 @@ uint8_t gap_le_set_phy(hci_con_handle_t con_handle, uint8_t all_phys, uint8_t tx /** * @brief Get connection interval + * @param con_handle * @return connection interval, otherwise 0 if error */ -uint16_t gap_le_connection_interval(hci_con_handle_t connection_handle); +uint16_t gap_le_connection_interval(hci_con_handle_t con_handle); /** * diff --git a/src/hci.c b/src/hci.c index 447457fc6c..2f62d769c1 100644 --- a/src/hci.c +++ b/src/hci.c @@ -4990,7 +4990,7 @@ void gap_secure_connections_enable(bool enable){ #endif // va_list part of hci_send_cmd -int hci_send_cmd_va_arg(const hci_cmd_t *cmd, va_list argptr){ +int hci_send_cmd_va_arg(const hci_cmd_t * cmd, va_list argptr){ if (!hci_can_send_command_packet_now()){ log_error("hci_send_cmd called but cannot send packet now"); return 0; @@ -5017,7 +5017,7 @@ int hci_send_cmd_va_arg(const hci_cmd_t *cmd, va_list argptr){ /** * pre: numcmds >= 0 - it's allowed to send a command to the controller */ -int hci_send_cmd(const hci_cmd_t *cmd, ...){ +int hci_send_cmd(const hci_cmd_t * cmd, ...){ va_list argptr; va_start(argptr, cmd); int res = hci_send_cmd_va_arg(cmd, argptr); @@ -5810,8 +5810,8 @@ uint8_t gap_request_role(const bd_addr_t addr, hci_role_t role){ #ifdef ENABLE_BLE -uint8_t gap_le_set_phy(hci_con_handle_t connection_handle, uint8_t all_phys, uint8_t tx_phys, uint8_t rx_phys, uint8_t phy_options){ - hci_connection_t * conn = hci_connection_for_handle(connection_handle); +uint8_t gap_le_set_phy(hci_con_handle_t con_handle, uint8_t all_phys, uint8_t tx_phys, uint8_t rx_phys, uint8_t phy_options){ + hci_connection_t * conn = hci_connection_for_handle(con_handle); if (!conn) return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; conn->le_phy_update_all_phys = all_phys; @@ -6004,8 +6004,8 @@ uint8_t gap_auto_connection_stop_all(void){ return ERROR_CODE_SUCCESS; } -uint16_t gap_le_connection_interval(hci_con_handle_t connection_handle){ - hci_connection_t * conn = hci_connection_for_handle(connection_handle); +uint16_t gap_le_connection_interval(hci_con_handle_t con_handle){ + hci_connection_t * conn = hci_connection_for_handle(con_handle); if (!conn) return 0; return conn->le_connection_interval; } @@ -6219,8 +6219,8 @@ void gap_ssp_generate_oob_data(void){ * @brief Set inquiry mode: standard, with RSSI, with RSSI + Extended Inquiry Results. Has to be called before power on. * @param inquiry_mode see bluetooth_defines.h */ -void hci_set_inquiry_mode(inquiry_mode_t mode){ - hci_stack->inquiry_mode = mode; +void hci_set_inquiry_mode(inquiry_mode_t inquiry_mode){ + hci_stack->inquiry_mode = inquiry_mode; } /** diff --git a/src/hci.h b/src/hci.h index 7105a2b15e..30332a8873 100644 --- a/src/hci.h +++ b/src/hci.h @@ -1115,10 +1115,12 @@ uint16_t hci_get_sco_voice_setting(void); * @brief Set inquiry mode: standard, with RSSI, with RSSI + Extended Inquiry Results. Has to be called before power on. * @param inquriy_mode see bluetooth_defines.h */ -void hci_set_inquiry_mode(inquiry_mode_t mode); +void hci_set_inquiry_mode(inquiry_mode_t inquriy_mode); /** * @brief Requests the change of BTstack power mode. + * @param power_mode + * @return 0 if success, otherwise error */ int hci_power_control(HCI_POWER_MODE mode); @@ -1157,7 +1159,7 @@ int hci_can_send_command_packet_now(void); /** * @brief Creates and sends HCI command packets based on a template and a list of parameters. Will return error if outgoing data buffer is occupied. */ -int hci_send_cmd(const hci_cmd_t *cmd, ...); +int hci_send_cmd(const hci_cmd_t * cmd, ...); // Sending SCO Packets @@ -1223,7 +1225,7 @@ void hci_set_master_slave_policy(uint8_t policy); /** * va_list version of hci_send_cmd, call hci_send_cmd_packet */ -int hci_send_cmd_va_arg(const hci_cmd_t *cmd, va_list argtr); +int hci_send_cmd_va_arg(const hci_cmd_t * cmd, va_list argptr); /** * Get connection iterator. Only used by l2cap.c and sm.c diff --git a/src/hci_dump.c b/src/hci_dump.c index 01723aac1d..6b275e57a5 100644 --- a/src/hci_dump.c +++ b/src/hci_dump.c @@ -48,7 +48,7 @@ #include "btstack_bool.h" #include "btstack_util.h" -static const hci_dump_t * hci_dump_impl; +static const hci_dump_t * hci_dump_implementation; static int max_nr_packets; static int nr_packets; static bool packet_log_enabled; @@ -57,16 +57,16 @@ static bool packet_log_enabled; static bool log_level_enabled[3] = { 1, 1, 1}; static bool hci_dump_log_level_active(int log_level){ - if (hci_dump_impl == NULL) return false; + if (hci_dump_implementation == NULL) return false; if (log_level < HCI_DUMP_LOG_LEVEL_DEBUG) return false; if (log_level > HCI_DUMP_LOG_LEVEL_ERROR) return false; return log_level_enabled[log_level]; } -void hci_dump_init(const hci_dump_t * impl){ +void hci_dump_init(const hci_dump_t * hci_dump_impl){ max_nr_packets = -1; nr_packets = 0; - hci_dump_impl = impl; + hci_dump_implementation = hci_dump_impl; packet_log_enabled = true; } @@ -79,7 +79,7 @@ void hci_dump_enable_packet_log(bool enabled){ } void hci_dump_packet(uint8_t packet_type, uint8_t in, uint8_t *packet, uint16_t len) { - if (hci_dump_impl == NULL) { + if (hci_dump_implementation == NULL) { return; } if (packet_log_enabled == false) { @@ -87,13 +87,13 @@ void hci_dump_packet(uint8_t packet_type, uint8_t in, uint8_t *packet, uint16_t } if (max_nr_packets > 0){ - if ((nr_packets >= max_nr_packets) && (hci_dump_impl->reset != NULL)) { + if ((nr_packets >= max_nr_packets) && (hci_dump_implementation->reset != NULL)) { nr_packets = 0; - (*hci_dump_impl->reset)(); + (*hci_dump_implementation->reset)(); } nr_packets++; } - (*hci_dump_impl->log_packet)(packet_type, in, packet, len); + (*hci_dump_implementation->log_packet)(packet_type, in, packet, len); } void hci_dump_log(int log_level, const char * format, ...){ @@ -101,7 +101,7 @@ void hci_dump_log(int log_level, const char * format, ...){ va_list argptr; va_start(argptr, format); - (*hci_dump_impl->log_message)(format, argptr); + (*hci_dump_implementation->log_message)(format, argptr); va_end(argptr); } @@ -111,7 +111,7 @@ void hci_dump_log_P(int log_level, PGM_P format, ...){ va_list argptr; va_start(argptr, format); - (*hci_dump_impl->log_message_P)(format, argptr); + (*hci_dump_implementation->log_message_P)(format, argptr); va_end(argptr); } #endif diff --git a/src/hci_transport_h4.c b/src/hci_transport_h4.c index d4dc58cae1..53b21ad2c5 100644 --- a/src/hci_transport_h4.c +++ b/src/hci_transport_h4.c @@ -138,7 +138,7 @@ static uint8_t * ehcill_tx_data; static uint16_t ehcill_tx_len; // 0 == no outgoing packet #endif -static void (*packet_handler)(uint8_t packet_type, uint8_t *packet, uint16_t size) = dummy_handler; +static void (*hci_transport_h4_packet_handler)(uint8_t packet_type, uint8_t *packet, uint16_t size) = dummy_handler; // packet reader state machine static H4_STATE h4_state; @@ -221,7 +221,7 @@ static void hci_transport_h4_packet_complete(void){ // reset state machine before delivering packet to stack as it might close the transport hci_transport_h4_reset_statemachine(); - packet_handler(hci_packet[0], &hci_packet[1], packet_len); + hci_transport_h4_packet_handler(hci_packet[0], &hci_packet[1], packet_len); } static void hci_transport_h4_block_read(void){ @@ -340,7 +340,7 @@ static void hci_transport_h4_block_sent(void){ hci_transport_h4_ehcill_handle_packet_sent(); #endif // notify upper stack that it can send again - packet_handler(HCI_EVENT_PACKET, (uint8_t *) &packet_sent_event[0], sizeof(packet_sent_event)); + hci_transport_h4_packet_handler(HCI_EVENT_PACKET, (uint8_t *) &packet_sent_event[0], sizeof(packet_sent_event)); break; #ifdef ENABLE_EHCILL @@ -453,7 +453,7 @@ static int hci_transport_h4_close(void){ } static void hci_transport_h4_register_packet_handler(void (*handler)(uint8_t packet_type, uint8_t *packet, uint16_t size)){ - packet_handler = handler; + hci_transport_h4_packet_handler = handler; } static void dummy_handler(uint8_t packet_type, uint8_t *packet, uint16_t size){ @@ -478,7 +478,7 @@ static void hci_transport_h4_ehcill_emit_sleep_state(int sleep_active){ event[0] = HCI_EVENT_TRANSPORT_SLEEP_MODE; event[1] = sizeof(event) - 2; event[2] = sleep_active; - packet_handler(HCI_EVENT_PACKET, &event[0], sizeof(event)); + hci_transport_h4_packet_handler(HCI_EVENT_PACKET, &event[0], sizeof(event)); } static void hci_transport_h4_ehcill_wakeup_handler(void){ diff --git a/src/l2cap.c b/src/l2cap.c index 194094e3b2..5bc9811d22 100644 --- a/src/l2cap.c +++ b/src/l2cap.c @@ -3796,10 +3796,10 @@ static void l2cap_acl_handler(uint8_t packet_type, uint16_t channel, uint8_t *pa } // Bluetooth 4.0 - allows to register handler for Attribute Protocol and Security Manager Protocol -void l2cap_register_fixed_channel(btstack_packet_handler_t the_packet_handler, uint16_t channel_id) { +void l2cap_register_fixed_channel(btstack_packet_handler_t packet_handler, uint16_t channel_id) { l2cap_fixed_channel_t * channel = l2cap_fixed_channel_for_channel_id(channel_id); if (!channel) return; - channel->packet_handler = the_packet_handler; + channel->packet_handler = packet_handler; } #ifdef ENABLE_CLASSIC @@ -4262,7 +4262,7 @@ uint8_t l2cap_le_request_can_send_now_event(uint16_t local_cid){ * @param data data to send * @param size data size */ -uint8_t l2cap_le_send_data(uint16_t local_cid, uint8_t * data, uint16_t len){ +uint8_t l2cap_le_send_data(uint16_t local_cid, uint8_t * data, uint16_t size){ l2cap_channel_t * channel = l2cap_get_channel_for_local_cid(local_cid); if (!channel) { @@ -4270,7 +4270,7 @@ uint8_t l2cap_le_send_data(uint16_t local_cid, uint8_t * data, uint16_t len){ return L2CAP_LOCAL_CID_DOES_NOT_EXIST; } - if (len > channel->remote_mtu){ + if (size > channel->remote_mtu){ log_error("l2cap_send cid 0x%02x, data length exceeds remote MTU.", local_cid); return L2CAP_DATA_LEN_EXCEEDS_REMOTE_MTU; } @@ -4281,7 +4281,7 @@ uint8_t l2cap_le_send_data(uint16_t local_cid, uint8_t * data, uint16_t len){ } channel->send_sdu_buffer = data; - channel->send_sdu_len = len; + channel->send_sdu_len = size; channel->send_sdu_pos = 0; l2cap_notify_channel_can_send(); diff --git a/src/l2cap.h b/src/l2cap.h index 1e20414055..5a0c11ceeb 100644 --- a/src/l2cap.h +++ b/src/l2cap.h @@ -641,7 +641,7 @@ uint8_t l2cap_le_provide_credits(uint16_t cid, uint16_t credits); * @brief Check if packet can be scheduled for transmission * @param local_cid L2CAP LE Data Channel Identifier */ -int l2cap_le_can_send_now(uint16_t cid); +int l2cap_le_can_send_now(uint16_t local_cid); /** * @brief Request emission of L2CAP_EVENT_LE_CAN_SEND_NOW as soon as possible @@ -649,7 +649,7 @@ int l2cap_le_can_send_now(uint16_t cid); * so packet handler should be ready to handle it * @param local_cid L2CAP LE Data Channel Identifier */ -uint8_t l2cap_le_request_can_send_now_event(uint16_t cid); +uint8_t l2cap_le_request_can_send_now_event(uint16_t local_cid); /** * @brief Send data via LE Data Channel @@ -658,13 +658,13 @@ uint8_t l2cap_le_request_can_send_now_event(uint16_t cid); * @param data data to send * @param size data size */ -uint8_t l2cap_le_send_data(uint16_t cid, uint8_t * data, uint16_t size); +uint8_t l2cap_le_send_data(uint16_t local_cid, uint8_t * data, uint16_t size); /** * @brief Disconnect from LE Data Channel * @param local_cid L2CAP LE Data Channel Identifier */ -uint8_t l2cap_le_disconnect(uint16_t cid); +uint8_t l2cap_le_disconnect(uint16_t local_cid); /** * @brief ERTM Set channel as busy. diff --git a/tool/btstack_memory_generator.py b/tool/btstack_memory_generator.py index d533d4d5b2..b10270dbe8 100755 --- a/tool/btstack_memory_generator.py +++ b/tool/btstack_memory_generator.py @@ -46,9 +46,9 @@ hfile_header_begin = """ /* - * btstack_memory.h + * btstack_memory.h * - * @brief BTstack memory management via configurable memory pools + * @brief BTstack memory management using configurable memory pools * */