1/* 2* Copyright (c) 2023 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/** 17 * @file 18 * @kit InputKit 19 */ 20 21import type { AsyncCallback } from './@ohos.base'; 22/** 23 * The shortKey module provides APIs to set the delay for starting an ability using a shortcut key. 24 * For example, you can set the delay to 3 seconds so that a screenshot is taken when you press and hold the shortcut key for 3 seconds. 25 * 26 * @namespace shortKey 27 * @syscap SystemCapability.MultimodalInput.Input.ShortKey 28 * @systemapi hide for inner use 29 * @since 10 30 */ 31 32declare namespace shortKey { 33 /** 34 * Sets the delay for starting an ability using shortcut keys. 35 * This API uses an asynchronous callback to return the result. 36 * 37 * @param { string } businessKey - Unique service ID registered on the multimodal side. 38 * It corresponds to businessId in the ability_launch_config.json file. You need to query this parameter on your own before calling the API. 39 * @param { number } delay - Delay for starting an ability using shortcut keys, in milliseconds. This field is invalid only when shortcut keys are used. 40 * @param { AsyncCallback<void> } callback - Callback used to return the result. 41 * If the operation is successful, err is undefined. Otherwise, err is an error object. 42 * @throws { BusinessError } 202 - SystemAPI permission error. 43 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 44 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 45 * @syscap SystemCapability.MultimodalInput.Input.ShortKey 46 * @systemapi hide for inner use 47 * @since 10 48 */ 49 function setKeyDownDuration(businessKey: string, delay: number, callback: AsyncCallback<void>): void; 50 51 /** 52 * Sets the delay for starting an ability using shortcut keys. 53 * This API uses a promise to return the result. 54 * 55 * @param { string } businessKey - Unique service ID registered on the multimodal side. 56 * It corresponds to businessId in the ability_launch_config.json file. You need to query this parameter on your own before calling the API. 57 * @param { number } delay - Delay for starting an ability using shortcut keys, in milliseconds. This field is invalid only when shortcut keys are used. 58 * @returns { Promise<void> } Returns the result through a promise. 59 * @throws { BusinessError } 202 - SystemAPI permission error. 60 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 61 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 62 * @syscap SystemCapability.MultimodalInput.Input.ShortKey 63 * @systemapi hide for inner use 64 * @since 10 65 */ 66 function setKeyDownDuration(businessKey: string, delay: number): Promise<void>; 67 68} 69export default shortKey; 70 71/** 72 * Enumerates fingerprint key event types. 73 * 74 * @enum { number } 75 * @syscap SystemCapability.MultimodalInput.Input.Core 76 * @systemapi Hide this for inner system use. 77 * @since 12 78 */ 79export declare enum FingerprintAction { 80 /** 81 * Pressing down. 82 * 83 * @syscap SystemCapability.MultimodalInput.Input.Core 84 * @systemapi Hide this for inner system use. 85 * @since 12 86 */ 87 DOWN = 0, 88 89 /** 90 * Lifting up. 91 * 92 * @syscap SystemCapability.MultimodalInput.Input.Core 93 * @systemapi Hide this for inner system use. 94 * @since 12 95 */ 96 UP = 1, 97 98 /** 99 * Sliding. 100 * 101 * @syscap SystemCapability.MultimodalInput.Input.Core 102 * @systemapi Hide this for inner system use. 103 * @since 12 104 */ 105 SLIDE = 2, 106 107 /** 108 * Retouching. 109 * 110 * @syscap SystemCapability.MultimodalInput.Input.Core 111 * @systemapi Hide this for inner system use. 112 * @since 12 113 */ 114 RETOUCH = 3, 115 116 /** 117 * Clicking. 118 * 119 * @syscap SystemCapability.MultimodalInput.Input.Core 120 * @systemapi Hide this for inner system use. 121 * @since 12 122 */ 123 CLICK = 4, 124} 125 126/** 127 * Defines the key event type and the offset position relative to the key. 128 * 129 * @interface FingerprintEvent 130 * @syscap SystemCapability.MultimodalInput.Input.Core 131 * @systemapi Hide this for inner system use. 132 * @since 12 133 */ 134export declare interface FingerprintEvent { 135 /** 136 * Fingerprint key event type. 137 * 138 * @type { FingerprintAction } 139 * @syscap SystemCapability.MultimodalInput.Input.Core 140 * @systemapi Hide this for inner system use. 141 * @since 12 142 */ 143 action: FingerprintAction; 144 145 /** 146 * This value indicates the sliding percentage of the fingerprint key on the X axis, 147 * that is, the ratio of the relative sliding distance to the device length 148 * compared with the previous report of the sliding event. 149 * A positive value indicates moving in the positive direction of the X axis, 150 * and a negative value indicates the opposite. 151 * The vertical upward direction of the device stands for the positive direction of the Y axis, 152 * and the horizontal rightward direction stands for the positive direction of the X axis. 153 * This way, a rectangular coordinate system is constructed. 154 * 155 * @type { number } 156 * @syscap SystemCapability.MultimodalInput.Input.Core 157 * @systemapi Hide this for inner system use. 158 * @since 12 159 */ 160 distanceX: number; 161 162 /** 163 * This value indicates the sliding percentage of the fingerprint key on the Y axis, 164 * that is, the ratio of the relative sliding distance to the component length 165 * compared with the previous report of the sliding event. 166 * A positive value indicates moving in the positive direction of the Y axis, 167 * and a negative value indicates the opposite. 168 * The vertical upward direction of the device stands for the positive direction of the Y axis, 169 * and the horizontal rightward direction stands for the positive direction of the X axis. 170 * This way, a rectangular coordinate system is constructed. 171 * 172 * @type { number } 173 * @syscap SystemCapability.MultimodalInput.Input.Core 174 * @systemapi Hide this for inner system use. 175 * @since 12 176 */ 177 distanceY: number; 178}