1 /****************************************************************************** 2 * Copyright (c) 2022 Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK") 3 * All rights reserved. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 *****************************************************************************/ 18 #ifndef LLMS_SCAN_H_ 19 #define LLMS_SCAN_H_ 20 21 22 #include "stack/ble/hci/hci_cmd.h" 23 24 enum{ 25 LEG_SCAN_STRATEGY_0 = 0, /*!< The number of scans corresponds to the number of connections, 26 that is to say, after the number of connections reaches the 27 maximum allowed number, scan cannot be started.*/ 28 LEG_SCAN_STRATEGY_1 = 1, /*!< When 1m is configured, if a master establishes a link, 29 scan continues to work. However, if the scan is disabled, 30 the scan cannot be started again.*/ 31 LEG_SCAN_STRATEGY_2 = 2, /*!< When 1m is configured, if a master establishes a link, 32 scan continues to work and scan can be turned on and off normally.*/ 33 }; 34 35 /** 36 * @brief for user to initialize legacy scanning module 37 * notice that only one module can be selected between legacy scanning module and extended scanning module 38 * @param none 39 * @return none 40 */ 41 void blc_ll_initLegacyScanning_module(void); 42 43 44 45 /** 46 * @brief This function is used to set the scan parameters 47 * @param[in] scan_type - passive Scanning or active scanning. 48 * @param[in] scan_interval - time interval from when the Controller started its last LE scan until it begins the subsequent LE scan 49 * @param[in] scan_window - The duration of the LE scan. 50 * @param[in] ownAddrType - Own_Address_Type 51 * @param[in] scan_fp - Scanning_Filter_Policy 52 * @return Status - 0x00: command succeeded; 0x01-0xFF: command failed 53 */ 54 ble_sts_t blc_ll_setScanParameter (scan_type_t scan_type, scan_inter_t scan_interval, scan_wind_t scan_window, own_addr_type_t ownAddrType, scan_fp_type_t scan_fp); 55 56 57 58 59 60 /** 61 * @brief enable or disable legacy scanning. 62 * @param[in] scan_enable 63 * @param[in] filter_duplicate - controls whether the Link Layer should filter out 64 * duplicate advertising reports (Filtering_Enabled) to the Host, 65 * @return Status - 0x00: command succeeded; 0x01-0xFF: command failed 66 */ 67 ble_sts_t blc_ll_setScanEnable (scan_en_t scan_enable, dupFilter_en_t filter_duplicate); 68 69 70 /** 71 * @brief This function is used to enable the private LegScan filter to filter specific private BIGInfo 72 * packets according to the SID value of the received ExtAdv packet 73 * @param[in] sid - The value of SID in the received ExtAdv packet 74 * @return none 75 */ 76 void blc_ll_enPrivLegScanFilterByExtAdvSid(u8 sid); 77 78 /** 79 * @brief This function is used to configure leg_scan enabling by API only. 80 * e.g. M4S4, even master connection number is 4, leg_scan still work 81 * @param[in] scanStrategy can be LEG_SCAN_STRATEGY_0/LEG_SCAN_STRATEGY_1/LEG_SCAN_STRATEGY_2 82 * @return none 83 */ 84 void blc_ll_ConfigLegacyScanEnable_by_API_only (u8 scanStrategy); 85 #endif /* LLMS_SCAN_H_ */ 86