diff --git a/doc/notes/hci_commands_used_le.txt b/doc/notes/hci_commands_used_le.txt index 735630d14..5af869ee3 100644 --- a/doc/notes/hci_commands_used_le.txt +++ b/doc/notes/hci_commands_used_le.txt @@ -3,16 +3,16 @@ hci_le_add_device_to_white_list hci_le_connection_update hci_le_create_connection hci_le_create_connection_cancel -hci_le_encrypt +hci_le_encrypt 32 hci_le_long_term_key_negative_reply -hci_le_long_term_key_request_reply +hci_le_long_term_key_request_reply 18 hci_le_rand hci_le_read_buffer_size hci_le_read_white_list_size hci_le_remove_device_from_white_list hci_le_set_advertise_enable hci_le_set_advertising_data -hci_le_set_advertising_parameters +hci_le_set_advertising_parameters 16 hci_le_set_random_address hci_le_set_scan_enable hci_le_set_scan_parameters @@ -27,3 +27,5 @@ hci_read_remote_supported_features_command hci_reset hci_set_event_mask hci_write_le_host_supported + +max parameter length: 32 diff --git a/src/hci.h b/src/hci.h index 2d1b8f1f8..ef685c9f8 100644 --- a/src/hci.h +++ b/src/hci.h @@ -69,10 +69,26 @@ extern "C" { #endif // packet buffer sizes + +// Max HCI Commadn LE payload size: +// 64 from LE Generate DHKey command +// 32 from LE Encrypt command +#if defined(ENABLE_LE_SECURE_CONNECTIONS) && !defined(HAVE_HCI_CONTROLLER_DHKEY_SUPPORT) +#define HCI_CMD_PAYLOAD_SIZE_LE 64 +#else +#define HCI_CMD_PAYLOAD_SIZE_LE 32 +#endif + // HCI_ACL_PAYLOAD_SIZE is configurable and defined in config.h // addition byte in even to terminate remote name request with '\0' #define HCI_EVENT_BUFFER_SIZE (HCI_EVENT_HEADER_SIZE + HCI_EVENT_PAYLOAD_SIZE + 1) + +#ifdef ENABLE_CLASSIC #define HCI_CMD_BUFFER_SIZE (HCI_CMD_HEADER_SIZE + HCI_CMD_PAYLOAD_SIZE) +#else +#define HCI_CMD_BUFFER_SIZE (HCI_CMD_HEADER_SIZE + HCI_CMD_PAYLOAD_SIZE_LE) +#endif + #define HCI_ACL_BUFFER_SIZE (HCI_ACL_HEADER_SIZE + HCI_ACL_PAYLOAD_SIZE) // size of hci buffers, big enough for command, event, or acl packet without H4 packet type diff --git a/src/hci_cmd.c b/src/hci_cmd.c index fb7db4914..30b97be7f 100644 --- a/src/hci_cmd.c +++ b/src/hci_cmd.c @@ -46,6 +46,7 @@ #include "classic/sdp_util.h" #include "hci.h" #include "hci_cmd.h" +#include "btstack_debug.h" #include @@ -578,12 +579,14 @@ const hci_cmd_t hci_delete_stored_link_key = { OPCODE(OGF_CONTROLLER_BASEBAND, 0x12), "B1" }; +#ifdef ENABLE_CLASSIC /** * @param local_name (UTF-8, Null Terminated, max 248 octets) */ const hci_cmd_t hci_write_local_name = { OPCODE(OGF_CONTROLLER_BASEBAND, 0x13), "N" }; +#endif /** */ @@ -1052,6 +1055,7 @@ OPCODE(OGF_LE_CONTROLLER, 0x25), "" // LE Read Local P-256 Public Key Complete is generated on completion }; +#ifdef HAVE_HCI_CONTROLLER_DHKEY_SUPPORT /** * @param end_test_cmd */ @@ -1059,6 +1063,7 @@ const hci_cmd_t hci_le_generate_dhkey = { OPCODE(OGF_LE_CONTROLLER, 0x26), "QQ" // LE Generate DHKey Complete is generated on completion }; +#endif #endif