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 JS_INPUT_DEVICE_COOPERATE_MANAGER_H 17 #define JS_INPUT_DEVICE_COOPERATE_MANAGER_H 18 19 #include <cstdint> 20 #include <mutex> 21 #include <string> 22 23 #include <napi/native_api.h> 24 #include <nocopyable.h> 25 26 #include "js_event_target.h" 27 28 namespace OHOS { 29 namespace MMI { 30 class JsInputDeviceCooperateManager : public JsEventTarget { 31 public: 32 JsInputDeviceCooperateManager() = default; 33 ~JsInputDeviceCooperateManager() = default; 34 DISALLOW_COPY_AND_MOVE(JsInputDeviceCooperateManager); 35 36 napi_value Enable(napi_env env, bool enable, napi_value handle = nullptr); 37 napi_value Start(napi_env env, const std::string &sinkDeviceDescriptor, int32_t srcInputDeviceId, 38 napi_value handle = nullptr); 39 napi_value Stop(napi_env env, napi_value handle = nullptr); 40 napi_value GetState(napi_env env, const std::string &deviceDescriptor, napi_value handle = nullptr); 41 void RegisterListener(napi_env env, const std::string &type, napi_value handle); 42 void UnregisterListener(napi_env env, const std::string &type, napi_value handle = nullptr); 43 void ResetEnv(); 44 45 private: 46 std::mutex mutex_; 47 }; 48 } // namespace MMI 49 } // namespace OHOS 50 #endif // JS_INPUT_DEVICE_COOPERATE_MANAGER_H 51