1 /* 2 * Copyright (C) 2021 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 "wifi_hotspot.h" 17 #include "wifi_hotspot_impl.h" 18 #include "wifi_logger.h" 19 20 DEFINE_WIFILOG_HOTSPOT_LABEL("WifiHotspot"); 21 22 namespace OHOS { 23 namespace Wifi { CreateWifiHotspot(int systemAbilityId)24std::unique_ptr<WifiHotspot> WifiHotspot::CreateWifiHotspot(int systemAbilityId) 25 { 26 std::unique_ptr<WifiHotspotImpl> hotspot = std::make_unique<WifiHotspotImpl>(systemAbilityId); 27 if (hotspot != nullptr) { 28 if (hotspot->Init()) { 29 WIFI_LOGI("succeeded"); 30 return hotspot; 31 } 32 } 33 34 WIFI_LOGE("new wifi hotspot failed"); 35 return nullptr; 36 } 37 GetInstance(int systemAbilityId)38std::unique_ptr<WifiHotspot> WifiHotspot::GetInstance(int systemAbilityId) 39 { 40 std::unique_ptr<WifiHotspotImpl> hotspot = std::make_unique<WifiHotspotImpl>(systemAbilityId); 41 if (hotspot != nullptr) { 42 if (hotspot->Init()) { 43 WIFI_LOGI("hotspot init succeeded"); 44 return hotspot; 45 } 46 } 47 48 WIFI_LOGE("new wifi hotspot failed"); 49 return nullptr; 50 } 51 ~WifiHotspot()52WifiHotspot::~WifiHotspot() 53 {} 54 } // namespace Wifi 55 } // namespace OHOS