mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
Merge branch 'bugfix/fix_ble_max_attribute_value_v5.2' into 'release/v5.2'
Bugfix/fix ble max attribute value v5.2 See merge request espressif/esp-idf!30415
This commit is contained in:
@@ -204,6 +204,48 @@ esp_err_t esp_ble_gap_set_rand_addr(esp_bd_addr_t rand_addr)
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_set_resolvable_private_address_timeout(uint16_t rpa_timeout)
|
||||
{
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if (rpa_timeout < 0x0001 || rpa_timeout > 0x0E10) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_ACT_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT;
|
||||
arg.set_rpa_timeout.rpa_timeout = rpa_timeout;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
|
||||
esp_err_t esp_ble_gap_add_device_to_resolving_list(esp_bd_addr_t peer_addr, uint8_t addr_type, uint8_t *peer_irk)
|
||||
{
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if (addr_type > BLE_ADDR_TYPE_RANDOM ||!peer_addr || (addr_type && ((peer_addr[0] & 0xC0) != 0xC0))) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
btc_msg_t msg = {0};
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_ACT_ADD_DEVICE_TO_RESOLVING_LIST;
|
||||
|
||||
memcpy(arg.add_dev_to_resolving_list.addr, peer_addr, ESP_BD_ADDR_LEN);
|
||||
arg.add_dev_to_resolving_list.addr_type = addr_type;
|
||||
memcpy(arg.add_dev_to_resolving_list.irk, peer_irk, ESP_PEER_IRK_LEN);
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_clear_rand_addr(void)
|
||||
{
|
||||
btc_msg_t msg;
|
||||
@@ -953,6 +995,25 @@ esp_err_t esp_ble_dtm_stop(void)
|
||||
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_set_privacy_mode(esp_ble_addr_type_t addr_type, esp_bd_addr_t addr, esp_ble_privacy_mode_t mode)
|
||||
{
|
||||
btc_msg_t msg;
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_SET_PRIVACY_MODE;
|
||||
|
||||
arg.set_privacy_mode.addr_type = addr_type;
|
||||
memcpy(arg.set_privacy_mode.addr, addr, sizeof(esp_bd_addr_t));
|
||||
arg.set_privacy_mode.privacy_mode = mode;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
esp_err_t esp_ble_gap_read_phy(esp_bd_addr_t bd_addr)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -19,7 +19,7 @@ extern "C" {
|
||||
return ESP_ERR_INVALID_STATE; \
|
||||
}
|
||||
|
||||
#define ESP_BT_STATUS_BASE_FOR_HCI_ERR 0X0100 /* base for coverting HCI error code to ESP status */
|
||||
#define ESP_BT_STATUS_BASE_FOR_HCI_ERR 0X0100 /* base for converting HCI error code to ESP status */
|
||||
|
||||
/* relate to BT_STATUS_xxx in bt_def.h */
|
||||
/// Status Return Value
|
||||
@@ -163,6 +163,9 @@ typedef enum {
|
||||
/// Bluetooth address length
|
||||
#define ESP_BD_ADDR_LEN 6
|
||||
|
||||
/// Bluetooth peer irk
|
||||
#define ESP_PEER_IRK_LEN 16
|
||||
|
||||
/// Bluetooth device address
|
||||
typedef uint8_t esp_bd_addr_t[ESP_BD_ADDR_LEN];
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ typedef enum {
|
||||
ESP_GAP_BLE_PASSKEY_REQ_EVT, /*!< passkey request event */
|
||||
ESP_GAP_BLE_OOB_REQ_EVT, /*!< OOB request event */
|
||||
ESP_GAP_BLE_LOCAL_IR_EVT, /*!< BLE local IR (identity Root 128-bit random static value used to generate Long Term Key) event */
|
||||
ESP_GAP_BLE_LOCAL_ER_EVT, /*!< BLE local ER (Encryption Root vakue used to genrate identity resolving key) event */
|
||||
ESP_GAP_BLE_LOCAL_ER_EVT, /*!< BLE local ER (Encryption Root value used to generate identity resolving key) event */
|
||||
ESP_GAP_BLE_NC_REQ_EVT, /*!< Numeric Comparison request event */
|
||||
//BLE_42_FEATURE_SUPPORT
|
||||
ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT, /*!< When stop adv complete, the event comes */
|
||||
@@ -225,7 +225,10 @@ typedef enum {
|
||||
ESP_GAP_BLE_DTM_TEST_UPDATE_EVT, /*!< when direct test mode state changes, the event comes */
|
||||
// BLE_INCLUDED
|
||||
ESP_GAP_BLE_ADV_CLEAR_COMPLETE_EVT, /*!< When clear advertising complete, the event comes */
|
||||
ESP_GAP_BLE_VENDOR_CMD_COMPLETE_EVT, /*!< When vendor hci command complete, the event comes */
|
||||
ESP_GAP_BLE_SET_RPA_TIMEOUT_COMPLETE_EVT, /*!< When set the Resolvable Private Address (RPA) timeout completes, the event comes */
|
||||
ESP_GAP_BLE_ADD_DEV_TO_RESOLVING_LIST_COMPLETE_EVT, /*!< when add a device to the resolving list completes, the event comes*/
|
||||
ESP_GAP_BLE_VENDOR_CMD_COMPLETE_EVT, /*!< When vendor hci command complete, the event comes */
|
||||
ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT, /*!< When set privacy mode complete, the event comes */
|
||||
ESP_GAP_BLE_EVT_MAX, /*!< when maximum advertising event complete, the event comes */
|
||||
} esp_gap_ble_cb_event_t;
|
||||
|
||||
@@ -799,9 +802,9 @@ typedef uint8_t esp_ble_gap_all_phys_t;
|
||||
#define ESP_BLE_GAP_PRI_PHY_CODED ESP_BLE_GAP_PHY_CODED /*!< Primary Phy is LE CODED */
|
||||
typedef uint8_t esp_ble_gap_pri_phy_t; // primary phy
|
||||
|
||||
#define ESP_BLE_GAP_PHY_1M_PREF_MASK (1 << 0) /*!< The Host prefers use the LE1M transmitter or reciever PHY */
|
||||
#define ESP_BLE_GAP_PHY_2M_PREF_MASK (1 << 1) /*!< The Host prefers use the LE2M transmitter or reciever PHY */
|
||||
#define ESP_BLE_GAP_PHY_CODED_PREF_MASK (1 << 2) /*!< The Host prefers use the LE CODED transmitter or reciever PHY */
|
||||
#define ESP_BLE_GAP_PHY_1M_PREF_MASK (1 << 0) /*!< The Host prefers use the LE1M transmitter or receiver PHY */
|
||||
#define ESP_BLE_GAP_PHY_2M_PREF_MASK (1 << 1) /*!< The Host prefers use the LE2M transmitter or receiver PHY */
|
||||
#define ESP_BLE_GAP_PHY_CODED_PREF_MASK (1 << 2) /*!< The Host prefers use the LE CODED transmitter or receiver PHY */
|
||||
typedef uint8_t esp_ble_gap_phy_mask_t;
|
||||
|
||||
#define ESP_BLE_GAP_PHY_OPTIONS_NO_PREF 0 /*!< The Host has no preferred coding when transmitting on the LE Coded PHY */
|
||||
@@ -1028,6 +1031,11 @@ typedef struct {
|
||||
} esp_ble_gap_past_params_t;
|
||||
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
|
||||
typedef enum{
|
||||
ESP_BLE_NETWORK_PRIVACY_MODE = 0X00, /*!< Network Privacy Mode for peer device (default) */
|
||||
ESP_BLE_DEVICE_PRIVACY_MODE = 0X01, /*!< Device Privacy Mode for peer device */
|
||||
} esp_ble_privacy_mode_t;
|
||||
|
||||
/**
|
||||
* @brief Gap callback parameters union
|
||||
*/
|
||||
@@ -1153,6 +1161,19 @@ typedef union {
|
||||
struct ble_local_privacy_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate the set local privacy operation success status */
|
||||
} local_privacy_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_LOCAL_PRIVACY_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_SET_RPA_TIMEOUT_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_rpa_timeout_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate the set RPA timeout operation success status */
|
||||
} set_rpa_timeout_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_RPA_TIMEOUT_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_ADD_DEV_TO_RESOLVING_LIST_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_add_dev_to_resolving_list_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicates the success status of adding a device to the resolving list */
|
||||
} add_dev_to_resolving_list_cmpl; /*!< Event parameter of ESP_GAP_BLE_ADD_DEV_TO_RESOLVING_LIST_COMPLETE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT
|
||||
*/
|
||||
@@ -1492,6 +1513,12 @@ typedef union {
|
||||
uint16_t param_len; /*!< The length of parameter buffer */
|
||||
uint8_t *p_param_buf; /*!< The point of parameter buffer */
|
||||
} vendor_cmd_cmpl; /*!< Event parameter of ESP_GAP_BLE_VENDOR_CMD_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_set_privacy_mode_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate privacy mode set operation success status */
|
||||
} set_privacy_mode_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT */
|
||||
} esp_ble_gap_cb_param_t;
|
||||
|
||||
/**
|
||||
@@ -1644,6 +1671,44 @@ esp_err_t esp_ble_gap_set_pkt_data_len(esp_bd_addr_t remote_device, uint16_t tx_
|
||||
*/
|
||||
esp_err_t esp_ble_gap_set_rand_addr(esp_bd_addr_t rand_addr);
|
||||
|
||||
/**
|
||||
* @brief This function sets the length of time the Controller uses a Resolvable Private Address
|
||||
* before generating and starting to use a new resolvable private address.
|
||||
*
|
||||
* @note Note: This function is currently not supported on the ESP32 but will be enabled in a future update.
|
||||
*
|
||||
* @param[in] rpa_timeout: The timeout duration in seconds for how long a Resolvable Private Address
|
||||
* is used before a new one is generated. The value must be within the range specified by
|
||||
* the Bluetooth specification (0x0001 to 0x0E10), which corresponds to a time range of
|
||||
* 1 second to 1 hour. The default value is 0x0384 (900 seconds or 15 minutes).
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gap_set_resolvable_private_address_timeout(uint16_t rpa_timeout);
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function adds a device to the resolving list used to generate and resolve Resolvable Private Addresses
|
||||
* in the Controller.
|
||||
*
|
||||
* @note Note: This function shall not be used when address resolution is enabled in the Controller and:
|
||||
* - Advertising (other than periodic advertising) is enabled,
|
||||
* - Scanning is enabled, or
|
||||
* - an HCI_LE_Create_Connection, HCI_LE_Extended_Create_Connection, or HCI_LE_Periodic_Advertising_Create_Sync command is pending.
|
||||
* This command may be used at any time when address resolution is disabled in the Controller.
|
||||
* The added device shall be set to Network Privacy mode.
|
||||
*
|
||||
* @param[in] peer_addr: The peer identity address of the device to be added to the resolving list.
|
||||
* @param[in] addr_type: The address type of the peer identity address (BLE_ADDR_TYPE_PUBLIC or BLE_ADDR_TYPE_RANDOM).
|
||||
* @param[in] peer_irk: The Identity Resolving Key (IRK) of the device.
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_ble_gap_add_device_to_resolving_list(esp_bd_addr_t peer_addr, uint8_t addr_type, uint8_t *peer_irk);
|
||||
/**
|
||||
* @brief This function clears the random address for the application
|
||||
*
|
||||
@@ -1655,7 +1720,6 @@ esp_err_t esp_ble_gap_set_rand_addr(esp_bd_addr_t rand_addr);
|
||||
esp_err_t esp_ble_gap_clear_rand_addr(void);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Enable/disable privacy (including address resolution) on the local device
|
||||
*
|
||||
@@ -2574,6 +2638,21 @@ esp_err_t esp_ble_gap_clear_advertising(void);
|
||||
*/
|
||||
esp_err_t esp_ble_gap_vendor_command_send(esp_ble_vendor_cmd_params_t *vendor_cmd_param);
|
||||
|
||||
/**
|
||||
* @brief This function set the privacy mode of the device in resolving list.
|
||||
*
|
||||
* @note This feature is not supported on ESP32.
|
||||
*
|
||||
* @param[in] addr_type: The address type of the peer identity address (BLE_ADDR_TYPE_PUBLIC or BLE_ADDR_TYPE_RANDOM).
|
||||
* @param[in] addr: The peer identity address of the device.
|
||||
* @param[in] mode: The privacy mode of the device.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*/
|
||||
esp_err_t esp_ble_gap_set_privacy_mode(esp_ble_addr_type_t addr_type, esp_bd_addr_t addr, esp_ble_privacy_mode_t mode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,337 +1,552 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __ESP_GATT_DEFS_H__
|
||||
#define __ESP_GATT_DEFS_H__
|
||||
|
||||
#pragma once
|
||||
#include "esp_bt_defs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/// GATT INVALID UUID
|
||||
/** @brief GATT INVALID UUID. */
|
||||
#define ESP_GATT_ILLEGAL_UUID 0
|
||||
/// GATT INVALID HANDLE
|
||||
|
||||
/** @brief GATT INVALID HANDLE. */
|
||||
#define ESP_GATT_ILLEGAL_HANDLE 0
|
||||
/// GATT attribute max handle
|
||||
|
||||
/** @brief GATT attribute max handle. */
|
||||
#define ESP_GATT_ATTR_HANDLE_MAX UC_CONFIG_BT_GATT_MAX_SR_ATTRIBUTES
|
||||
#define ESP_GATT_MAX_READ_MULTI_HANDLES 10 /* Max attributes to read in one request */
|
||||
|
||||
/** @brief Maximum number of attributes to read in one request. */
|
||||
#define ESP_GATT_MAX_READ_MULTI_HANDLES 10
|
||||
|
||||
|
||||
/**@{
|
||||
* All "ESP_GATT_UUID_xxx" is attribute types
|
||||
/**
|
||||
* @defgroup GATT_UUIDs GATT Service UUIDs
|
||||
* @brief Definitions of GATT Service UUIDs.
|
||||
*
|
||||
* This module contains the definitions of standard GATT service UUIDs. These UUIDs
|
||||
* identify the type of GATT service.
|
||||
* @{
|
||||
*/
|
||||
#define ESP_GATT_UUID_IMMEDIATE_ALERT_SVC 0x1802 /* Immediate alert Service*/
|
||||
#define ESP_GATT_UUID_LINK_LOSS_SVC 0x1803 /* Link Loss Service*/
|
||||
#define ESP_GATT_UUID_TX_POWER_SVC 0x1804 /* TX Power Service*/
|
||||
#define ESP_GATT_UUID_CURRENT_TIME_SVC 0x1805 /* Current Time Service Service*/
|
||||
#define ESP_GATT_UUID_REF_TIME_UPDATE_SVC 0x1806 /* Reference Time Update Service*/
|
||||
#define ESP_GATT_UUID_NEXT_DST_CHANGE_SVC 0x1807 /* Next DST Change Service*/
|
||||
#define ESP_GATT_UUID_GLUCOSE_SVC 0x1808 /* Glucose Service*/
|
||||
#define ESP_GATT_UUID_HEALTH_THERMOM_SVC 0x1809 /* Health Thermometer Service*/
|
||||
#define ESP_GATT_UUID_DEVICE_INFO_SVC 0x180A /* Device Information Service*/
|
||||
#define ESP_GATT_UUID_HEART_RATE_SVC 0x180D /* Heart Rate Service*/
|
||||
#define ESP_GATT_UUID_PHONE_ALERT_STATUS_SVC 0x180E /* Phone Alert Status Service*/
|
||||
#define ESP_GATT_UUID_BATTERY_SERVICE_SVC 0x180F /* Battery Service*/
|
||||
#define ESP_GATT_UUID_BLOOD_PRESSURE_SVC 0x1810 /* Blood Pressure Service*/
|
||||
#define ESP_GATT_UUID_ALERT_NTF_SVC 0x1811 /* Alert Notification Service*/
|
||||
#define ESP_GATT_UUID_HID_SVC 0x1812 /* HID Service*/
|
||||
#define ESP_GATT_UUID_SCAN_PARAMETERS_SVC 0x1813 /* Scan Parameters Service*/
|
||||
#define ESP_GATT_UUID_RUNNING_SPEED_CADENCE_SVC 0x1814 /* Running Speed and Cadence Service*/
|
||||
#define ESP_GATT_UUID_Automation_IO_SVC 0x1815 /* Automation IO Service*/
|
||||
#define ESP_GATT_UUID_CYCLING_SPEED_CADENCE_SVC 0x1816 /* Cycling Speed and Cadence Service*/
|
||||
#define ESP_GATT_UUID_CYCLING_POWER_SVC 0x1818 /* Cycling Power Service*/
|
||||
#define ESP_GATT_UUID_LOCATION_AND_NAVIGATION_SVC 0x1819 /* Location and Navigation Service*/
|
||||
#define ESP_GATT_UUID_ENVIRONMENTAL_SENSING_SVC 0x181A /* Environmental Sensing Service*/
|
||||
#define ESP_GATT_UUID_BODY_COMPOSITION 0x181B /* Body Composition Service*/
|
||||
#define ESP_GATT_UUID_USER_DATA_SVC 0x181C /* User Data Service*/
|
||||
#define ESP_GATT_UUID_WEIGHT_SCALE_SVC 0x181D /* Weight Scale Service*/
|
||||
#define ESP_GATT_UUID_BOND_MANAGEMENT_SVC 0x181E /* Bond Management Service*/
|
||||
#define ESP_GATT_UUID_CONT_GLUCOSE_MONITOR_SVC 0x181F /* Continuous Glucose Monitoring Service*/
|
||||
|
||||
/** @brief Immediate Alert Service UUID. */
|
||||
#define ESP_GATT_UUID_IMMEDIATE_ALERT_SVC 0x1802
|
||||
/** @brief Link Loss Service UUID. */
|
||||
#define ESP_GATT_UUID_LINK_LOSS_SVC 0x1803
|
||||
/** @brief TX Power Service UUID. */
|
||||
#define ESP_GATT_UUID_TX_POWER_SVC 0x1804
|
||||
/** @brief Current Time Service UUID. */
|
||||
#define ESP_GATT_UUID_CURRENT_TIME_SVC 0x1805
|
||||
/** @brief Reference Time Update Service UUID. */
|
||||
#define ESP_GATT_UUID_REF_TIME_UPDATE_SVC 0x1806
|
||||
/** @brief Next DST Change Service UUID. */
|
||||
#define ESP_GATT_UUID_NEXT_DST_CHANGE_SVC 0x1807
|
||||
/** @brief Glucose Service UUID. */
|
||||
#define ESP_GATT_UUID_GLUCOSE_SVC 0x1808
|
||||
/** @brief Health Thermometer Service UUID. */
|
||||
#define ESP_GATT_UUID_HEALTH_THERMOM_SVC 0x1809
|
||||
/** @brief Device Information Service UUID. */
|
||||
#define ESP_GATT_UUID_DEVICE_INFO_SVC 0x180A
|
||||
/** @brief Heart Rate Service UUID. */
|
||||
#define ESP_GATT_UUID_HEART_RATE_SVC 0x180D
|
||||
/** @brief Phone Alert Status Service UUID. */
|
||||
#define ESP_GATT_UUID_PHONE_ALERT_STATUS_SVC 0x180E
|
||||
/** @brief Battery Service UUID. */
|
||||
#define ESP_GATT_UUID_BATTERY_SERVICE_SVC 0x180F
|
||||
/** @brief Blood Pressure Service UUID. */
|
||||
#define ESP_GATT_UUID_BLOOD_PRESSURE_SVC 0x1810
|
||||
/** @brief Alert Notification Service UUID. */
|
||||
#define ESP_GATT_UUID_ALERT_NTF_SVC 0x1811
|
||||
/** @brief HID Service UUID. */
|
||||
#define ESP_GATT_UUID_HID_SVC 0x1812
|
||||
/** @brief Scan Parameters Service UUID. */
|
||||
#define ESP_GATT_UUID_SCAN_PARAMETERS_SVC 0x1813
|
||||
/** @brief Running Speed and Cadence Service UUID. */
|
||||
#define ESP_GATT_UUID_RUNNING_SPEED_CADENCE_SVC 0x1814
|
||||
/** @brief Automation IO Service UUID. */
|
||||
#define ESP_GATT_UUID_Automation_IO_SVC 0x1815
|
||||
/** @brief Cycling Speed and Cadence Service UUID. */
|
||||
#define ESP_GATT_UUID_CYCLING_SPEED_CADENCE_SVC 0x1816
|
||||
/** @brief Cycling Power Service UUID. */
|
||||
#define ESP_GATT_UUID_CYCLING_POWER_SVC 0x1818
|
||||
/** @brief Location and Navigation Service UUID. */
|
||||
#define ESP_GATT_UUID_LOCATION_AND_NAVIGATION_SVC 0x1819
|
||||
/** @brief Environmental Sensing Service UUID. */
|
||||
#define ESP_GATT_UUID_ENVIRONMENTAL_SENSING_SVC 0x181A
|
||||
/** @brief Body Composition Service UUID. */
|
||||
#define ESP_GATT_UUID_BODY_COMPOSITION 0x181B
|
||||
/** @brief User Data Service UUID. */
|
||||
#define ESP_GATT_UUID_USER_DATA_SVC 0x181C
|
||||
/** @brief Weight Scale Service UUID. */
|
||||
#define ESP_GATT_UUID_WEIGHT_SCALE_SVC 0x181D
|
||||
/** @brief Bond Management Service UUID. */
|
||||
#define ESP_GATT_UUID_BOND_MANAGEMENT_SVC 0x181E
|
||||
/** @brief Continuous Glucose Monitoring Service UUID. */
|
||||
#define ESP_GATT_UUID_CONT_GLUCOSE_MONITOR_SVC 0x181F
|
||||
/** @brief Primary Service UUID. */
|
||||
#define ESP_GATT_UUID_PRI_SERVICE 0x2800
|
||||
/** @brief Secondary Service UUID. */
|
||||
#define ESP_GATT_UUID_SEC_SERVICE 0x2801
|
||||
/** @brief Include Service UUID. */
|
||||
#define ESP_GATT_UUID_INCLUDE_SERVICE 0x2802
|
||||
#define ESP_GATT_UUID_CHAR_DECLARE 0x2803 /* Characteristic Declaration*/
|
||||
|
||||
#define ESP_GATT_UUID_CHAR_EXT_PROP 0x2900 /* Characteristic Extended Properties */
|
||||
#define ESP_GATT_UUID_CHAR_DESCRIPTION 0x2901 /* Characteristic User Description*/
|
||||
#define ESP_GATT_UUID_CHAR_CLIENT_CONFIG 0x2902 /* Client Characteristic Configuration */
|
||||
#define ESP_GATT_UUID_CHAR_SRVR_CONFIG 0x2903 /* Server Characteristic Configuration */
|
||||
#define ESP_GATT_UUID_CHAR_PRESENT_FORMAT 0x2904 /* Characteristic Presentation Format*/
|
||||
#define ESP_GATT_UUID_CHAR_AGG_FORMAT 0x2905 /* Characteristic Aggregate Format*/
|
||||
#define ESP_GATT_UUID_CHAR_VALID_RANGE 0x2906 /* Characteristic Valid Range */
|
||||
#define ESP_GATT_UUID_EXT_RPT_REF_DESCR 0x2907 /* External Report Reference */
|
||||
#define ESP_GATT_UUID_RPT_REF_DESCR 0x2908 /* Report Reference */
|
||||
#define ESP_GATT_UUID_NUM_DIGITALS_DESCR 0x2909 /* Number of Digitals */
|
||||
#define ESP_GATT_UUID_VALUE_TRIGGER_DESCR 0x290A /* Value Trigger Setting */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_CONFIG_DESCR 0x290B /* Environmental Sensing Configuration */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_MEASUREMENT_DESCR 0x290C /* Environmental Sensing Measurement */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_TRIGGER_DESCR 0x290D /* Environmental Sensing Trigger Setting */
|
||||
#define ESP_GATT_UUID_TIME_TRIGGER_DESCR 0x290E /* Time Trigger Setting */
|
||||
/** @brief Characteristic Declaration UUID. */
|
||||
#define ESP_GATT_UUID_CHAR_DECLARE 0x2803
|
||||
/** @brief Characteristic Extended Properties UUID. */
|
||||
#define ESP_GATT_UUID_CHAR_EXT_PROP 0x2900
|
||||
/** @brief Characteristic User Description UUID. */
|
||||
#define ESP_GATT_UUID_CHAR_DESCRIPTION 0x2901
|
||||
/** @brief Client Characteristic Configuration UUID. */
|
||||
#define ESP_GATT_UUID_CHAR_CLIENT_CONFIG 0x2902
|
||||
/** @brief Server Characteristic Configuration UUID. */
|
||||
#define ESP_GATT_UUID_CHAR_SRVR_CONFIG 0x2903
|
||||
/** @brief Characteristic Presentation Format UUID. */
|
||||
#define ESP_GATT_UUID_CHAR_PRESENT_FORMAT 0x2904
|
||||
/** @brief Characteristic Aggregate Format UUID. */
|
||||
#define ESP_GATT_UUID_CHAR_AGG_FORMAT 0x2905
|
||||
/** @brief Characteristic Valid Range UUID. */
|
||||
#define ESP_GATT_UUID_CHAR_VALID_RANGE 0x2906
|
||||
/** @brief External Report Reference Descriptor UUID. */
|
||||
#define ESP_GATT_UUID_EXT_RPT_REF_DESCR 0x2907
|
||||
/** @brief Report Reference Descriptor UUID. */
|
||||
#define ESP_GATT_UUID_RPT_REF_DESCR 0x2908
|
||||
/** @brief Number of Digitals Descriptor UUID. */
|
||||
#define ESP_GATT_UUID_NUM_DIGITALS_DESCR 0x2909
|
||||
/** @brief Value Trigger Setting Descriptor UUID. */
|
||||
#define ESP_GATT_UUID_VALUE_TRIGGER_DESCR 0x290A
|
||||
/** @brief Environmental Sensing Configuration Descriptor UUID. */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_CONFIG_DESCR 0x290B
|
||||
/** @brief Environmental Sensing Measurement Descriptor UUID. */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_MEASUREMENT_DESCR 0x290C
|
||||
/** @brief Environmental Sensing Trigger Setting Descriptor UUID. */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_TRIGGER_DESCR 0x290D
|
||||
/** @brief Time Trigger Setting Descriptor UUID. */
|
||||
#define ESP_GATT_UUID_TIME_TRIGGER_DESCR 0x290E
|
||||
|
||||
/* GAP Profile Attributes */
|
||||
/** @brief GAP Device Name UUID. */
|
||||
#define ESP_GATT_UUID_GAP_DEVICE_NAME 0x2A00
|
||||
/** @brief GAP Icon UUID. */
|
||||
#define ESP_GATT_UUID_GAP_ICON 0x2A01
|
||||
/** @brief GAP Preferred Connection Parameters UUID. */
|
||||
#define ESP_GATT_UUID_GAP_PREF_CONN_PARAM 0x2A04
|
||||
/** @brief GAP Central Address Resolution UUID. */
|
||||
#define ESP_GATT_UUID_GAP_CENTRAL_ADDR_RESOL 0x2AA6
|
||||
|
||||
/* Attribute Profile Attribute UUID */
|
||||
/** @brief GATT Service Changed UUID. */
|
||||
#define ESP_GATT_UUID_GATT_SRV_CHGD 0x2A05
|
||||
|
||||
/* Link ESP_Loss Service */
|
||||
#define ESP_GATT_UUID_ALERT_LEVEL 0x2A06 /* Alert Level */
|
||||
#define ESP_GATT_UUID_TX_POWER_LEVEL 0x2A07 /* TX power level */
|
||||
/* Link Loss Service */
|
||||
/** @brief Alert Level UUID. */
|
||||
#define ESP_GATT_UUID_ALERT_LEVEL 0x2A06
|
||||
/** @brief TX Power Level UUID. */
|
||||
#define ESP_GATT_UUID_TX_POWER_LEVEL 0x2A07
|
||||
|
||||
/* Current Time Service */
|
||||
#define ESP_GATT_UUID_CURRENT_TIME 0x2A2B /* Current Time */
|
||||
#define ESP_GATT_UUID_LOCAL_TIME_INFO 0x2A0F /* Local time info */
|
||||
#define ESP_GATT_UUID_REF_TIME_INFO 0x2A14 /* reference time information */
|
||||
/** @brief Current Time UUID. */
|
||||
#define ESP_GATT_UUID_CURRENT_TIME 0x2A2B
|
||||
/** @brief Local Time Info UUID. */
|
||||
#define ESP_GATT_UUID_LOCAL_TIME_INFO 0x2A0F
|
||||
/** @brief Reference Time Information UUID. */
|
||||
#define ESP_GATT_UUID_REF_TIME_INFO 0x2A14
|
||||
|
||||
/* Network availability Profile */
|
||||
#define ESP_GATT_UUID_NW_STATUS 0x2A18 /* network availability status */
|
||||
#define ESP_GATT_UUID_NW_TRIGGER 0x2A1A /* Network availability trigger */
|
||||
/* Network Availability Service */
|
||||
/** @brief Network Availability Status UUID. */
|
||||
#define ESP_GATT_UUID_NW_STATUS 0x2A18
|
||||
/** @brief Network Availability Trigger UUID. */
|
||||
#define ESP_GATT_UUID_NW_TRIGGER 0x2A1A
|
||||
|
||||
/* Phone alert */
|
||||
#define ESP_GATT_UUID_ALERT_STATUS 0x2A3F /* alert status */
|
||||
#define ESP_GATT_UUID_RINGER_CP 0x2A40 /* ringer control point */
|
||||
#define ESP_GATT_UUID_RINGER_SETTING 0x2A41 /* ringer setting */
|
||||
/* Phone Alert Status Service */
|
||||
/** @brief Alert Status UUID. */
|
||||
#define ESP_GATT_UUID_ALERT_STATUS 0x2A3F
|
||||
/** @brief Ringer Control Point UUID. */
|
||||
#define ESP_GATT_UUID_RINGER_CP 0x2A40
|
||||
/** @brief Ringer Setting UUID. */
|
||||
#define ESP_GATT_UUID_RINGER_SETTING 0x2A41
|
||||
|
||||
/* Glucose Service */
|
||||
/** @brief Glucose Measurement Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_GM_MEASUREMENT 0x2A18
|
||||
/** @brief Glucose Measurement Context Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_GM_CONTEXT 0x2A34
|
||||
/** @brief Glucose Control Point Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_GM_CONTROL_POINT 0x2A52
|
||||
/** @brief Glucose Feature Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_GM_FEATURE 0x2A51
|
||||
|
||||
/* device information characteristic */
|
||||
/* Device Information Service Characteristics */
|
||||
/** @brief System ID Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_SYSTEM_ID 0x2A23
|
||||
/** @brief Model Number String Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_MODEL_NUMBER_STR 0x2A24
|
||||
/** @brief Serial Number String Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_SERIAL_NUMBER_STR 0x2A25
|
||||
/** @brief Firmware Revision String Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_FW_VERSION_STR 0x2A26
|
||||
/** @brief Hardware Revision String Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HW_VERSION_STR 0x2A27
|
||||
/** @brief Software Revision String Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_SW_VERSION_STR 0x2A28
|
||||
/** @brief Manufacturer Name String Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_MANU_NAME 0x2A29
|
||||
/** @brief IEEE 11073-20601 Regulatory Certification Data List Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_IEEE_DATA 0x2A2A
|
||||
/** @brief PnP ID Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_PNP_ID 0x2A50
|
||||
|
||||
/* HID characteristics */
|
||||
/* HID Service Characteristics */
|
||||
/** @brief HID Information Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HID_INFORMATION 0x2A4A
|
||||
/** @brief HID Report Map Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HID_REPORT_MAP 0x2A4B
|
||||
/** @brief HID Control Point Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HID_CONTROL_POINT 0x2A4C
|
||||
/** @brief HID Report Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HID_REPORT 0x2A4D
|
||||
/** @brief HID Protocol Mode Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HID_PROTO_MODE 0x2A4E
|
||||
/** @brief HID Bluetooth Keyboard Input Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HID_BT_KB_INPUT 0x2A22
|
||||
/** @brief HID Bluetooth Keyboard Output Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HID_BT_KB_OUTPUT 0x2A32
|
||||
/** @brief HID Bluetooth Mouse Input Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_HID_BT_MOUSE_INPUT 0x2A33
|
||||
|
||||
/// Heart Rate Measurement
|
||||
#define ESP_GATT_HEART_RATE_MEAS 0x2A37
|
||||
/// Body Sensor Location
|
||||
#define ESP_GATT_BODY_SENSOR_LOCATION 0x2A38
|
||||
/// Heart Rate Control Point
|
||||
#define ESP_GATT_HEART_RATE_CNTL_POINT 0x2A39
|
||||
/* Heart Rate Service Characteristics */
|
||||
/** @brief Heart Rate Measurement Characteristic UUID. */
|
||||
#define ESP_GATT_HEART_RATE_MEAS 0x2A37
|
||||
/** @brief Body Sensor Location Characteristic UUID. */
|
||||
#define ESP_GATT_BODY_SENSOR_LOCATION 0x2A38
|
||||
/** @brief Heart Rate Control Point Characteristic UUID. */
|
||||
#define ESP_GATT_HEART_RATE_CNTL_POINT 0x2A39
|
||||
|
||||
/* Battery Service characteristics */
|
||||
/* Battery Service Characteristics */
|
||||
/** @brief Battery Level Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_BATTERY_LEVEL 0x2A19
|
||||
|
||||
/* Sensor Service */
|
||||
/* Sensor Service Characteristics */
|
||||
/** @brief Sensor Control Point Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_SC_CONTROL_POINT 0x2A55
|
||||
/** @brief Sensor Location Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_SENSOR_LOCATION 0x2A5D
|
||||
|
||||
/* Runners speed and cadence service */
|
||||
/* Running Speed and Cadence Service Characteristics */
|
||||
/** @brief RSC Measurement Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_RSC_MEASUREMENT 0x2A53
|
||||
/** @brief RSC Feature Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_RSC_FEATURE 0x2A54
|
||||
|
||||
/* Cycling speed and cadence service */
|
||||
/* Cycling Speed and Cadence Service Characteristics */
|
||||
/** @brief CSC Measurement Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_CSC_MEASUREMENT 0x2A5B
|
||||
/** @brief CSC Feature Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_CSC_FEATURE 0x2A5C
|
||||
|
||||
/* Scan ESP_Parameter characteristics */
|
||||
/* Scan Parameters Service Characteristics */
|
||||
/** @brief Scan Interval Window Characteristic UUID. */
|
||||
#define ESP_GATT_UUID_SCAN_INT_WINDOW 0x2A4F
|
||||
/** @brief Scan Refresh UUID. */
|
||||
#define ESP_GATT_UUID_SCAN_REFRESH 0x2A31
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/* Additional GATT Services not covered yet */
|
||||
/** @} */ // End of group GATT_UUIDs
|
||||
|
||||
/* relate to BTA_GATT_PREP_WRITE_xxx in bta/bta_gatt_api.h */
|
||||
/// Attribute write data type from the client
|
||||
|
||||
/**
|
||||
* @brief Defines the attribute write operation types from the client.
|
||||
*
|
||||
* These values are used to specify the type of write operation in a prepare write sequence.
|
||||
* relate to BTA_GATT_PREP_WRITE_xxx in bta/bta_gatt_api.h.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_PREP_WRITE_CANCEL = 0x00, /*!< Prepare write cancel */ /* relate to BTA_GATT_PREP_WRITE_CANCEL in bta/bta_gatt_api.h */
|
||||
ESP_GATT_PREP_WRITE_EXEC = 0x01, /*!< Prepare write execute */ /* relate to BTA_GATT_PREP_WRITE_EXEC in bta/bta_gatt_api.h */
|
||||
ESP_GATT_PREP_WRITE_CANCEL = 0x00, /*!< Prepare write cancel. Corresponds to BTA_GATT_PREP_WRITE_CANCEL. */
|
||||
ESP_GATT_PREP_WRITE_EXEC = 0x01, /*!< Prepare write execute. Corresponds to BTA_GATT_PREP_WRITE_EXEC. */
|
||||
} esp_gatt_prep_write_type;
|
||||
|
||||
/* relate to BTA_GATT_xxx in bta/bta_gatt_api.h */
|
||||
|
||||
/**
|
||||
* @brief GATT success code and error codes
|
||||
* @brief GATT operation status codes.
|
||||
*
|
||||
* These status codes are used to indicate the result of various GATT operations.
|
||||
* relate to BTA_GATT_xxx in bta/bta_gatt_api.h .
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_OK = 0x0, /* relate to BTA_GATT_OK in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_HANDLE = 0x01, /* 0x0001 */ /* relate to BTA_GATT_INVALID_HANDLE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_READ_NOT_PERMIT = 0x02, /* 0x0002 */ /* relate to BTA_GATT_READ_NOT_PERMIT in bta/bta_gatt_api.h */
|
||||
ESP_GATT_WRITE_NOT_PERMIT = 0x03, /* 0x0003 */ /* relate to BTA_GATT_WRITE_NOT_PERMIT in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_PDU = 0x04, /* 0x0004 */ /* relate to BTA_GATT_INVALID_PDU in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_AUTHENTICATION = 0x05, /* 0x0005 */ /* relate to BTA_GATT_INSUF_AUTHENTICATION in bta/bta_gatt_api.h */
|
||||
ESP_GATT_REQ_NOT_SUPPORTED = 0x06, /* 0x0006 */ /* relate to BTA_GATT_REQ_NOT_SUPPORTED in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_OFFSET = 0x07, /* 0x0007 */ /* relate to BTA_GATT_INVALID_OFFSET in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_AUTHORIZATION = 0x08, /* 0x0008 */ /* relate to BTA_GATT_INSUF_AUTHORIZATION in bta/bta_gatt_api.h */
|
||||
ESP_GATT_PREPARE_Q_FULL = 0x09, /* 0x0009 */ /* relate to BTA_GATT_PREPARE_Q_FULL in bta/bta_gatt_api.h */
|
||||
ESP_GATT_NOT_FOUND = 0x0a, /* 0x000a */ /* relate to BTA_GATT_NOT_FOUND in bta/bta_gatt_api.h */
|
||||
ESP_GATT_NOT_LONG = 0x0b, /* 0x000b */ /* relate to BTA_GATT_NOT_LONG in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_KEY_SIZE = 0x0c, /* 0x000c */ /* relate to BTA_GATT_INSUF_KEY_SIZE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_ATTR_LEN = 0x0d, /* 0x000d */ /* relate to BTA_GATT_INVALID_ATTR_LEN in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ERR_UNLIKELY = 0x0e, /* 0x000e */ /* relate to BTA_GATT_ERR_UNLIKELY in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_ENCRYPTION = 0x0f, /* 0x000f */ /* relate to BTA_GATT_INSUF_ENCRYPTION in bta/bta_gatt_api.h */
|
||||
ESP_GATT_UNSUPPORT_GRP_TYPE = 0x10, /* 0x0010 */ /* relate to BTA_GATT_UNSUPPORT_GRP_TYPE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INSUF_RESOURCE = 0x11, /* 0x0011 */ /* relate to BTA_GATT_INSUF_RESOURCE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_OK = 0x0, /*!< 0x0, Operation successful. Corresponds to BTA_GATT_OK. */
|
||||
ESP_GATT_INVALID_HANDLE = 0x01, /*!< 0x01, Invalid handle. Corresponds to BTA_GATT_INVALID_HANDLE. */
|
||||
ESP_GATT_READ_NOT_PERMIT = 0x02, /*!< 0x02, Read operation not permitted. Corresponds to BTA_GATT_READ_NOT_PERMIT. */
|
||||
ESP_GATT_WRITE_NOT_PERMIT = 0x03, /*!< 0x03, Write operation not permitted. Corresponds to BTA_GATT_WRITE_NOT_PERMIT. */
|
||||
ESP_GATT_INVALID_PDU = 0x04, /*!< 0x04, Invalid PDU. Corresponds to BTA_GATT_INVALID_PDU. */
|
||||
ESP_GATT_INSUF_AUTHENTICATION = 0x05, /*!< 0x05, Insufficient authentication. Corresponds to BTA_GATT_INSUF_AUTHENTICATION. */
|
||||
ESP_GATT_REQ_NOT_SUPPORTED = 0x06, /*!< 0x06, Request not supported. Corresponds to BTA_GATT_REQ_NOT_SUPPORTED. */
|
||||
ESP_GATT_INVALID_OFFSET = 0x07, /*!< 0x07, Invalid offset. Corresponds to BTA_GATT_INVALID_OFFSET. */
|
||||
ESP_GATT_INSUF_AUTHORIZATION = 0x08, /*!< 0x08, Insufficient authorization. Corresponds to BTA_GATT_INSUF_AUTHORIZATION. */
|
||||
ESP_GATT_PREPARE_Q_FULL = 0x09, /*!< 0x09, Prepare queue full. Corresponds to BTA_GATT_PREPARE_Q_FULL. */
|
||||
ESP_GATT_NOT_FOUND = 0x0a, /*!< 0x0a, Not found. Corresponds to BTA_GATT_NOT_FOUND. */
|
||||
ESP_GATT_NOT_LONG = 0x0b, /*!< 0x0b, Not long. Corresponds to BTA_GATT_NOT_LONG. */
|
||||
ESP_GATT_INSUF_KEY_SIZE = 0x0c, /*!< 0x0c, Insufficient key size. Corresponds to BTA_GATT_INSUF_KEY_SIZE. */
|
||||
ESP_GATT_INVALID_ATTR_LEN = 0x0d, /*!< 0x0d, Invalid attribute length. Corresponds to BTA_GATT_INVALID_ATTR_LEN. */
|
||||
ESP_GATT_ERR_UNLIKELY = 0x0e, /*!< 0x0e, Unlikely error. Corresponds to BTA_GATT_ERR_UNLIKELY. */
|
||||
ESP_GATT_INSUF_ENCRYPTION = 0x0f, /*!< 0x0f, Insufficient encryption. Corresponds to BTA_GATT_INSUF_ENCRYPTION. */
|
||||
ESP_GATT_UNSUPPORT_GRP_TYPE = 0x10, /*!< 0x10, Unsupported group type. Corresponds to BTA_GATT_UNSUPPORT_GRP_TYPE. */
|
||||
ESP_GATT_INSUF_RESOURCE = 0x11, /*!< 0x11, Insufficient resource. Corresponds to BTA_GATT_INSUF_RESOURCE. */
|
||||
|
||||
ESP_GATT_NO_RESOURCES = 0x80, /* 0x80 */ /* relate to BTA_GATT_NO_RESOURCES in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INTERNAL_ERROR = 0x81, /* 0x81 */ /* relate to BTA_GATT_INTERNAL_ERROR in bta/bta_gatt_api.h */
|
||||
ESP_GATT_WRONG_STATE = 0x82, /* 0x82 */ /* relate to BTA_GATT_WRONG_STATE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_DB_FULL = 0x83, /* 0x83 */ /* relate to BTA_GATT_DB_FULL in bta/bta_gatt_api.h */
|
||||
ESP_GATT_BUSY = 0x84, /* 0x84 */ /* relate to BTA_GATT_BUSY in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ERROR = 0x85, /* 0x85 */ /* relate to BTA_GATT_ERROR in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CMD_STARTED = 0x86, /* 0x86 */ /* relate to BTA_GATT_CMD_STARTED in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ILLEGAL_PARAMETER = 0x87, /* 0x87 */ /* relate to BTA_GATT_ILLEGAL_PARAMETER in bta/bta_gatt_api.h */
|
||||
ESP_GATT_PENDING = 0x88, /* 0x88 */ /* relate to BTA_GATT_PENDING in bta/bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_FAIL = 0x89, /* 0x89 */ /* relate to BTA_GATT_AUTH_FAIL in bta/bta_gatt_api.h */
|
||||
ESP_GATT_MORE = 0x8a, /* 0x8a */ /* relate to BTA_GATT_MORE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_INVALID_CFG = 0x8b, /* 0x8b */ /* relate to BTA_GATT_INVALID_CFG in bta/bta_gatt_api.h */
|
||||
ESP_GATT_SERVICE_STARTED = 0x8c, /* 0x8c */ /* relate to BTA_GATT_SERVICE_STARTED in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ENCRYPTED_MITM = ESP_GATT_OK, /* relate to BTA_GATT_ENCRYPED_MITM in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ENCRYPTED_NO_MITM = 0x8d, /* 0x8d */ /* relate to BTA_GATT_ENCRYPED_NO_MITM in bta/bta_gatt_api.h */
|
||||
ESP_GATT_NOT_ENCRYPTED = 0x8e, /* 0x8e */ /* relate to BTA_GATT_NOT_ENCRYPTED in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONGESTED = 0x8f, /* 0x8f */ /* relate to BTA_GATT_CONGESTED in bta/bta_gatt_api.h */
|
||||
ESP_GATT_DUP_REG = 0x90, /* 0x90 */ /* relate to BTA_GATT_DUP_REG in bta/bta_gatt_api.h */
|
||||
ESP_GATT_ALREADY_OPEN = 0x91, /* 0x91 */ /* relate to BTA_GATT_ALREADY_OPEN in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CANCEL = 0x92, /* 0x92 */ /* relate to BTA_GATT_CANCEL in bta/bta_gatt_api.h */
|
||||
/* Additional error codes specific to implementation or future use */
|
||||
ESP_GATT_NO_RESOURCES = 0x80, /*!< 0x80, No resources. Corresponds to BTA_GATT_NO_RESOURCES. */
|
||||
ESP_GATT_INTERNAL_ERROR = 0x81, /*!< 0x81, Internal error. Corresponds to BTA_GATT_INTERNAL_ERROR. */
|
||||
ESP_GATT_WRONG_STATE = 0x82, /*!< 0x82, Wrong state. Corresponds to BTA_GATT_WRONG_STATE. */
|
||||
ESP_GATT_DB_FULL = 0x83, /*!< 0x83, Database full. Corresponds to BTA_GATT_DB_FULL. */
|
||||
ESP_GATT_BUSY = 0x84, /*!< 0x84, Busy. Corresponds to BTA_GATT_BUSY. */
|
||||
ESP_GATT_ERROR = 0x85, /*!< 0x85, Generic error. Corresponds to BTA_GATT_ERROR. */
|
||||
ESP_GATT_CMD_STARTED = 0x86, /*!< 0x86, Command started. Corresponds to BTA_GATT_CMD_STARTED. */
|
||||
ESP_GATT_ILLEGAL_PARAMETER = 0x87, /*!< 0x87, Illegal parameter. Corresponds to BTA_GATT_ILLEGAL_PARAMETER. */
|
||||
ESP_GATT_PENDING = 0x88, /*!< 0x88, Operation pending. Corresponds to BTA_GATT_PENDING. */
|
||||
ESP_GATT_AUTH_FAIL = 0x89, /*!< 0x89, Authentication failed. Corresponds to BTA_GATT_AUTH_FAIL. */
|
||||
ESP_GATT_MORE = 0x8a, /*!< 0x8a, More data available. Corresponds to BTA_GATT_MORE. */
|
||||
ESP_GATT_INVALID_CFG = 0x8b, /*!< 0x8b, Invalid configuration. Corresponds to BTA_GATT_INVALID_CFG. */
|
||||
ESP_GATT_SERVICE_STARTED = 0x8c, /*!< 0x8c, Service started. Corresponds to BTA_GATT_SERVICE_STARTED. */
|
||||
ESP_GATT_ENCRYPTED_MITM = ESP_GATT_OK, /*!< 0x0, Encrypted, with MITM protection. Corresponds to BTA_GATT_ENCRYPTED_MITM. */
|
||||
ESP_GATT_ENCRYPTED_NO_MITM = 0x8d, /*!< 0x8d, Encrypted, without MITM protection. Corresponds to BTA_GATT_ENCRYPTED_NO_MITM. */
|
||||
ESP_GATT_NOT_ENCRYPTED = 0x8e, /*!< 0x8e, Not encrypted. Corresponds to BTA_GATT_NOT_ENCRYPTED. */
|
||||
ESP_GATT_CONGESTED = 0x8f, /*!< 0x8f, Congested. Corresponds to BTA_GATT_CONGESTED. */
|
||||
ESP_GATT_DUP_REG = 0x90, /*!< 0x90, Duplicate registration. Corresponds to BTA_GATT_DUP_REG. */
|
||||
ESP_GATT_ALREADY_OPEN = 0x91, /*!< 0x91, Already open. Corresponds to BTA_GATT_ALREADY_OPEN. */
|
||||
ESP_GATT_CANCEL = 0x92, /*!< 0x92, Operation cancelled. Corresponds to BTA_GATT_CANCEL. */
|
||||
/* 0xE0 ~ 0xFC reserved for future use */
|
||||
ESP_GATT_STACK_RSP = 0xe0, /* 0xe0 */ /* relate to BTA_GATT_STACK_RSP in bta/bta_gatt_api.h */
|
||||
ESP_GATT_APP_RSP = 0xe1, /* 0xe1 */ /* relate to BTA_GATT_APP_RSP in bta/bta_gatt_api.h */
|
||||
//Error caused by customer application or stack bug
|
||||
ESP_GATT_UNKNOWN_ERROR = 0xef, /* 0xef */ /* relate to BTA_GATT_UNKNOWN_ERROR in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CCC_CFG_ERR = 0xfd, /* 0xFD Client Characteristic Configuration Descriptor Improperly Configured */ /* relate to BTA_GATT_CCC_CFG_ERR in bta/bta_gatt_api.h */
|
||||
ESP_GATT_PRC_IN_PROGRESS = 0xfe, /* 0xFE Procedure Already in progress */ /* relate to BTA_GATT_PRC_IN_PROGRESS in bta/bta_gatt_api.h */
|
||||
ESP_GATT_OUT_OF_RANGE = 0xff, /* 0xFF Attribute value out of range */ /* relate to BTA_GATT_OUT_OF_RANGE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_STACK_RSP = 0xe0, /*!< 0xe0, Stack response. Corresponds to BTA_GATT_STACK_RSP. */
|
||||
ESP_GATT_APP_RSP = 0xe1, /*!< 0xe1, Application response. Corresponds to BTA_GATT_APP_RSP. */
|
||||
/* Error caused by customer application or stack bug */
|
||||
ESP_GATT_UNKNOWN_ERROR = 0xef, /*!< 0xef, Unknown error. Corresponds to BTA_GATT_UNKNOWN_ERROR. */
|
||||
ESP_GATT_CCC_CFG_ERR = 0xfd, /*!< 0xfd, Client Characteristic Configuration Descriptor improperly configured. Corresponds to BTA_GATT_CCC_CFG_ERR. */
|
||||
ESP_GATT_PRC_IN_PROGRESS = 0xfe, /*!< 0xfe, Procedure already in progress. Corresponds to BTA_GATT_PRC_IN_PROGRESS. */
|
||||
ESP_GATT_OUT_OF_RANGE = 0xff /*!< 0xff, Attribute value out of range. Corresponds to BTA_GATT_OUT_OF_RANGE. */
|
||||
} esp_gatt_status_t;
|
||||
|
||||
/* relate to BTA_GATT_CONN_xxx in bta/bta_gatt_api.h */
|
||||
|
||||
/**
|
||||
* @brief Gatt Connection reason enum
|
||||
* @brief Enumerates reasons for GATT connection.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_CONN_UNKNOWN = 0, /*!< Gatt connection unknown */ /* relate to BTA_GATT_CONN_UNKNOWN in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_L2C_FAILURE = 1, /*!< General L2cap failure */ /* relate to BTA_GATT_CONN_L2C_FAILURE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TIMEOUT = 0x08, /*!< Connection timeout */ /* relate to BTA_GATT_CONN_TIMEOUT in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TERMINATE_PEER_USER = 0x13, /*!< Connection terminate by peer user */ /* relate to BTA_GATT_CONN_TERMINATE_PEER_USER in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TERMINATE_LOCAL_HOST = 0x16, /*!< Connection terminated by local host */ /* relate to BTA_GATT_CONN_TERMINATE_LOCAL_HOST in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_FAIL_ESTABLISH = 0x3e, /*!< Connection fail to establish */ /* relate to BTA_GATT_CONN_FAIL_ESTABLISH in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_LMP_TIMEOUT = 0x22, /*!< Connection fail for LMP response tout */ /* relate to BTA_GATT_CONN_LMP_TIMEOUT in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_CONN_CANCEL = 0x0100, /*!< L2CAP connection cancelled */ /* relate to BTA_GATT_CONN_CONN_CANCEL in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_NONE = 0x0101 /*!< No connection to cancel */ /* relate to BTA_GATT_CONN_NONE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_UNKNOWN = 0, /*!< Unknown connection reason. Corresponds to BTA_GATT_CONN_UNKNOWN in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_L2C_FAILURE = 1, /*!< General L2CAP failure. Corresponds to BTA_GATT_CONN_L2C_FAILURE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TIMEOUT = 0x08, /*!< Connection timeout. Corresponds to BTA_GATT_CONN_TIMEOUT in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TERMINATE_PEER_USER = 0x13, /*!< Connection terminated by peer user. Corresponds to BTA_GATT_CONN_TERMINATE_PEER_USER in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_TERMINATE_LOCAL_HOST = 0x16, /*!< Connection terminated by local host. Corresponds to BTA_GATT_CONN_TERMINATE_LOCAL_HOST in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_FAIL_ESTABLISH = 0x3e, /*!< Failure to establish connection. Corresponds to BTA_GATT_CONN_FAIL_ESTABLISH in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_LMP_TIMEOUT = 0x22, /*!< Connection failed due to LMP response timeout. Corresponds to BTA_GATT_CONN_LMP_TIMEOUT in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_CONN_CANCEL = 0x0100, /*!< L2CAP connection cancelled. Corresponds to BTA_GATT_CONN_CONN_CANCEL in bta/bta_gatt_api.h */
|
||||
ESP_GATT_CONN_NONE = 0x0101 /*!< No connection to cancel. Corresponds to BTA_GATT_CONN_NONE in bta/bta_gatt_api.h */
|
||||
} esp_gatt_conn_reason_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Gatt id, include uuid and instance id
|
||||
* @brief Represents a GATT identifier.
|
||||
*/
|
||||
typedef struct {
|
||||
esp_bt_uuid_t uuid; /*!< UUID */
|
||||
uint8_t inst_id; /*!< Instance id */
|
||||
esp_bt_uuid_t uuid; /*!< @brief The UUID component of the GATT ID. */
|
||||
uint8_t inst_id; /*!< @brief The instance ID component of the GATT ID, providing further differentiation of the GATT ID. */
|
||||
} __attribute__((packed)) esp_gatt_id_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Gatt service id, include id
|
||||
* (uuid and instance id) and primary flag
|
||||
* @brief Represents a GATT service identifier.
|
||||
*/
|
||||
typedef struct {
|
||||
esp_gatt_id_t id; /*!< Gatt id, include uuid and instance */
|
||||
bool is_primary; /*!< This service is primary or not */
|
||||
esp_gatt_id_t id; /*!< @brief Encapsulates the UUID and instance ID of the GATT service. */
|
||||
bool is_primary; /*!< @brief Indicates if the service is primary. A value of true means it is a primary service, false indicates a secondary service. */
|
||||
} __attribute__((packed)) esp_gatt_srvc_id_t;
|
||||
|
||||
/* relate to BTA_GATT_AUTH_REQ_xxx in bta/bta_gatt_api.h */
|
||||
/**
|
||||
* @brief Gatt authentication request type
|
||||
* @brief Defines the GATT authentication request types.
|
||||
*
|
||||
* This enumeration lists the types of authentication requests that can be made.
|
||||
* It corresponds to the `BTA_GATT_AUTH_REQ_xxx` values defined in `bta/bta_gatt_api.h`.
|
||||
* The types include options for no authentication, unauthenticated encryption, authenticated encryption,
|
||||
* and both signed versions with and without MITM (Man-In-The-Middle) protection.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_AUTH_REQ_NONE = 0, /* relate to BTA_GATT_AUTH_REQ_NONE in bta/bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_NO_MITM = 1, /* unauthenticated encryption */ /* relate to BTA_GATT_AUTH_REQ_NO_MITM in bta/bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_MITM = 2, /* authenticated encryption */ /* relate to BTA_GATT_AUTH_REQ_MITM in bta/bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_SIGNED_NO_MITM = 3, /* relate to BTA_GATT_AUTH_REQ_SIGNED_NO_MITM in bta/bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_SIGNED_MITM = 4, /* relate to BTA_GATT_AUTH_REQ_SIGNED_MITM in bta/bta_gatt_api.h */
|
||||
ESP_GATT_AUTH_REQ_NONE = 0, /*!< No authentication required. Corresponds to BTA_GATT_AUTH_REQ_NONE. */
|
||||
ESP_GATT_AUTH_REQ_NO_MITM = 1, /*!< Unauthenticated encryption. Corresponds to BTA_GATT_AUTH_REQ_NO_MITM. */
|
||||
ESP_GATT_AUTH_REQ_MITM = 2, /*!< Authenticated encryption (MITM protection). Corresponds to BTA_GATT_AUTH_REQ_MITM. */
|
||||
ESP_GATT_AUTH_REQ_SIGNED_NO_MITM = 3, /*!< Signed data, no MITM protection. Corresponds to BTA_GATT_AUTH_REQ_SIGNED_NO_MITM. */
|
||||
ESP_GATT_AUTH_REQ_SIGNED_MITM = 4, /*!< Signed data with MITM protection. Corresponds to BTA_GATT_AUTH_REQ_SIGNED_MITM. */
|
||||
} esp_gatt_auth_req_t;
|
||||
|
||||
/* relate to BTA_GATT_PERM_xxx in bta/bta_gatt_api.h */
|
||||
/**
|
||||
* @brief Attribute permissions
|
||||
*/
|
||||
#define ESP_GATT_PERM_READ (1 << 0) /* bit 0 - 0x0001 */ /* relate to BTA_GATT_PERM_READ in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_READ_ENCRYPTED (1 << 1) /* bit 1 - 0x0002 */ /* relate to BTA_GATT_PERM_READ_ENCRYPTED in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_READ_ENC_MITM (1 << 2) /* bit 2 - 0x0004 */ /* relate to BTA_GATT_PERM_READ_ENC_MITM in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE (1 << 4) /* bit 4 - 0x0010 */ /* relate to BTA_GATT_PERM_WRITE in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_ENCRYPTED (1 << 5) /* bit 5 - 0x0020 */ /* relate to BTA_GATT_PERM_WRITE_ENCRYPTED in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_ENC_MITM (1 << 6) /* bit 6 - 0x0040 */ /* relate to BTA_GATT_PERM_WRITE_ENC_MITM in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_SIGNED (1 << 7) /* bit 7 - 0x0080 */ /* relate to BTA_GATT_PERM_WRITE_SIGNED in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_WRITE_SIGNED_MITM (1 << 8) /* bit 8 - 0x0100 */ /* relate to BTA_GATT_PERM_WRITE_SIGNED_MITM in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_PERM_READ_AUTHORIZATION (1 << 9) /* bit 9 - 0x0200 */
|
||||
#define ESP_GATT_PERM_WRITE_AUTHORIZATION (1 << 10) /* bit 10 - 0x0400 */
|
||||
#define ESP_GATT_PERM_ENCRYPT_KEY_SIZE(keysize) (((keysize - 6) & 0xF) << 12) /* bit 12:15 - 0xF000 */
|
||||
typedef uint16_t esp_gatt_perm_t;
|
||||
|
||||
/* relate to BTA_GATT_CHAR_PROP_BIT_xxx in bta/bta_gatt_api.h */
|
||||
/* definition of characteristic properties */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_BROADCAST (1 << 0) /* 0x01 */ /* relate to BTA_GATT_CHAR_PROP_BIT_BROADCAST in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_READ (1 << 1) /* 0x02 */ /* relate to BTA_GATT_CHAR_PROP_BIT_READ in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_WRITE_NR (1 << 2) /* 0x04 */ /* relate to BTA_GATT_CHAR_PROP_BIT_WRITE_NR in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_WRITE (1 << 3) /* 0x08 */ /* relate to BTA_GATT_CHAR_PROP_BIT_WRITE in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_NOTIFY (1 << 4) /* 0x10 */ /* relate to BTA_GATT_CHAR_PROP_BIT_NOTIFY in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_INDICATE (1 << 5) /* 0x20 */ /* relate to BTA_GATT_CHAR_PROP_BIT_INDICATE in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_AUTH (1 << 6) /* 0x40 */ /* relate to BTA_GATT_CHAR_PROP_BIT_AUTH in bta/bta_gatt_api.h */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_EXT_PROP (1 << 7) /* 0x80 */ /* relate to BTA_GATT_CHAR_PROP_BIT_EXT_PROP in bta/bta_gatt_api.h */
|
||||
/**
|
||||
* @brief Defines GATT attribute permission flags.
|
||||
*
|
||||
* These permission flags are used to specify the security requirements for GATT attributes.
|
||||
* They correlate directly with the BTA_GATT_PERM_xxx definitions found in bta/bta_gatt_api.h.
|
||||
*/
|
||||
|
||||
/** @defgroup GATT_PERMS GATT Attribute Permissions
|
||||
* @brief Definitions of permission flags for GATT attributes.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @brief Permission to read the attribute. Corresponds to BTA_GATT_PERM_READ. */
|
||||
#define ESP_GATT_PERM_READ (1 << 0)
|
||||
|
||||
/** @brief Permission to read the attribute with encryption. Corresponds to BTA_GATT_PERM_READ_ENCRYPTED. */
|
||||
#define ESP_GATT_PERM_READ_ENCRYPTED (1 << 1)
|
||||
|
||||
/** @brief Permission to read the attribute with encrypted MITM (Man In The Middle) protection. Corresponds to BTA_GATT_PERM_READ_ENC_MITM.*/
|
||||
#define ESP_GATT_PERM_READ_ENC_MITM (1 << 2)
|
||||
|
||||
/** @brief Permission to write to the attribute. Corresponds to BTA_GATT_PERM_WRITE. */
|
||||
#define ESP_GATT_PERM_WRITE (1 << 4)
|
||||
|
||||
/** @brief Permission to write to the attribute with encryption. Corresponds to BTA_GATT_PERM_WRITE_ENCRYPTED. */
|
||||
#define ESP_GATT_PERM_WRITE_ENCRYPTED (1 << 5)
|
||||
|
||||
/** @brief Permission to write to the attribute with encrypted MITM protection. Corresponds to BTA_GATT_PERM_WRITE_ENC_MITM. */
|
||||
#define ESP_GATT_PERM_WRITE_ENC_MITM (1 << 6)
|
||||
|
||||
/** @brief Permission for signed writes to the attribute. Corresponds to BTA_GATT_PERM_WRITE_SIGNED. */
|
||||
#define ESP_GATT_PERM_WRITE_SIGNED (1 << 7)
|
||||
|
||||
/** @brief Permission for signed writes to the attribute with MITM protection. Corresponds to BTA_GATT_PERM_WRITE_SIGNED_MITM. */
|
||||
#define ESP_GATT_PERM_WRITE_SIGNED_MITM (1 << 8)
|
||||
|
||||
/** @brief Permission to read the attribute with authorization. */
|
||||
#define ESP_GATT_PERM_READ_AUTHORIZATION (1 << 9)
|
||||
|
||||
/** @brief Permission to write to the attribute with authorization. */
|
||||
#define ESP_GATT_PERM_WRITE_AUTHORIZATION (1 << 10)
|
||||
|
||||
/**
|
||||
* @brief Macro to specify minimum encryption key size.
|
||||
*
|
||||
* @param keysize The minimum size of the encryption key, in bytes.
|
||||
*/
|
||||
#define ESP_GATT_PERM_ENCRYPT_KEY_SIZE(keysize) (((keysize - 6) & 0xF) << 12)
|
||||
|
||||
/** @} */ // End of GATT_PERMS group
|
||||
|
||||
typedef uint16_t esp_gatt_perm_t; ///< Type to represent GATT attribute permissions.
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Defines GATT characteristic properties.
|
||||
*
|
||||
* These properties are related to `BTA_GATT_CHAR_PROP_BIT_xxx` in `bta/bta_gatt_api.h`.
|
||||
*/
|
||||
|
||||
/** @defgroup GATT_CHAR_PROPERTIES GATT Characteristic Properties
|
||||
* These properties define various capabilities of a GATT characteristic.
|
||||
* @{
|
||||
*/
|
||||
/** @brief Ability to broadcast.Corresponds to BTA_GATT_CHAR_PROP_BIT_BROADCAST. */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_BROADCAST (1 << 0)
|
||||
|
||||
/** @brief Ability to read.Corresponds to BTA_GATT_CHAR_PROP_BIT_READ. */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_READ (1 << 1)
|
||||
|
||||
/** @brief Ability to write without response.Corresponds to BTA_GATT_CHAR_PROP_BIT_WRITE_NR. */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_WRITE_NR (1 << 2)
|
||||
|
||||
/** @brief Ability to write.Corresponds to BTA_GATT_CHAR_PROP_BIT_WRITE. */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_WRITE (1 << 3)
|
||||
|
||||
/** @brief Ability to notify.Corresponds to BTA_GATT_CHAR_PROP_BIT_NOTIFY. */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_NOTIFY (1 << 4)
|
||||
|
||||
/** @brief Ability to indicate.Corresponds to BTA_GATT_CHAR_PROP_BIT_INDICATE. */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_INDICATE (1 << 5)
|
||||
|
||||
/** @brief Ability to authenticate.Corresponds to BTA_GATT_CHAR_PROP_BIT_AUTH. */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_AUTH (1 << 6)
|
||||
|
||||
/** @brief Has extended properties.Corresponds to BTA_GATT_CHAR_PROP_BIT_EXT_PROP. */
|
||||
#define ESP_GATT_CHAR_PROP_BIT_EXT_PROP (1 << 7)
|
||||
|
||||
/** @} */ // end of GATT_CHAR_PROPERTIES
|
||||
|
||||
/**
|
||||
* @typedef esp_gatt_char_prop_t
|
||||
* @brief Type for characteristic properties bitmask.
|
||||
*/
|
||||
typedef uint8_t esp_gatt_char_prop_t;
|
||||
|
||||
/// GATT maximum attribute length
|
||||
#define ESP_GATT_MAX_ATTR_LEN 600 //as same as GATT_MAX_ATTR_LEN
|
||||
|
||||
/**
|
||||
* @brief Defines the maximum length of a GATT attribute.
|
||||
*
|
||||
* This definition specifies the maximum number of bytes that a GATT attribute can hold.
|
||||
*/
|
||||
#define ESP_GATT_MAX_ATTR_LEN 512 /*!< As same as GATT_MAX_ATTR_LEN. */
|
||||
|
||||
/**
|
||||
* @brief Enumerates the possible sources of a GATT service discovery.
|
||||
*
|
||||
* This enumeration identifies the source of a GATT service discovery process,
|
||||
* indicating whether the service information was obtained from a remote device,
|
||||
* from NVS (Non-Volatile Storage) flash, or the source is unknown.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_SERVICE_FROM_REMOTE_DEVICE = 0, /* relate to BTA_GATTC_SERVICE_INFO_FROM_REMOTE_DEVICE in bta_gattc_int.h */
|
||||
ESP_GATT_SERVICE_FROM_NVS_FLASH = 1, /* relate to BTA_GATTC_SERVICE_INFO_FROM_NVS_FLASH in bta_gattc_int.h */
|
||||
ESP_GATT_SERVICE_FROM_UNKNOWN = 2, /* relate to BTA_GATTC_SERVICE_INFO_FROM_UNKNOWN in bta_gattc_int.h */
|
||||
ESP_GATT_SERVICE_FROM_REMOTE_DEVICE = 0, /*!< Service information from a remote device. Relates to BTA_GATTC_SERVICE_INFO_FROM_REMOTE_DEVICE. */
|
||||
ESP_GATT_SERVICE_FROM_NVS_FLASH = 1, /*!< Service information from NVS flash. Relates to BTA_GATTC_SERVICE_INFO_FROM_NVS_FLASH. */
|
||||
ESP_GATT_SERVICE_FROM_UNKNOWN = 2, /*!< Service source is unknown. Relates to BTA_GATTC_SERVICE_INFO_FROM_UNKNOWN. */
|
||||
} esp_service_source_t;
|
||||
|
||||
/**
|
||||
* @brief Attribute description (used to create database)
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t uuid_length; /*!< UUID length */
|
||||
uint8_t *uuid_p; /*!< UUID value */
|
||||
uint16_t perm; /*!< Attribute permission */
|
||||
uint16_t max_length; /*!< Maximum length of the element*/
|
||||
uint16_t length; /*!< Current length of the element*/
|
||||
uint8_t *value; /*!< Element value array*/
|
||||
} esp_attr_desc_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief attribute auto response flag
|
||||
* @brief Defines an attribute's description.
|
||||
*
|
||||
* This structure is used to describe an attribute in the GATT database. It includes
|
||||
* details such as the UUID of the attribute, its permissions, and its value.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t uuid_length; /*!< Length of the UUID in bytes. */
|
||||
uint8_t *uuid_p; /*!< Pointer to the UUID value. */
|
||||
uint16_t perm; /*!< Attribute permissions, defined by esp_gatt_perm_t. */
|
||||
uint16_t max_length; /*!< Maximum length of the attribute's value. */
|
||||
uint16_t length; /*!< Current length of the attribute's value. */
|
||||
uint8_t *value; /*!< Pointer to the attribute's value array. */
|
||||
} esp_attr_desc_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Defines attribute control for GATT operations.
|
||||
*
|
||||
* This module provides definitions for controlling attribute auto responses
|
||||
* in GATT operations.
|
||||
*/
|
||||
|
||||
/** @brief Response to Write/Read operations should be handled by the application. */
|
||||
#define ESP_GATT_RSP_BY_APP 0
|
||||
|
||||
/** @brief Response to Write/Read operations should be automatically handled by the GATT stack. */
|
||||
#define ESP_GATT_AUTO_RSP 1
|
||||
|
||||
/**
|
||||
* @brief Defines the auto response setting for attribute operations.
|
||||
*
|
||||
* This structure is used to control whether the GATT stack or the application
|
||||
* will handle responses to Read/Write operations.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
#define ESP_GATT_RSP_BY_APP 0
|
||||
#define ESP_GATT_AUTO_RSP 1
|
||||
/**
|
||||
* @brief if auto_rsp set to ESP_GATT_RSP_BY_APP, means the response of Write/Read operation will by replied by application.
|
||||
if auto_rsp set to ESP_GATT_AUTO_RSP, means the response of Write/Read operation will be replied by GATT stack automatically.
|
||||
* @brief Controls who handles the response to Read/Write operations.
|
||||
*
|
||||
* - If set to @c ESP_GATT_RSP_BY_APP, the application is responsible for
|
||||
* generating the response.
|
||||
* - If set to @c ESP_GATT_AUTO_RSP, the GATT stack will automatically generate
|
||||
* the response.
|
||||
*/
|
||||
uint8_t auto_rsp;
|
||||
} esp_attr_control_t;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief attribute type added to the gatt server database
|
||||
* @brief attribute type added to the GATT server database
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
@@ -370,116 +585,103 @@ typedef struct
|
||||
uint16_t end_hdl; /*!< Gatt end handle value of included 128 bit service */
|
||||
} esp_gatts_incl128_svc_desc_t; /*!< Gatt include 128 bit service entry element */
|
||||
|
||||
/// Gatt attribute value
|
||||
/**
|
||||
* @brief Represents a GATT attribute's value.
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t value[ESP_GATT_MAX_ATTR_LEN]; /*!< Gatt attribute value */
|
||||
uint16_t handle; /*!< Gatt attribute handle */
|
||||
uint16_t offset; /*!< Gatt attribute value offset */
|
||||
uint16_t len; /*!< Gatt attribute value length */
|
||||
uint8_t auth_req; /*!< Gatt authentication request */
|
||||
uint8_t value[ESP_GATT_MAX_ATTR_LEN]; /*!< Array holding the value of the GATT attribute. */
|
||||
uint16_t handle; /*!< Unique identifier (handle) of the GATT attribute. */
|
||||
uint16_t offset; /*!< Offset within the attribute's value, for partial updates. */
|
||||
uint16_t len; /*!< Current length of the data in the value array. */
|
||||
uint8_t auth_req; /*!< Authentication requirements for accessing this attribute. */
|
||||
} esp_gatt_value_t;
|
||||
|
||||
/// GATT remote read request response type
|
||||
/**
|
||||
* @brief Represents the response type for a GATT remote read request.
|
||||
*/
|
||||
typedef union {
|
||||
esp_gatt_value_t attr_value; /*!< Gatt attribute structure */
|
||||
uint16_t handle; /*!< Gatt attribute handle */
|
||||
esp_gatt_value_t attr_value; /*!< The GATT attribute value, including its data, handle, and metadata. */
|
||||
uint16_t handle; /*!< Only the handle of the GATT attribute, when that's the only required information. */
|
||||
} esp_gatt_rsp_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Gatt write type
|
||||
*/
|
||||
* @brief Defines the types of GATT write operations.
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_GATT_WRITE_TYPE_NO_RSP = 1, /*!< Gatt write attribute need no response */
|
||||
ESP_GATT_WRITE_TYPE_RSP, /*!< Gatt write attribute need remote response */
|
||||
ESP_GATT_WRITE_TYPE_NO_RSP = 1, /*!< Write operation where no response is needed. */
|
||||
ESP_GATT_WRITE_TYPE_RSP = 2, /*!< Write operation that requires a remote response. */
|
||||
} esp_gatt_write_type_t;
|
||||
|
||||
/**
|
||||
* @brief Connection parameters information
|
||||
*/
|
||||
|
||||
/** @brief Connection parameters for GATT. */
|
||||
typedef struct {
|
||||
uint16_t interval; /*!< connection interval */
|
||||
uint16_t latency; /*!< Slave latency for the connection in number of connection events. Range: 0x0000 to 0x01F3 */
|
||||
uint16_t timeout; /*!< Supervision timeout for the LE Link. Range: 0x000A to 0x0C80.
|
||||
Mandatory Range: 0x000A to 0x0C80 Time = N * 10 msec
|
||||
Time Range: 100 msec to 32 seconds */
|
||||
uint16_t interval; /*!< Connection interval. */
|
||||
uint16_t latency; /*!< Slave latency for the connection in number of connection events. */
|
||||
uint16_t timeout; /*!< Supervision timeout for the LE Link. */
|
||||
} esp_gatt_conn_params_t;
|
||||
|
||||
#define ESP_GATT_IF_NONE 0xff /*!< If callback report gattc_if/gatts_if as this macro, means this event is not correspond to any app */
|
||||
/** @brief Macro indicating no specific GATT interface. */
|
||||
#define ESP_GATT_IF_NONE 0xff /*!< No specific application GATT interface. */
|
||||
|
||||
typedef uint8_t esp_gatt_if_t; /*!< Gatt interface type, different application on GATT client use different gatt_if */
|
||||
/** @brief GATT interface type for client applications. */
|
||||
typedef uint8_t esp_gatt_if_t;
|
||||
|
||||
/**
|
||||
* @brief the type of attribute element
|
||||
*/
|
||||
/** @brief Enumerates types of GATT database attributes. */
|
||||
typedef enum {
|
||||
ESP_GATT_DB_PRIMARY_SERVICE, /*!< Gattc primary service attribute type in the cache */
|
||||
ESP_GATT_DB_SECONDARY_SERVICE, /*!< Gattc secondary service attribute type in the cache */
|
||||
ESP_GATT_DB_CHARACTERISTIC, /*!< Gattc characteristic attribute type in the cache */
|
||||
ESP_GATT_DB_DESCRIPTOR, /*!< Gattc characteristic descriptor attribute type in the cache */
|
||||
ESP_GATT_DB_INCLUDED_SERVICE, /*!< Gattc include service attribute type in the cache */
|
||||
ESP_GATT_DB_ALL, /*!< Gattc all the attribute (primary service & secondary service & include service & char & descriptor) type in the cache */
|
||||
} esp_gatt_db_attr_type_t; /*!< Gattc attribute type element */
|
||||
ESP_GATT_DB_PRIMARY_SERVICE, /*!< Primary service attribute. */
|
||||
ESP_GATT_DB_SECONDARY_SERVICE, /*!< Secondary service attribute. */
|
||||
ESP_GATT_DB_CHARACTERISTIC, /*!< Characteristic attribute. */
|
||||
ESP_GATT_DB_DESCRIPTOR, /*!< Descriptor attribute. */
|
||||
ESP_GATT_DB_INCLUDED_SERVICE, /*!< Included service attribute. */
|
||||
ESP_GATT_DB_ALL, /*!< All attribute types. */
|
||||
} esp_gatt_db_attr_type_t;
|
||||
|
||||
/**
|
||||
* @brief read multiple attribute
|
||||
*/
|
||||
/** @brief Represents multiple attributes for reading. */
|
||||
typedef struct {
|
||||
uint8_t num_attr; /*!< The number of the attribute */
|
||||
uint16_t handles[ESP_GATT_MAX_READ_MULTI_HANDLES]; /*!< The handles list */
|
||||
} esp_gattc_multi_t; /*!< The gattc multiple read element */
|
||||
uint8_t num_attr; /*!< Number of attributes. */
|
||||
uint16_t handles[ESP_GATT_MAX_READ_MULTI_HANDLES]; /*!< List of attribute handles. */
|
||||
} esp_gattc_multi_t;
|
||||
|
||||
/**
|
||||
* @brief data base attribute element
|
||||
*/
|
||||
/** @brief GATT database attribute element. */
|
||||
typedef struct {
|
||||
esp_gatt_db_attr_type_t type; /*!< The attribute type */
|
||||
uint16_t attribute_handle; /*!< The attribute handle, it's valid for all of the type */
|
||||
uint16_t start_handle; /*!< The service start handle, it's valid only when the type = ESP_GATT_DB_PRIMARY_SERVICE or ESP_GATT_DB_SECONDARY_SERVICE */
|
||||
uint16_t end_handle; /*!< The service end handle, it's valid only when the type = ESP_GATT_DB_PRIMARY_SERVICE or ESP_GATT_DB_SECONDARY_SERVICE */
|
||||
esp_gatt_char_prop_t properties; /*!< The characteristic properties, it's valid only when the type = ESP_GATT_DB_CHARACTERISTIC */
|
||||
esp_bt_uuid_t uuid; /*!< The attribute uuid, it's valid for all of the type */
|
||||
} esp_gattc_db_elem_t; /*!< The gattc service data base element in the cache */
|
||||
esp_gatt_db_attr_type_t type; /*!< Attribute type. */
|
||||
uint16_t attribute_handle; /*!< Attribute handle. */
|
||||
uint16_t start_handle; /*!< Service start handle. */
|
||||
uint16_t end_handle; /*!< Service end handle. */
|
||||
esp_gatt_char_prop_t properties; /*!< Characteristic properties. */
|
||||
esp_bt_uuid_t uuid; /*!< Attribute UUID. */
|
||||
} esp_gattc_db_elem_t;
|
||||
|
||||
/**
|
||||
* @brief service element
|
||||
*/
|
||||
/** @brief Represents a GATT service element. */
|
||||
typedef struct {
|
||||
bool is_primary; /*!< The service flag, true if the service is primary service, else is secondary service */
|
||||
uint16_t start_handle; /*!< The start handle of the service */
|
||||
uint16_t end_handle; /*!< The end handle of the service */
|
||||
esp_bt_uuid_t uuid; /*!< The uuid of the service */
|
||||
} esp_gattc_service_elem_t; /*!< The gattc service element */
|
||||
bool is_primary; /*!< Indicates if the service is primary. */
|
||||
uint16_t start_handle; /*!< Service start handle. */
|
||||
uint16_t end_handle; /*!< Service end handle. */
|
||||
esp_bt_uuid_t uuid; /*!< Service UUID. */
|
||||
} esp_gattc_service_elem_t;
|
||||
|
||||
/**
|
||||
* @brief characteristic element
|
||||
*/
|
||||
/** @brief Represents a GATT characteristic element. */
|
||||
typedef struct {
|
||||
uint16_t char_handle; /*!< The characteristic handle */
|
||||
esp_gatt_char_prop_t properties; /*!< The characteristic properties */
|
||||
esp_bt_uuid_t uuid; /*!< The characteristic uuid */
|
||||
} esp_gattc_char_elem_t; /*!< The gattc characteristic element */
|
||||
uint16_t char_handle; /*!< Characteristic handle. */
|
||||
esp_gatt_char_prop_t properties; /*!< Characteristic properties. */
|
||||
esp_bt_uuid_t uuid; /*!< Characteristic UUID. */
|
||||
} esp_gattc_char_elem_t;
|
||||
|
||||
/**
|
||||
* @brief descriptor element
|
||||
*/
|
||||
/** @brief Represents a GATT descriptor element. */
|
||||
typedef struct {
|
||||
uint16_t handle; /*!< The characteristic descriptor handle */
|
||||
esp_bt_uuid_t uuid; /*!< The characteristic descriptor uuid */
|
||||
} esp_gattc_descr_elem_t; /*!< The gattc descriptor type element */
|
||||
uint16_t handle; /*!< Descriptor handle. */
|
||||
esp_bt_uuid_t uuid; /*!< Descriptor UUID. */
|
||||
} esp_gattc_descr_elem_t;
|
||||
|
||||
/**
|
||||
* @brief include service element
|
||||
*/
|
||||
/** @brief Represents an included GATT service element. */
|
||||
typedef struct {
|
||||
uint16_t handle; /*!< The include service current attribute handle */
|
||||
uint16_t incl_srvc_s_handle; /*!< The start handle of the service which has been included */
|
||||
uint16_t incl_srvc_e_handle; /*!< The end handle of the service which has been included */
|
||||
esp_bt_uuid_t uuid; /*!< The include service uuid */
|
||||
} esp_gattc_incl_svc_elem_t; /*!< The gattc include service element */
|
||||
|
||||
uint16_t handle; /*!< Current attribute handle of the included service. */
|
||||
uint16_t incl_srvc_s_handle; /*!< Start handle of the included service. */
|
||||
uint16_t incl_srvc_e_handle; /*!< End handle of the included service. */
|
||||
esp_bt_uuid_t uuid; /*!< Included service UUID. */
|
||||
} esp_gattc_incl_svc_elem_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ESP_GATT_DEFS_H__ */
|
||||
|
||||
@@ -654,7 +654,7 @@ static void bta_dm_disable_timer_cback (TIMER_LIST_ENT *p_tle)
|
||||
}
|
||||
|
||||
/* Retrigger disable timer in case ACL disconnect failed, DISABLE_EVT still need
|
||||
to be sent out to avoid jave layer disable timeout */
|
||||
to be sent out to avoid the layer disable timeout */
|
||||
if (trigger_disc) {
|
||||
bta_dm_cb.disable_timer.p_cback = (TIMER_CBACK *)&bta_dm_disable_timer_cback;
|
||||
bta_dm_cb.disable_timer.param = 1;
|
||||
@@ -716,7 +716,7 @@ void bta_dm_get_dev_name (tBTA_DM_MSG *p_data)
|
||||
**
|
||||
** Function bta_dm_cfg_coex_status
|
||||
**
|
||||
** Description config coexistance status
|
||||
** Description config coexistence status
|
||||
**
|
||||
**
|
||||
** Returns void
|
||||
@@ -787,7 +787,7 @@ static BOOLEAN bta_dm_read_remote_device_name (BD_ADDR bd_addr, tBT_TRANSPORT tr
|
||||
APPL_TRACE_DEBUG("bta_dm_read_remote_device_name: BTM_ReadRemoteDeviceName is busy");
|
||||
|
||||
/* Remote name discovery is on going now so BTM cannot notify through "bta_dm_remname_cback" */
|
||||
/* adding callback to get notified that current reading remore name done */
|
||||
/* adding callback to get notified that current reading remote name done */
|
||||
BTM_SecAddRmtNameNotifyCallback(&bta_dm_service_search_remname_cback);
|
||||
|
||||
return (TRUE);
|
||||
@@ -1171,7 +1171,7 @@ void bta_dm_add_device (tBTA_DM_MSG *p_data)
|
||||
}
|
||||
|
||||
if (p_dev->is_trusted) {
|
||||
/* covert BTA service mask to BTM mask */
|
||||
/* convert BTA service mask to BTM mask */
|
||||
while (p_dev->tm && (index < BTA_MAX_SERVICE_ID)) {
|
||||
if (p_dev->tm & (UINT32)(1 << index)) {
|
||||
|
||||
@@ -1199,7 +1199,7 @@ void bta_dm_add_device (tBTA_DM_MSG *p_data)
|
||||
** Function bta_dm_close_acl
|
||||
**
|
||||
** Description This function forces to close the connection to a remote device
|
||||
** and optionaly remove the device from security database if
|
||||
** and optionally remove the device from security database if
|
||||
** required.
|
||||
****
|
||||
*******************************************************************************/
|
||||
@@ -2722,7 +2722,7 @@ static void bta_dm_discover_device(BD_ADDR remote_bd_addr)
|
||||
&bta_dm_search_cb.services_found );
|
||||
}
|
||||
|
||||
/* if seaching with EIR is not completed */
|
||||
/* if searching with EIR is not completed */
|
||||
if (bta_dm_search_cb.services_to_search) {
|
||||
/* check whether connection already exists to the device
|
||||
if connection exists, we don't have to wait for ACL
|
||||
@@ -3809,7 +3809,7 @@ static void bta_dm_disable_conn_down_timer_cback (TIMER_LIST_ENT *p_tle)
|
||||
tBTA_SYS_HW_MSG *sys_enable_event;
|
||||
|
||||
#if (BTA_DM_PM_INCLUDED == TRUE)
|
||||
/* disable the power managment module */
|
||||
/* disable the power management module */
|
||||
bta_dm_disable_pm();
|
||||
#endif /* #if (BTA_DM_PM_INCLUDED == TRUE) */
|
||||
|
||||
@@ -4196,7 +4196,7 @@ static void bta_dm_set_eir (char *local_name)
|
||||
p = (UINT8 *)p_buf + BTM_HCI_EIR_OFFSET; /* reset p */
|
||||
#endif // BTA_EIR_CANNED_UUID_LIST
|
||||
|
||||
/* if UUID doesn't fit remaing space, shorten local name */
|
||||
/* if UUID doesn't fit remaining space, shorten local name */
|
||||
if ( local_name_len > (free_eir_length - 4 - num_uuid * LEN_UUID_16)) {
|
||||
APPL_TRACE_WARNING("BTA EIR: local name is shortened");
|
||||
local_name_len = p_bta_dm_eir_cfg->bta_dm_eir_min_name_len;
|
||||
@@ -5249,14 +5249,14 @@ void bta_dm_ble_disconnect (tBTA_DM_MSG *p_data)
|
||||
**
|
||||
** Description This function set the LE random address for the device.
|
||||
**
|
||||
** Parameters: rand_addr:the random address whitch should be setting
|
||||
** Parameters: rand_addr:the random address which should be setting
|
||||
** Explanation: This function added by Yulong at 2016/9/9
|
||||
*******************************************************************************/
|
||||
void bta_dm_ble_set_rand_address(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
tBTM_STATUS status = BTM_SET_STATIC_RAND_ADDR_FAIL;
|
||||
if (p_data->set_addr.addr_type != BLE_ADDR_RANDOM) {
|
||||
APPL_TRACE_ERROR("Invalid random adress type = %d\n", p_data->set_addr.addr_type);
|
||||
APPL_TRACE_ERROR("Invalid random address type = %d\n", p_data->set_addr.addr_type);
|
||||
if(p_data->set_addr.p_set_rand_addr_cback) {
|
||||
(*p_data->set_addr.p_set_rand_addr_cback)(status);
|
||||
}
|
||||
@@ -5611,7 +5611,7 @@ void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data)
|
||||
}
|
||||
|
||||
p_acl_cb->p_set_pkt_data_cback = p_data->ble_set_data_length.p_set_pkt_data_cback;
|
||||
// if the value of the data length is same, triger callback directly
|
||||
// if the value of the data length is same, trigger callback directly
|
||||
if(p_data->ble_set_data_length.tx_data_length == p_acl_cb->data_length_params.tx_len) {
|
||||
if(p_data->ble_set_data_length.p_set_pkt_data_cback) {
|
||||
(*p_data->ble_set_data_length.p_set_pkt_data_cback)(status, &p_acl_cb->data_length_params);
|
||||
@@ -5620,7 +5620,7 @@ void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data)
|
||||
}
|
||||
|
||||
if(p_acl_cb->data_len_updating) {
|
||||
// aleady have one cmd
|
||||
// already have one cmd
|
||||
if(p_acl_cb->data_len_waiting) {
|
||||
status = BTM_ILLEGAL_ACTION;
|
||||
} else {
|
||||
@@ -5806,6 +5806,28 @@ void bta_dm_ble_gap_clear_adv(tBTA_DM_MSG *p_data)
|
||||
}
|
||||
}
|
||||
|
||||
void bta_dm_ble_gap_set_rpa_timeout(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
APPL_TRACE_API("%s, rpa_timeout = %d", __func__, p_data->set_rpa_timeout.rpa_timeout);
|
||||
BTM_BleSetRpaTimeout(p_data->set_rpa_timeout.rpa_timeout,p_data->set_rpa_timeout.p_set_rpa_timeout_cback);
|
||||
}
|
||||
|
||||
void bta_dm_ble_gap_add_dev_to_resolving_list(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
APPL_TRACE_API("%s", __func__);
|
||||
BTM_BleAddDevToResolvingList(p_data->add_dev_to_resolving_list.addr,
|
||||
p_data->add_dev_to_resolving_list.addr_type,
|
||||
p_data->add_dev_to_resolving_list.irk,
|
||||
p_data->add_dev_to_resolving_list.p_add_dev_to_resolving_list_callback);
|
||||
}
|
||||
|
||||
void bta_dm_ble_gap_set_privacy_mode(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
APPL_TRACE_API("%s, privacy_mode = %d", __func__, p_data->ble_set_privacy_mode.privacy_mode);
|
||||
BTM_BleSetPrivacyMode(p_data->ble_set_privacy_mode.addr_type, p_data->ble_set_privacy_mode.addr,
|
||||
p_data->ble_set_privacy_mode.privacy_mode, p_data->ble_set_privacy_mode.p_cback);
|
||||
}
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
void bta_dm_ble_gap_dtm_enhance_tx_start(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
@@ -6487,7 +6509,7 @@ static void bta_dm_gatt_disc_result(tBTA_GATT_ID service_id)
|
||||
}
|
||||
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s out of room to accomodate more service ids ble_raw_size = %d ble_raw_used = %d", __FUNCTION__, bta_dm_search_cb.ble_raw_size, bta_dm_search_cb.ble_raw_used );
|
||||
APPL_TRACE_ERROR("%s out of room to accommodate more service ids ble_raw_size = %d ble_raw_used = %d", __FUNCTION__, bta_dm_search_cb.ble_raw_size, bta_dm_search_cb.ble_raw_used );
|
||||
}
|
||||
|
||||
APPL_TRACE_API("%s service_id_uuid_len=%d ", __func__, service_id.uuid.len);
|
||||
|
||||
@@ -957,7 +957,7 @@ void BTA_DmAddDevice(BD_ADDR bd_addr, DEV_CLASS dev_class, LINK_KEY link_key,
|
||||
**
|
||||
** Function BTA_DmRemoveDevice
|
||||
**
|
||||
** Description This function removes a device fromthe security database list of
|
||||
** Description This function removes a device from the security database list of
|
||||
** peer device. It manages unpairing even while connected.
|
||||
**
|
||||
**
|
||||
@@ -1175,7 +1175,7 @@ void BTA_DmAddBleDevice(BD_ADDR bd_addr, tBLE_ADDR_TYPE addr_type, int auth_mode
|
||||
** Description Send BLE SMP passkey reply.
|
||||
**
|
||||
** Parameters: bd_addr - BD address of the peer
|
||||
** accept - passkey entry sucessful or declined.
|
||||
** accept - passkey entry successful or declined.
|
||||
** passkey - passkey value, must be a 6 digit number,
|
||||
** can be lead by 0.
|
||||
**
|
||||
@@ -2014,7 +2014,7 @@ void BTA_DmDiscoverExt(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_services,
|
||||
** p_services: if service is not empty, service discovery will be done.
|
||||
** for all GATT based service condition, put num_uuid, and
|
||||
** p_uuid is the pointer to the list of UUID values.
|
||||
** p_cback: callback functino when search is completed.
|
||||
** p_cback: callback function when search is completed.
|
||||
**
|
||||
**
|
||||
**
|
||||
@@ -2102,7 +2102,7 @@ void BTA_DmBleUpdateConnectionParam(BD_ADDR bd_addr, UINT16 min_int,
|
||||
**
|
||||
** Description Enable/disable privacy on the local device
|
||||
**
|
||||
** Parameters: privacy_enable - enable/disabe privacy on remote device.
|
||||
** Parameters: privacy_enable - enable/disable privacy on remote device.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
@@ -2154,7 +2154,7 @@ void BTA_DmBleConfigLocalIcon(uint16_t icon)
|
||||
**
|
||||
** Function BTA_BleEnableAdvInstance
|
||||
**
|
||||
** Description This function enable a Multi-ADV instance with the specififed
|
||||
** Description This function enable a Multi-ADV instance with the specified
|
||||
** adv parameters
|
||||
**
|
||||
** Parameters p_params: pointer to the adv parameter structure.
|
||||
@@ -2193,7 +2193,7 @@ void BTA_BleEnableAdvInstance (tBTA_BLE_ADV_PARAMS *p_params,
|
||||
**
|
||||
** Function BTA_BleUpdateAdvInstParam
|
||||
**
|
||||
** Description This function update a Multi-ADV instance with the specififed
|
||||
** Description This function update a Multi-ADV instance with the specified
|
||||
** adv parameters.
|
||||
**
|
||||
** Parameters inst_id: Adv instance to update the parameter.
|
||||
@@ -2224,7 +2224,7 @@ void BTA_BleUpdateAdvInstParam (UINT8 inst_id, tBTA_BLE_ADV_PARAMS *p_params)
|
||||
**
|
||||
** Function BTA_BleCfgAdvInstData
|
||||
**
|
||||
** Description This function configure a Multi-ADV instance with the specififed
|
||||
** Description This function configure a Multi-ADV instance with the specified
|
||||
** adv data or scan response data.
|
||||
**
|
||||
** Parameter inst_id: Adv instance to configure the adv data or scan response.
|
||||
@@ -2654,6 +2654,21 @@ void BTA_DmBleDtmStop(tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
|
||||
}
|
||||
}
|
||||
|
||||
void BTA_DmBleSetPrivacyMode(uint8_t addr_type, BD_ADDR addr, uint8_t privacy_mode, tBTA_SET_PRIVACY_MODE_CMPL_CBACK *p_cback)
|
||||
{
|
||||
tBTA_DM_API_SET_PRIVACY_MODE *p_msg;
|
||||
|
||||
if ((p_msg = (tBTA_DM_API_SET_PRIVACY_MODE *)osi_malloc(sizeof(tBTA_DM_API_SET_PRIVACY_MODE)))
|
||||
!= NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_SET_PRIVACY_MODE_EVT;
|
||||
p_msg->addr_type = addr_type;
|
||||
memcpy(p_msg->addr, addr, sizeof(BD_ADDR));
|
||||
p_msg->privacy_mode = privacy_mode;
|
||||
p_msg->p_cback = p_cback;
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -2667,7 +2682,7 @@ void BTA_DmBleDtmStop(tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
|
||||
**
|
||||
** Parameters: bd_addr - Address of the peer device
|
||||
** transport - transport of the link to be encruypted
|
||||
** p_callback - Pointer to callback function to indicat the
|
||||
** p_callback - Pointer to callback function to indicate the
|
||||
** link encryption status
|
||||
** sec_act - This is the security action to indicate
|
||||
** what kind of BLE security level is required for
|
||||
@@ -2847,7 +2862,7 @@ extern void BTA_DmBleStopAdvertising(void)
|
||||
**
|
||||
** Description This function set the random address for the APP
|
||||
**
|
||||
** Parameters rand_addr: the random address whith should be setting
|
||||
** Parameters rand_addr: the random address with should be setting
|
||||
** p_set_rand_addr_cback: complete callback
|
||||
** Returns void
|
||||
**
|
||||
@@ -2863,7 +2878,68 @@ extern void BTA_DmSetRandAddress(BD_ADDR rand_addr, tBTA_SET_RAND_ADDR_CBACK *p_
|
||||
p_msg->hdr.event = BTA_DM_API_SET_RAND_ADDR_EVT;
|
||||
p_msg->addr_type = BLE_ADDR_RANDOM;
|
||||
p_msg->p_set_rand_addr_cback = p_set_rand_addr_cback;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleSetRpaTimeout
|
||||
**
|
||||
** Description This function sets the Resolvable Private Address (RPA) timeout
|
||||
** for the Bluetooth device. The RPA timeout defines how long an RPA
|
||||
** remains in use before a new one is generated.
|
||||
**
|
||||
** Parameters rpa_timeout: The timeout in seconds within the range of 1s to 1 hour
|
||||
** as defined by the Bluetooth specification. This duration
|
||||
** specifies how long the controller uses an RPA before
|
||||
** generating a new one.
|
||||
** Returns void
|
||||
**
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_DmBleSetRpaTimeout(uint16_t rpa_timeout,tBTA_SET_RPA_TIMEOUT_CMPL_CBACK *p_set_rpa_timeout_cback)
|
||||
{
|
||||
tBTA_DM_API_SET_RPA_TIMEOUT *p_msg;
|
||||
if ((p_msg = (tBTA_DM_API_SET_RPA_TIMEOUT *) osi_malloc(sizeof(tBTA_DM_API_SET_RPA_TIMEOUT))) != NULL) {
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_SET_RPA_TIMEOUT));
|
||||
p_msg->hdr.event = BTA_DM_API_SET_RPA_TIMEOUT_EVT;
|
||||
p_msg->rpa_timeout = rpa_timeout; // Assign the RPA timeout value to the message
|
||||
p_msg->p_set_rpa_timeout_cback = p_set_rpa_timeout_cback;
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleAddDevToResolvingList
|
||||
**
|
||||
** Description This function adds a device to the resolving list of the
|
||||
** Bluetooth controller. The resolving list is used for resolving
|
||||
** the identity of devices using resolvable private addresses (RPAs).
|
||||
**
|
||||
** Parameters addr: Bluetooth device address to be added to the resolving list
|
||||
** addr_type: Type of the address (public or random)
|
||||
** irk: Identity Resolving Key (IRK) of the device
|
||||
** add_dev_to_resolving_list_callback: Callback function to be invoked
|
||||
** upon completion of the operation
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_DmBleAddDevToResolvingList(BD_ADDR addr,
|
||||
uint8_t addr_type,
|
||||
PEER_IRK irk,
|
||||
tBTA_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *add_dev_to_resolving_list_callback)
|
||||
{
|
||||
tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST *p_msg;
|
||||
if ((p_msg = (tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST *) osi_malloc(sizeof(tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST))) != NULL) {
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST));
|
||||
p_msg->hdr.event = BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT;
|
||||
memcpy(p_msg->addr, addr, BD_ADDR_LEN); // Copy the device address to the message
|
||||
p_msg->addr_type = addr_type; // Assign the address type to the message
|
||||
memcpy(p_msg->irk, irk, PEER_IRK_LEN); // Copy the IRK to the message
|
||||
p_msg->p_add_dev_to_resolving_list_callback = add_dev_to_resolving_list_callback;
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
@@ -2933,7 +3009,7 @@ void BTA_DmBleGapReadPHY(BD_ADDR addr)
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_READ_PHY));
|
||||
p_msg->hdr.event = BTA_DM_API_READ_PHY_EVT;
|
||||
memcpy(p_msg->bd_addr, addr, BD_ADDR_LEN);
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -2945,13 +3021,13 @@ void BTA_DmBleGapSetPreferedDefaultPHY(tBTA_DM_BLE_GAP_PHY_MASK tx_phy_mask,
|
||||
tBTA_DM_BLE_GAP_PHY_MASK rx_phy_mask)
|
||||
{
|
||||
tBTA_DM_API_SET_PER_DEF_PHY *p_msg;
|
||||
APPL_TRACE_API("%s, Set prefered default phy.", __func__);
|
||||
APPL_TRACE_API("%s, Set preferred default phy.", __func__);
|
||||
if ((p_msg = (tBTA_DM_API_SET_PER_DEF_PHY *) osi_malloc(sizeof(tBTA_DM_API_SET_PER_DEF_PHY))) != NULL) {
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_SET_PER_DEF_PHY));
|
||||
p_msg->hdr.event = BTA_DM_API_SET_PER_DEF_PHY_EVT;
|
||||
p_msg->tx_phy_mask = tx_phy_mask;
|
||||
p_msg->rx_phy_mask = rx_phy_mask;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -2966,7 +3042,7 @@ void BTA_DmBleGapSetPreferedPHY(BD_ADDR addr,
|
||||
UINT16 phy_options)
|
||||
{
|
||||
tBTA_DM_API_SET_PER_PHY *p_msg;
|
||||
APPL_TRACE_API("%s, Set prefered phy.", __func__);
|
||||
APPL_TRACE_API("%s, Set preferred phy.", __func__);
|
||||
if ((p_msg = (tBTA_DM_API_SET_PER_PHY *) osi_malloc(sizeof(tBTA_DM_API_SET_PER_PHY))) != NULL) {
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_SET_PER_PHY));
|
||||
p_msg->hdr.event = BTA_DM_API_SET_PER_PHY_EVT;
|
||||
@@ -2975,7 +3051,7 @@ void BTA_DmBleGapSetPreferedPHY(BD_ADDR addr,
|
||||
p_msg->tx_phy_mask = tx_phy_mask;
|
||||
p_msg->rx_phy_mask = rx_phy_mask;
|
||||
p_msg->phy_options = phy_options;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -2991,7 +3067,7 @@ void BTA_DmBleGapExtAdvSetRandaddr(UINT16 instance, BD_ADDR addr)
|
||||
p_msg->hdr.event = BTA_DM_API_SET_EXT_ADV_RAND_ADDR_EVT;
|
||||
p_msg->instance = instance;
|
||||
memcpy(&p_msg->rand_addr, addr, BD_ADDR_LEN);
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3009,7 +3085,7 @@ void BTA_DmBleGapExtAdvSetParams(UINT16 instance,
|
||||
p_msg->hdr.event = BTA_DM_API_SET_EXT_ADV_PARAMS_EVT;
|
||||
p_msg->instance = instance;
|
||||
memcpy(&p_msg->params, params, sizeof(tBTA_DM_BLE_GAP_EXT_ADV_PARAMS));
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3032,7 +3108,7 @@ void BTA_DmBleGapConfigExtAdvDataRaw(BOOLEAN is_scan_rsp, UINT8 instance, UINT16
|
||||
if (data) {
|
||||
memcpy(p_msg->data, data, length);
|
||||
}
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3052,7 +3128,7 @@ void BTA_DmBleGapExtAdvEnable(BOOLEAN enable, UINT8 num, tBTA_DM_BLE_EXT_ADV *ex
|
||||
if (ext_adv) {
|
||||
memcpy(p_msg->ext_adv, ext_adv, sizeof(tBTA_DM_BLE_EXT_ADV)*num);
|
||||
}
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3067,7 +3143,7 @@ void BTA_DmBleGapExtAdvSetRemove(UINT8 instance)
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_BLE_EXT_ADV_SET_REMOVE));
|
||||
p_msg->hdr.event = BTA_DM_API_EXT_ADV_SET_REMOVE_EVT;
|
||||
p_msg->instance = instance;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3081,7 +3157,7 @@ void BTA_DmBleGapExtAdvSetClear(void)
|
||||
if ((p_msg = (tBTA_DM_API_BLE_EXT_ADV_SET_CLEAR *) osi_malloc(sizeof(tBTA_DM_API_BLE_EXT_ADV_SET_CLEAR))) != NULL) {
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_BLE_EXT_ADV_SET_CLEAR));
|
||||
p_msg->hdr.event = BTA_DM_API_EXT_ADV_SET_CLEAR_EVT;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3098,7 +3174,7 @@ void BTA_DmBleGapPeriodicAdvSetParams(UINT8 instance,
|
||||
p_msg->hdr.event = BTA_DM_API_PERIODIC_ADV_SET_PARAMS_EVT;
|
||||
p_msg->instance = instance;
|
||||
memcpy(&p_msg->params, params, sizeof(tBTA_DM_BLE_Periodic_Adv_Params));
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3120,7 +3196,7 @@ void BTA_DmBleGapPeriodicAdvCfgDataRaw(UINT8 instance, UINT16 length,
|
||||
memcpy(p_msg->data, data, length);
|
||||
p_msg->data = length != 0 ? (UINT8 *)(p_msg + 1) : NULL;
|
||||
p_msg->only_update_did = only_update_did;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3137,7 +3213,7 @@ void BTA_DmBleGapPeriodicAdvEnable(UINT8 enable, UINT8 instance)
|
||||
p_msg->hdr.event = BTA_DM_API_PERIODIC_ADV_ENABLE_EVT;
|
||||
p_msg->instance = instance;
|
||||
p_msg->enable = enable;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3153,7 +3229,7 @@ void BTA_DmBleGapPeriodicAdvCreateSync(tBTA_DM_BLE_Periodic_Sync_Params *params)
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_PERIODIC_ADV_SYNC));
|
||||
p_msg->hdr.event = BTA_DM_API_PERIODIC_ADV_SYNC_EVT;
|
||||
memcpy(&p_msg->params, params, sizeof(tBTA_DM_BLE_Periodic_Sync_Params));
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3168,7 +3244,7 @@ void BTA_DmBleGapPeriodicAdvSyncCancel(void)
|
||||
if ((p_msg = (tBTA_DM_API_PERIODIC_ADV_SYNC_CANCEL *) osi_malloc(sizeof(tBTA_DM_API_PERIODIC_ADV_SYNC_CANCEL))) != NULL) {
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_PERIODIC_ADV_SYNC_CANCEL));
|
||||
p_msg->hdr.event = BTA_DM_API_PERIODIC_ADV_SYNC_CANCEL_EVT;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3184,7 +3260,7 @@ void BTA_DmBleGapPeriodicAdvSyncTerm(UINT16 sync_handle)
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_PERIODIC_ADV_SYNC_TERM));
|
||||
p_msg->hdr.event = BTA_DM_API_PERIODIC_ADV_SYNC_TERMINATE_EVT;
|
||||
p_msg->sync_handle = sync_handle;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3204,7 +3280,7 @@ void BTA_DmBleGapPeriodicAdvAddDevToList(tBLE_ADDR_TYPE addr_type,
|
||||
p_msg->addr_type = addr_type;
|
||||
p_msg->sid = sid;
|
||||
memcpy(p_msg->addr, addr, sizeof(BD_ADDR));
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3224,7 +3300,7 @@ void BTA_DmBleGapPeriodicAdvRemoveDevFromList(tBLE_ADDR_TYPE addr_type,
|
||||
p_msg->addr_type = addr_type;
|
||||
p_msg->sid = sid;
|
||||
memcpy(p_msg->addr, addr, sizeof(BD_ADDR));
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3239,7 +3315,7 @@ void BTA_DmBleGapPeriodicAdvClearDev(void)
|
||||
if ((p_msg = (tBTA_DM_API_PERIODIC_ADV_DEV_CLEAR *) osi_malloc(sizeof(tBTA_DM_API_PERIODIC_ADV_DEV_CLEAR))) != NULL) {
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_PERIODIC_ADV_DEV_CLEAR));
|
||||
p_msg->hdr.event = BTA_DM_API_PERIODIC_ADV_CLEAR_DEV_EVT;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3255,7 +3331,7 @@ void BTA_DmBleGapSetExtScanParams(tBTA_DM_BLE_EXT_SCAN_PARAMS *params)
|
||||
memset(p_msg, 0, sizeof(tBTA_DM_API_SET_EXT_SCAN_PARAMS));
|
||||
p_msg->hdr.event = BTA_DM_API_SET_EXT_SCAN_PARAMS_EVT;
|
||||
memcpy(&p_msg->params, params, sizeof(tBTA_DM_BLE_EXT_SCAN_PARAMS));
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3273,7 +3349,7 @@ void BTA_DmBleGapExtScan(BOOLEAN start, UINT32 duration, UINT16 period)
|
||||
p_msg->start = start;
|
||||
p_msg->duration = duration;
|
||||
p_msg->period = period;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3307,7 +3383,7 @@ void BTA_DmBleGapPreferExtConnectParamsSet(BD_ADDR bd_addr,
|
||||
if (phy_coded_conn_params) {
|
||||
memcpy(&p_msg->phy_coded_conn_params, phy_coded_conn_params, sizeof(tBTA_DM_BLE_CONN_PARAMS));
|
||||
}
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3326,7 +3402,7 @@ void BTA_DmBleGapExtConnect(tBLE_ADDR_TYPE own_addr_type, const BD_ADDR peer_add
|
||||
p_msg->hdr.event = BTA_DM_API_EXT_CONN_EVT;
|
||||
p_msg->own_addr_type = own_addr_type;
|
||||
memcpy(p_msg->peer_addr, peer_addr, sizeof(BD_ADDR));
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3379,7 +3455,7 @@ void BTA_DmBleGapPeriodicAdvRecvEnable(UINT16 sync_handle, UINT8 enable)
|
||||
p_msg->hdr.event = BTA_DM_API_PERIODIC_ADV_RECV_ENABLE_EVT;
|
||||
p_msg->sync_handle = sync_handle;
|
||||
p_msg->enable = enable;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3396,7 +3472,7 @@ void BTA_DmBleGapPeriodicAdvSyncTrans(BD_ADDR peer_addr, UINT16 service_data, UI
|
||||
memcpy(p_msg->addr, peer_addr, sizeof(BD_ADDR));
|
||||
p_msg->service_data = service_data;
|
||||
p_msg->sync_handle = sync_handle;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3413,7 +3489,7 @@ void BTA_DmBleGapPeriodicAdvSetInfoTrans(BD_ADDR peer_addr, UINT16 service_data,
|
||||
memcpy(p_msg->addr, peer_addr, sizeof(BD_ADDR));
|
||||
p_msg->service_data = service_data;
|
||||
p_msg->adv_hanlde = adv_handle;
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
@@ -3429,7 +3505,7 @@ void BTA_DmBleGapSetPeriodicAdvSyncTransParams(BD_ADDR peer_addr, tBTA_DM_BLE_PA
|
||||
p_msg->hdr.event = BTA_DM_API_SET_PERIODIC_ADV_SYNC_TRANS_PARAMS_EVT;
|
||||
memcpy(p_msg->addr, peer_addr, sizeof(BD_ADDR));
|
||||
memcpy(&p_msg->params, params, sizeof(tBTA_DM_BLE_PAST_PARAMS));
|
||||
//start sent the msg to the bta system control moudle
|
||||
//start sent the msg to the bta system control module
|
||||
bta_sys_sendmsg(p_msg);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s malloc failed", __func__);
|
||||
|
||||
@@ -227,6 +227,9 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
||||
bta_dm_ble_gap_dtm_rx_start, /* BTA_DM_API_DTM_RX_START_EVT */
|
||||
bta_dm_ble_gap_dtm_stop, /* BTA_DM_API_DTM_STOP_EVT */
|
||||
bta_dm_ble_gap_clear_adv, /* BTA_DM_API_BLE_CLEAR_ADV_EVT */
|
||||
bta_dm_ble_gap_set_rpa_timeout, /* BTA_DM_API_SET_RPA_TIMEOUT_EVT */
|
||||
bta_dm_ble_gap_add_dev_to_resolving_list, /* BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT */
|
||||
bta_dm_ble_gap_set_privacy_mode, /* BTA_DM_API_SET_PRIVACY_MODE_EVT */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ enum {
|
||||
BTA_DM_API_PIN_REPLY_EVT,
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#if (BTA_DM_PM_INCLUDED == TRUE)
|
||||
/* power manger events */
|
||||
/* power manager events */
|
||||
BTA_DM_PM_BTM_STATUS_EVT,
|
||||
BTA_DM_PM_TIMER_EVT,
|
||||
#endif /* #if (BTA_DM_PM_INCLUDED == TRUE) */
|
||||
@@ -220,6 +220,9 @@ enum {
|
||||
BTA_DM_API_DTM_RX_START_EVT,
|
||||
BTA_DM_API_DTM_STOP_EVT,
|
||||
BTA_DM_API_BLE_CLEAR_ADV_EVT,
|
||||
BTA_DM_API_SET_RPA_TIMEOUT_EVT,
|
||||
BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT,
|
||||
BTA_DM_API_SET_PRIVACY_MODE_EVT,
|
||||
#endif
|
||||
BTA_DM_MAX_EVT
|
||||
};
|
||||
@@ -671,7 +674,7 @@ typedef struct {
|
||||
tBTA_DM_BLE_SEL_CBACK *p_select_cback;
|
||||
} tBTA_DM_API_BLE_SET_BG_CONN_TYPE;
|
||||
|
||||
/* set prefered BLE connection parameters for a device */
|
||||
/* set preferred BLE connection parameters for a device */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
BD_ADDR peer_bda;
|
||||
@@ -772,6 +775,20 @@ typedef struct {
|
||||
BT_HDR hdr;
|
||||
} tBTA_DM_APT_CLEAR_ADDR;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
UINT16 rpa_timeout;
|
||||
tBTA_SET_RPA_TIMEOUT_CMPL_CBACK *p_set_rpa_timeout_cback;
|
||||
} tBTA_DM_API_SET_RPA_TIMEOUT;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr; // Event header
|
||||
esp_bd_addr_t addr; // Bluetooth device address
|
||||
UINT8 addr_type; // Type of the address
|
||||
UINT8 irk[PEER_IRK_LEN]; // Identity Resolving Key (IRK)
|
||||
tBTA_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *p_add_dev_to_resolving_list_callback; // Callback function pointer
|
||||
} tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST;
|
||||
|
||||
/* set adv parameter for BLE advertising */
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
@@ -922,6 +939,14 @@ typedef struct {
|
||||
tBTA_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback;
|
||||
} tBTA_DM_API_CLEAR_ADV;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBLE_ADDR_TYPE addr_type;
|
||||
BD_ADDR addr;
|
||||
UINT8 privacy_mode;
|
||||
tBTA_SET_PRIVACY_MODE_CMPL_CBACK *p_cback;
|
||||
} tBTA_DM_API_SET_PRIVACY_MODE;
|
||||
|
||||
#endif /* BLE_INCLUDED */
|
||||
|
||||
/* data type for BTA_DM_API_REMOVE_ACL_EVT */
|
||||
@@ -1273,6 +1298,8 @@ typedef union {
|
||||
tBTA_DM_API_BLE_SET_DATA_LENGTH ble_set_data_length;
|
||||
tBTA_DM_APT_SET_DEV_ADDR set_addr;
|
||||
tBTA_DM_APT_CLEAR_ADDR clear_addr;
|
||||
tBTA_DM_API_SET_RPA_TIMEOUT set_rpa_timeout;
|
||||
tBTA_DM_API_ADD_DEV_TO_RESOLVING_LIST add_dev_to_resolving_list;
|
||||
tBTA_DM_API_BLE_MULTI_ADV_ENB ble_multi_adv_enb;
|
||||
tBTA_DM_API_BLE_MULTI_ADV_PARAM ble_multi_adv_param;
|
||||
tBTA_DM_API_BLE_MULTI_ADV_DATA ble_multi_adv_data;
|
||||
@@ -1322,6 +1349,7 @@ typedef union {
|
||||
tBTA_DM_API_BLE_DTM_RX_START dtm_rx_start;
|
||||
tBTA_DM_API_BLE_DTM_STOP dtm_stop;
|
||||
tBTA_DM_API_CLEAR_ADV ble_clear_adv;
|
||||
tBTA_DM_API_SET_PRIVACY_MODE ble_set_privacy_mode;
|
||||
#endif
|
||||
|
||||
tBTA_DM_API_REMOVE_ACL remove_acl;
|
||||
@@ -1456,7 +1484,7 @@ typedef struct {
|
||||
UINT32 role_policy_mask; /* the bits set indicates the modules that wants to remove role switch from the default link policy */
|
||||
UINT16 cur_policy; /* current default link policy */
|
||||
UINT16 rs_event; /* the event waiting for role switch */
|
||||
UINT8 cur_av_count; /* current AV connecions */
|
||||
UINT8 cur_av_count; /* current AV connections */
|
||||
BOOLEAN disable_pair_mode; /* disable pair mode or not */
|
||||
BOOLEAN conn_paired_only; /* allow connectable to paired device only or not */
|
||||
tBTA_DM_API_SEARCH search_msg;
|
||||
@@ -1764,7 +1792,9 @@ extern void bta_dm_ble_gap_dtm_tx_start(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_dtm_rx_start(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_dtm_stop(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_clear_adv(tBTA_DM_MSG *p_data);
|
||||
|
||||
extern void bta_dm_ble_gap_set_rpa_timeout(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_add_dev_to_resolving_list(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_set_privacy_mode(tBTA_DM_MSG *p_data);
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
extern void bta_dm_ble_gap_dtm_enhance_tx_start(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_dtm_enhance_rx_start(tBTA_DM_MSG *p_data);
|
||||
|
||||
@@ -398,7 +398,7 @@ typedef tBTM_BLE_128SERVICE tBTA_BLE_128SERVICE;
|
||||
typedef tBTM_BLE_32SERVICE tBTA_BLE_32SERVICE;
|
||||
|
||||
typedef struct {
|
||||
tBTA_BLE_INT_RANGE int_range; /* slave prefered conn interval range */
|
||||
tBTA_BLE_INT_RANGE int_range; /* slave preferred conn interval range */
|
||||
tBTA_BLE_MANU *p_manu; /* manufacturer data */
|
||||
tBTA_BLE_SERVICE *p_services; /* 16 bits services */
|
||||
tBTA_BLE_128SERVICE *p_services_128b; /* 128 bits service */
|
||||
@@ -433,6 +433,12 @@ typedef tBTM_SET_RAND_ADDR_CBACK tBTA_SET_RAND_ADDR_CBACK;
|
||||
|
||||
typedef tBTM_SET_LOCAL_PRIVACY_CBACK tBTA_SET_LOCAL_PRIVACY_CBACK;
|
||||
|
||||
typedef tBTM_SET_RPA_TIMEOUT_CMPL_CBACK tBTA_SET_RPA_TIMEOUT_CMPL_CBACK;
|
||||
|
||||
typedef tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK tBTA_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK;
|
||||
|
||||
typedef tBTM_SET_PRIVACY_MODE_CMPL_CBACK tBTA_SET_PRIVACY_MODE_CMPL_CBACK;
|
||||
|
||||
typedef tBTM_CMPL_CB tBTA_CMPL_CB;
|
||||
|
||||
typedef tBTM_VSC_CMPL tBTA_VSC_CMPL;
|
||||
@@ -665,7 +671,7 @@ typedef UINT8 tBTA_SIG_STRENGTH_MASK;
|
||||
// btla-specific --
|
||||
#define BTA_DM_DEV_UNPAIRED_EVT 25 /* BT unpair event */
|
||||
#define BTA_DM_HW_ERROR_EVT 26 /* BT Chip H/W error */
|
||||
#define BTA_DM_LE_FEATURES_READ 27 /* Cotroller specific LE features are read */
|
||||
#define BTA_DM_LE_FEATURES_READ 27 /* Controller specific LE features are read */
|
||||
#define BTA_DM_ENER_INFO_READ 28 /* Energy info read */
|
||||
#define BTA_DM_BLE_DEV_UNPAIRED_EVT 29 /* BLE unpair event */
|
||||
#define BTA_DM_SP_KEY_REQ_EVT 30 /* Simple Pairing Passkey request */
|
||||
@@ -1111,7 +1117,7 @@ typedef struct {
|
||||
#define BTA_DM_INQ_RES_EVT 0 /* Inquiry result for a peer device. */
|
||||
#define BTA_DM_INQ_CMPL_EVT 1 /* Inquiry complete. */
|
||||
#define BTA_DM_DISC_RES_EVT 2 /* Discovery result for a peer device. */
|
||||
#define BTA_DM_DISC_BLE_RES_EVT 3 /* Discovery result for BLE GATT based servoce on a peer device. */
|
||||
#define BTA_DM_DISC_BLE_RES_EVT 3 /* Discovery result for BLE GATT based service on a peer device. */
|
||||
#define BTA_DM_DISC_CMPL_EVT 4 /* Discovery complete. */
|
||||
#define BTA_DM_DI_DISC_CMPL_EVT 5 /* Discovery complete. */
|
||||
#define BTA_DM_SEARCH_CANCEL_CMPL_EVT 6 /* Search cancelled */
|
||||
@@ -1935,7 +1941,7 @@ extern void BTA_DmDiscoverUUID(BD_ADDR bd_addr, tSDP_UUID *uuid,
|
||||
**
|
||||
** Function BTA_DmGetCachedRemoteName
|
||||
**
|
||||
** Description Retieve cached remote name if available
|
||||
** Description Retrieve cached remote name if available
|
||||
**
|
||||
** Returns BTA_SUCCESS if cached name was retrieved
|
||||
** BTA_FAILURE if cached name is not available
|
||||
@@ -2286,7 +2292,7 @@ extern void BTA_DmBleSetBgConnType(tBTA_DM_BLE_CONN_TYPE bg_conn_type, tBTA_DM_B
|
||||
** Description Send BLE SMP passkey reply.
|
||||
**
|
||||
** Parameters: bd_addr - BD address of the peer
|
||||
** accept - passkey entry sucessful or declined.
|
||||
** accept - passkey entry successful or declined.
|
||||
** passkey - passkey value, must be a 6 digit number,
|
||||
** can be lead by 0.
|
||||
**
|
||||
@@ -2452,7 +2458,7 @@ extern void BTA_DmSetBleScanFilterParams(tGATT_IF client_if, UINT32 scan_interva
|
||||
**
|
||||
** Parameters: adv_int_min - adv interval minimum
|
||||
** adv_int_max - adv interval max
|
||||
** p_dir_bda - directed adv initator address
|
||||
** p_dir_bda - directed adv initiator address
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
@@ -2478,7 +2484,7 @@ extern void BTA_DmSetBleAdvParamsAll (UINT16 adv_int_min, UINT16 adv_int_max,
|
||||
** services: if service is not empty, service discovery will be done.
|
||||
** for all GATT based service condition, put num_uuid, and
|
||||
** p_uuid is the pointer to the list of UUID values.
|
||||
** p_cback: callback functino when search is completed.
|
||||
** p_cback: callback function when search is completed.
|
||||
**
|
||||
**
|
||||
**
|
||||
@@ -2537,7 +2543,7 @@ extern void BTA_DmDiscoverByTransport(BD_ADDR bd_addr, tBTA_SERVICE_MASK_EXT *p_
|
||||
**
|
||||
** Parameters: bd_addr - Address of the peer device
|
||||
** transport - transport of the link to be encruypted
|
||||
** p_callback - Pointer to callback function to indicat the
|
||||
** p_callback - Pointer to callback function to indicate the
|
||||
** link encryption status
|
||||
** sec_act - This is the security action to indicate
|
||||
** what knid of BLE security level is required for
|
||||
@@ -2594,7 +2600,11 @@ extern void BTA_DmBleStopAdvertising(void);
|
||||
|
||||
extern void BTA_DmSetRandAddress(BD_ADDR rand_addr, tBTA_SET_RAND_ADDR_CBACK *p_set_rand_addr_cback);
|
||||
extern void BTA_DmClearRandAddress(void);
|
||||
|
||||
extern void BTA_DmBleSetRpaTimeout(uint16_t rpa_timeout,tBTA_SET_RPA_TIMEOUT_CMPL_CBACK *p_set_rpa_timeout_cback);
|
||||
extern void BTA_DmBleAddDevToResolvingList(BD_ADDR addr,
|
||||
uint8_t addr_type,
|
||||
PEER_IRK irk,
|
||||
tBTA_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *add_dev_to_resolving_list_callback);
|
||||
#endif
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
@@ -2605,7 +2615,7 @@ extern void BTA_DmClearRandAddress(void);
|
||||
**
|
||||
** Description Enable/disable privacy on the local device
|
||||
**
|
||||
** Parameters: privacy_enable - enable/disabe privacy on remote device.
|
||||
** Parameters: privacy_enable - enable/disable privacy on remote device.
|
||||
** set_local_privacy_cback -callback to be called with result
|
||||
** Returns void
|
||||
**
|
||||
@@ -2632,7 +2642,7 @@ extern void BTA_DmBleConfigLocalIcon(uint16_t icon);
|
||||
** Description Enable/disable privacy on a remote device
|
||||
**
|
||||
** Parameters: bd_addr - BD address of the peer
|
||||
** privacy_enable - enable/disabe privacy on remote device.
|
||||
** privacy_enable - enable/disable privacy on remote device.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
@@ -2867,6 +2877,8 @@ extern void BTA_DmBleDtmTxStart(uint8_t tx_channel, uint8_t len_of_data, uint8_t
|
||||
extern void BTA_DmBleDtmRxStart(uint8_t rx_channel, tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback);
|
||||
extern void BTA_DmBleDtmStop(tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback);
|
||||
|
||||
extern void BTA_DmBleSetPrivacyMode(uint8_t addr_type, BD_ADDR addr, uint8_t privacy_mode, tBTA_SET_PRIVACY_MODE_CMPL_CBACK *p_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleSetStorageParams
|
||||
|
||||
@@ -891,6 +891,40 @@ static void btc_set_local_privacy_callback(UINT8 status)
|
||||
}
|
||||
}
|
||||
|
||||
static void btc_set_rpa_timeout_callback(UINT8 status)
|
||||
{
|
||||
esp_ble_gap_cb_param_t param;
|
||||
bt_status_t ret;
|
||||
btc_msg_t msg = {0};
|
||||
msg.sig = BTC_SIG_API_CB;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = ESP_GAP_BLE_SET_RPA_TIMEOUT_COMPLETE_EVT;
|
||||
param.set_rpa_timeout_cmpl.status = btc_btm_status_to_esp_status(status);
|
||||
ret = btc_transfer_context(&msg, ¶m,
|
||||
sizeof(esp_ble_gap_cb_param_t), NULL, NULL);
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
static void btc_add_dev_to_resolving_list_callback(UINT8 status)
|
||||
{
|
||||
esp_ble_gap_cb_param_t param;
|
||||
bt_status_t ret;
|
||||
btc_msg_t msg = {0};
|
||||
|
||||
msg.sig = BTC_SIG_API_CB;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = ESP_GAP_BLE_ADD_DEV_TO_RESOLVING_LIST_COMPLETE_EVT;
|
||||
|
||||
param.add_dev_to_resolving_list_cmpl.status = btc_btm_status_to_esp_status(status);
|
||||
|
||||
ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL, NULL);
|
||||
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
static void btc_set_encryption_callback(BD_ADDR bd_addr, tBTA_TRANSPORT transport, tBTA_STATUS enc_status)
|
||||
@@ -1292,6 +1326,25 @@ static void btc_ble_vendor_hci_cmd_complete_callback(tBTA_VSC_CMPL *p_param)
|
||||
}
|
||||
}
|
||||
|
||||
static void btc_ble_set_privacy_mode_callback(UINT8 status)
|
||||
{
|
||||
esp_ble_gap_cb_param_t param;
|
||||
bt_status_t ret;
|
||||
btc_msg_t msg = {0};
|
||||
|
||||
msg.sig = BTC_SIG_API_CB;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT;
|
||||
|
||||
param.set_privacy_mode_cmpl.status = btc_btm_status_to_esp_status(status);
|
||||
|
||||
ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL, NULL);
|
||||
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
void btc_get_whitelist_size(uint16_t *length)
|
||||
{
|
||||
BTM_BleGetWhiteListSize(length);
|
||||
@@ -1405,6 +1458,19 @@ static void btc_ble_set_rand_addr (BD_ADDR rand_addr, tBTA_SET_RAND_ADDR_CBACK *
|
||||
}
|
||||
}
|
||||
|
||||
static void btc_ble_set_rpa_timeout(uint16_t rpa_timeout,tBTA_SET_RPA_TIMEOUT_CMPL_CBACK *set_rpa_timeout_cback)
|
||||
{
|
||||
BTA_DmBleSetRpaTimeout(rpa_timeout,set_rpa_timeout_cback);
|
||||
}
|
||||
|
||||
static void btc_ble_add_device_to_resolving_list(BD_ADDR addr,
|
||||
uint8_t addr_type,
|
||||
uint8_t irk[],
|
||||
tBTA_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *add_dev_to_resolving_list_callback)
|
||||
{
|
||||
BTA_DmBleAddDevToResolvingList(addr, addr_type, irk, add_dev_to_resolving_list_callback);
|
||||
}
|
||||
|
||||
static void btc_ble_clear_rand_addr (void)
|
||||
{
|
||||
BTA_DmClearRandAddress();
|
||||
@@ -1457,6 +1523,13 @@ static void btc_ble_dtm_stop(tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
|
||||
BTA_DmBleDtmStop(p_dtm_cmpl_cback);
|
||||
}
|
||||
|
||||
static void btc_ble_set_privacy_mode(uint8_t addr_type,
|
||||
BD_ADDR addr,
|
||||
uint8_t privacy_mode,
|
||||
tBTA_SET_PRIVACY_MODE_CMPL_CBACK *p_cback)
|
||||
{
|
||||
BTA_DmBleSetPrivacyMode(addr_type, addr, privacy_mode, p_cback);
|
||||
}
|
||||
|
||||
void btc_gap_ble_cb_handler(btc_msg_t *msg)
|
||||
{
|
||||
@@ -1465,7 +1538,7 @@ void btc_gap_ble_cb_handler(btc_msg_t *msg)
|
||||
if (msg->act < ESP_GAP_BLE_EVT_MAX) {
|
||||
btc_gap_ble_cb_to_app(msg->act, param);
|
||||
} else {
|
||||
BTC_TRACE_ERROR("%s, unknow msg->act = %d", __func__, msg->act);
|
||||
BTC_TRACE_ERROR("%s, unknown msg->act = %d", __func__, msg->act);
|
||||
}
|
||||
|
||||
btc_gap_ble_cb_deep_free(msg);
|
||||
@@ -1879,6 +1952,17 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
|
||||
btc_ble_set_rand_addr(bd_addr, btc_set_rand_addr_callback);
|
||||
break;
|
||||
}
|
||||
case BTC_GAP_BLE_ACT_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT: {
|
||||
btc_ble_set_rpa_timeout(arg->set_rpa_timeout.rpa_timeout,btc_set_rpa_timeout_callback);
|
||||
break;
|
||||
}
|
||||
case BTC_GAP_BLE_ACT_ADD_DEVICE_TO_RESOLVING_LIST: {
|
||||
btc_ble_add_device_to_resolving_list(arg->add_dev_to_resolving_list.addr,
|
||||
arg->add_dev_to_resolving_list.addr_type,
|
||||
arg->add_dev_to_resolving_list.irk,
|
||||
btc_add_dev_to_resolving_list_callback);
|
||||
break;
|
||||
}
|
||||
case BTC_GAP_BLE_ACT_CLEAR_RAND_ADDRESS: {
|
||||
btc_ble_clear_rand_addr();
|
||||
break;
|
||||
@@ -2296,6 +2380,10 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
|
||||
arg->vendor_cmd_send.p_param_buf,
|
||||
btc_ble_vendor_hci_cmd_complete_callback);
|
||||
break;
|
||||
case BTC_GAP_BLE_SET_PRIVACY_MODE:
|
||||
btc_ble_set_privacy_mode(arg->set_privacy_mode.addr_type, arg->set_privacy_mode.addr,
|
||||
arg->set_privacy_mode.privacy_mode, btc_ble_set_privacy_mode_callback);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -2306,6 +2394,7 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
|
||||
//register connection parameter update callback
|
||||
void btc_gap_callback_init(void)
|
||||
{
|
||||
BTM_BleRegiseterPktLengthChangeCallback(btc_set_pkt_length_callback);
|
||||
BTM_BleRegiseterConnParamCallback(btc_update_conn_param_callback);
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
BTM_BleGapRegisterCallback(btc_ble_5_gap_callback);
|
||||
|
||||
@@ -102,7 +102,10 @@ typedef enum {
|
||||
#if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
BTC_GAP_BLE_ACT_CLEAR_ADV,
|
||||
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)
|
||||
BTC_GAP_BLE_ACT_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT,
|
||||
BTC_GAP_BLE_ACT_ADD_DEVICE_TO_RESOLVING_LIST,
|
||||
BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT,
|
||||
BTC_GAP_BLE_SET_PRIVACY_MODE,
|
||||
} btc_gap_ble_act_t;
|
||||
|
||||
/* btc_ble_gap_args_t */
|
||||
@@ -140,6 +143,16 @@ typedef union {
|
||||
struct set_rand_addr_args {
|
||||
esp_bd_addr_t rand_addr;
|
||||
} set_rand_addr;
|
||||
// BTC_GAP_BLE_ACT_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT
|
||||
struct set_rpa_timeout_args {
|
||||
uint16_t rpa_timeout;
|
||||
} set_rpa_timeout;
|
||||
//BTC_GAP_BLE_ACT_ADD_DEVICE_TO_RESOLVING_LIST
|
||||
struct add_dev_to_resolving_list_args {
|
||||
esp_bd_addr_t addr;
|
||||
uint8_t addr_type;
|
||||
uint8_t irk[PEER_IRK_LEN];
|
||||
} add_dev_to_resolving_list;
|
||||
//BTC_GAP_BLE_ACT_CONFIG_LOCAL_PRIVACY,
|
||||
struct cfg_local_privacy_args {
|
||||
bool privacy_enable;
|
||||
@@ -255,9 +268,15 @@ typedef union {
|
||||
uint8_t param_len;
|
||||
uint8_t *p_param_buf;
|
||||
} vendor_cmd_send;
|
||||
// BTC_GAP_BLE_SET_PRIVACY_MODE
|
||||
struct set_privacy_mode {
|
||||
esp_ble_addr_type_t addr_type;
|
||||
esp_bd_addr_t addr;
|
||||
uint8_t privacy_mode;
|
||||
} set_privacy_mode;
|
||||
} btc_ble_gap_args_t;
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
typedef union {
|
||||
struct read_phy_args {
|
||||
esp_bd_addr_t bd_addr;
|
||||
|
||||
@@ -70,7 +70,7 @@ static tBTM_BLE_VSC_CB *cmn_ble_gap_vsc_cb_ptr;
|
||||
static tBTM_BLE_CTRL_FEATURES_CBACK *p_ctrl_le_feature_rd_cmpl_cback = NULL;
|
||||
#endif
|
||||
|
||||
tBTM_CallbackFunc conn_param_update_cb;
|
||||
tBTM_CallbackFunc conn_callback_func;
|
||||
/*******************************************************************************
|
||||
** Local functions
|
||||
*******************************************************************************/
|
||||
@@ -309,7 +309,21 @@ void btm_ble_sem_free(void)
|
||||
*******************************************************************************/
|
||||
void BTM_BleRegiseterConnParamCallback(tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb)
|
||||
{
|
||||
conn_param_update_cb.update_conn_param_cb = update_conn_param_cb;
|
||||
conn_callback_func.update_conn_param_cb = update_conn_param_cb;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleRegiseterPktLengthChangeCallback
|
||||
**
|
||||
** Description Registers a callback function for packet length changes.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTM_BleRegiseterPktLengthChangeCallback(tBTM_SET_PKT_DATA_LENGTH_CBACK *ptk_len_chane_cb)
|
||||
{
|
||||
conn_callback_func.set_pkt_data_length_cb = ptk_len_chane_cb;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -1333,7 +1347,7 @@ tBTM_STATUS BTM_BleSetConnectableMode(tBTM_BLE_CONN_MODE connectable_mode)
|
||||
**
|
||||
** Function btm_set_conn_mode_adv_init_addr
|
||||
**
|
||||
** Description set initator address type and local address type based on adv
|
||||
** Description set initiator address type and local address type based on adv
|
||||
** mode.
|
||||
**
|
||||
**
|
||||
@@ -2001,7 +2015,7 @@ tBTM_STATUS BTM_BleSetRandAddress(BD_ADDR rand_addr)
|
||||
}
|
||||
|
||||
if (btm_cb.ble_ctr_cb.inq_var.state != BTM_BLE_IDLE) {
|
||||
BTM_TRACE_ERROR("Advertising or scaning now, can't set randaddress %d", btm_cb.ble_ctr_cb.inq_var.state);
|
||||
BTM_TRACE_ERROR("Advertising or scanning now, can't set randaddress %d", btm_cb.ble_ctr_cb.inq_var.state);
|
||||
return BTM_SET_STATIC_RAND_ADDR_FAIL;
|
||||
}
|
||||
memcpy(btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr, rand_addr, BD_ADDR_LEN);
|
||||
@@ -2030,7 +2044,7 @@ void BTM_BleClearRandAddress(void)
|
||||
{
|
||||
tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
|
||||
if (btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type == BLE_ADDR_RANDOM && (p_cb->inq_var.state != BTM_BLE_IDLE)) {
|
||||
BTM_TRACE_ERROR("Advertising or scaning now, can't restore public address ");
|
||||
BTM_TRACE_ERROR("Advertising or scanning now, can't restore public address ");
|
||||
return;
|
||||
}
|
||||
memset(btm_cb.ble_ctr_cb.addr_mgnt_cb.static_rand_addr, 0, BD_ADDR_LEN);
|
||||
@@ -3729,7 +3743,7 @@ static void btm_ble_process_adv_pkt_cont(BD_ADDR bda, UINT8 addr_type, UINT8 evt
|
||||
/* never been report as an LE device */
|
||||
if (p_i &&
|
||||
(!(p_i->inq_info.results.device_type & BT_DEVICE_TYPE_BLE) ||
|
||||
/* scan repsonse to be updated */
|
||||
/* scan response to be updated */
|
||||
(!p_i->scan_rsp))) {
|
||||
update = TRUE;
|
||||
} else if (BTM_BLE_IS_DISCO_ACTIVE(btm_cb.ble_ctr_cb.scan_activity)) {
|
||||
@@ -4003,7 +4017,7 @@ static void btm_ble_stop_discover(void)
|
||||
**
|
||||
** Description Set or clear adv states in topology mask
|
||||
**
|
||||
** Returns operation status. TRUE if sucessful, FALSE otherwise.
|
||||
** Returns operation status. TRUE if successful, FALSE otherwise.
|
||||
**
|
||||
*******************************************************************************/
|
||||
typedef BOOLEAN (BTM_TOPOLOGY_FUNC_PTR)(tBTM_BLE_STATE_MASK);
|
||||
@@ -4264,7 +4278,7 @@ void btm_ble_timeout(TIMER_LIST_ENT *p_tle)
|
||||
break;
|
||||
|
||||
case BTU_TTYPE_BLE_GAP_LIM_DISC:
|
||||
/* lim_timeout expiried, limited discovery should exit now */
|
||||
/* lim_timeout expired, limited discovery should exit now */
|
||||
btm_cb.btm_inq_vars.discoverable_mode &= ~BTM_BLE_LIMITED_DISCOVERABLE;
|
||||
btm_ble_set_adv_flag(btm_cb.btm_inq_vars.connectable_mode, btm_cb.btm_inq_vars.discoverable_mode);
|
||||
break;
|
||||
@@ -4703,6 +4717,40 @@ BOOLEAN BTM_BleClearAdv(tBTM_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback)
|
||||
p_cb->inq_var.p_clear_adv_cb = p_clear_adv_cback;
|
||||
return TRUE;
|
||||
}
|
||||
BOOLEAN BTM_BleSetRpaTimeout(uint16_t rpa_timeout,tBTM_SET_RPA_TIMEOUT_CMPL_CBACK *p_set_rpa_timeout_cback)
|
||||
{
|
||||
if ((btsnd_hcic_ble_set_rand_priv_addr_timeout(rpa_timeout)) != TRUE) {
|
||||
BTM_TRACE_ERROR("Set RPA Timeout error, rpa_timeout:0x%04x",rpa_timeout);
|
||||
return FALSE;
|
||||
}
|
||||
btm_cb.devcb.p_ble_set_rpa_timeout_cmpl_cb = p_set_rpa_timeout_cback;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN BTM_BleAddDevToResolvingList(BD_ADDR addr,
|
||||
uint8_t addr_type,
|
||||
uint8_t irk[],
|
||||
tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *p_add_dev_to_resolving_list_callback)
|
||||
{
|
||||
UINT8 *local_irk = btm_cb.devcb.id_keys.irk;
|
||||
if ((btsnd_hcic_ble_add_device_resolving_list(addr_type, addr, irk, local_irk)) != TRUE) {
|
||||
BTM_TRACE_ERROR("Add device to resolving list error");
|
||||
return FALSE;
|
||||
}
|
||||
btm_cb.devcb.p_add_dev_to_resolving_list_cmpl_cb = p_add_dev_to_resolving_list_callback;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN BTM_BleSetPrivacyMode(UINT8 addr_type, BD_ADDR bd_addr, UINT8 privacy_mode, tBTM_SET_PRIVACY_MODE_CMPL_CBACK *p_callback)
|
||||
{
|
||||
if (btsnd_hcic_ble_set_privacy_mode(addr_type, bd_addr, privacy_mode) != TRUE) {
|
||||
BTM_TRACE_ERROR("LE SetPrivacyMode Mode=%d: error", privacy_mode);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
btm_cb.devcb.p_set_privacy_mode_cmpl_cb = p_callback;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool btm_ble_adv_pkt_ready(void)
|
||||
{
|
||||
|
||||
@@ -275,6 +275,14 @@ void btm_ble_add_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len)
|
||||
{
|
||||
UINT8 status;
|
||||
STREAM_TO_UINT8(status, p);
|
||||
if (btm_cb.devcb.p_add_dev_to_resolving_list_cmpl_cb) {
|
||||
tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *p_cb = btm_cb.devcb.p_add_dev_to_resolving_list_cmpl_cb;
|
||||
if (p_cb) {
|
||||
(*p_cb)(status);
|
||||
}
|
||||
} else {
|
||||
BTM_TRACE_DEBUG("no resolving list callback");
|
||||
}
|
||||
|
||||
BTM_TRACE_DEBUG("%s status = %d", __func__, status);
|
||||
|
||||
@@ -416,6 +424,64 @@ void btm_ble_set_addr_resolution_enable_complete(UINT8 *p, UINT16 evt_len)
|
||||
random_cb->set_local_privacy_cback(BTM_ILLEGAL_VALUE);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_ble_set_rpa_timeout_complete
|
||||
**
|
||||
** Description This function is called when the LE Set Resolvable Private
|
||||
** Address Timeout command completes.
|
||||
**
|
||||
** Parameters p: Pointer to the command complete event data.
|
||||
** evt_len: Length of the event data.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btm_ble_set_rpa_timeout_complete(UINT8 *p, UINT16 evt_len)
|
||||
{
|
||||
UINT8 status;
|
||||
|
||||
// Extract the status of the command completion from the event data
|
||||
STREAM_TO_UINT8(status, p);
|
||||
|
||||
BTM_TRACE_DEBUG("%s status = %d", __func__, status);
|
||||
|
||||
tBTM_SET_RPA_TIMEOUT_CMPL_CBACK *p_cb = btm_cb.devcb.p_ble_set_rpa_timeout_cmpl_cb;
|
||||
|
||||
if (p_cb) {
|
||||
(*p_cb)(status);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btm_ble_set_privacy_mode_complete
|
||||
**
|
||||
** Description This function is called when the LE Set Privacy Mode command completes.
|
||||
**
|
||||
** Parameters p: Pointer to the command complete event data.
|
||||
** evt_len: Length of the event data.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void btm_ble_set_privacy_mode_complete(UINT8 *p, UINT16 evt_len)
|
||||
{
|
||||
UINT8 status;
|
||||
|
||||
// Extract the status of the command completion from the event data
|
||||
STREAM_TO_UINT8(status, p);
|
||||
|
||||
BTM_TRACE_DEBUG("%s status = 0x%x", __func__, status);
|
||||
|
||||
tBTM_SET_PRIVACY_MODE_CMPL_CBACK *p_cb = btm_cb.devcb.p_set_privacy_mode_cmpl_cb;
|
||||
|
||||
if (p_cb) {
|
||||
(*p_cb)(status);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
VSC that implement controller based privacy
|
||||
********************************************************************************/
|
||||
@@ -459,7 +525,7 @@ void btm_ble_resolving_list_vsc_op_cmpl (tBTM_VSC_CMPL *p_params)
|
||||
** Description This function to remove an IRK entry from the list
|
||||
**
|
||||
** Parameters ble_addr_type: address type
|
||||
** ble_addr: LE adddress
|
||||
** ble_addr: LE address
|
||||
**
|
||||
** Returns status
|
||||
**
|
||||
@@ -949,7 +1015,7 @@ void btm_ble_enable_resolving_list(UINT8 rl_mask)
|
||||
**
|
||||
** Function btm_ble_resolving_list_empty
|
||||
**
|
||||
** Description check to see if resoving list is empty or not
|
||||
** Description check to see if resolving list is empty or not
|
||||
**
|
||||
** Returns TRUE: empty; FALSE non-empty
|
||||
**
|
||||
@@ -1074,7 +1140,7 @@ void btm_ble_add_default_entry_to_resolving_list(void)
|
||||
/*
|
||||
* Add local IRK entry with 00:00:00:00:00:00 address. This entry will
|
||||
* be used to generate RPA for non-directed advertising if own_addr_type
|
||||
* is set to rpa_pub since we use all-zero address as peer addres in
|
||||
* is set to rpa_pub since we use all-zero address as peer address in
|
||||
* such case. Peer IRK should be left all-zero since this is not for an
|
||||
* actual peer.
|
||||
*/
|
||||
|
||||
@@ -313,7 +313,7 @@ typedef struct {
|
||||
#define BTM_PRIVACY_NONE 0 /* BLE no privacy */
|
||||
#define BTM_PRIVACY_1_1 1 /* BLE privacy 1.1, do not support privacy 1.0 */
|
||||
#define BTM_PRIVACY_1_2 2 /* BLE privacy 1.2 */
|
||||
#define BTM_PRIVACY_MIXED 3 /* BLE privacy mixed mode, broadcom propietary mode */
|
||||
#define BTM_PRIVACY_MIXED 3 /* BLE privacy mixed mode, broadcom proprietary mode */
|
||||
typedef UINT8 tBTM_PRIVACY_MODE;
|
||||
|
||||
/* data length change event callback */
|
||||
@@ -486,6 +486,7 @@ void btm_ble_refresh_peer_resolvable_private_addr(BD_ADDR pseudo_bda, BD_ADDR rr
|
||||
void btm_ble_refresh_local_resolvable_private_addr(BD_ADDR pseudo_addr, BD_ADDR local_rpa);
|
||||
void btm_ble_read_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len) ;
|
||||
void btm_ble_set_addr_resolution_enable_complete(UINT8 *p, UINT16 evt_len) ;
|
||||
void btm_ble_set_rpa_timeout_complete(UINT8 *p, UINT16 evt_len) ;
|
||||
void btm_ble_remove_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len);
|
||||
void btm_ble_add_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len);
|
||||
void btm_ble_clear_resolving_list_complete(UINT8 *p, UINT16 evt_len);
|
||||
@@ -496,6 +497,7 @@ void btm_ble_enable_resolving_list_for_platform (UINT8 rl_mask);
|
||||
void btm_ble_resolving_list_init(UINT8 max_irk_list_sz);
|
||||
void btm_ble_resolving_list_cleanup(void);
|
||||
void btm_ble_add_default_entry_to_resolving_list(void);
|
||||
void btm_ble_set_privacy_mode_complete(UINT8 *p, UINT16 evt_len);
|
||||
#endif
|
||||
|
||||
void btm_ble_multi_adv_configure_rpa (tBTM_BLE_MULTI_ADV_INST *p_inst);
|
||||
|
||||
@@ -231,6 +231,13 @@ TIMER_LIST_ENT ble_channels_timer;
|
||||
tBTM_CMPL_CB *p_ble_channels_cmpl_cb; /* Callback function to be called When
|
||||
ble set host channels is completed */
|
||||
|
||||
tBTM_SET_RPA_TIMEOUT_CMPL_CBACK *p_ble_set_rpa_timeout_cmpl_cb; /* Callback function to be called When
|
||||
ble set rpa timeout is completed */
|
||||
|
||||
tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *p_add_dev_to_resolving_list_cmpl_cb;
|
||||
|
||||
tBTM_SET_PRIVACY_MODE_CMPL_CBACK *p_set_privacy_mode_cmpl_cb;
|
||||
|
||||
tBTM_CMPL_CB *p_le_test_cmd_cmpl_cb; /* Callback function to be called when
|
||||
LE test mode command has been sent successfully */
|
||||
|
||||
@@ -355,7 +362,7 @@ typedef struct {
|
||||
UINT8 inqfilt_type; /* Contains the inquiry filter type (BD ADDR, COD, or Clear) */
|
||||
|
||||
#define BTM_INQ_INACTIVE_STATE 0
|
||||
#define BTM_INQ_CLR_FILT_STATE 1 /* Currently clearing the inquiry filter preceeding the inquiry request */
|
||||
#define BTM_INQ_CLR_FILT_STATE 1 /* Currently clearing the inquiry filter preceding the inquiry request */
|
||||
/* (bypassed if filtering is not used) */
|
||||
#define BTM_INQ_SET_FILT_STATE 2 /* Sets the new filter (or turns off filtering) in this state */
|
||||
#define BTM_INQ_ACTIVE_STATE 3 /* Actual inquiry or periodic inquiry is in progress */
|
||||
@@ -950,8 +957,8 @@ typedef struct {
|
||||
UINT8 acl_disc_reason;
|
||||
UINT8 trace_level;
|
||||
UINT8 busy_level; /* the current busy level */
|
||||
BOOLEAN is_paging; /* TRUE, if paging is in progess */
|
||||
BOOLEAN is_inquiry; /* TRUE, if inquiry is in progess */
|
||||
BOOLEAN is_paging; /* TRUE, if paging is in progress */
|
||||
BOOLEAN is_inquiry; /* TRUE, if inquiry is in progress */
|
||||
fixed_queue_t *page_queue;
|
||||
BOOLEAN paging;
|
||||
BOOLEAN discing;
|
||||
@@ -964,9 +971,11 @@ typedef struct {
|
||||
typedef struct{
|
||||
//connection parameters update callback
|
||||
tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb;
|
||||
// setting packet data length callback
|
||||
tBTM_SET_PKT_DATA_LENGTH_CBACK *set_pkt_data_length_cb;
|
||||
}tBTM_CallbackFunc;
|
||||
|
||||
extern tBTM_CallbackFunc conn_param_update_cb;
|
||||
extern tBTM_CallbackFunc conn_callback_func;
|
||||
/* security action for L2CAP COC channels */
|
||||
#define BTM_SEC_OK 1
|
||||
#define BTM_SEC_ENCRYPT 2 /* encrypt the link with current key */
|
||||
|
||||
@@ -1088,7 +1088,12 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
|
||||
btm_ble_set_addr_resolution_enable_complete(p, evt_len);
|
||||
break;
|
||||
case HCI_BLE_SET_RAND_PRIV_ADDR_TIMOUT:
|
||||
btm_ble_set_rpa_timeout_complete(p, evt_len);
|
||||
break;
|
||||
case HCI_BLE_SET_PRIVACY_MODE:
|
||||
btm_ble_set_privacy_mode_complete(p, evt_len);
|
||||
break;
|
||||
#endif // #if (defined BLE_PRIVACY_SPT && BLE_PRIVACY_SPT == TRUE)
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
case HCI_BLE_SET_EXT_ADV_PARAM:
|
||||
case HCI_BLE_SET_EXT_ADV_DATA:
|
||||
@@ -1128,7 +1133,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
|
||||
break;
|
||||
}
|
||||
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
#endif
|
||||
#endif /* (BLE_INCLUDED == TRUE) */
|
||||
|
||||
default: {
|
||||
@@ -1457,7 +1461,6 @@ static void btu_hcif_command_status_evt(uint8_t status, BT_HDR *command, void *c
|
||||
hack->context = context;
|
||||
|
||||
event->event = BTU_POST_TO_TASK_NO_GOOD_HORRIBLE_HACK;
|
||||
|
||||
if (btu_task_post(SIG_BTU_HCI_MSG, event, OSI_THREAD_MAX_TIMEOUT) == false) {
|
||||
osi_free(event);
|
||||
}
|
||||
|
||||
@@ -1909,4 +1909,28 @@ UINT8 btsnd_hcic_ble_set_default_periodic_adv_sync_trans_params(UINT8 mode, UINT
|
||||
return btu_hcif_send_cmd_sync(LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
}
|
||||
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
|
||||
UINT8 btsnd_hcic_ble_set_privacy_mode(UINT8 addr_type, BD_ADDR addr, UINT8 privacy_mode)
|
||||
{
|
||||
BT_HDR *p;
|
||||
UINT8 *pp;
|
||||
|
||||
if ((p = HCI_GET_CMD_BUF (HCIC_PARAM_SIZE_SET_PRIVACY_MODE)) == NULL) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
pp = (UINT8 *)(p + 1);
|
||||
p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SET_PRIVACY_MODE;
|
||||
p->offset = 0;
|
||||
|
||||
UINT16_TO_STREAM(pp, HCI_BLE_SET_PRIVACY_MODE);
|
||||
UINT8_TO_STREAM(pp, HCIC_PARAM_SIZE_SET_PRIVACY_MODE);
|
||||
|
||||
UINT8_TO_STREAM(pp, addr_type);
|
||||
BDADDR_TO_STREAM(pp, addr);
|
||||
UINT8_TO_STREAM(pp, privacy_mode);
|
||||
|
||||
btu_hcif_send_cmd(LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||
return (TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -678,6 +678,11 @@ typedef void (BT_LOG_FUNC) (int trace_type, const char *fmt_str, ...);
|
||||
typedef uint8_t BD_ADDR[BD_ADDR_LEN];
|
||||
#endif
|
||||
|
||||
/* peer irk */
|
||||
#ifndef PEER_IRK_LEN
|
||||
#define PEER_IRK_LEN 16
|
||||
typedef uint8_t PEER_IRK[PEER_IRK_LEN];
|
||||
#endif
|
||||
// From bd.c
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
@@ -197,6 +197,9 @@ typedef void (tBTM_UPDATE_WHITELIST_CBACK) (UINT8 status, tBTM_WL_OPERATION wl_o
|
||||
|
||||
typedef void (tBTM_SET_LOCAL_PRIVACY_CBACK) (UINT8 status);
|
||||
|
||||
typedef void (tBTM_SET_RPA_TIMEOUT_CMPL_CBACK) (UINT8 status);
|
||||
|
||||
typedef void (tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK) (UINT8 status);
|
||||
/*******************************
|
||||
** Device Coexist status
|
||||
********************************/
|
||||
@@ -330,7 +333,7 @@ typedef enum {
|
||||
#define BTM_COD_MINOR_CELLULAR 0x04
|
||||
#define BTM_COD_MINOR_CORDLESS 0x08
|
||||
#define BTM_COD_MINOR_SMART_PHONE 0x0C
|
||||
#define BTM_COD_MINOR_WIRED_MDM_V_GTWY 0x10 /* wired modem or voice gatway */
|
||||
#define BTM_COD_MINOR_WIRED_MDM_V_GTWY 0x10 /* wired modem or voice gateway */
|
||||
#define BTM_COD_MINOR_ISDN_ACCESS 0x14
|
||||
|
||||
/* minor device class field for LAN Access Point Major Class */
|
||||
@@ -1593,7 +1596,7 @@ typedef struct {
|
||||
tBTM_AUTH_REQ loc_auth_req; /* Authentication required for local device */
|
||||
tBTM_AUTH_REQ rmt_auth_req; /* Authentication required for peer device */
|
||||
tBTM_IO_CAP loc_io_caps; /* IO Capabilities of the local device */
|
||||
tBTM_IO_CAP rmt_io_caps; /* IO Capabilities of the remot device */
|
||||
tBTM_IO_CAP rmt_io_caps; /* IO Capabilities of the remote device */
|
||||
} tBTM_SP_CFM_REQ;
|
||||
|
||||
/* data type for BTM_SP_KEY_REQ_EVT */
|
||||
@@ -2266,7 +2269,7 @@ UINT8 BTM_SetTraceLevel (UINT8 new_level);
|
||||
**
|
||||
** Function BTM_WritePageTimeout
|
||||
**
|
||||
** Description Send HCI Wite Page Timeout.
|
||||
** Description Send HCI Write Page Timeout.
|
||||
**
|
||||
** Returns
|
||||
** BTM_SUCCESS Command sent.
|
||||
@@ -2458,7 +2461,7 @@ tBTM_STATUS BTM_StartInquiry (tBTM_INQ_PARMS *p_inqparms,
|
||||
** Description This function returns a bit mask of the current inquiry state
|
||||
**
|
||||
** Returns BTM_INQUIRY_INACTIVE if inactive (0)
|
||||
** BTM_LIMITED_INQUIRY_ACTIVE if a limted inquiry is active
|
||||
** BTM_LIMITED_INQUIRY_ACTIVE if a limited inquiry is active
|
||||
** BTM_GENERAL_INQUIRY_ACTIVE if a general inquiry is active
|
||||
** BTM_PERIODIC_INQUIRY_ACTIVE if a periodic inquiry is active
|
||||
**
|
||||
@@ -3598,7 +3601,7 @@ BOOLEAN BTM_SecAddDevice (BD_ADDR bd_addr, DEV_CLASS dev_class,
|
||||
**
|
||||
** Description Free resources associated with the device.
|
||||
**
|
||||
** Returns TRUE if rmoved OK, FALSE if not found
|
||||
** Returns TRUE if removed OK, FALSE if not found
|
||||
**
|
||||
*******************************************************************************/
|
||||
//extern
|
||||
@@ -4244,7 +4247,7 @@ UINT8 BTM_GetEirUuidList( UINT8 *p_eir, UINT8 uuid_size, UINT8 *p_num_uuid,
|
||||
** pointer is used, PCM parameter maintained in
|
||||
** the control block will be used; otherwise update
|
||||
** control block value.
|
||||
** err_data_rpt: Lisbon feature to enable the erronous data report
|
||||
** err_data_rpt: Lisbon feature to enable the erroneous data report
|
||||
** or not.
|
||||
**
|
||||
** Returns BTM_SUCCESS if the successful.
|
||||
|
||||
@@ -144,12 +144,12 @@ typedef UINT8 tBTM_BLE_SFP;
|
||||
#ifndef BTM_BLE_SCAN_FAST_INT
|
||||
#define BTM_BLE_SCAN_FAST_INT 96 /* 30 ~ 60 ms (use 60) = 96 *0.625 */
|
||||
#endif
|
||||
/* default scan window for background connection, applicable for auto connection or selective conenction */
|
||||
/* default scan window for background connection, applicable for auto connection or selective connection */
|
||||
#ifndef BTM_BLE_SCAN_FAST_WIN
|
||||
#define BTM_BLE_SCAN_FAST_WIN 48 /* 30 ms = 48 *0.625 */
|
||||
#endif
|
||||
|
||||
/* default scan paramter used in reduced power cycle (background scanning) */
|
||||
/* default scan parameter used in reduced power cycle (background scanning) */
|
||||
#ifndef BTM_BLE_SCAN_SLOW_INT_1
|
||||
#define BTM_BLE_SCAN_SLOW_INT_1 2048 /* 1.28 s = 2048 *0.625 */
|
||||
#endif
|
||||
@@ -157,7 +157,7 @@ typedef UINT8 tBTM_BLE_SFP;
|
||||
#define BTM_BLE_SCAN_SLOW_WIN_1 48 /* 30 ms = 48 *0.625 */
|
||||
#endif
|
||||
|
||||
/* default scan paramter used in reduced power cycle (background scanning) */
|
||||
/* default scan parameter used in reduced power cycle (background scanning) */
|
||||
#ifndef BTM_BLE_SCAN_SLOW_INT_2
|
||||
#define BTM_BLE_SCAN_SLOW_INT_2 4096 /* 2.56 s = 4096 *0.625 */
|
||||
#endif
|
||||
@@ -460,7 +460,7 @@ typedef struct {
|
||||
} tBTM_BLE_PROPRIETARY;
|
||||
|
||||
typedef struct {
|
||||
tBTM_BLE_INT_RANGE int_range; /* slave prefered conn interval range */
|
||||
tBTM_BLE_INT_RANGE int_range; /* slave preferred conn interval range */
|
||||
tBTM_BLE_MANU *p_manu; /* manufacturer data */
|
||||
tBTM_BLE_SERVICE *p_services; /* services */
|
||||
tBTM_BLE_128SERVICE *p_services_128b; /* 128 bits service */
|
||||
@@ -1006,6 +1006,8 @@ typedef void (tBTM_START_STOP_ADV_CMPL_CBACK) (UINT8 status);
|
||||
|
||||
typedef void (tBTM_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK) (tBTM_STATUS status, uint8_t subcode, uint32_t length, uint8_t *device_info);
|
||||
typedef void (tBTM_CLEAR_ADV_CMPL_CBACK) (UINT8 status);
|
||||
typedef void (tBTM_SET_PRIVACY_MODE_CMPL_CBACK) (tBTM_STATUS status);
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#define BTM_BLE_5_GAP_READ_PHY_COMPLETE_EVT 1
|
||||
#define BTM_BLE_5_GAP_SET_PREFERED_DEFAULT_PHY_COMPLETE_EVT 2
|
||||
@@ -1048,7 +1050,8 @@ typedef void (tBTM_CLEAR_ADV_CMPL_CBACK) (UINT8 status);
|
||||
#define BTM_BLE_GAP_SET_PAST_PARAMS_COMPLETE_EVT 38
|
||||
#define BTM_BLE_GAP_PERIODIC_ADV_SYNC_TRANS_RECV_EVT 39
|
||||
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
#define BTM_BLE_5_GAP_UNKNOWN_EVT 40
|
||||
#define BTM_BLE_GAP_SET_PRIVACY_MODE_COMPLETE_EVT 40
|
||||
#define BTM_BLE_5_GAP_UNKNOWN_EVT 41
|
||||
typedef UINT8 tBTM_BLE_5_GAP_EVENT;
|
||||
|
||||
#define BTM_BLE_EXT_ADV_DATA_COMPLETE 0x00
|
||||
@@ -1366,6 +1369,7 @@ extern "C" {
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTM_BleRegiseterConnParamCallback(tBTM_UPDATE_CONN_PARAM_CBACK *update_conn_param_cb);
|
||||
void BTM_BleRegiseterPktLengthChangeCallback(tBTM_SET_PKT_DATA_LENGTH_CBACK *ptk_len_chane_cb);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -1895,7 +1899,7 @@ void BTM_BleSecureConnectionCreateOobData(void);
|
||||
** Function BTM_BleDataSignature
|
||||
**
|
||||
** Description This function is called to sign the data using AES128 CMAC
|
||||
** algorith.
|
||||
** algorithm.
|
||||
**
|
||||
** Parameter bd_addr: target device the data to be signed for.
|
||||
** p_text: singing data
|
||||
@@ -1903,7 +1907,7 @@ void BTM_BleSecureConnectionCreateOobData(void);
|
||||
** signature: output parameter where data signature is going to
|
||||
** be stored.
|
||||
**
|
||||
** Returns TRUE if signing sucessul, otherwise FALSE.
|
||||
** Returns TRUE if signing successful, otherwise FALSE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
//extern
|
||||
@@ -2393,7 +2397,7 @@ BOOLEAN BTM_UseLeLink (BD_ADDR bd_addr);
|
||||
**
|
||||
** Function BTM_BleStackEnable
|
||||
**
|
||||
** Description Enable/Disable BLE functionality on stack regarless controller
|
||||
** Description Enable/Disable BLE functionality on stack regardless controller
|
||||
** capability.
|
||||
**
|
||||
** Parameters: enable: TRUE to enable, FALSE to disable.
|
||||
@@ -2437,7 +2441,7 @@ BOOLEAN BTM_BleSecurityProcedureIsRunning (BD_ADDR bd_addr);
|
||||
** Function BTM_BleGetSupportedKeySize
|
||||
**
|
||||
** Description This function gets the maximum encryption key size in bytes
|
||||
** the local device can suport.
|
||||
** the local device can support.
|
||||
** record.
|
||||
**
|
||||
** Returns the key size or 0 if the size can't be retrieved.
|
||||
@@ -2472,7 +2476,7 @@ tBTM_STATUS BTM_BleEnableAdvInstance (tBTM_BLE_ADV_PARAMS *p_params,
|
||||
**
|
||||
** Function BTM_BleUpdateAdvInstParam
|
||||
**
|
||||
** Description This function update a Multi-ADV instance with the specififed
|
||||
** Description This function update a Multi-ADV instance with the specified
|
||||
** adv parameters.
|
||||
**
|
||||
** Parameters inst_id: adv instance ID
|
||||
@@ -2548,7 +2552,7 @@ tBTM_STATUS BTM_BleAdvFilterParamSetup(int action,
|
||||
**
|
||||
** Parameters action: to read/write/clear
|
||||
** cond_type: filter condition type.
|
||||
** p_cond: filter condition paramter
|
||||
** p_cond: filter condition parameter
|
||||
**
|
||||
** Returns tBTM_STATUS
|
||||
**
|
||||
@@ -2655,6 +2659,59 @@ BOOLEAN BTM_Ble_Authorization(BD_ADDR bd_addr, BOOLEAN authorize);
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN BTM_BleClearAdv(tBTM_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleSetRpaTimeout
|
||||
**
|
||||
** Description This function is called to set the Resolvable Private Address
|
||||
** (RPA) timeout.
|
||||
**
|
||||
** Parameter rpa_timeout - The timeout value for RPA, typically in seconds.
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN BTM_BleSetRpaTimeout(uint16_t rpa_timeout, tBTM_SET_RPA_TIMEOUT_CMPL_CBACK *p_set_rpa_timeout_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleAddDevToResolvingList
|
||||
**
|
||||
** Description This function is called to add a device to the resolving list
|
||||
** used to generate and resolve Resolvable Private Addresses (RPAs)
|
||||
** in the Bluetooth Controller.
|
||||
**
|
||||
** Parameters addr - The address of the device to be added to the resolving list.
|
||||
** addr_type - The address type of the device (public or random).
|
||||
** irk - The Identity Resolving Key (IRK) of the device.
|
||||
** p_add_dev_to_resolving_list_callback - Callback function to be called when the operation is completed.
|
||||
**
|
||||
** Returns TRUE if the operation was successful, otherwise FALSE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN BTM_BleAddDevToResolvingList(BD_ADDR addr,
|
||||
uint8_t addr_type,
|
||||
uint8_t irk[],
|
||||
tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK *p_add_dev_to_resolving_list_callback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTM_BleSetPrivacyMode
|
||||
**
|
||||
** Description This function is called to set the privacy mode of device in resolving list
|
||||
**
|
||||
** Parameters addr_type - The address type of the device in resolving list (public or random).
|
||||
** addr - The address of the device in resolving list.
|
||||
** privacy_mode - The privacy mode (network or device) of the device.
|
||||
** p_callback - Callback function to be called when the operation is completed.
|
||||
**
|
||||
** Returns TRUE if the operation was successful, otherwise FALSE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN BTM_BleSetPrivacyMode(UINT8 addr_type,
|
||||
BD_ADDR bd_addr,
|
||||
UINT8 privacy_mode,
|
||||
tBTM_SET_PRIVACY_MODE_CMPL_CBACK *p_callback);
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ typedef UINT16 tGATT_DISCONN_REASON;
|
||||
/* max length of an attribute value
|
||||
*/
|
||||
#ifndef GATT_MAX_ATTR_LEN
|
||||
#define GATT_MAX_ATTR_LEN 600
|
||||
#define GATT_MAX_ATTR_LEN 512
|
||||
#endif
|
||||
|
||||
/* default GATT MTU size over LE link
|
||||
@@ -701,7 +701,7 @@ extern UINT8 GATT_SetTraceLevel (UINT8 new_level);
|
||||
**
|
||||
** Function GATTS_AddHandleRange
|
||||
**
|
||||
** Description This function add the allocated handles range for the specifed
|
||||
** Description This function add the allocated handles range for the specified
|
||||
** application UUID, service UUID and service instance
|
||||
**
|
||||
** Parameter p_hndl_range: pointer to allocated handles information
|
||||
@@ -720,7 +720,7 @@ extern BOOLEAN GATTS_AddHandleRange(tGATTS_HNDL_RANGE *p_hndl_range);
|
||||
** NV save callback function. There can be one and only one
|
||||
** NV save callback function.
|
||||
**
|
||||
** Parameter p_cb_info : callback informaiton
|
||||
** Parameter p_cb_info : callback information
|
||||
**
|
||||
** Returns TRUE if registered OK, else FALSE
|
||||
**
|
||||
@@ -1143,7 +1143,7 @@ extern BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, tBLE_ADDR_TYPE b
|
||||
**
|
||||
** Function GATT_CancelConnect
|
||||
**
|
||||
** Description This function terminate the connection initaition to a remote
|
||||
** Description This function terminate the connection initiation to a remote
|
||||
** device on GATT channel.
|
||||
**
|
||||
** Parameters gatt_if: client interface. If 0 used as unconditionally disconnect,
|
||||
|
||||
@@ -383,8 +383,8 @@
|
||||
#define HCI_BLE_RD_TRANSMIT_POWER (0x004B | HCI_GRP_BLE_CMDS)
|
||||
#define HCI_BLE_RD_RF_PATH_COMPENSATION (0x004C | HCI_GRP_BLE_CMDS)
|
||||
#define HCI_BLE_WR_RF_PATH_COMPENSATION (0x004D | HCI_GRP_BLE_CMDS)
|
||||
#define HCI_BLE_SET_PRIVACY_MODE (0x004E | HCI_GRP_BLE_CMDS)
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#define HCI_BLE_SET_PRIVACY_MODE (0x004E | HCI_GRP_BLE_CMDS)
|
||||
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
#define HCI_BLE_SET_PERIOD_ADV_RECV_ENABLE (0x0059 | HCI_GRP_BLE_CMDS)
|
||||
#define HCI_BLE_PERIOD_ADV_SYNC_TRANS (0x005A | HCI_GRP_BLE_CMDS)
|
||||
@@ -1131,18 +1131,18 @@ typedef UINT8 tHCI_STATUS;
|
||||
#define HCI_MIN_INQ_LAP 0x9E8B00
|
||||
#define HCI_MAX_INQ_LAP 0x9E8B3F
|
||||
|
||||
/* HCI role defenitions */
|
||||
/* HCI role definitions */
|
||||
#define HCI_ROLE_MASTER 0x00
|
||||
#define HCI_ROLE_SLAVE 0x01
|
||||
#define HCI_ROLE_UNKNOWN 0xff
|
||||
|
||||
/* HCI mode defenitions */
|
||||
/* HCI mode definitions */
|
||||
#define HCI_MODE_ACTIVE 0x00
|
||||
#define HCI_MODE_HOLD 0x01
|
||||
#define HCI_MODE_SNIFF 0x02
|
||||
#define HCI_MODE_PARK 0x03
|
||||
|
||||
/* HCI Flow Control Mode defenitions */
|
||||
/* HCI Flow Control Mode definitions */
|
||||
#define HCI_PACKET_BASED_FC_MODE 0x00
|
||||
#define HCI_BLOCK_BASED_FC_MODE 0x01
|
||||
|
||||
@@ -1411,7 +1411,7 @@ typedef UINT8 tHCI_STATUS;
|
||||
/* Define an invalid value for a handle */
|
||||
#define HCI_INVALID_HANDLE 0xFFFF
|
||||
|
||||
/* Define max ammount of data in the HCI command */
|
||||
/* Define max amount of data in the HCI command */
|
||||
#define HCI_COMMAND_SIZE 255
|
||||
|
||||
/* Define the preamble length for all HCI Commands.
|
||||
|
||||
@@ -621,7 +621,7 @@ BOOLEAN btsnd_hcic_write_voice_settings(UINT16 flags); /* Write Voice
|
||||
|
||||
|
||||
BOOLEAN btsnd_hcic_write_auto_flush_tout(UINT16 handle,
|
||||
UINT16 timeout); /* Write Retransmit Timout */
|
||||
UINT16 timeout); /* Write Retransmit Timeout */
|
||||
|
||||
#define HCIC_PARAM_SIZE_WRITE_AUTO_FLUSH_TOUT 4
|
||||
|
||||
@@ -754,6 +754,7 @@ void btsnd_hcic_vendor_spec_cmd (BT_HDR *buffer, UINT16 opcode,
|
||||
#define HCIC_PARAM_SIZE_BLE_WRITE_EXTENDED_SCAN_PARAM 11
|
||||
#define HCIC_PARAM_SIZE_BLE_UPDATE_ADV_FLOW_CONTROL 2
|
||||
#define HCIC_PARAM_SIZE_BLE_CLEAR_ADV 0
|
||||
#define HCIC_PARAM_SIZE_SET_PRIVACY_MODE 8
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
#define HCIC_PARAM_SIZE_BLE_READ_PHY 2
|
||||
#define HCIC_PARAM_SIZE_BLE_SET_DEF_PHY 3
|
||||
@@ -1037,6 +1038,8 @@ UINT8 btsnd_hcic_ble_write_rf_path_compensation(UINT16 rf_tx_path, UINT16 rf_rx_
|
||||
|
||||
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
UINT8 btsnd_hcic_ble_set_privacy_mode(UINT8 addr_type, BD_ADDR addr, UINT8 privacy_mode);
|
||||
|
||||
#define HCIC_PARAM_SIZE_WRITE_AUTHENT_PAYLOAD_TOUT 4
|
||||
|
||||
#define HCI__WRITE_AUTHENT_PAYLOAD_TOUT_HANDLE_OFF 0
|
||||
|
||||
@@ -175,14 +175,14 @@ BOOLEAN L2CA_UpdateBleConnParams (BD_ADDR rem_bda, UINT16 min_int, UINT16 max_in
|
||||
L2CAP_TRACE_ERROR("There are two connection parameter requests that are being updated, please try later ");
|
||||
}
|
||||
|
||||
if ((need_cb == TRUE) && (conn_param_update_cb.update_conn_param_cb != NULL)) {
|
||||
if ((need_cb == TRUE) && (conn_callback_func.update_conn_param_cb != NULL)) {
|
||||
tBTM_LE_UPDATE_CONN_PRAMS update_param;
|
||||
update_param.max_conn_int = max_int;
|
||||
update_param.min_conn_int = min_int;
|
||||
update_param.conn_int = p_lcb->current_used_conn_interval;
|
||||
update_param.slave_latency = p_lcb->current_used_conn_latency;
|
||||
update_param.supervision_tout = p_lcb->current_used_conn_timeout;
|
||||
(conn_param_update_cb.update_conn_param_cb)(status, p_lcb->remote_bd_addr, &update_param);
|
||||
(conn_callback_func.update_conn_param_cb)(status, p_lcb->remote_bd_addr, &update_param);
|
||||
return (status == HCI_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ UINT8 L2CA_GetBleConnRole (BD_ADDR bd_addr)
|
||||
**
|
||||
** Function l2cble_notify_le_connection
|
||||
**
|
||||
** Description This function notifiy the l2cap connection to the app layer
|
||||
** Description This function notify the l2cap connection to the app layer
|
||||
**
|
||||
** Returns none
|
||||
**
|
||||
@@ -647,7 +647,7 @@ void l2cble_process_conn_update_evt (UINT16 handle, UINT8 status, UINT16 conn_in
|
||||
p_lcb->conn_update_mask &= ~L2C_BLE_UPDATE_PARAM_FULL;
|
||||
btu_stop_timer(&p_lcb->upda_con_timer);
|
||||
|
||||
if (conn_param_update_cb.update_conn_param_cb != NULL) {
|
||||
if (conn_callback_func.update_conn_param_cb != NULL) {
|
||||
l2c_send_update_conn_params_cb(p_lcb, status);
|
||||
}
|
||||
|
||||
@@ -686,7 +686,7 @@ void l2cble_get_conn_param_format_err_from_contoller (UINT8 status, UINT16 handl
|
||||
|
||||
btu_stop_timer (&p_lcb->upda_con_timer);
|
||||
|
||||
if (conn_param_update_cb.update_conn_param_cb != NULL) {
|
||||
if (conn_callback_func.update_conn_param_cb != NULL) {
|
||||
l2c_send_update_conn_params_cb(p_lcb, status);
|
||||
}
|
||||
if ((p_lcb->conn_update_mask & L2C_BLE_UPDATE_PARAM_FULL) != 0){
|
||||
@@ -868,7 +868,7 @@ void l2cble_process_sig_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len)
|
||||
**
|
||||
** Function l2cble_init_direct_conn
|
||||
**
|
||||
** Description This function is to initate a direct connection
|
||||
** Description This function is to initiate a direct connection
|
||||
**
|
||||
** Returns TRUE connection initiated, FALSE otherwise.
|
||||
**
|
||||
@@ -894,7 +894,7 @@ BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb)
|
||||
|
||||
/* There can be only one BLE connection request outstanding at a time */
|
||||
if (p_dev_rec == NULL) {
|
||||
L2CAP_TRACE_WARNING ("unknown device, can not initate connection");
|
||||
L2CAP_TRACE_WARNING ("unknown device, can not initiate connection");
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
@@ -947,7 +947,7 @@ BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb)
|
||||
|
||||
if (!btm_ble_topology_check(BTM_BLE_STATE_INIT)) {
|
||||
l2cu_release_lcb (p_lcb);
|
||||
L2CAP_TRACE_ERROR("initate direct connection fail, topology limitation");
|
||||
L2CAP_TRACE_ERROR("initiate direct connection fail, topology limitation");
|
||||
return FALSE;
|
||||
}
|
||||
uint32_t link_timeout = L2CAP_BLE_LINK_CONNECT_TOUT;
|
||||
@@ -981,7 +981,7 @@ BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb)
|
||||
BLE_CE_LEN_MIN, /* UINT16 min_len */
|
||||
BLE_CE_LEN_MIN)) { /* UINT16 max_len */
|
||||
l2cu_release_lcb (p_lcb);
|
||||
L2CAP_TRACE_ERROR("initate direct connection fail, no resources");
|
||||
L2CAP_TRACE_ERROR("initiate direct connection fail, no resources");
|
||||
return (FALSE);
|
||||
} else {
|
||||
p_lcb->link_state = LST_CONNECTING;
|
||||
@@ -1033,7 +1033,7 @@ BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb)
|
||||
btm_ble_set_conn_st (BLE_DIR_CONN);
|
||||
if(!btsnd_hcic_ble_create_ext_conn(&aux_conn)) {
|
||||
l2cu_release_lcb (p_lcb);
|
||||
L2CAP_TRACE_ERROR("initate Aux connection failed, no resources");
|
||||
L2CAP_TRACE_ERROR("initiate Aux connection failed, no resources");
|
||||
}
|
||||
#else
|
||||
L2CAP_TRACE_ERROR("BLE 5.0 not support!\n");
|
||||
@@ -1324,15 +1324,18 @@ void l2cble_process_data_length_change_event(UINT16 handle, UINT16 tx_data_len,
|
||||
if(p_acl) {
|
||||
p_acl->data_length_params = data_length_params;
|
||||
if (p_acl->p_set_pkt_data_cback) {
|
||||
// Only when the corresponding API is called will the callback be registered
|
||||
(*p_acl->p_set_pkt_data_cback)(BTM_SUCCESS, &data_length_params);
|
||||
} else {
|
||||
// If the callback is not registered,using global callback
|
||||
(*conn_callback_func.set_pkt_data_length_cb)(BTM_SUCCESS, &data_length_params);
|
||||
}
|
||||
|
||||
p_acl->data_len_updating = false;
|
||||
if(p_acl->data_len_waiting) {
|
||||
p_acl->data_len_waiting = false;
|
||||
p_acl->p_set_pkt_data_cback = p_acl->p_set_data_len_cback_waiting;
|
||||
p_acl->p_set_data_len_cback_waiting = NULL;
|
||||
// if value is same, triger callback directly
|
||||
// if value is same, trigger callback directly
|
||||
if(p_acl->tx_len_waiting == p_acl->data_length_params.tx_len) {
|
||||
if(p_acl->p_set_pkt_data_cback) {
|
||||
(*p_acl->p_set_pkt_data_cback)(BTM_SUCCESS, &p_acl->data_length_params);
|
||||
@@ -1396,7 +1399,7 @@ void l2cble_set_fixed_channel_tx_data_length(BD_ADDR remote_bda, UINT16 fix_cid,
|
||||
*******************************************************************************/
|
||||
void l2c_send_update_conn_params_cb(tL2C_LCB *p_lcb, UINT8 status)
|
||||
{
|
||||
if(conn_param_update_cb.update_conn_param_cb != NULL){
|
||||
if(conn_callback_func.update_conn_param_cb != NULL){
|
||||
tBTM_LE_UPDATE_CONN_PRAMS update_param;
|
||||
//if myself update the connection parameters
|
||||
if (p_lcb->updating_param_flag){
|
||||
@@ -1412,7 +1415,7 @@ void l2c_send_update_conn_params_cb(tL2C_LCB *p_lcb, UINT8 status)
|
||||
update_param.slave_latency = p_lcb->current_used_conn_latency;
|
||||
update_param.supervision_tout = p_lcb->current_used_conn_timeout;
|
||||
|
||||
(conn_param_update_cb.update_conn_param_cb)(status, p_lcb->remote_bd_addr, &update_param);
|
||||
(conn_callback_func.update_conn_param_cb)(status, p_lcb->remote_bd_addr, &update_param);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user