1 /*
2  * Copyright (c) 2023-2024 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_ADVERTISE_MANAGER_H
17 #define OHOS_ADVERTISE_MANAGER_H
18 
19 #include "dm_timer.h"
20 #include "softbus_listener.h"
21 
22 namespace OHOS {
23 namespace DistributedHardware {
24 class AdvertiseManager : public std::enable_shared_from_this<AdvertiseManager> {
25 public:
26     AdvertiseManager(std::shared_ptr<SoftbusListener> softbusListener);
27     ~AdvertiseManager();
28 
29     int32_t StartAdvertising(const std::string &pkgName, const std::map<std::string, std::string> &advertiseParam);
30     int32_t StopAdvertising(const std::string &pkgName, int32_t publishId);
31 
32 private:
33     void HandleAutoStopAdvertise(const std::string &timerName, const std::string &pkgName, int32_t publishId);
34     void ConfigAdvParam(const std::map<std::string, std::string> &advertiseParam, DmPublishInfo *dmPubInfo);
35 
36 private:
37     std::shared_ptr<DmTimer> timer_;
38     std::shared_ptr<SoftbusListener> softbusListener_;
39 };
40 } // namespace DistributedHardware
41 } // namespace OHOS
42 #endif // OHOS_ADVERTISE_MANAGER_H
43