1 /* 2 * Copyright (C) 2023 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_DEVICE_MGR_SERVICE_IMPL_H 17 #define OHOS_WIFI_DEVICE_MGR_SERVICE_IMPL_H 18 19 #ifndef OHOS_ARCH_LITE 20 #include "iremote_object.h" 21 #include "system_ability.h" 22 #include "wifi_errcode.h" 23 #include "wifi_device_mgr_stub.h" 24 #include "wifi_device_stub.h" 25 26 namespace OHOS { 27 namespace Wifi { 28 enum ServiceRunningState { 29 STATE_NOT_START, 30 STATE_RUNNING 31 }; 32 33 class WifiDeviceMgrServiceImpl : public SystemAbility, public WifiDeviceMgrStub { 34 DECLARE_SYSTEM_ABILITY(WifiDeviceMgrServiceImpl); 35 public: 36 WifiDeviceMgrServiceImpl(); 37 virtual ~WifiDeviceMgrServiceImpl(); 38 static sptr<WifiDeviceMgrServiceImpl> GetInstance(); 39 void OnStart() override; 40 void OnStop() override; 41 int32_t OnExtension(const std::string& extension, MessageParcel& data, MessageParcel& reply) override; 42 sptr<IRemoteObject> GetWifiRemote(int instId) override; 43 int32_t Dump(int32_t fd, const std::vector<std::u16string>& args) override; 44 std::map<int, sptr<IRemoteObject>>& GetDeviceServiceMgr(); 45 46 private: 47 bool Init(); 48 static sptr<WifiDeviceMgrServiceImpl> g_instance; 49 std::map<int, sptr<IRemoteObject>> mWifiService; 50 static std::mutex g_instanceLock; 51 static std::mutex g_initMutex; 52 bool mPublishFlag; 53 ServiceRunningState mState; 54 }; 55 } // namespace Wifi 56 } // namespace OHOS 57 #endif 58 #endif