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_CONSTANTS_H 17 #define NAPI_CONSTANTS_H 18 19 #include <cstddef> 20 #include <string_view> 21 22 namespace OHOS { 23 namespace MMI { 24 inline constexpr std::string_view CALL_FUNCTION = "napi_call_function"; 25 inline constexpr std::string_view CREATE_OBJECT = "napi_create_object"; 26 inline constexpr std::string_view CREATE_INT32 = "napi_create_int32"; 27 inline constexpr std::string_view CREATE_INT64 = "napi_create_int64"; 28 inline constexpr std::string_view CREATE_PROMISE = "napi_create_promise"; 29 inline constexpr std::string_view CREATE_REFERENCE = "napi_create_reference"; 30 inline constexpr std::string_view CREATE_ASYNC_WORK = "napi_create_async_work"; 31 inline constexpr std::string_view DEFINE_PROPERTIES = "napi_define_properties"; 32 inline constexpr std::string_view DEFINE_CLASS = "napi_define_class"; 33 inline constexpr std::string_view DELETE_REFERENCE = "napi_delete_reference"; 34 inline constexpr std::string_view GET_CB_INFO = "napi_get_cb_info"; 35 inline constexpr std::string_view GET_VALUE_BOOL = "napi_get_value_bool"; 36 inline constexpr std::string_view GET_GLOBAL = "napi_get_global"; 37 inline constexpr std::string_view GET_REFERENCE_VALUE = "napi_get_reference_value"; 38 inline constexpr std::string_view GET_BOOLEAN = "napi_get_boolean"; 39 inline constexpr std::string_view GET_VALUE_INT32 = "napi_get_value_int32"; 40 inline constexpr std::string_view GET_UV_EVENT_LOOP = "napi_get_uv_event_loop"; 41 inline constexpr std::string_view GET_UNDEFINED = "napi_get_undefined"; 42 inline constexpr std::string_view GET_NAMED_PROPERTY = "napi_get_named_property"; 43 inline constexpr std::string_view HAS_NAMED_PROPERTY = "napi_has_named_property"; 44 inline constexpr std::string_view NEW_INSTANCE = "napi_new_instance"; 45 inline constexpr std::string_view QUEUE_ASYNC_WORK = "napi_queue_async_work"; 46 inline constexpr std::string_view RESOLVE_DEFERRED = "napi_resolve_deferred"; 47 inline constexpr std::string_view REJECT_DEFERRED = "napi_reject_deferred"; 48 inline constexpr std::string_view REFERENCE_REF = "napi_reference_ref"; 49 inline constexpr std::string_view REFERENCE_UNREF = "napi_reference_unref"; 50 inline constexpr std::string_view SET_NAMED_PROPERTY = "napi_set_named_property"; 51 inline constexpr std::string_view STRICT_EQUALS = "napi_strict_equals"; 52 inline constexpr std::string_view TYPEOF = "napi_typeof"; 53 inline constexpr std::string_view UNWRAP = "napi_unwrap"; 54 inline constexpr std::string_view WRAP = "napi_wrap"; 55 inline constexpr std::string_view GET_VALUE_STRING_UTF8 = "napi_get_value_string_utf8"; 56 inline constexpr std::string_view GET_ARRAY_LENGTH = "napi_get_array_length"; 57 inline constexpr std::string_view GET_ELEMENT = "napi_get_element"; 58 inline constexpr std::string_view CREATE_ARRAY = "napi_create_array"; 59 inline constexpr std::string_view SET_ELEMENT = "napi_set_element"; 60 inline constexpr std::string_view CREATE_STRING_UTF8 = "napi_create_string_utf8"; 61 inline const std::string CHANGED_TYPE = "change"; 62 inline const std::string SUBSCRIBE_TYPE = "key"; 63 inline const std::string HOTKEY_SUBSCRIBE_TYPE = "hotkeyChange"; 64 inline constexpr std::string_view DELETE_ASYNC_WORK = "napi_delete_async_work"; 65 inline constexpr std::string_view COERCE_TO_BOOL = "napi_coerce_to_bool"; 66 inline constexpr std::string_view CREATE_ERROR = "napi_create_error"; 67 68 inline constexpr size_t MAX_STRING_LEN { 1024 }; 69 70 inline constexpr int SUCCESS { 0 }; 71 inline constexpr int FAILED { -1 }; 72 inline constexpr int32_t ANR_DISPATCH = 0; 73 inline constexpr int32_t ANR_MONITOR = 1; 74 75 inline constexpr uint32_t EVDEV_UDEV_TAG_KEYBOARD = (1 << 1); 76 inline constexpr uint32_t EVDEV_UDEV_TAG_MOUSE = (1 << 2); 77 inline constexpr uint32_t EVDEV_UDEV_TAG_TOUCHPAD = (1 << 3); 78 } // namespace MMI 79 } // namespace OHOS 80 #endif // NAPI_CONSTANTS_H 81