• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 #include "netmgr_ext_log_wrapper.h"
17 #include "wearable_distributed_net_management.h"
18 
19 namespace OHOS {
20 namespace NetManagerStandard {
GetInstance()21 WearableDistributedNetManagement &WearableDistributedNetManagement::GetInstance()
22 {
23     static WearableDistributedNetManagement instance;
24     return instance;
25 }
26 
StartWearableDistributedNetwork(const int32_t tcpPortId,const int32_t udpPortId,const bool isMetered)27 int32_t WearableDistributedNetManagement::StartWearableDistributedNetwork(const int32_t tcpPortId,
28                                                                           const int32_t udpPortId, const bool isMetered)
29 {
30     NETMGR_EXT_LOG_I("Wearable Distributed Net Management Start Network");
31     return WearableDistributedNetAgent::GetInstance().SetupWearableDistributedNetwork(tcpPortId, udpPortId, isMetered);
32 }
33 
StopWearableDistributedNetwork()34 int32_t WearableDistributedNetManagement::StopWearableDistributedNetwork()
35 {
36     NETMGR_EXT_LOG_I("Wearable Distributed Net Management Stop Network");
37     return WearableDistributedNetAgent::GetInstance().TearDownWearableDistributedNetwork();
38 }
39 
UpdateNetScore(const bool isCharging)40 void WearableDistributedNetManagement::UpdateNetScore(const bool isCharging)
41 {
42     WearableDistributedNetAgent::GetInstance().UpdateNetScore(isCharging);
43 }
44 
UpdateMeteredStatus(const bool isMetered)45 int32_t WearableDistributedNetManagement::UpdateMeteredStatus(const bool isMetered)
46 {
47     NETMGR_EXT_LOG_I("Update wearable distributed net metered status");
48     return WearableDistributedNetAgent::GetInstance().UpdateMeteredStatus(isMetered);
49 }
50 } // namespace NetManagerStandard
51 } // namespace OHOS
52