1 /* 2 * Copyright (C) 2022 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_WIFI_HOTSPOT_MGR_SERVICE_IMPL_H 17 #define OHOS_WIFI_HOTSPOT_MGR_SERVICE_IMPL_H 18 19 #include <file_ex.h> 20 #include "iremote_object.h" 21 #include "system_ability.h" 22 #include "wifi_errcode.h" 23 #include "wifi_hotspot_mgr_stub.h" 24 #include "wifi_hotspot_stub.h" 25 26 namespace OHOS { 27 namespace Wifi { 28 enum ServiceRunningState { 29 STATE_NOT_START, 30 STATE_RUNNING 31 }; 32 33 class WifiHotspotMgrServiceImpl : public SystemAbility, public WifiHotspotMgrStub { 34 DECLARE_SYSTEM_ABILITY(WifiHotspotMgrServiceImpl); 35 public: 36 WifiHotspotMgrServiceImpl(); 37 virtual ~WifiHotspotMgrServiceImpl(); 38 static sptr<WifiHotspotMgrServiceImpl> GetInstance(); 39 void OnStart() override; 40 void OnStop() override; 41 sptr<IRemoteObject> GetWifiRemote(int id) override; 42 43 /** 44 * @Description dump hotspot information 45 * 46 * @param fd - file descriptor 47 * @param args - dump arguments 48 * @return ErrCode - operation result 49 */ 50 int32_t Dump(int32_t fd, const std::vector<std::u16string>& args) override; 51 52 private: 53 bool Init(); 54 static sptr<WifiHotspotMgrServiceImpl> g_instance; 55 std::map<int, sptr<IRemoteObject>> mWifiService; 56 static std::mutex g_instanceLock; 57 static std::mutex g_hotspotMutex; 58 bool mPublishFlag; 59 ServiceRunningState mState; 60 }; 61 } // namespace Wifi 62 } // namespace OHOS 63 #endif