• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 BLM_PAIR_H_
19 #define BLM_PAIR_H_
20 
21 #include "blt_common.h"
22 #include "drivers.h"
23 #include "tl_common.h"
24 #include "vendor/common/user_config.h"
25 
26 /*!  Pair parameter manager type */
27 typedef struct {
28     u8 manual_pair;
29     u8 mac_type;  // address type
30     u8 mac[6];
31     u32 pair_tick;
32 } man_pair_t;
33 
34 extern man_pair_t blm_manPair;
35 
36 /**
37  * @brief   Pair management initialization for master.
38  * @param   none.
39  * @return  none.
40  */
41 void user_master_host_pairing_management_init(void);
42 
43 /**
44  * @brief     search mac address in the bond slave mac table:
45  *            when slave paired with dongle, add this addr to table
46  *            re_poweron slave, dongle will search if this AdvA in slave adv pkt is in this table
47  *            if in, it will connect slave directly
48  *             this function must in ramcode
49  * @param[in]  adr_type   address type
50  * @param[in]  adr        Pointer point to address buffer.
51  * @return     0:      invalid index
52  *             others valid index
53  */
54 int user_tbl_slave_mac_search(u8 adr_type, u8 *adr);
55 
56 /**
57  * @brief     Store bonding info to flash.
58  * @param[in] adr_type   address type
59  * @param[in] adr        Pointer point to address buffer.
60  * @return    none.
61  */
62 int user_tbl_slave_mac_add(u8 adr_type, u8 *adr);
63 
64 /**
65  * @brief      Delete bonding info.
66  * @param[in]  adr_type   address type
67  * @param[in]  adr        Pointer point to address buffer.
68  * @return     1: delete ok
69  *             0: no find
70  */
71 int user_tbl_slave_mac_delete_by_adr(u8 adr_type, u8 *adr);
72 
73 /**
74  * @brief      Delete all device bonding info.
75  * @param      none.
76  * @return     none.
77  */
78 void user_tbl_slave_mac_delete_all(void);
79 
80 #endif /* APP_PAIR_H_ */
81