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 CAMERA_PRE_LAUNCH_CONFIG_NAPI_H 17 #define CAMERA_PRE_LAUNCH_CONFIG_NAPI_H 18 19 #include "camera_log.h" 20 #include "napi/native_api.h" 21 #include "napi/native_node_api.h" 22 23 #include "hilog/log.h" 24 #include "camera_napi_utils.h" 25 #include "input/prelaunch_config.h" 26 27 #include <fstream> 28 #include <iostream> 29 #include <sstream> 30 #include <vector> 31 32 #include <fcntl.h> 33 #include <sys/stat.h> 34 #include <sys/time.h> 35 #include <sys/types.h> 36 37 namespace OHOS { 38 namespace CameraStandard { 39 static const char CAMERA_PRELAUNCH_CONFIG_NAPI_CLASS_NAME[] = "PrelauncherConfig"; 40 41 class CameraPrelaunchConfigNapi { 42 public: 43 static napi_value Init(napi_env env, napi_value exports); 44 static napi_value GetPrelaunchCameraDevice(napi_env env, napi_callback_info info); 45 CameraPrelaunchConfigNapi(); 46 ~CameraPrelaunchConfigNapi(); 47 PrelaunchConfig* prelaunchConfig_; 48 static thread_local PrelaunchConfig* sPrelaunchConfig_; 49 50 private: 51 static void CameraPrelaunchConfigNapiDestructor(napi_env env, void* nativeObject, void* finalize_hint); 52 static napi_value CameraPrelaunchConfigNapiConstructor(napi_env env, napi_callback_info info); 53 napi_env env_; 54 napi_ref wrapper_; 55 56 static thread_local napi_ref sConstructor_; 57 }; 58 } // namespace CameraStandard 59 } // namespace OHOS 60 #endif // CAMERA_PRE_LAUNCH_CONFIG_NAPI_H 61