Loading system/btif/src/btif_gatt_util.c +2 −0 Original line number Diff line number Diff line Loading @@ -291,8 +291,10 @@ void btif_gatt_check_encrypted_link (BD_ADDR bd_addr) buf, sizeof(btif_dm_ble_penc_keys_t)) == BT_STATUS_SUCCESS) && !btif_gatt_is_link_encrypted(bd_addr)) { #if (!defined(BLE_DELAY_REQUEST_ENC) || (BLE_DELAY_REQUEST_ENC == FALSE)) BTA_DmSetEncryption(bd_addr, &btif_gatt_set_encryption_cb, BTM_BLE_SEC_ENCRYPT); #endif } } Loading system/include/bt_target.h +6 −0 Original line number Diff line number Diff line Loading @@ -1456,6 +1456,12 @@ and USER_HW_DISABLE_API macros */ #define BLE_PERIPHERAL_ADV_NAME FALSE #endif #ifndef BLE_DELAY_REQUEST_ENC /* This flag is to work around IPHONE problem, We need to wait for iPhone ready before send encryption request to iPhone */ #define BLE_DELAY_REQUEST_ENC FALSE #endif #ifndef GATT_MAX_SR_PROFILES #define GATT_MAX_SR_PROFILES 32 /* max is 32 */ #endif Loading system/stack/gatt/gatt_db.c +24 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include <string.h> #include "gatt_int.h" #include "l2c_api.h" #include "btm_int.h" /******************************************************************************** ** L O C A L F U N C T I O N P R O T O T Y P E S * Loading Loading @@ -329,6 +330,9 @@ tGATT_STATUS gatts_db_read_attr_value_by_type (tGATT_TCB *p_tcb, UINT16 len = 0; UINT8 *p = (UINT8 *)(p_rsp + 1) + p_rsp->len + L2CAP_MIN_OFFSET; tBT_UUID attr_uuid; #if (defined(BLE_DELAY_REQUEST_ENC) && (BLE_DELAY_REQUEST_ENC == TRUE)) UINT8 flag; #endif if (p_db && p_db->p_attr_list) { Loading Loading @@ -393,6 +397,26 @@ tGATT_STATUS gatts_db_read_attr_value_by_type (tGATT_TCB *p_tcb, } } #if (defined(BLE_DELAY_REQUEST_ENC) && (BLE_DELAY_REQUEST_ENC == TRUE)) if (BTM_GetSecurityFlags(p_tcb->peer_bda, &flag)) { if ((p_tcb->att_lcid == L2CAP_ATT_CID) && (status == GATT_PENDING) && (type.uu.uuid16 == GATT_UUID_GAP_DEVICE_NAME)) { if ((flag & (BTM_SEC_LINK_KEY_KNOWN | BTM_SEC_FLAG_ENCRYPTED)) == BTM_SEC_LINK_KEY_KNOWN) { tACL_CONN *p; p = btm_bda_to_acl(p_tcb->peer_bda); if ((p != NULL) && (p->link_role == BTM_ROLE_MASTER)) { tBTM_BLE_SEC_ACT sec_act = BTM_BLE_SEC_ENCRYPT; btm_ble_set_encryption(p_tcb->peer_bda, &sec_act, p->link_role); } } } } #endif return status; } Loading Loading
system/btif/src/btif_gatt_util.c +2 −0 Original line number Diff line number Diff line Loading @@ -291,8 +291,10 @@ void btif_gatt_check_encrypted_link (BD_ADDR bd_addr) buf, sizeof(btif_dm_ble_penc_keys_t)) == BT_STATUS_SUCCESS) && !btif_gatt_is_link_encrypted(bd_addr)) { #if (!defined(BLE_DELAY_REQUEST_ENC) || (BLE_DELAY_REQUEST_ENC == FALSE)) BTA_DmSetEncryption(bd_addr, &btif_gatt_set_encryption_cb, BTM_BLE_SEC_ENCRYPT); #endif } } Loading
system/include/bt_target.h +6 −0 Original line number Diff line number Diff line Loading @@ -1456,6 +1456,12 @@ and USER_HW_DISABLE_API macros */ #define BLE_PERIPHERAL_ADV_NAME FALSE #endif #ifndef BLE_DELAY_REQUEST_ENC /* This flag is to work around IPHONE problem, We need to wait for iPhone ready before send encryption request to iPhone */ #define BLE_DELAY_REQUEST_ENC FALSE #endif #ifndef GATT_MAX_SR_PROFILES #define GATT_MAX_SR_PROFILES 32 /* max is 32 */ #endif Loading
system/stack/gatt/gatt_db.c +24 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include <string.h> #include "gatt_int.h" #include "l2c_api.h" #include "btm_int.h" /******************************************************************************** ** L O C A L F U N C T I O N P R O T O T Y P E S * Loading Loading @@ -329,6 +330,9 @@ tGATT_STATUS gatts_db_read_attr_value_by_type (tGATT_TCB *p_tcb, UINT16 len = 0; UINT8 *p = (UINT8 *)(p_rsp + 1) + p_rsp->len + L2CAP_MIN_OFFSET; tBT_UUID attr_uuid; #if (defined(BLE_DELAY_REQUEST_ENC) && (BLE_DELAY_REQUEST_ENC == TRUE)) UINT8 flag; #endif if (p_db && p_db->p_attr_list) { Loading Loading @@ -393,6 +397,26 @@ tGATT_STATUS gatts_db_read_attr_value_by_type (tGATT_TCB *p_tcb, } } #if (defined(BLE_DELAY_REQUEST_ENC) && (BLE_DELAY_REQUEST_ENC == TRUE)) if (BTM_GetSecurityFlags(p_tcb->peer_bda, &flag)) { if ((p_tcb->att_lcid == L2CAP_ATT_CID) && (status == GATT_PENDING) && (type.uu.uuid16 == GATT_UUID_GAP_DEVICE_NAME)) { if ((flag & (BTM_SEC_LINK_KEY_KNOWN | BTM_SEC_FLAG_ENCRYPTED)) == BTM_SEC_LINK_KEY_KNOWN) { tACL_CONN *p; p = btm_bda_to_acl(p_tcb->peer_bda); if ((p != NULL) && (p->link_role == BTM_ROLE_MASTER)) { tBTM_BLE_SEC_ACT sec_act = BTM_BLE_SEC_ENCRYPT; btm_ble_set_encryption(p_tcb->peer_bda, &sec_act, p->link_role); } } } } #endif return status; } Loading