1 /* 2 * Copyright (c) 2022 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 NAPI_SETTINGS_H 17 #define NAPI_SETTINGS_H 18 19 #include <vector> 20 21 #include "napi/native_api.h" 22 #include "napi/native_common.h" 23 #include "napi/native_node_api.h" 24 #include "uri.h" 25 26 #define ARGS_ONE 1 27 #define ARGS_TWO 2 28 #define ARGS_THREE 3 29 #define ARGS_FOUR 4 30 31 #define PARAM0 0 32 #define PARAM1 1 33 #define PARAM2 2 34 #define PARAM3 3 35 36 namespace OHOS { 37 namespace Settings { 38 /** 39 * @brief getUri NAPI implementation. 40 * @param env the environment that the Node-API call is invoked under 41 * @param info the callback info passed into the callback function 42 * @return napi_value the return value from NAPI C++ to JS for the module. 43 */ 44 napi_value napi_get_uri(napi_env env, napi_callback_info info); 45 46 /** 47 * @brief getUriSync NAPI implementation. 48 * @param env the environment that the Node-API call is invoked under 49 * @param info the callback info passed into the callback function 50 * @return napi_value the return value from NAPI C++ to JS for the module. 51 */ 52 napi_value napi_get_uri_sync(napi_env env, napi_callback_info info); 53 54 /** 55 * @brief getValue NAPI implementation. 56 * @param env the environment that the Node-API call is invoked under 57 * @param info the callback info passed into the callback function 58 * @return napi_value the return value from NAPI C++ to JS for the module. 59 */ 60 napi_value napi_get_value(napi_env env, napi_callback_info info); 61 napi_value napi_get_value_ext(napi_env env, napi_callback_info info, const bool stageMode); 62 63 /** 64 * @brief getValueSync NAPI implementation. 65 * @param env the environment that the Node-API call is invoked under 66 * @param info the callback info passed into the callback function 67 * @return napi_value the return value from NAPI C++ to JS for the module. 68 */ 69 napi_value napi_get_value_sync(napi_env env, napi_callback_info info); 70 71 /** 72 * @brief setValue NAPI implementation. 73 * @param env the environment that the Node-API call is invoked under 74 * @param info the callback info passed into the callback function 75 * @return napi_value the return value from NAPI C++ to JS for the module. 76 */ 77 napi_value napi_set_value(napi_env env, napi_callback_info info); 78 napi_value napi_set_value_ext(napi_env env, napi_callback_info info, const bool stageMode); 79 80 /** 81 * @brief setValueSync NAPI implementation. 82 * @param env the environment that the Node-API call is invoked under 83 * @param info the callback info passed into the callback function 84 * @return napi_value the return value from NAPI C++ to JS for the module. 85 */ 86 napi_value napi_set_value_sync(napi_env env, napi_callback_info info); 87 88 /** 89 * @brief initNapiClass NAPI implementation. 90 * @param env the environment that the Node-API call is invoked under 91 * @param exports the class property 92 * @return napi_value the return value from NAPI C++ to JS for the module. 93 */ 94 napi_value InitNapiClass(napi_env env, napi_value exports); 95 96 /** 97 * @brief enableAirplaneMode NAPI implementation. 98 * @param env the environment that the Node-API call is invoked under 99 * @param info the callback info passed into the callback function 100 * @return napi_value the return value from NAPI C++ to JS for the module. 101 */ 102 napi_value napi_enable_airplane_mode(napi_env env, napi_callback_info info); 103 104 /** 105 * @brief canShowFloating NAPI implementation. 106 * @param env the environment that the Node-API call is invoked under 107 * @param info the callback info passed into the callback function 108 * @return napi_value the return value from NAPI C++ to JS for the module. 109 */ 110 napi_value napi_can_show_floating(napi_env env, napi_callback_info info); 111 } // namespace Settings 112 } // namespace OHOS 113 #endif // NAPI_SETTINGS_H 114