• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 JS_INPUT_DEVICE_MANAGER_H
17 #define JS_INPUT_DEVICE_MANAGER_H
18 
19 #include <memory>
20 #include "js_event_target.h"
21 
22 namespace OHOS {
23 namespace MMI {
24 class JsInputDeviceManager : public JsEventTarget {
25 public:
26     JsInputDeviceManager() = default;
27     DISALLOW_COPY_AND_MOVE(JsInputDeviceManager);
28     ~JsInputDeviceManager() = default;
29 
30     void ResetEnv();
31     napi_value GetDeviceIds(napi_env env, napi_value handle = nullptr);
32     napi_value GetDevice(napi_env env, int32_t id, napi_value handle = nullptr);
33     napi_value SupportKeys(napi_env env, int32_t id, std::vector<int32_t> &keyCodes,
34                                    napi_value handle = nullptr);
35     napi_value GetKeyboardType(napi_env env, int32_t id, napi_value handle = nullptr);
36     void RegisterDevListener(napi_env env, const std::string &type, napi_value handle);
37     void UnregisterDevListener(napi_env env, const std::string &type, napi_value handle = nullptr);
38     napi_value GetDeviceList(napi_env env, napi_value handle = nullptr);
39     napi_value GetDeviceInfo(napi_env env, int32_t id, napi_value handle = nullptr);
40 };
41 } // namespace MMI
42 } // namespace OHOS
43 
44 #endif // JS_INPUT_DEVICE_MANAGER_H