1/* 2* Copyright (C) 2021 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 16import { Callback } from './basic'; 17 18 /** 19 * The event of key input management module is configured to subscribe and unsubscribe system keys. 20 * 21 * @since 8 22 * @syscap SystemCapability.MultimodalInput.Input.InputConsumer 23 * @import import inputConsumer from '@ohos.multimodalInput.inputConsumer'; 24 * @systemapi hide for inner use 25 */ 26 27declare namespace inputConsumer { 28 /** 29 * Defines event of key that user want to subscribe or unsubscribe. 30 * 31 * @syscap SystemCapability.MultimodalInput.Input.InputConsumer 32 * @systemapi hide for inner use 33 * @param preKeys The pre-keys that want to subscribe or unsubscribe. 34 * @param finalKey The post position key that want to subscribe or unsubscribe. 35 * @param isFinalKeyDown The final key press down or up. 36 * @param finalKeyDownDuration Duration of final key press. 37 */ 38 interface KeyOptions { 39 preKeys: Array<number>; 40 finalKey: number; 41 isFinalKeyDown: boolean; 42 finalKeyDownDuration: number; 43 } 44 45 /** 46 * Subscribe system keys. 47 * 48 * @since 8 49 * @syscap SystemCapability.MultimodalInput.Input.InputConsumer 50 * @systemapi hide for inner use 51 * @param type type of the inputevent about input which is to be subscribed. 52 * @param keyOption the key events about input which is to be subscribed. 53 * @param callback callback function, receive reported data. 54 */ 55 function on(type: "key", keyOptions: KeyOptions, callback: Callback<KeyOptions>): void; 56 57 /** 58 * Subscribe system keys. 59 * 60 * @since 8 61 * @syscap SystemCapability.MultimodalInput.Input.InputConsumer 62 * @systemapi hide for inner use 63 * @param type type of the inputevent about input which is to be subscribed. 64 * @param keyOption the key events about input which is to be subscribed. 65 * @param callback callback function, receive reported data. 66 */ 67 function off(type: "key", keyOptions: KeyOptions, callback?: Callback<KeyOptions>): void; 68} 69 70export default inputConsumer;