1 /* 2 * Copyright (c) 2025 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 CAMERA_NAPI_EX_MANAGER_H_ 17 #define CAMERA_NAPI_EX_MANAGER_H_ 18 19 #include <mutex> 20 21 #include "camera_dynamic_loader.h" 22 #include "dynamic_loader/camera_napi_ex_proxy.h" 23 #include "napi/native_node_api.h" 24 25 namespace OHOS { 26 namespace CameraStandard { 27 enum CameraNapiExProxyUserType : int32_t { 28 CAMERA_MANAGER_NAPI = 0, 29 MODE_MANAGER_NAPI, 30 }; 31 32 class CameraNapiExManager { 33 public: 34 static std::shared_ptr<CameraNapiExProxy> 35 GetCameraNapiExProxy(CameraNapiExProxyUserType type = CameraNapiExProxyUserType::CAMERA_MANAGER_NAPI); 36 static void FreeCameraNapiExProxy(CameraNapiExProxyUserType type = CameraNapiExProxyUserType::CAMERA_MANAGER_NAPI); 37 private: 38 static std::shared_ptr<CameraNapiExProxy> cameraNapiExProxy_; 39 static std::vector<CameraNapiExProxyUserType> userList_; 40 static std::mutex mutex_; 41 }; 42 } // namespace CameraStandard 43 } // namespace OHOS 44 #endif // CAMERA_NAPI_EX_MANAGER_H_