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