1 /* 2 * Copyright 2024 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/btm/neighbor_inquiry.h" 22 #include "stack/include/btm_api_types.h" 23 #include "stack/include/btm_status.h" 24 25 /******************************************************************************* 26 * 27 * Function BTM_SetDiscoverability 28 * 29 * Description This function is called to set the device into or out of 30 * discoverable mode. Discoverable mode means inquiry 31 * scans are enabled. If a value of '0' is entered for window 32 * or interval, the default values are used. 33 * 34 * Returns BTM_SUCCESS if successful 35 * BTM_BUSY if a setting of the filter is already in progress 36 * BTM_NO_RESOURCES if couldn't get a memory pool buffer 37 * BTM_ILLEGAL_VALUE if a bad parameter was detected 38 * BTM_WRONG_MODE if the device is not up. 39 * 40 ******************************************************************************/ 41 tBTM_STATUS BTM_SetDiscoverability(uint16_t inq_mode); 42 43 /******************************************************************************* 44 * 45 * Function BTM_StartInquiry 46 * 47 * Description This function is called to start an inquiry. 48 * 49 * Parameters: p_inqparms - pointer to the inquiry information 50 * mode - GENERAL or LIMITED inquiry 51 * duration - length in 1.28 sec intervals (If '0', the 52 * inquiry is CANCELLED) 53 * filter_cond_type - BTM_CLR_INQUIRY_FILTER, 54 * BTM_FILTER_COND_DEVICE_CLASS, or 55 * BTM_FILTER_COND_BD_ADDR 56 * filter_cond - value for the filter (based on 57 * filter_cond_type) 58 * 59 * p_results_cb - Pointer to the callback routine which gets 60 * called upon receipt of an inquiry result. If 61 * this field is NULL, the application is not 62 * notified. 63 * 64 * p_cmpl_cb - Pointer to the callback routine which gets 65 * called upon completion. If this field is 66 * NULL, the application is not notified when 67 * completed. 68 * Returns tBTM_STATUS 69 * BTM_CMD_STARTED if successfully initiated 70 * BTM_BUSY if already in progress 71 * BTM_ILLEGAL_VALUE if parameter(s) are out of range 72 * BTM_NO_RESOURCES if could not allocate resources to start 73 * the command 74 * BTM_WRONG_MODE if the device is not up. 75 * 76 ******************************************************************************/ 77 tBTM_STATUS BTM_StartInquiry(tBTM_INQ_RESULTS_CB* p_results_cb, 78 tBTM_CMPL_CB* p_cmpl_cb); 79 80 /******************************************************************************* 81 * 82 * Function BTM_IsInquiryActive 83 * 84 * Description Return a bit mask of the current inquiry state 85 * 86 * Returns Bitmask of current inquiry state 87 * 88 ******************************************************************************/ 89 uint16_t BTM_IsInquiryActive(void); 90 91 /******************************************************************************* 92 * 93 * Function BTM_CancelInquiry 94 * 95 * Description This function cancels an inquiry if active 96 * 97 ******************************************************************************/ 98 void BTM_CancelInquiry(void); 99 100 /******************************************************************************* 101 * 102 * Function BTM_SetConnectability 103 * 104 * Description This function is called to set the device into or out of 105 * connectable mode. Discoverable mode means page scans are 106 * enabled. 107 * 108 * Returns BTM_SUCCESS if successful 109 * BTM_ILLEGAL_VALUE if a bad parameter is detected 110 * BTM_NO_RESOURCES if could not allocate a message buffer 111 * BTM_WRONG_MODE if the device is not up. 112 * 113 ******************************************************************************/ 114 tBTM_STATUS BTM_SetConnectability(uint16_t page_mode); 115 116 /******************************************************************************* 117 * 118 * Function BTM_SetInquiryMode 119 * 120 * Description This function is called to set standard, with RSSI 121 * mode or extended of the inquiry for local device. 122 * 123 * Input Params: BTM_INQ_RESULT_STANDARD, BTM_INQ_RESULT_WITH_RSSI or 124 * BTM_INQ_RESULT_EXTENDED 125 * 126 * Returns BTM_SUCCESS if successful 127 * BTM_NO_RESOURCES if couldn't get a memory pool buffer 128 * BTM_ILLEGAL_VALUE if a bad parameter was detected 129 * BTM_WRONG_MODE if the device is not up. 130 * 131 ******************************************************************************/ 132 tBTM_STATUS BTM_SetInquiryMode(uint8_t mode); 133 134 void BTM_EnableInterlacedInquiryScan(); 135 136 void BTM_EnableInterlacedPageScan(); 137