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 <cstdint> 20 21 #include "stack/include/bt_octets.h" 22 #include "stack/include/btm_api_types.h" 23 #include "stack/include/btm_ble_api_types.h" 24 #include "stack/include/hci_error_code.h" 25 #include "types/raw_address.h" 26 27 /**************************************** 28 * Security Manager Callback Functions 29 ****************************************/ 30 /* Authorize device for service. Parameters are 31 * Service Id (NULL - unknown service or unused 32 * [BTM_SEC_SERVICE_NAME_LEN set to 0]) 33 */ 34 typedef uint8_t(tBTM_AUTHORIZE_CALLBACK)(uint8_t service_id); 35 36 /* Get PIN for the connection. Parameters are 37 * BD Address of remote 38 * Device Class of remote 39 * BD Name of remote 40 * Flag indicating the minimum pin code length to be 16 digits 41 */ 42 typedef uint8_t(tBTM_PIN_CALLBACK)(const RawAddress& bd_addr, 43 DEV_CLASS dev_class, 44 const tBTM_BD_NAME bd_name, 45 bool min_16_digit); 46 47 /* New Link Key for the connection. Parameters are 48 * BD Address of remote 49 * Link Key 50 * Key Type: Combination, Local Unit, or Remote Unit 51 */ 52 typedef uint8_t(tBTM_LINK_KEY_CALLBACK)(const RawAddress& bd_addr, 53 DEV_CLASS dev_class, 54 tBTM_BD_NAME bd_name, 55 const LinkKey& key, uint8_t key_type, 56 bool is_ctkd); 57 58 /* Remote Name Resolved. Parameters are 59 * BD Address of remote 60 * BD Name of remote 61 */ 62 typedef void(tBTM_RMT_NAME_CALLBACK)(const RawAddress& bd_addr, DEV_CLASS dc, 63 tBTM_BD_NAME bd_name); 64 65 /* Authentication complete for the connection. Parameters are 66 * BD Address of remote 67 * Device Class of remote 68 * BD Name of remote 69 * 70 */ 71 typedef void(tBTM_AUTH_COMPLETE_CALLBACK)(const RawAddress& bd_addr, 72 DEV_CLASS dev_class, 73 tBTM_BD_NAME bd_name, 74 tHCI_REASON reason); 75 76 struct tBTM_APPL_INFO { 77 tBTM_PIN_CALLBACK* p_pin_callback{nullptr}; 78 tBTM_LINK_KEY_CALLBACK* p_link_key_callback{nullptr}; 79 tBTM_AUTH_COMPLETE_CALLBACK* p_auth_complete_callback{nullptr}; 80 tBTM_BOND_CANCEL_CMPL_CALLBACK* p_bond_cancel_cmpl_callback{nullptr}; 81 tBTM_SP_CALLBACK* p_sp_callback{nullptr}; 82 tBTM_LE_CALLBACK* p_le_callback{nullptr}; 83 tBTM_LE_KEY_CALLBACK* p_le_key_callback{nullptr}; 84 }; 85