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 * @systemapi hide for inner use 24 */ 25 26declare namespace inputConsumer { 27 /** 28 * Defines event of key that user want to subscribe or unsubscribe. 29 * 30 * @syscap SystemCapability.MultimodalInput.Input.InputConsumer 31 * @systemapi hide for inner use 32 * @param preKeys The pre-keys that want to subscribe or unsubscribe. 33 * @param finalKey The post position key that want to subscribe or unsubscribe. 34 * @param isFinalKeyDown The final key press down or up. 35 * @param finalKeyDownDuration Duration of final key press. 36 */ 37 interface KeyOptions { 38 preKeys: Array<number>; 39 finalKey: number; 40 isFinalKeyDown: boolean; 41 finalKeyDownDuration: number; 42 } 43 44 /** 45 * Subscribe system keys. 46 * 47 * @since 8 48 * @syscap SystemCapability.MultimodalInput.Input.InputConsumer 49 * @systemapi hide for inner use 50 * @param type type of the inputevent about input which is to be subscribed. 51 * @param keyOptions the key events about input which is to be subscribed. 52 * @param callback callback function, receive reported data. 53 * @throws {BusinessError} 401 - Parameter error. 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 keyOptions the key events about input which is to be subscribed. 65 * @param callback callback function, receive reported data. 66 * @throws {BusinessError} 401 - Parameter error. 67 */ 68 function off(type: "key", keyOptions: KeyOptions, callback?: Callback<KeyOptions>): void; 69} 70 71export default inputConsumer;