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 <hdf_log.h> 17#include "iface_util.h" 18 19namespace OHOS { 20namespace HDI { 21namespace Wlan { 22namespace Chip { 23namespace V1_0 { 24IfaceUtil::IfaceUtil(const std::weak_ptr<IfaceTool> ifaceTool) 25 : ifaceTool_(ifaceTool) 26{} 27 28bool IfaceUtil::SetMacAddress(const std::string& ifaceName, const std::string& mac) 29{ 30 bool success = ifaceTool_.lock()->SetMacAddress(ifaceName.c_str(), mac.c_str()); 31 if (!success) { 32 HDF_LOGE("SetMacAddress failed on %{public}s", ifaceName.c_str()); 33 } else { 34 HDF_LOGD("SetMacAddress successed on %{public}s", ifaceName.c_str()); 35 } 36 return success; 37} 38 39bool IfaceUtil::SetUpState(const std::string& ifaceName, bool requestUp) 40{ 41 return ifaceTool_.lock()->SetUpState(ifaceName.c_str(), requestUp); 42} 43 44bool IfaceUtil::GetUpState(const std::string& ifaceName) 45{ 46 return ifaceTool_.lock()->GetUpState(ifaceName.c_str()); 47} 48} 49} 50} 51} 52}