15ccb8f90Sopenharmony_ci/*
25ccb8f90Sopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
35ccb8f90Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
45ccb8f90Sopenharmony_ci * you may not use this file except in compliance with the License.
55ccb8f90Sopenharmony_ci * You may obtain a copy of the License at
65ccb8f90Sopenharmony_ci *
75ccb8f90Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
85ccb8f90Sopenharmony_ci *
95ccb8f90Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
105ccb8f90Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
115ccb8f90Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
125ccb8f90Sopenharmony_ci * See the License for the specific language governing permissions and
135ccb8f90Sopenharmony_ci * limitations under the License.
145ccb8f90Sopenharmony_ci */
155ccb8f90Sopenharmony_ci
165ccb8f90Sopenharmony_ci#ifndef POWER_NAPI_UTILS_H
175ccb8f90Sopenharmony_ci#define POWER_NAPI_UTILS_H
185ccb8f90Sopenharmony_ci
195ccb8f90Sopenharmony_ci#include <string>
205ccb8f90Sopenharmony_ci
215ccb8f90Sopenharmony_ci#include "napi/native_api.h"
225ccb8f90Sopenharmony_ci#include "napi/native_common.h"
235ccb8f90Sopenharmony_ci#include "napi/native_node_api.h"
245ccb8f90Sopenharmony_ci
255ccb8f90Sopenharmony_cinamespace OHOS {
265ccb8f90Sopenharmony_cinamespace PowerMgr {
275ccb8f90Sopenharmony_ciclass NapiUtils {
285ccb8f90Sopenharmony_cipublic:
295ccb8f90Sopenharmony_ci    static napi_value GetCallbackInfo(napi_env& env, napi_callback_info& info, size_t& argc, napi_value argv[]);
305ccb8f90Sopenharmony_ci    static std::string GetStringFromNapi(napi_env& env, napi_value& napiStr);
315ccb8f90Sopenharmony_ci    static napi_ref CreateReference(napi_env& env, napi_value& value);
325ccb8f90Sopenharmony_ci    static void ReleaseReference(napi_env& env, napi_ref& ref);
335ccb8f90Sopenharmony_ci    static bool CheckValueType(napi_env& env, napi_value& value, napi_valuetype checkType);
345ccb8f90Sopenharmony_ci};
355ccb8f90Sopenharmony_ci} // namespace PowerMgr
365ccb8f90Sopenharmony_ci} // namespace OHOS
375ccb8f90Sopenharmony_ci
385ccb8f90Sopenharmony_ci#endif // POWER_NAPI_UTILS_H
39