1/* 2 * Copyright (c) 2021 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#ifndef NATIVE_PARAMETERS_JS_H 16#define NATIVE_PARAMETERS_JS_H 17 18#include <cstdarg> 19#include <cstdio> 20#include <cstdlib> 21#include <cstring> 22#include <fcntl.h> 23#include <map> 24#include <mutex> 25#include <sstream> 26#include <string> 27#include <unistd.h> 28 29#include "beget_ext.h" 30#include "napi/native_api.h" 31#include "napi/native_node_api.h" 32#include "param_wrapper.h" 33#include "parameter.h" 34 35#define PARAM_JS_DOMAIN (BASE_DOMAIN + 0xc) 36#define PARAM_JS_LOGI(fmt, ...) STARTUP_LOGI(PARAM_JS_DOMAIN, "PARAM_JS", fmt, ##__VA_ARGS__) 37#define PARAM_JS_LOGE(fmt, ...) STARTUP_LOGE(PARAM_JS_DOMAIN, "PARAM_JS", fmt, ##__VA_ARGS__) 38#define PARAM_JS_LOGV(fmt, ...) STARTUP_LOGV(PARAM_JS_DOMAIN, "PARAM_JS", fmt, ##__VA_ARGS__) 39#define PARAM_JS_LOGW(fmt, ...) STARTUP_LOGW(PARAM_JS_DOMAIN, "PARAM_JS", fmt, ##__VA_ARGS__) 40 41#define PARAM_JS_CHECK(retCode, exper, ...) \ 42 if (!(retCode)) { \ 43 PARAM_JS_LOGE(__VA_ARGS__); \ 44 exper; \ 45 } 46 47EXTERN_C_START 48napi_value GetWatcher(napi_env env, napi_callback_info info); 49napi_value ParamWait(napi_env env, napi_callback_info info); 50napi_value RegisterWatcher(napi_env env, napi_value exports); 51EXTERN_C_END 52 53#endif // NATIVE_PARAMETERS_JS_H