1 /* 2 * Copyright 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include "stack/include/btm_api_types.h" 20 #include "stack/include/btm_ble_api_types.h" 21 #include "stack/include/hci_error_code.h" 22 23 /**************************************** 24 * Security Manager Callback Functions 25 ****************************************/ 26 /* Authorize device for service. Parameters are 27 * Service Id (NULL - unknown service or unused 28 * [BTM_SEC_SERVICE_NAME_LEN set to 0]) 29 */ 30 typedef uint8_t(tBTM_AUTHORIZE_CALLBACK)(uint8_t service_id); 31 32 /* Get PIN for the connection. Parameters are 33 * BD Address of remote 34 * Device Class of remote 35 * BD Name of remote 36 * Flag indicating the minimum pin code length to be 16 digits 37 */ 38 typedef uint8_t(tBTM_PIN_CALLBACK)(const RawAddress& bd_addr, 39 DEV_CLASS dev_class, tBTM_BD_NAME bd_name, 40 bool min_16_digit); 41 42 /* New Link Key for the connection. Parameters are 43 * BD Address of remote 44 * Link Key 45 * Key Type: Combination, Local Unit, or Remote Unit 46 */ 47 typedef uint8_t(tBTM_LINK_KEY_CALLBACK)(const RawAddress& bd_addr, 48 DEV_CLASS dev_class, 49 tBTM_BD_NAME bd_name, 50 const LinkKey& key, uint8_t key_type); 51 52 /* Remote Name Resolved. Parameters are 53 * BD Address of remote 54 * BD Name of remote 55 */ 56 typedef void(tBTM_RMT_NAME_CALLBACK)(const RawAddress& bd_addr, DEV_CLASS dc, 57 tBTM_BD_NAME bd_name); 58 59 /* Authentication complete for the connection. Parameters are 60 * BD Address of remote 61 * Device Class of remote 62 * BD Name of remote 63 * 64 */ 65 typedef void(tBTM_AUTH_COMPLETE_CALLBACK)(const RawAddress& bd_addr, 66 DEV_CLASS dev_class, 67 tBTM_BD_NAME bd_name, 68 tHCI_REASON reason); 69 70 struct tBTM_APPL_INFO { 71 tBTM_PIN_CALLBACK* p_pin_callback{nullptr}; 72 tBTM_LINK_KEY_CALLBACK* p_link_key_callback{nullptr}; 73 tBTM_AUTH_COMPLETE_CALLBACK* p_auth_complete_callback{nullptr}; 74 tBTM_BOND_CANCEL_CMPL_CALLBACK* p_bond_cancel_cmpl_callback{nullptr}; 75 tBTM_SP_CALLBACK* p_sp_callback{nullptr}; 76 tBTM_LE_CALLBACK* p_le_callback{nullptr}; 77 tBTM_LE_KEY_CALLBACK* p_le_key_callback{nullptr}; 78 }; 79