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 LEG_ADV_H_ 19 #define LEG_ADV_H_ 20 21 enum { 22 LEG_ADV_STRATEGY_0 = 0, /*!< default adv strategy */ 23 LEG_ADV_STRATEGY_1 = 1, 24 /* !< adv keep sending. eg: if 1M1S configuration, After a slave establishes a link, adv can continue to send, 25 but after disabling adv, adv can no longer be enbled. */ 26 LEG_ADV_STRATEGY_2 = 2, /* !< Advertiser. eg: if 1M1S configuration, 27 After a slave establishes a link, adv can still be switched on and off normally. 28 It should be noted that: adv will be closed every time the link is established. 29 If you need to send adv, you need to manually enable adv (HCI_LE_Set_Adv_Enable_Cmd) */ 30 }; 31 32 /** 33 * @brief for user to initialize legacy advertising module 34 * notice that only one module can be selected between 35 * legacy advertising module and extended advertising module 36 * @param none 37 * @return none 38 */ 39 void blc_ll_initLegacyAdvertising_module(void); 40 41 /** 42 * @brief set the data used in advertising packets that have a data field. 43 * @param[in] *data - advertising data buffer 44 * @param[in] len - The number of significant octets in the Advertising_Data. 45 * @return Status - 0x00: command succeeded; 0x01-0xFF: command failed 46 */ 47 ble_sts_t blc_ll_setAdvData(u8 *data, u8 len); 48 49 /** 50 * @brief This function is used to provide data used in Scanning Packets that have a data field. 51 * @param[in] *data - Scan_Response_Data buffer 52 * @param[in] len - The number of significant octets in the Scan_Response_Data. 53 * @return Status - 0x00: command succeeded; 0x01-0xFF: command failed 54 */ 55 ble_sts_t blc_ll_setScanRspData(u8 *data, u8 len); 56 57 /** 58 * @brief This function is used to set the advertising parameters. 59 * @param[in] intervalMin - Minimum advertising interval(Time = N * 0.625 ms, Range: 0x0020 to 0x4000) 60 * @param[in] intervalMin - Maximum advertising interval(Time = N * 0.625 ms, Range: 0x0020 to 0x4000) 61 * @param[in] advType - Advertising_Type 62 * @param[in] ownAddrType - Own_Address_Type 63 * @param[in] peerAddrType - Peer_Address_Type 64 * @param[in] *peerAddr - Peer_Address 65 * @param[in] adv_channelMap - Advertising_Channel_Map 66 * @param[in] advFilterPolicy - Advertising_Filter_Policy 67 * @return Status - 0x00: command succeeded; 0x01-0xFF: command failed 68 */ 69 ble_sts_t blc_ll_setAdvParam(adv_inter_t intervalMin, adv_inter_t intervalMax, adv_type_t advType, 70 own_addr_type_t ownAddrType, u8 peerAddrType, u8 *peerAddr, adv_chn_map_t adv_channelMap, 71 adv_fp_type_t advFilterPolicy); 72 73 /** 74 * @brief This function is used to request the Controller to start or stop advertising. 75 * @param adv_enable - Advertising_Enable 76 * @return Status - 0x00: command succeeded; 0x01-0xFF: command failed 77 */ 78 ble_sts_t blc_ll_setAdvEnable(adv_en_t adv_enable); 79 80 /** 81 * @brief this function is used to set whether to continue sending broadcast packets 82 * when receiving scan request in the current adv interval. 83 * @param[in] enable - enable:continue sending broadcast packets when receiving scan request. 84 * @return none. 85 */ 86 void blc_ll_continue_adv_after_scan_req(u8 enable); 87 88 /** 89 * @brief This function is used to set some other channel to replace advertising chn37/38/39. 90 * @param[in] chn0 - channel to replace channel 37 91 * @param[in] chn1 - channel to replace channel 38 92 * @param[in] chn2 - channel to replace channel 39 93 * @return none 94 */ 95 void blc_ll_setAdvCustomedChannel(u8 chn0, u8 chn1, u8 chn2); 96 97 /** 98 * @brief This function is used to configure leg_adv enabling by API only. 99 * e.g. M4S4, even slave connection number is 4, leg_adv still work but can not be connected 100 * @param[in] advStrategy can be LEG_ADV_STRATEGY_0/LEG_ADV_STRATEGY_1/LEG_ADV_STRATEGY_2 101 * @return none 102 */ 103 void blc_ll_ConfigLegacyAdvEnable_by_API_only(u8 advStrategy); 104 105 #endif /* LEG_ADV_H_ */ 106