1/* 2 * Copyright (c) 2021-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 { Callback, AsyncCallback } from './@ohos.base'; 22import type { KeyCode } from './@ohos.multimodalInput.keyCode'; 23 24/** 25 * The input device management module is configured to obtain an ID and device information of an input device. 26 * 27 * @namespace inputDevice 28 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 29 * @since 8 30 */ 31declare namespace inputDevice { 32 /** 33 * Add or remove device 34 * @typedef { 'add' | 'remove' } 35 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 36 * @since 9 37 */ 38 type ChangedType = 'add' | 'remove'; 39 40 /** 41 * The type of input device 42 * @typedef { 'keyboard' | 'mouse' | 'touchpad' | 'touchscreen' | 'joystick' | 'trackball' } 43 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 44 * @since 9 45 */ 46 type SourceType = 'keyboard' | 'mouse' | 'touchpad' | 'touchscreen' | 'joystick' | 'trackball'; 47 48 /** 49 * Axis Type of the input event 50 * @typedef { 'touchmajor'| 'touchminor' | 'orientation' | 'x' | 'y' | 'pressure' | 'toolminor' | 'toolmajor' | 'null' } 51 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 52 * @since 9 53 */ 54 type AxisType = 55 'touchmajor' 56 | 'touchminor' 57 | 'orientation' 58 | 'x' 59 | 'y' 60 | 'pressure' 61 | 'toolminor' 62 | 'toolmajor' 63 | 'null'; 64 65 /** 66 * @enum { number } 67 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 68 * @since 9 69 */ 70 enum KeyboardType { 71 /** 72 * None 73 * 74 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 75 * @since 9 76 */ 77 NONE = 0, 78 79 /** 80 * Unknown key 81 * 82 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 83 * @since 9 84 */ 85 UNKNOWN = 1, 86 87 /** 88 * Alphabetical keyboard 89 * 90 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 91 * @since 9 92 */ 93 ALPHABETIC_KEYBOARD = 2, 94 95 /** 96 * Digital keyboard 97 * 98 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 99 * @since 9 100 */ 101 DIGITAL_KEYBOARD = 3, 102 103 /** 104 * Stylus 105 * 106 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 107 * @since 9 108 */ 109 HANDWRITING_PEN = 4, 110 111 /** 112 * Remote control 113 * 114 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 115 * @since 9 116 */ 117 REMOTE_CONTROL = 5 118 } 119 120 /** 121 * Enumerates function keys. 122 * 123 * @enum { number } 124 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 125 * @since 15 126 */ 127 enum FunctionKey { 128 /** 129 * CapsLock key. Enabling or disabling the CapsLock key is allowed only for input keyboard extensions. 130 * 131 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 132 * @since 15 133 */ 134 CAPS_LOCK = 1 135 } 136 137 /** 138 * Defines the listener for input device events. 139 * 140 * @interface DeviceListener 141 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 142 * @since 9 143 */ 144 interface DeviceListener { 145 /** 146 * Type of the input device event. The options are add and remove. 147 * 148 * @type { ChangedType } 149 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 150 * @since 9 151 */ 152 type: ChangedType; 153 154 /** 155 * ID of the input device for the reported input device event. 156 * 157 * @type { number } 158 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 159 * @since 9 160 */ 161 deviceId: number; 162 } 163 164 /** 165 * Starts listening for an input device event. 166 * 167 * @param { 'change' } type - Type of the input device event, which is **change**. 168 * @param { Callback<DeviceListener> } listener - Callback for the input device event. 169 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 170 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 171 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 172 * @since 9 173 */ 174 function on(type: 'change', listener: Callback<DeviceListener>): void; 175 176 /** 177 * Stops listening for an input device event. 178 * 179 * @param { 'change' } type - Type of the input device event, which is **change**. 180 * @param { Callback<DeviceListener> } listener - Callback for the input device event. 181 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 182 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 183 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 184 * @since 9 185 */ 186 function off(type: 'change', listener?: Callback<DeviceListener>): void; 187 188 /** 189 * Defines axis information about events that can be reported by an input device. 190 * For example, a touchscreen may report information such as x, y, and pressure, 191 * which indicate the x-axis coordinate, y-axis coordinate, and pressure, respectively. 192 * 193 * @interface AxisRange 194 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 195 * @since 8 196 */ 197 interface AxisRange { 198 /** 199 * Input source type of the axis. For example, if a mouse reports an x-axis event, 200 * the source of the x-axis is the mouse. 201 * 202 * @type { SourceType } 203 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 204 * @since 8 205 */ 206 source: SourceType; 207 208 /** 209 * Type of the axis. for example, the x-axis, y-axis, and pressure axis. 210 * 211 * @type { AxisType } 212 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 213 * @since 8 214 */ 215 axis: AxisType; 216 217 /** 218 * Maximum value of the data reported on this axis. 219 * 220 * @type { number } 221 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 222 * @since 8 223 */ 224 max: number; 225 226 /** 227 * Minimum value of the data reported on this axis. 228 * 229 * @type { number } 230 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 231 * @since 8 232 */ 233 min: number; 234 235 /** 236 * Fuzz value of the data reported on this axis. 237 * 238 * @type { number } 239 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 240 * @since 9 241 */ 242 fuzz: number; 243 244 /** 245 * Flat value of the data reported on this axis. 246 * 247 * @type { number } 248 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 249 * @since 9 250 */ 251 flat: number; 252 253 /** 254 * Resolution value of the data reported on this axis. 255 * 256 * @type { number } 257 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 258 * @since 9 259 */ 260 resolution: number; 261 } 262 263 /** 264 * Defines the information about an input device. 265 * 266 * @interface InputDeviceData 267 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 268 * @since 8 269 */ 270 interface InputDeviceData { 271 /** 272 * Id of the input device. 273 * 274 * @type { number } 275 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 276 * @since 8 277 */ 278 id: number; 279 280 /** 281 * Name of the input device. 282 * 283 * @type { string } 284 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 285 * @since 8 286 */ 287 name: string; 288 289 /** 290 * Source type supported by the input device. For example, if a keyboard is attached with a touchpad, 291 * the device has two input sources: keyboard and touchpad. 292 * 293 * @type { Array<SourceType> } 294 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 295 * @since 8 296 */ 297 sources: Array<SourceType>; 298 299 /** 300 * Axis range of the input device. 301 * 302 * @type { Array<AxisRange> } 303 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 304 * @since 8 305 */ 306 axisRanges: Array<AxisRange>; 307 308 /** 309 * Bus of the input device. 310 * 311 * @type { number } 312 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 313 * @since 9 314 */ 315 bus: number; 316 317 /** 318 * Product of the input device. 319 * 320 * @type { number } 321 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 322 * @since 9 323 */ 324 product: number; 325 326 /** 327 * Vendor of the input device. 328 * 329 * @type { number } 330 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 331 * @since 9 332 */ 333 vendor: number; 334 335 /** 336 * Version of the input device. 337 * 338 * @type { number } 339 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 340 * @since 9 341 */ 342 version: number; 343 344 /** 345 * Physical path of the input device. 346 * 347 * @type { string } 348 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 349 * @since 9 350 */ 351 phys: string; 352 353 /** 354 * Unique identifier of the input device. 355 * 356 * @type { string } 357 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 358 * @since 9 359 */ 360 uniq: string; 361 } 362 363 /** 364 * Obtains the IDs of all input devices. 365 * 366 * @param { AsyncCallback<Array<number>> } callback - Callback function, receive reported data 367 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 368 * @since 8 369 * @deprecated since 9 370 * @useinstead ohos.multimodalInput.inputDevice#getDeviceList 371 */ 372 function getDeviceIds(callback: AsyncCallback<Array<number>>): void; 373 374 /** 375 * Obtains the IDs of all input devices. 376 * 377 * @returns { Promise<Array<number>> } 378 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 379 * @since 8 380 * @deprecated since 9 381 * @useinstead ohos.multimodalInput.inputDevice#getDeviceList 382 */ 383 function getDeviceIds(): Promise<Array<number>>; 384 385 /** 386 * Obtain the information about an input device. 387 * 388 * @param { number } deviceId - ID of the input device whose information is to be obtained. 389 * @param { AsyncCallback<InputDeviceData> } callback - Callback function, receive reported data 390 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 391 * @since 8 392 * @deprecated since 9 393 * @useinstead ohos.multimodalInput.inputDevice#getDeviceInfo 394 */ 395 function getDevice(deviceId: number, callback: AsyncCallback<InputDeviceData>): void; 396 397 /** 398 * Obtain the information about an input device. 399 * 400 * @param { number } deviceId - ID of the input device whose information is to be obtained. 401 * @returns { Promise<InputDeviceData> } 402 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 403 * @since 8 404 * @deprecated since 9 405 * @useinstead ohos.multimodalInput.inputDevice#getDeviceInfo 406 */ 407 function getDevice(deviceId: number): Promise<InputDeviceData>; 408 409 /** 410 * Obtains the IDs of all input devices. 411 * 412 * @param { AsyncCallback<Array<number>> } callback - Callback function, receive reported data 413 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 414 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 415 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 416 * @since 9 417 */ 418 function getDeviceList(callback: AsyncCallback<Array<number>>): void; 419 420 /** 421 * Obtains the IDs of all input devices. 422 * 423 * @returns { Promise<Array<number>> } 424 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 425 * @since 9 426 */ 427 function getDeviceList(): Promise<Array<number>>; 428 429 /** 430 * Obtain the information about an input device. 431 * 432 * @param { number } deviceId - ID of the input device whose information is to be obtained. 433 * @param { AsyncCallback<InputDeviceData> } callback - Callback function, receive reported data 434 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 435 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 436 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 437 * @since 9 438 */ 439 function getDeviceInfo(deviceId: number, callback: AsyncCallback<InputDeviceData>): void; 440 441 /** 442 * Obtain the information about an input device. 443 * 444 * @param { number } deviceId - ID of the input device whose information is to be obtained. 445 * @returns { Promise<InputDeviceData> } 446 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 447 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 448 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 449 * @since 9 450 */ 451 function getDeviceInfo(deviceId: number): Promise<InputDeviceData>; 452 453 /** 454 * Obtain the information about an input device. 455 * 456 * @param { number } deviceId - ID of the input device whose information is to be obtained. 457 * @returns { InputDeviceData } 458 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 459 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 460 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 461 * @since 10 462 */ 463 function getDeviceInfoSync(deviceId: number): InputDeviceData; 464 465 /** 466 * Checks whether the specified key codes of an input device are supported. 467 * 468 * @param { number } deviceId - ID of the input device. 469 * @param { Array<KeyCode> } keys - Key codes of the input device, You can query maximum of five key codes at a time. 470 * @param { AsyncCallback<Array<boolean>> } callback -Indicates whether the specified key codes are supported. 471 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 472 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 473 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 474 * @since 9 475 */ 476 function supportKeys(deviceId: number, keys: Array<KeyCode>, callback: AsyncCallback<Array<boolean>>): void; 477 478 /** 479 * Checks whether the specified key codes of an input device are supported. 480 * 481 * @param { number } deviceId - ID of the input device. 482 * @param { Array<KeyCode> } keys - Key codes of the input device, You can query maximum of five key codes at a time. 483 * @returns { Promise<Array<boolean>> } Returns a result indicating whether the specified key codes are supported. 484 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 485 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 486 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 487 * @since 9 488 */ 489 function supportKeys(deviceId: number, keys: Array<KeyCode>): Promise<Array<boolean>>; 490 491 /** 492 * Checks whether the specified key codes of an input device are supported. 493 * 494 * @param { number } deviceId - ID of the input device. 495 * @param { Array<KeyCode> } keys - Key codes of the input device, You can query maximum of five key codes at a time. 496 * @returns { Array<boolean> } Returns a result indicating whether the specified key codes are supported. 497 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 498 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 499 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 500 * @since 10 501 */ 502 function supportKeysSync(deviceId: number, keys: Array<KeyCode>): Array<boolean>; 503 504 /** 505 * Query the keyboard type of the input device. 506 * 507 * @param { number } deviceId - ID of the specified input device. 508 * @param { AsyncCallback<KeyboardType> } callback - Returns the keyboard type. 509 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 510 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 511 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 512 * @since 9 513 */ 514 function getKeyboardType(deviceId: number, callback: AsyncCallback<KeyboardType>): void; 515 516 /** 517 * Query the keyboard type of the input device. 518 * 519 * @param { number } deviceId - ID of the specified input device. 520 * @returns { Promise<KeyboardType> } Returns the keyboard type. 521 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 522 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 523 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 524 * @since 9 525 */ 526 function getKeyboardType(deviceId: number): Promise<KeyboardType>; 527 528 /** 529 * Query the keyboard type of the input device. 530 * 531 * @param { number } deviceId - ID of the specified input device. 532 * @returns { KeyboardType } Returns the keyboard type. 533 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 534 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 535 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 536 * @since 10 537 */ 538 function getKeyboardTypeSync(deviceId: number): KeyboardType; 539 540 /** 541 * Setting the Keyboard Repetition Delay. 542 * 543 * @param { number } delay - Repeat delay time, the unit is ms. 544 * @param { AsyncCallback<void> } callback - Callback used to return the result. 545 * @throws { BusinessError } 202 - SystemAPI permission error. 546 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 547 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 548 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 549 * @systemapi hide for inner use. 550 * @since 10 551 */ 552 function setKeyboardRepeatDelay(delay: number, callback: AsyncCallback<void>): void; 553 554 /** 555 * Setting the Keyboard Repetition Delay. 556 * 557 * @param { number } delay - Repeat delay time, the unit is ms. 558 * @returns { Promise<void> } Returns the result through a promise. 559 * @throws { BusinessError } 202 - SystemAPI permission error. 560 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 561 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 562 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 563 * @systemapi hide for inner use. 564 * @since 10 565 */ 566 function setKeyboardRepeatDelay(delay: number): Promise<void>; 567 568 /** 569 * Get the Keyboard Repetition Delay. 570 * 571 * @param { AsyncCallback<number> } callback - Callback used to return the result. 572 * @throws { BusinessError } 202 - SystemAPI permission error. 573 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 574 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 575 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 576 * @systemapi hide for inner use. 577 * @since 10 578 */ 579 function getKeyboardRepeatDelay(callback: AsyncCallback<number>): void; 580 581 /** 582 * Get the Keyboard Repetition Delay. 583 * 584 * @returns { Promise<number> } Returns the result through a promise. 585 * @throws { BusinessError } 202 - SystemAPI permission error. 586 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 587 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 588 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 589 * @systemapi hide for inner use. 590 * @since 10 591 */ 592 function getKeyboardRepeatDelay(): Promise<number>; 593 594 /** 595 * Setting the Keyboard Key Repetition Rate. 596 * 597 * @param { number } rate - Repetition rate, the unit is ms. 598 * @param { AsyncCallback<void> } callback - Callback used to return the result. 599 * @throws { BusinessError } 202 - SystemAPI permission error. 600 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 601 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 602 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 603 * @systemapi hide for inner use. 604 * @since 10 605 */ 606 function setKeyboardRepeatRate(rate: number, callback: AsyncCallback<void>): void; 607 608 /** 609 * Setting the Keyboard Key Repetition Rate. 610 * 611 * @param { number } rate - Repetition rate, the unit is ms. 612 * @returns { Promise<void> } Returns the result through a promise. 613 * @throws { BusinessError } 202 - SystemAPI permission error. 614 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 615 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 616 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 617 * @systemapi hide for inner use. 618 * @since 10 619 */ 620 function setKeyboardRepeatRate(rate: number): Promise<void>; 621 622 /** 623 * Get Keyboard Key Repetition Rate. 624 * 625 * @param { AsyncCallback<number> } callback - Callback used to return the result. 626 * @throws { BusinessError } 202 - SystemAPI permission error. 627 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 628 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 629 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 630 * @systemapi hide for inner use. 631 * @since 10 632 */ 633 function getKeyboardRepeatRate(callback: AsyncCallback<number>): void; 634 635 /** 636 * Get Keyboard Key Repetition Rate. 637 * 638 * @returns { Promise<number> } Returns the result through a promise. 639 * @throws { BusinessError } 202 - SystemAPI permission error. 640 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 641 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 642 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 643 * @systemapi hide for inner use. 644 * @since 10 645 */ 646 function getKeyboardRepeatRate(): Promise<number>; 647 648 /** 649 * Obtains the interval since the last input. 650 * 651 * @returns { Promise<number> } Promise used to return the interval since the last input. 652 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 653 * @since 14 654 */ 655 function getIntervalSinceLastInput(): Promise<number>; 656 657 /** 658 * Enabling and disabling the device node. 659 * 660 * @permission ohos.permission.INPUT_DEVICE_CONTROLLER 661 * @param { number } deviceId - Device id. 662 * @param { boolean } enabled - Device node status. 663 * @returns { Promise<void> } Returns the result through a promise. 664 * @throws { BusinessError } 201 - Permission verification failed. 665 * The application does not have the permission required to call the API 666 * @throws { BusinessError } 202 - Permission verification failed. 667 * A non-system application calls a system API. 668 * @throws { BusinessError } 401 - Input parameter error. Possible causes: 669 * 1. Mandatory parameters are left unspecified; 670 * 2. Incorrect parameter types; 671 * 3. Parameter verification failed. 672 * @throws { BusinessError } 3900001 - The specified device does not exist. 673 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 674 * @systemapi 675 * @since 18 676 */ 677 function setInputDeviceEnabled(deviceId: number, enabled: boolean): Promise<void>; 678 679 /** 680 * Sets whether to enable the function key. 681 * 682 * @permission ohos.permission.INPUT_KEYBOARD_CONTROLLER 683 * @param { number } functionKey - Function key. 684 * @param { boolean } enabled - Whether to enable or disable the function key. 685 * @returns { Promise<void> } Returns the result through a promise. 686 * @throws { BusinessError } 201 - Permission denied. 687 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 688 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 689 * @throws { BusinessError } 3900002 - There is currently no keyboard device connected. 690 * @throws { BusinessError } 3900003 - It is prohibited for non-input applications. 691 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 692 * @since 15 693 */ 694 function setFunctionKeyEnabled(functionKey: FunctionKey, enabled: boolean): Promise<void>; 695 696 /** 697 * Checks whether the function key is enabled. 698 * 699 * @param { number } functionKey - Function key. 700 * @returns { Promise<boolean> } Returns the result through a promise. 701 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 702 * <br>2. Incorrect parameter types; 3. Parameter verification failed. 703 * @throws { BusinessError } 3900002 - There is currently no keyboard device connected. 704 * @syscap SystemCapability.MultimodalInput.Input.InputDevice 705 * @since 15 706 */ 707 function isFunctionKeyEnabled(functionKey: FunctionKey): Promise<boolean>; 708} 709 710export default inputDevice;