diff --git a/nimble/host/include/host/ble_esp_gap.h b/nimble/host/include/host/ble_esp_gap.h new file mode 100644 index 000000000..35f743721 --- /dev/null +++ b/nimble/host/include/host/ble_esp_gap.h @@ -0,0 +1,83 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ + +#ifndef H_BLE_ESP_GAP_ +#define H_BLE_ESP_GAP_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Configure LE Data Length in controller (OGF = 0x08, OCF = 0x0022). + * + * @param conn_handle Connection handle. + * @param tx_octets The preferred value of payload octets that the Controller + * should use for a new connection (Range + * 0x001B-0x00FB). + * @param tx_time The preferred maximum number of microseconds that the local Controller + * should use to transmit a single link layer packet + * (Range 0x0148-0x4290). + * + * @return 0 on success, + * other error code on failure. + */ +int ble_hs_hci_util_set_data_len(uint16_t conn_handle, uint16_t tx_octets, + uint16_t tx_time); + +/** + * Read host's suggested values for the controller's maximum transmitted number of payload octets + * and maximum packet transmission time (OGF = 0x08, OCF = 0x0024). + * + * @param out_sugg_max_tx_octets The Host's suggested value for the Controller's maximum transmitted + * number of payload octets in LL Data PDUs to be used for new + * connections. (Range 0x001B-0x00FB). + * @param out_sugg_max_tx_time The Host's suggested value for the Controller's maximum packet + * transmission time for packets containing LL Data PDUs to be used + * for new connections. (Range 0x0148-0x4290). + * + * @return 0 on success, + * other error code on failure. + */ +int ble_hs_hci_util_read_sugg_def_data_len(uint16_t *out_sugg_max_tx_octets, + uint16_t *out_sugg_max_tx_time); +/** + * Configure host's suggested maximum transmitted number of payload octets and maximum packet + * transmission time in controller (OGF = 0x08, OCF = 0x0024). + * + * @param sugg_max_tx_octets The Host's suggested value for the Controller's maximum transmitted + * number of payload octets in LL Data PDUs to be used for new + * connections. (Range 0x001B-0x00FB). + * @param sugg_max_tx_time The Host's suggested value for the Controller's maximum packet + * transmission time for packets containing LL Data PDUs to be used + * for new connections. (Range 0x0148-0x4290). + * + * @return 0 on success, + * other error code on failure. + */ +int ble_hs_hci_util_write_sugg_def_data_len(uint16_t sugg_max_tx_octets, uint16_t sugg_max_tx_time); + +/** + * Removes the address from controller's white list. + * + * @param addrs The entry to be removed from the white list. + * + * @return 0 on success; nonzero on failure. + */ +int ble_gap_wl_tx_rmv(const ble_addr_t *addrs); + +/** + * Clears all addresses from controller's white list. + * + * @return 0 on success; nonzero on failure. + */ +int ble_gap_wl_tx_clear(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/nimble/host/include/host/ble_esp_gatt.h b/nimble/host/include/host/ble_esp_gatt.h new file mode 100644 index 000000000..aa93090ec --- /dev/null +++ b/nimble/host/include/host/ble_esp_gatt.h @@ -0,0 +1,24 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ + +#ifndef H_BLE_ESP_GATT_ +#define H_BLE_ESP_GATT_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Resets the GATT configuration parameters and deallocates the memory of attributes. + * + */ +void ble_gatts_stop(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/nimble/host/include/host/ble_esp_hs.h b/nimble/host/include/host/ble_esp_hs.h new file mode 100644 index 000000000..154190495 --- /dev/null +++ b/nimble/host/include/host/ble_esp_hs.h @@ -0,0 +1,24 @@ +/* + * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ + +#ifndef H_BLE_ESP_HS_ +#define H_BLE_ESP_HS_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Deinitializes the NimBLE host. This function must be called after the + * NimBLE host stop procedure is complete. + */ +void ble_hs_deinit(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/nimble/host/include/host/ble_gap.h b/nimble/host/include/host/ble_gap.h index 7f261ed40..e5c689f33 100644 --- a/nimble/host/include/host/ble_gap.h +++ b/nimble/host/include/host/ble_gap.h @@ -31,6 +31,7 @@ #include "host/ble_hs.h" #include "host/ble_hs_adv.h" #include "syscfg/syscfg.h" +#include "host/ble_esp_gap.h" #ifdef __cplusplus extern "C" { @@ -1310,55 +1311,6 @@ int ble_gap_adv_set_fields(const struct ble_hs_adv_fields *rsp_fields); */ int ble_gap_adv_rsp_set_fields(const struct ble_hs_adv_fields *rsp_fields); -/** - * Configure LE Data Length in controller (OGF = 0x08, OCF = 0x0022). - * - * @param conn_handle Connection handle. - * @param tx_octets The preferred value of payload octets that the Controller - * should use for a new connection (Range - * 0x001B-0x00FB). - * @param tx_time The preferred maximum number of microseconds that the local Controller - * should use to transmit a single link layer packet - * (Range 0x0148-0x4290). - * - * @return 0 on success, - * other error code on failure. - */ -int ble_hs_hci_util_set_data_len(uint16_t conn_handle, uint16_t tx_octets, - uint16_t tx_time); - -/** - * Read host's suggested values for the controller's maximum transmitted number of payload octets - * and maximum packet transmission time (OGF = 0x08, OCF = 0x0024). - * - * @param out_sugg_max_tx_octets The Host's suggested value for the Controller's maximum transmitted - * number of payload octets in LL Data PDUs to be used for new - * connections. (Range 0x001B-0x00FB). - * @param out_sugg_max_tx_time The Host's suggested value for the Controller's maximum packet - * transmission time for packets containing LL Data PDUs to be used - * for new connections. (Range 0x0148-0x4290). - * - * @return 0 on success, - * other error code on failure. - */ -int ble_hs_hci_util_read_sugg_def_data_len(uint16_t *out_sugg_max_tx_octets, - uint16_t *out_sugg_max_tx_time); -/** - * Configure host's suggested maximum transmitted number of payload octets and maximum packet - * transmission time in controller (OGF = 0x08, OCF = 0x0024). - * - * @param sugg_max_tx_octets The Host's suggested value for the Controller's maximum transmitted - * number of payload octets in LL Data PDUs to be used for new - * connections. (Range 0x001B-0x00FB). - * @param sugg_max_tx_time The Host's suggested value for the Controller's maximum packet - * transmission time for packets containing LL Data PDUs to be used - * for new connections. (Range 0x0148-0x4290). - * - * @return 0 on success, - * other error code on failure. - */ -int ble_hs_hci_util_write_sugg_def_data_len(uint16_t sugg_max_tx_octets, uint16_t sugg_max_tx_time); - #if MYNEWT_VAL(BLE_EXT_ADV) /** @brief Extended advertising parameters */ struct ble_gap_ext_adv_params { @@ -2028,22 +1980,6 @@ int ble_gap_terminate(uint16_t conn_handle, uint8_t hci_reason); */ int ble_gap_wl_set(const ble_addr_t *addrs, uint8_t white_list_count); -/** - * Removes the address from controller's white list. - * - * @param addrs The entry to be removed from the white list. - * - * @return 0 on success; nonzero on failure. - */ -int ble_gap_wl_tx_rmv(const ble_addr_t *addrs); - -/** - * Clears all addresses from controller's white list. - * - * @return 0 on success; nonzero on failure. - */ -int ble_gap_wl_tx_clear(void); - /** * Initiates a connection parameter update procedure. * diff --git a/nimble/host/include/host/ble_gatt.h b/nimble/host/include/host/ble_gatt.h index a720c37f5..cb6a63018 100644 --- a/nimble/host/include/host/ble_gatt.h +++ b/nimble/host/include/host/ble_gatt.h @@ -30,6 +30,8 @@ #include #include "host/ble_att.h" #include "host/ble_uuid.h" +#include "host/ble_esp_gatt.h" + #ifdef __cplusplus extern "C" { #endif @@ -1062,12 +1064,6 @@ int ble_gatts_reset(void); */ int ble_gatts_start(void); -/** - * Resets the GATT configuration parameters and deallocates the memory of attributes. - * - */ -void ble_gatts_stop(void); - #ifdef __cplusplus } #endif diff --git a/nimble/host/include/host/ble_hs.h b/nimble/host/include/host/ble_hs.h index 9223f3b3a..4eba4b440 100644 --- a/nimble/host/include/host/ble_hs.h +++ b/nimble/host/include/host/ble_hs.h @@ -44,6 +44,7 @@ #include "host/ble_store.h" #include "host/ble_uuid.h" #include "nimble/nimble_npl.h" +#include "host/ble_esp_hs.h" #ifdef __cplusplus extern "C" { @@ -451,12 +452,6 @@ void ble_hs_evq_set(struct ble_npl_eventq *evq); */ void ble_hs_init(void); -/** - * Deinitializes the NimBLE host. This function must be called after the - * NimBLE host stop procedure is complete. - */ -void ble_hs_deinit(void); - /** * @brief Called when the system is shutting down. Stops the BLE host. *