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 #include "wifi_p2p.h" 16 #include "wifi_p2p_impl.h" 17 #include "wifi_logger.h" 18 #include "wifi_common_util.h" 19 DEFINE_WIFILOG_P2P_LABEL("WifiP2p"); 20 21 namespace OHOS { 22 namespace Wifi { GetInstance(int systemAbilityId)23NO_SANITIZE("cfi") std::shared_ptr<WifiP2p> WifiP2p::GetInstance(int systemAbilityId) 24 { 25 std::shared_ptr<WifiP2pImpl> impl = std::make_shared<WifiP2pImpl>(); 26 if (impl && impl->Init(systemAbilityId)) { 27 WIFI_LOGD("init p2p successfully!"); 28 return impl; 29 } 30 31 WIFI_LOGE("new wifi p2p failed"); 32 return nullptr; 33 } 34 ~WifiP2p()35WifiP2p::~WifiP2p() 36 {} 37 } // namespace Wifi 38 } // namespace OHOS