1 /*
2  * Copyright (C) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_BT_GATT_UTILS_H
17 #define OHOS_BT_GATT_UTILS_H
18 
19 #include "string"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 namespace OHOS {
26 namespace Bluetooth {
27 
28 #define ADV_ADDR_TIME_THRESHOLD (15 * 60 * 1000) // 15 mins
29 
30 /*
31  * The method is only available for {@link BleStartAdvWithAddr}.
32  * Because there cannot be duplicate adv addresses within one hour,
33  * this method will delete adv addresses after one hour.
34  */
35 void RemoveTimeoutAdvAddr();
36 
37 /*
38  * This method is only available for {@link BleStartAdvWithAddr}.
39  * Duplicate addresses within 15 minutes are allowed to be broadcast,
40  * and duplicate addresses after 15 minutes are not allowed to be broadcast.
41  * There is no limit on non-duplicate addresses.
42  */
43 bool CanStartAdv(const std::string& addrStr);
44 
45 }  // namespace Bluetooth
46 }  // namespace OHOS
47 #ifdef __cplusplus
48 }
49 #endif
50 #endif