feat(bt/gap): Add new apis for bluetooth to set and get page timeout
1: add two new apis for classic bluetooth, esp_bt_gap_set_page_timeout(page_to) and esp_bt_gap_get_page_timeout(), which can get and set the value of page timeout.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -218,6 +218,8 @@ typedef enum {
|
||||
ESP_BT_GAP_QOS_CMPL_EVT, /*!< QOS complete event */
|
||||
ESP_BT_GAP_ACL_CONN_CMPL_STAT_EVT, /*!< ACL connection complete status event */
|
||||
ESP_BT_GAP_ACL_DISCONN_CMPL_STAT_EVT, /*!< ACL disconnection complete status event */
|
||||
ESP_BT_GAP_SET_PAGE_TO_EVT, /*!< Set page timeout event */
|
||||
ESP_BT_GAP_GET_PAGE_TO_EVT, /*!< Get page timeout event */
|
||||
ESP_BT_GAP_EVT_MAX,
|
||||
} esp_bt_gap_cb_event_t;
|
||||
|
||||
@@ -372,6 +374,21 @@ typedef union {
|
||||
logical transport. unit is 0.625ms. */
|
||||
} qos_cmpl; /*!< QoS complete parameter struct */
|
||||
|
||||
/**
|
||||
* @brief ESP_BT_GAP_SET_PAGE_TO_EVT
|
||||
*/
|
||||
struct page_to_set_param {
|
||||
esp_bt_status_t stat; /*!< set page timeout status*/
|
||||
} set_page_timeout; /*!< set page timeout parameter struct */
|
||||
|
||||
/**
|
||||
* @brief ESP_BT_GAP_GET_PAGE_TO_EVT
|
||||
*/
|
||||
struct page_to_get_param {
|
||||
esp_bt_status_t stat; /*!< get page timeout status*/
|
||||
uint16_t page_to; /*!< page_timeout value to be set, unit is 0.625ms. */
|
||||
} get_page_timeout; /*!< get page timeout parameter struct */
|
||||
|
||||
/**
|
||||
* @brief ESP_BT_GAP_ACL_CONN_CMPL_STAT_EVT
|
||||
*/
|
||||
@@ -786,6 +803,35 @@ esp_err_t esp_bt_gap_read_remote_name(esp_bd_addr_t remote_bda);
|
||||
*/
|
||||
esp_err_t esp_bt_gap_set_qos(esp_bd_addr_t remote_bda, uint32_t t_poll);
|
||||
|
||||
/**
|
||||
* @brief Set the page timeout
|
||||
* esp_bt_gap_cb_t will be called with ESP_BT_GAP_SET_PAGE_TO_EVT
|
||||
* after set page timeout ends. The value to be set will not be effective util the
|
||||
* next page procedure, it's suggested to set the page timeout before initiating
|
||||
* a connection.
|
||||
*
|
||||
* @param[in] page_to: Page timeout, the maximum time the master will wait for a
|
||||
Base-band page response from the remote device at a locally
|
||||
initiated connection attempt. The valid range is 0x0016 ~ 0xffff,
|
||||
the default value is 0x2000, unit is 0.625ms.
|
||||
*
|
||||
* @return - ESP_OK: success
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - other: failed
|
||||
*/
|
||||
esp_err_t esp_bt_gap_set_page_timeout(uint16_t page_to);
|
||||
|
||||
/**
|
||||
* @brief Get the page timeout
|
||||
* esp_bt_gap_cb_t will be called with ESP_BT_GAP_GET_PAGE_TO_EVT
|
||||
* after get page timeout ends
|
||||
*
|
||||
* @return - ESP_OK: success
|
||||
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - other: failed
|
||||
*/
|
||||
esp_err_t esp_bt_gap_get_page_timeout(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user