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