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 
19 #ifndef STACK_BLE_CONTROLLER_LL_PRDADV_PDA_SYNC_H_
20 #define STACK_BLE_CONTROLLER_LL_PRDADV_PDA_SYNC_H_
21 
22 
23 /**
24  * @brief      for user to initialize periodic advertising synchronization module
25  * @param	   none
26  * @return     none
27  */
28 void 		blc_ll_initPeriodicAdvertisingSynchronization_module(void);
29 
30 
31 /**
32  * @brief      this function is used to synchronize with a periodic advertising train from an advertiser and begin
33 			   receiving periodic advertising packets.
34  * @param[in]  options - used to determine whether the Periodic Advertiser List is used and whether HCI_Periodic_Advertising_Report events
35  *  					 for this periodic advertising train are initially enabled or disabled.
36  * @param[in]  adv_sid - Advertising SID subfield in the ADI field used to identify the Periodic Advertising
37  * @param[in]  adv_adrType - Advertiser Address Type
38  * @param[in]  *adv_addr - Advertiser Address
39  * @param[in]  skip - The maximum number of periodic advertising events that can be skipped after a successful receive
40  * @param[in]  sync_timeout - Synchronization timeout for the periodic advertising train
41  * @param[in]  sync_cte_type -
42  * @return     Status - 0x00: command succeeded; 0x01-0xFF: command failed
43  */
44 ble_sts_t 	blc_ll_periodicAdvertisingCreateSync ( option_msk_t options, u8 adv_sid, u8 adv_adrType, u8 *adv_addr, u16 skip, sync_tm_t sync_timeout, u8 sync_cte_type);
45 
46 /**
47  * @brief      This function is used to cancel the periodic advertising create sync command while it is pending.
48  * @param      none
49  * @return     Status - 0x00: command succeeded; 0x01-0xFF: command failed
50  */
51 ble_sts_t 	blc_ll_periodicAdvertisingCreateSyncCancel (void);
52 
53 
54 
55 /**
56  * @brief      This function is used to stop reception of the periodic advertising train identified
57  * 			   by the Sync_Handle parameter.
58  * @param[in]  sync_handle - Sync_Handle identifying the periodic advertising train
59  * @return     Status - 0x00: command succeeded; 0x01-0xFF: command failed
60  */
61 ble_sts_t 	blc_ll_periodicAdvertisingTerminateSync (u16 sync_handle);
62 
63 /**
64  * @brief      This function is used to add an entry, consisting of a single device address and SID,
65  * 			   to the Periodic Advertiser list stored in the Controller.
66  * @param[in]  adv_adrType - Advertiser_Address_Type
67  * @param[in]  *adv_addr - Advertiser_Address
68  * @param[in]  adv_sid - Advertising_SID
69  * @return     Status - 0x00: command succeeded; 0x01-0xFF: command failed
70  */
71 ble_sts_t 	blc_ll_addDeivceToPeriodicAdvertiserList (u8 adv_adrType, u8 *adv_addr, u8 adv_sid);
72 
73 /**
74  * @brief      This function is used to remove one entry from the list of Periodic Advertisers
75  * 			   stored in the Controller.
76  * @param[in]  adv_adrType - Advertiser_Address_Type
77  * @param[in]  *adv_addr - Advertiser_Address
78  * @param[in]  adv_sid - Advertising_SID
79  * @return     Status - 0x00: command succeeded; 0x01-0xFF: command failed
80  */
81 ble_sts_t 	blc_ll_removeDeivceFromPeriodicAdvertiserList (u8 adv_adrType, u8 *adv_addr, u8 adv_sid);
82 
83 /**
84  * @brief      This function is used to remove all entries from the list of Periodic Advertisers.
85  * @param	   none
86  * @return     Status - 0x00: command succeeded; 0x01-0xFF: command failed
87  */
88 ble_sts_t 	blc_ll_clearPeriodicAdvertiserList (void);
89 
90 /**
91  * @brief      This function is used to read the total number of Periodic Advertiser list entries.
92  * @param[in]  none
93  * @param[out]  *perdAdvListSize - point to Periodic_Advertiser_List_Size
94  * @return     Status - 0x00: command succeeded; 0x01-0xFF: command failed
95  */
96 ble_sts_t 	blc_ll_readPeriodicAdvertiserListSize (u8 *perdAdvListSize);
97 
98 ble_sts_t 	blc_hci_le_periodic_advertising_create_sync(hci_le_periodicAdvCreateSync_cmdParam_t* cmdPara);
99 
100 
101 
102 
103 #endif /* STACK_BLE_CONTROLLER_LL_PRDADV_PDA_SYNC_H_ */
104