1# @ohos.multimodalInput.pointer (Mouse Pointer) (System API) 2 3The **pointer** module provides APIs related to pointer attribute management. 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8> 9> This topic describes only system APIs provided by the module. For details about its public APIs, see [@ohos.multimodalInput.pointer (Mouse Pointer)](js-apis-pointer.md). 10 11## Modules to Import 12 13```js 14import { pointer } from '@kit.InputKit'; 15``` 16 17## pointer.setPointerSpeed 18 19setPointerSpeed(speed: number, callback: AsyncCallback<void>): void 20 21Sets the moving speed of the mouse pointer. This API uses an asynchronous callback to return the result. 22 23**System capability**: SystemCapability.MultimodalInput.Input.Pointer 24 25**System API**: This is a system API. 26 27**Parameters** 28 29| Name | Type | Mandatory | Description | 30| -------- | ------------------------- | ---- | ------------------------------------- | 31| speed | number | Yes | Moving speed of the mouse pointer. The value ranges from **1** to **11**. The default value is **7**. | 32| callback | AsyncCallback<void> | Yes | Callback used to return the result.| 33 34**Error codes** 35 36For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 37 38| ID| Error Message | 39| -------- | ----------------- | 40| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.2.Incorrect parameter types.3.Parameter verification failed. | 41 42 43**Example** 44 45```js 46try { 47 pointer.setPointerSpeed(5, (error: Error) => { 48 if (error) { 49 console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 50 return; 51 } 52 console.log(`Set pointer speed success`); 53 }); 54} catch (error) { 55 console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 56} 57``` 58 59## pointer.setPointerSpeed 60 61setPointerSpeed(speed: number): Promise<void> 62 63Sets the moving speed of the mouse pointer. This API uses a promise to return the result. 64 65**System capability**: SystemCapability.MultimodalInput.Input.Pointer 66 67**System API**: This is a system API. 68 69**Parameters** 70 71| Name | Type | Mandatory | Description | 72| ----- | ------ | ---- | ----------------------------------- | 73| speed | number | Yes | Moving speed of the mouse pointer. The value ranges from **1** to **11**. The default value is **7**.| 74 75**Return value** 76 77| Name | Description | 78| ------------------- | ---------------- | 79| Promise<void> | Promise used to return the result.| 80 81**Error codes** 82 83For details about the following error codes, see [Screen Hopping Error Codes](../apis-distributedservice-kit/errorcode-devicestatus.md). 84 85| ID| Error Message | 86| -------- | ----------------- | 87| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.2.Incorrect parameter types.3.Parameter verification failed. | 88 89 90**Example** 91 92```js 93try { 94 pointer.setPointerSpeed(5).then(() => { 95 console.log(`Set pointer speed success`); 96 }); 97} catch (error) { 98 console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 99} 100``` 101 102## pointer.setPointerSpeedSync<sup>10+</sup> 103 104setPointerSpeedSync(speed: number): void 105 106Sets the moving speed of the mouse pointer. This API returns the result synchronously. 107 108**System capability**: SystemCapability.MultimodalInput.Input.Pointer 109 110**System API**: This is a system API. 111 112**Parameters** 113 114| Name | Type | Mandatory | Description | 115| ----- | ------ | ---- | ----------------------------------- | 116| speed | number | Yes | Moving speed of the mouse pointer. The value ranges from **1** to **11**. The default value is **7**.| 117 118**Error codes** 119 120For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 121 122| ID | Error Message | 123| ---- | --------------------- | 124| 202 | SystemAPI permission error. | 125| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 126 127**Example** 128 129```js 130try { 131 let speed = pointer.setPointerSpeedSync(5); 132 console.log(`Set pointer speed success`); 133} catch (error) { 134 console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 135} 136``` 137 138## pointer.getPointerSpeed 139 140getPointerSpeed(callback: AsyncCallback<number>): void 141 142Obtains the moving speed of the mouse pointer. This API uses an asynchronous callback to return the result. 143 144**System capability**: SystemCapability.MultimodalInput.Input.Pointer 145 146**System API**: This is a system API. 147 148**Parameters** 149 150| Name | Type | Mandatory | Description | 151| -------- | --------------------------- | ---- | -------------- | 152| callback | AsyncCallback<number> | Yes | Callback used to return the result.| 153 154**Error codes** 155 156For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 157 158| ID | Error Message | 159| ---- | --------------------- | 160| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 161 162 163**Example** 164 165```js 166try { 167 pointer.getPointerSpeed((error: Error, speed: number) => { 168 if (error) { 169 console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 170 return; 171 } 172 console.log(`Get pointer speed success, speed: ${JSON.stringify(speed)}`); 173 }); 174} catch (error) { 175 console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 176} 177``` 178 179## pointer.getPointerSpeed 180 181getPointerSpeed(): Promise<number> 182 183Obtains the moving speed of the mouse pointer. This API uses a promise to return the result. 184 185**System capability**: SystemCapability.MultimodalInput.Input.Pointer 186 187**System API**: This is a system API. 188 189**Return value** 190 191| Name | Description | 192| --------------------- | ------------------- | 193| Promise<number> | Promise used to return the result.| 194 195**Example** 196 197```js 198try { 199 pointer.getPointerSpeed().then(speed => { 200 console.log(`Get pointer speed success, speed: ${JSON.stringify(speed)}`); 201 }); 202} catch (error) { 203 console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 204} 205``` 206 207## pointer.getPointerSpeedSync<sup>10+</sup> 208 209getPointerSpeedSync(): number 210 211Obtains the moving speed of the mouse pointer. This API returns the result synchronously. 212 213**System capability**: SystemCapability.MultimodalInput.Input.Pointer 214 215**System API**: This is a system API. 216 217**Return value** 218 219| Name | Description | 220| --------------------- | ------------------- | 221| number | Moving speed of the mouse pointer.| 222 223**Error codes** 224 225For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 226 227| ID | Error Message | 228| ---- | --------------------- | 229| 202 | SystemAPI permission error. | 230| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 231 232**Example** 233 234```js 235try { 236 let speed = pointer.getPointerSpeedSync(); 237 console.log(`Get pointer speed success, speed: ${JSON.stringify(speed)}`); 238} catch (error) { 239 console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 240} 241``` 242 243## pointer.setHoverScrollState<sup>10+</sup> 244 245setHoverScrollState(state: boolean, callback: AsyncCallback<void>): void 246 247Sets the status of the mouse hover scroll switch. This API uses an asynchronous callback to return the result. 248 249**System capability**: SystemCapability.MultimodalInput.Input.Pointer 250 251**System API**: This is a system API. 252 253**Parameters** 254 255| Name | Type | Mandatory | Description | 256| -------- | ------------------------- | ---- | ------------------------------------- | 257| state | boolean | Yes | Status of the mouse hover scroll switch. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. | 258| callback | AsyncCallback<void> | Yes | Callback used to return the result.| 259 260**Error codes** 261 262For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 263 264| ID | Error Message | 265| ---- | --------------------- | 266| 202 | SystemAPI permission error. | 267| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 268 269**Example** 270 271```js 272try { 273 pointer.setHoverScrollState(true, (error: Error) => { 274 if (error) { 275 console.log(`Set the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 276 return; 277 } 278 console.log(`Set the mouse hover scroll success`); 279 }); 280} catch (error) { 281 console.log(`Set the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 282} 283``` 284 285## pointer.setHoverScrollState<sup>10+</sup> 286 287setHoverScrollState(state: boolean): Promise<void> 288 289Sets the status of the mouse hover scroll switch. This API uses a promise to return the result. 290 291**System capability**: SystemCapability.MultimodalInput.Input.Pointer 292 293**System API**: This is a system API. 294 295**Parameters** 296 297| Name | Type | Mandatory | Description | 298| ----- | ------ | ---- | ----------------------------------- | 299| state | boolean | Yes | Status of the mouse hover scroll switch. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite.| 300 301**Return value** 302 303| Name | Description | 304| ------------------- | ---------------- | 305| Promise<void> | Promise used to return the result.| 306 307**Error codes** 308 309For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 310 311| ID | Error Message | 312| ---- | --------------------- | 313| 202 | SystemAPI permission error. | 314| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 315 316**Example** 317 318```js 319try { 320 pointer.setHoverScrollState(true).then(() => { 321 console.log(`Set the mouse hover scroll success`); 322 }); 323} catch (error) { 324 console.log(`Set the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 325} 326``` 327 328## pointer.getHoverScrollState<sup>10+</sup> 329 330getHoverScrollState(callback: AsyncCallback<boolean>): void 331 332Obtains the status of the mouse hover scroll switch. This API uses an asynchronous callback to return the result. 333 334**System capability**: SystemCapability.MultimodalInput.Input.Pointer 335 336**System API**: This is a system API. 337 338**Parameters** 339 340| Name | Type | Mandatory | Description | 341| -------- | --------------------------- | ---- | -------------- | 342| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite.| 343 344**Error codes** 345 346For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 347 348| ID | Error Message | 349| ---- | --------------------- | 350| 202 | SystemAPI permission error. | 351| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 352 353**Example** 354 355```js 356try { 357 pointer.getHoverScrollState((error: Error, state: boolean) => { 358 console.log(`Get the mouse hover scroll success, state: ${JSON.stringify(state)}`); 359 }); 360} catch (error) { 361 console.log(`Get the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 362} 363``` 364 365## pointer.getHoverScrollState<sup>10+</sup> 366 367getHoverScrollState(): Promise<boolean> 368 369Obtains the status of the mouse hover scroll switch. This API uses a promise to return the result. 370 371**System capability**: SystemCapability.MultimodalInput.Input.Pointer 372 373**System API**: This is a system API. 374 375**Return value** 376 377| Name | Description | 378| --------------------- | ------------------- | 379| Promise<boolean> | Promise used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite.| 380 381**Error codes** 382 383For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 384 385| ID | Error Message | 386| ---- | --------------------- | 387| 202 | SystemAPI permission error. | 388| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 389 390**Example** 391 392```js 393try { 394 pointer.getHoverScrollState().then((state: boolean) => { 395 console.log(`Get the mouse hover scroll success, state: ${JSON.stringify(state)}`); 396 }); 397} catch (error) { 398 console.log(`Get the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 399} 400``` 401 402## pointer.setMousePrimaryButton<sup>10+</sup> 403 404setMousePrimaryButton(primary: PrimaryButton, callback: AsyncCallback<void>): void 405 406Sets the primary button of the mouse. This API uses an asynchronous callback to return the result. 407 408**System capability**: SystemCapability.MultimodalInput.Input.Pointer 409 410**System API**: This is a system API. 411 412**Parameters** 413 414| Name | Type | Mandatory | Description | 415| -------- | ------------------------- | ---- | ------------------------------------- | 416| primary | [PrimaryButton](js-apis-pointer.md#primarybutton10) | Yes | ID of the primary mouse button. | 417| callback | AsyncCallback<void> | Yes | Callback used to return the result.| 418 419**Error codes** 420 421For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 422 423| ID | Error Message | 424| ---- | --------------------- | 425| 202 | SystemAPI permission error. | 426| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 427 428**Example** 429 430```js 431try { 432 pointer.setMousePrimaryButton(pointer.PrimaryButton.RIGHT, (error: Error) => { 433 if (error) { 434 console.log(`Set mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 435 return; 436 } 437 console.log(`Set mouse primary button success`); 438 }); 439} catch (error) { 440 console.log(`Set mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 441} 442``` 443 444## pointer.setMousePrimaryButton<sup>10+</sup> 445 446setMousePrimaryButton(primary: PrimaryButton): Promise<void> 447 448Sets the primary button of the mouse. This API uses a promise to return the result. 449 450**System capability**: SystemCapability.MultimodalInput.Input.Pointer 451 452**System API**: This is a system API. 453 454**Parameters** 455 456| Name | Type | Mandatory | Description | 457| ----- | ------ | ---- | ----------------------------------- | 458| primary | [PrimaryButton](js-apis-pointer.md#primarybutton10) | Yes | ID of the primary mouse button.| 459 460**Return value** 461 462| Name | Description | 463| ------------------- | ---------------- | 464| Promise<void> | Promise used to return the result.| 465 466**Error codes** 467 468For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 469 470| ID | Error Message | 471| ---- | --------------------- | 472| 202 | SystemAPI permission error. | 473| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 474 475**Example** 476 477```js 478try { 479 pointer.setMousePrimaryButton(pointer.PrimaryButton.RIGHT).then(() => { 480 console.log(`Set mouse primary button success`); 481 }); 482} catch (error) { 483 console.log(`Set mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 484} 485``` 486 487## pointer.getMousePrimaryButton<sup>10+</sup> 488 489getMousePrimaryButton(callback: AsyncCallback<PrimaryButton>): void 490 491Obtains the primary button of the mouse. This API uses an asynchronous callback to return the result. 492 493**System capability**: SystemCapability.MultimodalInput.Input.Pointer 494 495**System API**: This is a system API. 496 497**Parameters** 498 499| Name | Type | Mandatory | Description | 500| -------- | --------------------------- | ---- | -------------- | 501| callback | AsyncCallback<[PrimaryButton](js-apis-pointer.md#primarybutton10)> | Yes | Callback used to return the result.| 502 503**Error codes** 504 505For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 506 507| ID | Error Message | 508| ---- | --------------------- | 509| 202 | SystemAPI permission error. | 510| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 511 512**Example** 513 514```js 515try { 516 pointer.getMousePrimaryButton((error: Error, primary: pointer.PrimaryButton) => { 517 console.log(`Get mouse primary button success, primary: ${JSON.stringify(primary)}`); 518 }); 519} catch (error) { 520 console.log(`Get mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 521} 522``` 523 524## pointer.getMousePrimaryButton<sup>10+</sup> 525 526getMousePrimaryButton(): Promise<PrimaryButton> 527 528Obtains the primary button of the mouse. This API uses a promise to return the result. 529 530**System capability**: SystemCapability.MultimodalInput.Input.Pointer 531 532**System API**: This is a system API. 533 534**Return value** 535 536| Name | Description | 537| --------------------- | ------------------- | 538| Promise<[PrimaryButton](js-apis-pointer.md#primarybutton10)> | Promise used to return the result.| 539 540**Error codes** 541 542For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 543 544| ID | Error Message | 545| ---- | --------------------- | 546| 202 | SystemAPI permission error. | 547| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 548 549**Example** 550 551```js 552try { 553 pointer.getMousePrimaryButton().then((primary: pointer.PrimaryButton) => { 554 console.log(`Get mouse primary button success, primary: ${JSON.stringify(primary)}`); 555 }); 556} catch (error) { 557 console.log(`Get mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 558} 559``` 560 561## pointer.setMouseScrollRows<sup>10+</sup> 562 563setMouseScrollRows(rows: number, callback: AsyncCallback<void>): void 564 565Sets the number of mouse scroll rows. This API uses an asynchronous callback to return the result. 566 567**System capability**: SystemCapability.MultimodalInput.Input.Pointer 568 569**System API**: This is a system API. 570 571**Parameters** 572 573| Name | Type | Mandatory | Description | 574| -------- | ------------------------- | ---- | ------------------------------------- | 575| rows | number | Yes | Number of mouse scroll rows. The value ranges from 1 to 100. The default value is **3**. | 576| callback | AsyncCallback<void> | Yes | Callback used to return the result.| 577 578**Error codes** 579 580For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 581 582| ID | Error Message | 583| ---- | --------------------- | 584| 202 | SystemAPI permission error. | 585| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 586 587**Example** 588 589```js 590try { 591 pointer.setMouseScrollRows(1, (error: Error) => { 592 if (error) { 593 console.log(`setMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 594 return; 595 } 596 console.log(`setMouseScrollRows success`); 597 }); 598} catch (error) { 599 console.log(`setMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 600} 601``` 602 603## pointer.setMouseScrollRows<sup>10+</sup> 604 605setMouseScrollRows(rows: number): Promise<void> 606 607Sets the number of mouse scroll rows. This API uses a promise to return the result. 608 609**System capability**: SystemCapability.MultimodalInput.Input.Pointer 610 611**System API**: This is a system API. 612 613**Parameters** 614 615| Name | Type | Mandatory | Description | 616| ----- | ------ | ---- | ----------------------------------- | 617| rows | number | Yes | Number of mouse scroll rows. The value ranges from 1 to 100. The default value is **3**.| 618 619**Return value** 620 621| Name | Description | 622| ------------------- | ---------------- | 623| Promise<void> | Promise used to return the result.| 624 625**Error codes** 626 627For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 628 629| ID | Error Message | 630| ---- | --------------------- | 631| 202 | SystemAPI permission error. | 632| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 633 634**Example** 635 636```js 637try { 638 pointer.setMouseScrollRows(20).then(() => { 639 console.log(`setMouseScrollRows success`); 640 }); 641} catch (error) { 642 console.log(`setMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 643} 644``` 645 646## pointer.getMouseScrollRows<sup>10+</sup> 647 648getMouseScrollRows(callback: AsyncCallback<number>): void 649 650Obtains the number of mouse scroll rows. This API uses an asynchronous callback to return the result. 651 652**System capability**: SystemCapability.MultimodalInput.Input.Pointer 653 654**System API**: This is a system API. 655 656**Parameters** 657 658| Name | Type | Mandatory | Description | 659| -------- | --------------------------- | ---- | -------------- | 660| callback | AsyncCallback<number> | Yes | Callback used to return the result.| 661 662**Error codes** 663 664For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 665 666| ID | Error Message | 667| ---- | --------------------- | 668| 202 | SystemAPI permission error. | 669| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 670 671**Example** 672 673```js 674try { 675 pointer.getMouseScrollRows((error: Error, rows: number) => { 676 console.log(`getMouseScrollRows success, rows: ${JSON.stringify(rows)}`); 677 }); 678} catch (error) { 679 console.log(`getMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 680} 681``` 682 683## pointer.getMouseScrollRows<sup>10+</sup> 684 685getMouseScrollRows(): Promise<number> 686 687Obtains the moving speed of the mouse pointer. This API uses a promise to return the result. 688 689**System capability**: SystemCapability.MultimodalInput.Input.Pointer 690 691**System API**: This is a system API. 692 693**Return value** 694 695| Name | Description | 696| --------------------- | ------------------- | 697| Promise<number> | Promise used to return the result.| 698 699**Error codes** 700 701For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 702 703| ID | Error Message | 704| ---- | --------------------- | 705| 202 | SystemAPI permission error. | 706| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 707 708**Example** 709 710```js 711try { 712 pointer.getMouseScrollRows().then((rows: number) => { 713 console.log(`getMouseScrollRows success, rows: ${JSON.stringify(rows)}`); 714 }); 715} catch (error) { 716 console.log(`getMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 717} 718``` 719 720## pointer.setTouchpadScrollSwitch<sup>10+</sup> 721 722setTouchpadScrollSwitch(state: boolean, callback: AsyncCallback\<void>): void 723 724Sets the scroll switch of the touchpad. This API uses an asynchronous callback to return the result. 725 726**System capability**: SystemCapability.MultimodalInput.Input.Pointer 727 728**System API**: This is a system API. 729 730**Parameters** 731 732| Name | Type | Mandatory | Description | 733| -------- | ------------------------- | ---- | ------------------------------------- | 734| state | boolean | Yes | Scroll switch status. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**. | 735| callback | AsyncCallback\<void> | Yes | Callback used to return the result.| 736 737**Error codes** 738 739For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 740 741| ID | Error Message | 742| ---- | --------------------- | 743| 202 | SystemAPI permission error. | 744| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 745 746**Example** 747 748```js 749try { 750 pointer.setTouchpadScrollSwitch(true, (error: Error) => { 751 if (error) { 752 console.log(`setTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 753 return; 754 } 755 console.log(`setTouchpadScrollSwitch success`); 756 }); 757} catch (error) { 758 console.log(`setTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 759} 760``` 761 762## pointer.setTouchpadScrollSwitch<sup>10+</sup> 763 764setTouchpadScrollSwitch(state: boolean): Promise\<void> 765 766Sets the scroll switch of the touchpad. This API uses a promise to return the result. 767 768**System capability**: SystemCapability.MultimodalInput.Input.Pointer 769 770**System API**: This is a system API. 771 772**Parameters** 773 774| Name | Type | Mandatory | Description | 775| ----- | ------ | ---- | ----------------------------------- | 776| state | boolean| Yes | Scroll switch status. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.| 777 778**Return value** 779 780| Name | Description | 781| ------------------- | ---------------- | 782| Promise\<void> | Promise used to return the result.| 783 784**Error codes** 785 786For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 787 788| ID | Error Message | 789| ---- | --------------------- | 790| 202 | SystemAPI permission error. | 791| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 792 793**Example** 794 795```js 796try { 797 pointer.setTouchpadScrollSwitch(false).then(() => { 798 console.log(`setTouchpadScrollSwitch success`); 799 }); 800} catch (error) { 801 console.log(`setTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 802} 803``` 804 805## pointer.getTouchpadScrollSwitch<sup>10+</sup> 806 807getTouchpadScrollSwitch(callback: AsyncCallback\<boolean>): void 808 809Obtains the scroll switch status of the touchpad. This API uses an asynchronous callback to return the result. 810 811**System capability**: SystemCapability.MultimodalInput.Input.Pointer 812 813**System API**: This is a system API. 814 815**Parameters** 816 817| Name | Type | Mandatory | Description | 818| -------- | --------------------------- | ---- | -------------- | 819| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.| 820 821**Error codes** 822 823For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 824 825| ID | Error Message | 826| ---- | --------------------- | 827| 202 | SystemAPI permission error. | 828| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 829 830**Example** 831 832```js 833try { 834 pointer.getTouchpadScrollSwitch((error: Error, state: boolean) => { 835 console.log(`getTouchpadScrollSwitch success, state: ${JSON.stringify(state)}`); 836 }); 837} catch (error) { 838 console.log(`getTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 839} 840``` 841 842## pointer.getTouchpadScrollSwitch<sup>10+</sup> 843 844getTouchpadScrollSwitch(): Promise\<boolean> 845 846Obtains the scroll switch status of the touchpad. This API uses a promise to return the result. 847 848**System capability**: SystemCapability.MultimodalInput.Input.Pointer 849 850**System API**: This is a system API. 851 852**Return value** 853 854| Name | Description | 855| --------------------- | ------------------- | 856| Promise\<boolean> | Promise used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.| 857 858**Error codes** 859 860For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 861 862| ID | Error Message | 863| ---- | --------------------- | 864| 202 | SystemAPI permission error. | 865| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 866 867**Example** 868 869```js 870try { 871 pointer.getTouchpadScrollSwitch().then((state) => { 872 console.log(`getTouchpadScrollSwitch success, state: ${JSON.stringify(state)}`); 873 }); 874} catch (error) { 875 console.log(`getTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 876} 877``` 878 879## pointer.setTouchpadScrollDirection<sup>10+</sup> 880 881setTouchpadScrollDirection(state: boolean, callback: AsyncCallback\<void>): void 882 883Sets the scroll direction of the touchpad. This API uses an asynchronous callback to return the result. 884 885**System capability**: SystemCapability.MultimodalInput.Input.Pointer 886 887**System API**: This is a system API. 888 889**Parameters** 890 891| Name | Type | Mandatory | Description | 892| -------- | ------------------------- | ---- | ------------------------------------- | 893| state | boolean | Yes | Scroll direction of the touchpad.<br>The value **true** indicates that the scroll direction is the same as the finger moving direction, and the value **false** indicates the opposite.<br>The default value is **true**. | 894| callback | AsyncCallback\<void> | Yes | Callback used to return the result.| 895 896**Error codes** 897 898For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 899 900| ID | Error Message | 901| ---- | --------------------- | 902| 202 | SystemAPI permission error. | 903| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 904 905**Example** 906 907```js 908try { 909 pointer.setTouchpadScrollDirection(true, (error: Error) => { 910 if (error) { 911 console.log(`setTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 912 return; 913 } 914 console.log(`setTouchpadScrollDirection success`); 915 }); 916} catch (error) { 917 console.log(`setTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 918} 919``` 920 921## pointer.setTouchpadScrollDirection<sup>10+</sup> 922 923setTouchpadScrollDirection(state: boolean): Promise\<void> 924 925Sets the scroll direction of the touchpad. This API uses a promise to return the result. 926 927**System capability**: SystemCapability.MultimodalInput.Input.Pointer 928 929**System API**: This is a system API. 930 931**Parameters** 932 933| Name | Type | Mandatory | Description | 934| ----- | ------ | ---- | ----------------------------------- | 935| state | boolean| Yes | Scroll direction of the touchpad.<br>The value **true** indicates that the scroll direction is the same as the finger moving direction, and the value **false** indicates the opposite.<br>The default value is **true**.| 936 937**Return value** 938 939| Name | Description | 940| ------------------- | ---------------- | 941| Promise\<void> | Promise used to return the result.| 942 943**Error codes** 944 945For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 946 947| ID | Error Message | 948| ---- | --------------------- | 949| 202 | SystemAPI permission error. | 950| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 951 952**Example** 953 954```js 955try { 956 pointer.setTouchpadScrollDirection (false).then(() => { 957 console.log(`setTouchpadScrollDirection success`); 958 }); 959} catch (error) { 960 console.log(`setTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 961} 962``` 963 964## pointer.getTouchpadScrollDirection<sup>10+</sup> 965 966getTouchpadScrollDirection(callback: AsyncCallback\<boolean>): void 967 968Obtains the scroll direction of the touchpad. This API uses an asynchronous callback to return the result. 969 970**System capability**: SystemCapability.MultimodalInput.Input.Pointer 971 972**System API**: This is a system API. 973 974**Parameters** 975 976| Name | Type | Mandatory | Description | 977| -------- | --------------------------- | ---- | -------------- | 978| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result.<br>The value **true** indicates that the scroll direction is the same as the finger moving direction, and the value **false** indicates the opposite.<br>The default value is **true**.| 979 980**Error codes** 981 982For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 983 984| ID | Error Message | 985| ---- | --------------------- | 986| 202 | SystemAPI permission error. | 987| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 988 989**Example** 990 991```js 992try { 993 pointer.getTouchpadScrollDirection ((error: Error, state: boolean) => { 994 console.log(`getTouchpadScrollDirection success, state: ${JSON.stringify(state)}`); 995 }); 996} catch (error) { 997 console.log(`getTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 998} 999``` 1000 1001## pointer.getTouchpadScrollDirection<sup>10+</sup> 1002 1003getTouchpadScrollDirection(): Promise\<boolean> 1004 1005Obtains the scroll direction of the touchpad. This API uses a promise to return the result. 1006 1007**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1008 1009**System API**: This is a system API. 1010 1011**Return value** 1012 1013| Name | Description | 1014| --------------------- | ------------------- | 1015| Promise\<boolean> | Promise used to return the result.<br>The value **true** indicates that the scroll direction is the same as the finger moving direction, and the value **false** indicates the opposite.<br>The default value is **true**.| 1016 1017**Error codes** 1018 1019For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1020 1021| ID | Error Message | 1022| ---- | --------------------- | 1023| 202 | SystemAPI permission error. | 1024| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1025 1026**Example** 1027 1028```js 1029try { 1030 pointer.getTouchpadScrollDirection().then((state: boolean) => { 1031 console.log(`getTouchpadScrollDirection success, state: ${JSON.stringify(state)}`); 1032 }); 1033} catch (error) { 1034 console.log(`getTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1035} 1036``` 1037 1038## pointer.setTouchpadTapSwitch<sup>10+</sup> 1039 1040setTouchpadTapSwitch(state: boolean, callback: AsyncCallback\<void>): void 1041 1042Sets the tap switch of the touchpad. This API uses an asynchronous callback to return the result. 1043 1044**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1045 1046**System API**: This is a system API. 1047 1048**Parameters** 1049 1050| Name | Type | Mandatory | Description | 1051| -------- | ------------------------- | ---- | ------------------------------------- | 1052| state | boolean | Yes |Tap switch status of the touchpad The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**. | 1053| callback | AsyncCallback\<void> | Yes | Callback used to return the result.| 1054 1055**Error codes** 1056 1057For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1058 1059| ID | Error Message | 1060| ---- | --------------------- | 1061| 202 | SystemAPI permission error. | 1062| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1063 1064**Example** 1065 1066```js 1067try { 1068 pointer.setTouchpadTapSwitch(true, (error: Error) => { 1069 if (error) { 1070 console.log(`setTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1071 return; 1072 } 1073 console.log(`setTouchpadTapSwitch success`); 1074 }); 1075} catch (error) { 1076 console.log(`setTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1077} 1078``` 1079 1080## pointer.setTouchpadTapSwitch <sup>10+</sup> 1081 1082setTouchpadTapSwitch(state: boolean): Promise\<void> 1083 1084Sets the tap switch of the touchpad. This API uses a promise to return the result. 1085 1086**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1087 1088**System API**: This is a system API. 1089 1090**Parameters** 1091 1092| Name | Type | Mandatory | Description | 1093| ----- | ------ | ---- | ----------------------------------- | 1094| state | boolean| Yes | Tap switch status of the touchpad. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**. | 1095 1096**Return value** 1097 1098| Name | Description | 1099| ------------------- | ---------------- | 1100| Promise\<void> | Promise used to return the result.| 1101 1102**Error codes** 1103 1104For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1105 1106| ID | Error Message | 1107| ---- | --------------------- | 1108| 202 | SystemAPI permission error. | 1109| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1110 1111**Example** 1112 1113```js 1114try { 1115 pointer.setTouchpadTapSwitch(false).then(() => { 1116 console.log(`setTouchpadTapSwitch success`); 1117 }); 1118} catch (error) { 1119 console.log(`setTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1120} 1121``` 1122 1123## pointer.getTouchpadTapSwitch<sup>10+</sup> 1124 1125getTouchpadTapSwitch(callback: AsyncCallback\<boolean>): void 1126 1127Obtains the tap switch status of the touchpad. This API uses an asynchronous callback to return the result. 1128 1129**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1130 1131**System API**: This is a system API. 1132 1133**Parameters** 1134 1135| Name | Type | Mandatory | Description | 1136| -------- | --------------------------- | ---- | -------------- | 1137| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.| 1138 1139**Error codes** 1140 1141For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1142 1143| ID | Error Message | 1144| ---- | --------------------- | 1145| 202 | SystemAPI permission error. | 1146| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1147 1148**Example** 1149 1150```js 1151try { 1152 pointer.getTouchpadTapSwitch((error: Error, state: boolean) => { 1153 console.log(`getTouchpadTapSwitch success, state: ${JSON.stringify(state)}`); 1154 }); 1155} catch (error) { 1156 console.log(`getTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1157} 1158``` 1159 1160## pointer.getTouchpadTapSwitch<sup>10+</sup> 1161 1162getTouchpadTapSwitch(): Promise\<boolean> 1163 1164Obtains the tap switch status of the touchpad. This API uses a promise to return the result. 1165 1166**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1167 1168**System API**: This is a system API. 1169 1170**Return value** 1171 1172| Name | Description | 1173| --------------------- | ------------------- | 1174| Promise\<boolean> | Promise used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.| 1175 1176**Error codes** 1177 1178For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1179 1180| ID | Error Message | 1181| ---- | --------------------- | 1182| 202 | SystemAPI permission error. | 1183| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1184 1185**Example** 1186 1187```js 1188try { 1189 pointer.getTouchpadTapSwitch().then((state: boolean) => { 1190 console.log(`getTouchpadTapSwitch success, state: ${JSON.stringify(state)}`); 1191 }); 1192} catch (error) { 1193 console.log(`getTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1194} 1195``` 1196 1197## pointer.setTouchpadPointerSpeed<sup>10+</sup> 1198 1199setTouchpadPointerSpeed(speed: number, callback: AsyncCallback\<void>): void 1200 1201Sets the mouse pointer moving speed of the touchpad. This API uses an asynchronous callback to return the result. 1202 1203**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1204 1205**System API**: This is a system API. 1206 1207**Parameters** 1208 1209| Name | Type | Mandatory | Description | 1210| -------- | ------------------------- | ---- | ------------------------------------- | 1211| speed | number | Yes |Mouse pointer moving speed of the touchpad. The value range is [1,11]. The default value is **6**. | 1212| callback | AsyncCallback\<void> | Yes | Callback used to return the result.| 1213 1214**Error codes** 1215 1216For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1217 1218| ID | Error Message | 1219| ---- | --------------------- | 1220| 202 | SystemAPI permission error. | 1221| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1222 1223**Example** 1224 1225```js 1226try { 1227 pointer.setTouchpadPointerSpeed(1, (error: Error) => { 1228 if (error) { 1229 console.log(`setTouchpadPointerSpeedfailed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1230 return; 1231 } 1232 console.log(`setTouchpadPointerSpeed success`); 1233 }); 1234} catch (error) { 1235 console.log(`setTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1236} 1237``` 1238 1239## pointer.setTouchpadPointerSpeed<sup>10+</sup> 1240 1241setTouchpadPointerSpeed(speed: number): Promise\<void> 1242 1243Sets the mouse pointer moving speed of the touchpad. This API uses a promise to return the result. 1244 1245**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1246 1247**System API**: This is a system API. 1248 1249**Parameters** 1250 1251| Name | Type | Mandatory | Description | 1252| ----- | ------ | ---- | ----------------------------------- | 1253| speed| number | Yes | Mouse pointer moving speed of the touchpad. The value range is [1,11]. The default value is **6**. | 1254 1255**Return value** 1256 1257| Name | Description | 1258| ------------------- | ---------------- | 1259| Promise\<void> | Promise used to return the result.| 1260 1261**Error codes** 1262 1263For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1264 1265| ID | Error Message | 1266| ---- | --------------------- | 1267| 202 | SystemAPI permission error. | 1268| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1269 1270**Example** 1271 1272```js 1273try { 1274 pointer.setTouchpadPointerSpeed(10).then(() => { 1275 console.log(`setTouchpadPointerSpeed success`); 1276 }); 1277} catch (error) { 1278 console.log(`setTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1279} 1280``` 1281 1282## pointer.getTouchpadPointerSpeed<sup>10+</sup> 1283 1284getTouchpadPointerSpeed(callback: AsyncCallback\<number>): void 1285 1286Obtains the mouse pointer moving speed of the touchpad. This API uses an asynchronous callback to return the result. 1287 1288**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1289 1290**System API**: This is a system API. 1291 1292**Parameters** 1293 1294| Name | Type | Mandatory | Description | 1295| -------- | --------------------------- | ---- | -------------- | 1296| callback | AsyncCallback\<number> | Yes | Callback used to return the result.| 1297 1298**Error codes** 1299 1300For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1301 1302| ID | Error Message | 1303| ---- | --------------------- | 1304| 202 | SystemAPI permission error. | 1305| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1306 1307**Example** 1308 1309```js 1310try { 1311 pointer.getTouchpadPointerSpeed((error: Error, speed: number) => { 1312 console.log(`getTouchpadPointerSpeed success, speed: ${JSON.stringify(speed)}`); 1313 }); 1314} catch (error) { 1315 console.log(`getTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1316} 1317``` 1318 1319## pointer.getTouchpadPointerSpeed<sup>10+</sup> 1320 1321getTouchpadPointerSpeed(): Promise\<number> 1322 1323Obtains the mouse pointer moving speed of the touchpad. This API uses a promise to return the result. 1324 1325**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1326 1327**System API**: This is a system API. 1328 1329**Return value** 1330 1331| Name | Description | 1332| --------------------- | ------------------- | 1333| Promise\<number> | Promise used to return the result.| 1334 1335**Error codes** 1336 1337For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1338 1339| ID | Error Message | 1340| ---- | --------------------- | 1341| 202 | SystemAPI permission error. | 1342| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1343 1344**Example** 1345 1346```js 1347try { 1348 pointer.getTouchpadPointerSpeed().then((speed: number) => { 1349 console.log(`getTouchpadPointerSpeed success, speed: ${JSON.stringify(speed)}`); 1350 }); 1351} catch (error) { 1352 console.log(`getTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1353} 1354``` 1355 1356## pointer.setTouchpadPinchSwitch<sup>10+</sup> 1357 1358setTouchpadPinchSwitch(state: boolean, callback: AsyncCallback\<void>): void 1359 1360Sets the pinch switch of the touchpad. This API uses an asynchronous callback to return the result. 1361 1362**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1363 1364**System API**: This is a system API. 1365 1366**Parameters** 1367 1368| Name | Type | Mandatory | Description | 1369| -------- | ------------------------- | ---- | ------------------------------------- | 1370| state | boolean | Yes |Pinch switch status of the touchpad. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**. | 1371| callback | AsyncCallback\<void> | Yes | Callback used to return the result.| 1372 1373**Error codes** 1374 1375For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1376 1377| ID | Error Message | 1378| ---- | --------------------- | 1379| 202 | SystemAPI permission error. | 1380| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1381 1382**Example** 1383 1384```js 1385try { 1386 pointer.setTouchpadTapSwitch(true, (error: Error) => { 1387 if (error) { 1388 console.log(`setTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1389 return; 1390 } 1391 console.log(`setTouchpadPinchSwitch success`); 1392 }); 1393} catch (error) { 1394 console.log(`setTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1395} 1396``` 1397 1398## pointer.setTouchpadPinchSwitch<sup>10+</sup> 1399 1400setTouchpadPinchSwitch(state: boolean): Promise\<void> 1401 1402Sets the pinch switch of the touchpad. This API uses a promise to return the result. 1403 1404**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1405 1406**System API**: This is a system API. 1407 1408**Parameters** 1409 1410| Name | Type | Mandatory | Description | 1411| ----- | ------ | ---- | ----------------------------------- | 1412| state | boolean| Yes | Pinch switch status of the touchpad. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**. | 1413 1414**Return value** 1415 1416| Name | Description | 1417| ------------------- | ---------------- | 1418| Promise\<void> | Promise used to return the result.| 1419 1420**Error codes** 1421 1422For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1423 1424| ID | Error Message | 1425| ---- | --------------------- | 1426| 202 | SystemAPI permission error. | 1427| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1428 1429**Example** 1430 1431```js 1432try { 1433 pointer.setTouchpadPinchSwitch(false).then(() => { 1434 console.log(`setTouchpadPinchSwitch success`); 1435 }); 1436} catch (error) { 1437 console.log(`setTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1438} 1439``` 1440 1441## pointer.getTouchpadPinchSwitch<sup>10+</sup> 1442 1443getTouchpadPinchSwitch(callback: AsyncCallback\<boolean>): void 1444 1445Obtains the pinch switch status of the touchpad. This API uses an asynchronous callback to return the result. 1446 1447**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1448 1449**System API**: This is a system API. 1450 1451**Parameters** 1452 1453| Name | Type | Mandatory | Description | 1454| -------- | --------------------------- | ---- | -------------- | 1455| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.| 1456 1457**Error codes** 1458 1459For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1460 1461| ID | Error Message | 1462| ---- | --------------------- | 1463| 202 | SystemAPI permission error. | 1464| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1465 1466**Example** 1467 1468```js 1469try { 1470 pointer.getTouchpadPinchSwitch((error: Error, state: boolean) => { 1471 console.log(`getTouchpadPinchSwitch success, state: ${JSON.stringify(state)}`); 1472 }); 1473} catch (error) { 1474 console.log(`getTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1475} 1476``` 1477 1478## pointer.getTouchpadPinchSwitch<sup>10+</sup> 1479 1480getTouchpadPinchSwitch(): Promise\<boolean> 1481 1482Obtains the pinch switch status of the touchpad. This API uses a promise to return the result. 1483 1484**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1485 1486**System API**: This is a system API. 1487 1488**Return value** 1489 1490| Name | Description | 1491| --------------------- | ------------------- | 1492| Promise\<boolean> | Promise used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.| 1493 1494**Error codes** 1495 1496For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1497 1498| ID | Error Message | 1499| ---- | --------------------- | 1500| 202 | SystemAPI permission error. | 1501| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1502 1503**Example** 1504 1505```js 1506try { 1507 pointer.getTouchpadPinchSwitch().then((state: boolean) => { 1508 console.log(`getTouchpadPinchSwitch success, state: ${JSON.stringify(state)}`); 1509 }); 1510} catch (error) { 1511 console.log(`getTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1512} 1513``` 1514 1515## pointer.setTouchpadSwipeSwitch<sup>10+</sup> 1516 1517setTouchpadSwipeSwitch(state: boolean, callback: AsyncCallback\<void>): void 1518 1519Sets the multi-finger swipe switch of the touchpad. This API uses an asynchronous callback to return the result. 1520 1521**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1522 1523**System API**: This is a system API. 1524 1525**Parameters** 1526 1527| Name | Type | Mandatory | Description | 1528| -------- | ------------------------- | ---- | ------------------------------------- | 1529| state | boolean | Yes |Swipe switch status of the touchpad. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**. | 1530| callback | AsyncCallback\<void> | Yes | Callback used to return the result.| 1531 1532**Error codes** 1533 1534For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1535 1536| ID | Error Message | 1537| ---- | --------------------- | 1538| 202 | SystemAPI permission error. | 1539| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1540 1541**Example** 1542 1543```js 1544try { 1545 pointer.setTouchpadSwipeSwitch(true, (error: Error) => { 1546 if (error) { 1547 console.log(`setTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1548 return; 1549 } 1550 console.log(`setTouchpadSwipeSwitch success`); 1551 }); 1552} catch (error) { 1553 console.log(`setTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1554} 1555``` 1556 1557## pointer.setTouchpadSwipeSwitch<sup>10+</sup> 1558 1559setTouchpadSwipeSwitch(state: boolean): Promise\<void> 1560 1561Sets the swipe switch of the touchpad. This API uses a promise to return the result. 1562 1563**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1564 1565**System API**: This is a system API. 1566 1567**Parameters** 1568 1569| Name | Type | Mandatory | Description | 1570| ----- | ------ | ---- | ----------------------------------- | 1571| state | boolean| Yes | Swipe switch status of the touchpad. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**. | 1572 1573**Return value** 1574 1575| Name | Description | 1576| ------------------- | ---------------- | 1577| Promise\<void> | Promise used to return the result.| 1578 1579**Error codes** 1580 1581For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1582 1583| ID | Error Message | 1584| ---- | --------------------- | 1585| 202 | SystemAPI permission error. | 1586| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1587 1588**Example** 1589 1590```js 1591try { 1592 pointer.setTouchpadSwipeSwitch(false).then(() => { 1593 console.log(`setTouchpadSwipeSwitch success`); 1594 }); 1595} catch (error) { 1596 console.log(`setTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1597} 1598``` 1599 1600## pointer.getTouchpadSwipeSwitch<sup>10+</sup> 1601 1602getTouchpadSwipeSwitch(callback: AsyncCallback\<boolean>): void 1603 1604Obtains the multi-finger swipe switch status of the touchpad. This API uses an asynchronous callback to return the result. 1605 1606**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1607 1608**System API**: This is a system API. 1609 1610**Parameters** 1611 1612| Name | Type | Mandatory | Description | 1613| -------- | --------------------------- | ---- | -------------- | 1614| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.| 1615 1616**Error codes** 1617 1618For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1619 1620| ID | Error Message | 1621| ---- | --------------------- | 1622| 202 | SystemAPI permission error. | 1623| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1624 1625**Example** 1626 1627```js 1628try { 1629 pointer.getTouchpadSwipeSwitch((error: Error, state: boolean) => { 1630 console.log(`getTouchpadSwipeSwitch success, state: ${JSON.stringify(state)}`); 1631 }); 1632} catch (error) { 1633 console.log(`getTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1634} 1635``` 1636 1637## pointer.getTouchpadSwipeSwitch<sup>10+</sup> 1638 1639getTouchpadSwipeSwitch(): Promise\<boolean> 1640 1641Obtains the multi-finger swipe switch status of the touchpad. This API uses a promise to return the result. 1642 1643**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1644 1645**System API**: This is a system API. 1646 1647**Return value** 1648 1649| Name | Description | 1650| --------------------- | ------------------- | 1651| Promise\<boolean> | Promise used to return the result. The value **true** indicates that the switch is enabled, and the value **false** indicates the opposite. The default value is **true**.| 1652 1653**Error codes** 1654 1655For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1656 1657| ID | Error Message | 1658| ---- | --------------------- | 1659| 202 | SystemAPI permission error. | 1660| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1661 1662**Example** 1663 1664```js 1665try { 1666 pointer.getTouchpadSwipeSwitch().then((state: boolean) => { 1667 console.log(`getTouchpadSwipeSwitch success, state: ${JSON.stringify(state)}`); 1668 }); 1669} catch (error) { 1670 console.log(`getTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1671} 1672``` 1673 1674## pointer.setTouchpadRightClickType<sup>10+</sup> 1675 1676setTouchpadRightClickType(type: RightClickType, callback: AsyncCallback\<void>): void 1677 1678Sets the shortcut menu type of the touchpad. This API uses an asynchronous callback to return the result. 1679 1680**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1681 1682**System API**: This is a system API. 1683 1684**Parameters** 1685 1686| Name | Type | Mandatory | Description | 1687| -------- | ------------------------- | ---- | ------------------------------------- | 1688| type| [RightClickType](js-apis-pointer.md#rightclicktype10)| Yes |Shortcut menu type of the touchpad.<br>- TOUCHPAD_RIGHT_BUTTON: tapping the right-button area of the touchpad.<br>- TOUCHPAD_LEFT_BUTTON: tapping the left-button area of the touchpad.<br>- TOUCHPAD_TWO_FINGER_TAP: tapping or pressing the touchpad with two fingers.<br>The default value is **TOUCHPAD_RIGHT_BUTTON**. | 1689| callback | AsyncCallback\<void> | Yes | Callback used to return the result.| 1690 1691**Error codes** 1692 1693For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1694 1695| ID | Error Message | 1696| ---- | --------------------- | 1697| 202 | SystemAPI permission error. | 1698| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1699 1700**Example** 1701 1702```js 1703try { 1704 pointer.setTouchpadRightClickType(pointer.RightClickType.TOUCHPAD_RIGHT_BUTTON , (error: Error) => { 1705 if (error) { 1706 console.log(`setTouchpadRightClickType, error: ${JSON.stringify(error, [`code`, `message`])}`); 1707 return; 1708 } 1709 console.log(`setTouchpadRightClickType success`); 1710 }); 1711} catch (error) { 1712 console.log(`setTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1713} 1714``` 1715 1716## pointer.setTouchpadRightClickType<sup>10+</sup> 1717 1718setTouchpadRightClickType(type: RightClickType): Promise\<void> 1719 1720Sets the shortcut menu type of the touchpad. This API uses a promise to return the result. 1721 1722**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1723 1724**System API**: This is a system API. 1725 1726**Parameters** 1727 1728| Name | Type | Mandatory | Description | 1729| ----- | ------ | ---- | ----------------------------------- | 1730| type| [RightClickType](js-apis-pointer.md#rightclicktype10)| Yes | Shortcut menu type of the touchpad.<br>- TOUCHPAD_RIGHT_BUTTON: tapping the right-button area of the touchpad.<br>- TOUCHPAD_LEFT_BUTTON: tapping the left-button area of the touchpad.<br>- TOUCHPAD_TWO_FINGER_TAP: tapping or pressing the touchpad with two fingers.<br>The default value is **TOUCHPAD_RIGHT_BUTTON**.| 1731 1732**Return value** 1733 1734| Name | Description | 1735| ------------------- | ---------------- | 1736| Promise\<void> | Promise used to return the result.| 1737 1738**Error codes** 1739 1740For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1741 1742| ID | Error Message | 1743| ---- | --------------------- | 1744| 202 | SystemAPI permission error. | 1745| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1746 1747**Example** 1748 1749```js 1750try { 1751 pointer.setTouchpadRightClickType(pointer.RightClickType.TOUCHPAD_RIGHT_BUTTON).then(() => { 1752 console.log(`setTouchpadRightClickType success`); 1753 }); 1754} catch (error) { 1755 console.log(`setTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1756} 1757``` 1758 1759## pointer.getTouchpadRightClickType<sup>10+</sup> 1760 1761getTouchpadRightClickType(callback: AsyncCallback\<RightClickType>): void 1762 1763Obtains the shortcut menu type of the touchpad. This API uses an asynchronous callback to return the result. 1764 1765**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1766 1767**System API**: This is a system API. 1768 1769**Parameters** 1770 1771| Name | Type | Mandatory | Description | 1772| -------- | --------------------------- | ---- | -------------- | 1773| callback | AsyncCallback\<[RightClickType](js-apis-pointer.md#rightclicktype10)> | Yes | Callback used to return the result.| 1774 1775**Error codes** 1776 1777For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1778 1779| ID | Error Message | 1780| ---- | --------------------- | 1781| 202 | SystemAPI permission error. | 1782| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1783 1784**Example** 1785 1786```js 1787try { 1788 pointer.getTouchpadRightClickType((error: Error, type: pointer.RightClickType) => { 1789 console.log(`getTouchpadRightClickType success, type: ${JSON.stringify(type)}`); 1790 }); 1791} catch (error) { 1792 console.log(`getTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1793} 1794``` 1795 1796## pointer.getTouchpadRightClickType<sup>10+</sup> 1797 1798getTouchpadRightClickType(): Promise\<RightClickType> 1799 1800Obtains the shortcut menu type of the touchpad. This API uses a promise to return the result. 1801 1802**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1803 1804**System API**: This is a system API. 1805 1806**Return value** 1807 1808| Name | Description | 1809| --------------------- | ------------------- | 1810| Promise\<[RightClickType](js-apis-pointer.md#rightclicktype10) > | Promise used to return the result.| 1811 1812**Error codes** 1813 1814For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1815 1816| ID | Error Message | 1817| ---- | --------------------- | 1818| 202 | SystemAPI permission error. | 1819| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1820 1821**Example** 1822 1823```js 1824try { 1825 pointer.getTouchpadRightClickType().then((type: pointer.RightClickType) => { 1826 console.log(`getTouchpadRightClickType success, typeed: ${JSON.stringify(type)}`); 1827 }); 1828} catch (error) { 1829 console.log(`getTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1830} 1831``` 1832 1833## pointer.setPointerSize<sup>10+</sup> 1834 1835setPointerSize(size: number, callback: AsyncCallback<void>): void 1836 1837Sets the pointer size. This API uses an asynchronous callback to return the result. 1838 1839**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1840 1841**System API**: This is a system API. 1842 1843**Parameters** 1844 1845| Name | Type | Mandatory | Description | 1846| -------- | ------------------------- | ---- | ------------------------------------- | 1847| size | number | Yes | Pointer size. The value ranges from **1** to **7**. The default value is **1**. | 1848| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.| 1849 1850**Error codes** 1851 1852For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1853 1854| ID | Error Message | 1855| ---- | --------------------- | 1856| 202 | SystemAPI permission error. | 1857| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1858 1859**Example** 1860 1861```js 1862try { 1863 pointer.setPointerSize(1, (error: Error) => { 1864 if (error) { 1865 console.log(`setPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1866 return; 1867 } 1868 console.log(`setPointerSize success`); 1869 }); 1870} catch (error) { 1871 console.log(`setPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1872} 1873``` 1874 1875## pointer.setPointerSize<sup>10+</sup> 1876 1877setPointerSize(size: number): Promise<void> 1878 1879Sets the pointer size. This API uses a promise to return the result. 1880 1881**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1882 1883**System API**: This is a system API. 1884 1885**Parameters** 1886 1887| Name | Type | Mandatory | Description | 1888| ----- | ------ | ---- | ----------------------------------- | 1889| size | number | Yes | Pointer size. The value ranges from **1** to **7**. The default value is **1**.| 1890 1891**Return value** 1892 1893| Name | Description | 1894| ------------------- | ---------------- | 1895| Promise<void> | Promise that returns no value.| 1896 1897**Error codes** 1898 1899For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1900 1901| ID | Error Message | 1902| ---- | --------------------- | 1903| 202 | SystemAPI permission error. | 1904| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1905 1906**Example** 1907 1908```js 1909try { 1910 pointer.setPointerSize(3).then(() => { 1911 console.log(`setPointerSize success`); 1912 }); 1913} catch (error) { 1914 console.log(`setPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1915} 1916``` 1917 1918## pointer.setPointerSizeSync<sup>10+</sup> 1919 1920setPointerSizeSync(size: number): void; 1921 1922Sets the pointer size. This API returns the result synchronously. 1923 1924**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1925 1926**System API**: This is a system API. 1927 1928**Parameters** 1929 1930| Name | Type | Mandatory | Description | 1931| ----- | ------ | ---- | ----------------------------------- | 1932| size | number | Yes | Pointer size. The value ranges from **1** to **7**. The default value is **1**.| 1933 1934**Error codes** 1935 1936For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1937 1938| ID | Error Message | 1939| ---- | --------------------- | 1940| 202 | SystemAPI permission error. | 1941| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1942 1943**Example** 1944 1945```js 1946try { 1947 pointer.setPointerSizeSync(5); 1948 console.log(`setPointerSizeSync success`); 1949} catch (error) { 1950 console.log(`setPointerSizeSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1951} 1952``` 1953 1954## pointer.getPointerSize<sup>10+</sup> 1955 1956getPointerSize(callback: AsyncCallback<number>): void 1957 1958Obtains the pointer size. This API uses an asynchronous callback to return the result. 1959 1960**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1961 1962**System API**: This is a system API. 1963 1964**Parameters** 1965 1966| Name | Type | Mandatory | Description | 1967| -------- | --------------------------- | ---- | -------------- | 1968| callback | AsyncCallback<number> | Yes | Callback used to return the result.| 1969 1970**Error codes** 1971 1972For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 1973 1974| ID | Error Message | 1975| ---- | --------------------- | 1976| 202 | SystemAPI permission error. | 1977| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 1978 1979**Example** 1980 1981```js 1982try { 1983 pointer.getPointerSize((error: Error, size: number) => { 1984 console.log(`getPointerSize success, size: ${JSON.stringify(size)}`); 1985 }); 1986} catch (error) { 1987 console.log(`getPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 1988} 1989``` 1990 1991## pointer.getPointerSize<sup>10+</sup> 1992 1993getPointerSize(): Promise<number> 1994 1995Obtains the pointer size. This API uses a promise to return the result. 1996 1997**System capability**: SystemCapability.MultimodalInput.Input.Pointer 1998 1999**System API**: This is a system API. 2000 2001**Return value** 2002 2003| Name | Description | 2004| --------------------- | ------------------- | 2005| Promise<number> | Promise used to return the result.| 2006 2007**Error codes** 2008 2009For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 2010 2011| ID | Error Message | 2012| ---- | --------------------- | 2013| 202 | SystemAPI permission error. | 2014 2015 2016**Example** 2017 2018```js 2019try { 2020 pointer.getPointerSize().then((size: number) => { 2021 console.log(`getPointerSize success, size: ${JSON.stringify(size)}`); 2022 }); 2023} catch (error) { 2024 console.log(`getPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 2025} 2026``` 2027 2028## pointer.getPointerSizeSync<sup>10+</sup> 2029 2030getPointerSizeSync(): number 2031 2032Obtains the pointer size. This API returns the result synchronously. 2033 2034**System capability**: SystemCapability.MultimodalInput.Input.Pointer 2035 2036**System API**: This is a system API. 2037 2038**Return value** 2039 2040| Name | Description | 2041| --------------------- | ------------------- | 2042| number | Pointer size. | 2043 2044**Error codes** 2045 2046For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 2047 2048| ID | Error Message | 2049| ---- | --------------------- | 2050| 202 | SystemAPI permission error. | 2051 2052 2053**Example** 2054 2055```js 2056try { 2057 let pointerSize = pointer.getPointerSizeSync(); 2058 console.log(`getPointerSizeSync success, pointerSize: ${JSON.stringify(pointerSize)}`); 2059} catch (error) { 2060 console.log(`getPointerSizeSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 2061} 2062``` 2063 2064## pointer.setPointerColor<sup>10+</sup> 2065 2066setPointerColor(color: number, callback: AsyncCallback<void>): void 2067 2068Sets the pointer color. This API uses an asynchronous callback to return the result. 2069 2070**NOTE** 2071> 2072> When performing this operation, you need to connect an external device, such as a mouse or Bluetooth device. 2073 2074**System capability**: SystemCapability.MultimodalInput.Input.Pointer 2075 2076**System API**: This is a system API. 2077 2078**Parameters** 2079 2080| Name | Type | Mandatory | Description | 2081| -------- | ------------------------- | ---- | ------------------------------------- | 2082| color | number | Yes | Pointer color. The default value is **black** (0x000000). | 2083| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.| 2084 2085**Error codes** 2086 2087For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 2088 2089| ID | Error Message | 2090| ---- | --------------------- | 2091| 202 | SystemAPI permission error. | 2092| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 2093 2094**Example** 2095 2096```js 2097try { 2098 pointer.setPointerColor(0xF6C800, (error: Error) => { 2099 if (error) { 2100 console.log(`setPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 2101 return; 2102 } 2103 console.log(`setPointerColor success`); 2104 }); 2105} catch (error) { 2106 console.log(`setPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 2107} 2108``` 2109 2110## pointer.setPointerColor<sup>10+</sup> 2111 2112setPointerColor(color: number): Promise<void> 2113 2114Sets the pointer color. This API uses a promise to return the result. 2115 2116**NOTE** 2117> 2118> When performing this operation, you need to connect an external device, such as a mouse or Bluetooth device. 2119 2120**System capability**: SystemCapability.MultimodalInput.Input.Pointer 2121 2122**System API**: This is a system API. 2123 2124**Parameters** 2125 2126| Name | Type | Mandatory | Description | 2127| ----- | ------ | ---- | ----------------------------------- | 2128| color | number | Yes | Pointer color. The default value is **black** (0x000000).| 2129 2130**Return value** 2131 2132| Name | Description | 2133| ------------------- | ---------------- | 2134| Promise<void> | Promise that returns no value.| 2135 2136**Error codes** 2137 2138For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 2139 2140| ID | Error Message | 2141| ---- | --------------------- | 2142| 202 | SystemAPI permission error. | 2143| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 2144 2145**Example** 2146 2147```js 2148try { 2149 pointer.setPointerColor(0xF6C800).then(() => { 2150 console.log(`setPointerColor success`); 2151 }); 2152} catch (error) { 2153 console.log(`setPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 2154} 2155``` 2156 2157## pointer.setPointerColorSync<sup>10+</sup> 2158 2159setPointerColorSync(color: number): void; 2160 2161Sets the pointer color. This API returns the result synchronously. 2162 2163**NOTE** 2164> 2165> When performing this operation, you need to connect an external device, such as a mouse or Bluetooth device. 2166 2167**System capability**: SystemCapability.MultimodalInput.Input.Pointer 2168 2169**System API**: This is a system API. 2170 2171**Parameters** 2172 2173| Name | Type | Mandatory | Description | 2174| ----- | ------ | ---- | ----------------------------------- | 2175| color | number | Yes | Pointer color. The default value is **black** (0x000000).| 2176 2177**Error codes** 2178 2179For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 2180 2181| ID | Error Message | 2182| ---- | --------------------- | 2183| 202 | SystemAPI permission error. | 2184| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 2185 2186**Example** 2187 2188```js 2189try { 2190 pointer.setPointerColorSync(0xF6C800); 2191 console.log(`setPointerColorSync success`); 2192} catch (error) { 2193 console.log(`setPointerColorSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 2194} 2195``` 2196 2197## pointer.getPointerColor<sup>10+</sup> 2198 2199getPointerColor(callback: AsyncCallback<number>): void 2200 2201Obtains the pointer color. This API uses an asynchronous callback to return the result. 2202 2203**System capability**: SystemCapability.MultimodalInput.Input.Pointer 2204 2205**System API**: This is a system API. 2206 2207**Parameters** 2208 2209| Name | Type | Mandatory | Description | 2210| -------- | --------------------------- | ---- | -------------- | 2211| callback | AsyncCallback<number> | Yes | Callback used to return the result.| 2212 2213**Error codes** 2214 2215For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 2216 2217| ID | Error Message | 2218| ---- | --------------------- | 2219| 202 | SystemAPI permission error. | 2220| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;2. Incorrect parameter types; 3. Parameter verification failed. | 2221 2222**Example** 2223 2224```js 2225try { 2226 pointer.getPointerColor((error: Error, color: number) => { 2227 console.log(`getPointerColor success, color: ${JSON.stringify(color)}`); 2228 }); 2229} catch (error) { 2230 console.log(`getPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 2231} 2232``` 2233 2234## pointer.getPointerColor<sup>10+</sup> 2235 2236getPointerColor(): Promise<number> 2237 2238Obtains the pointer color. This API uses a promise to return the result. 2239 2240**System capability**: SystemCapability.MultimodalInput.Input.Pointer 2241 2242**System API**: This is a system API. 2243 2244**Return value** 2245 2246| Name | Description | 2247| --------------------- | ------------------- | 2248| Promise<number> | Promise used to return the result.| 2249 2250**Error codes** 2251 2252For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 2253 2254| ID | Error Message | 2255| ---- | --------------------- | 2256| 202 | SystemAPI permission error. | 2257 2258 2259**Example** 2260 2261```js 2262try { 2263 pointer.getPointerColor().then((color: number) => { 2264 console.log(`getPointerColor success, color: ${JSON.stringify(color)}`); 2265 }); 2266} catch (error) { 2267 console.log(`getPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 2268} 2269``` 2270 2271## pointer.getPointerColorSync<sup>10+</sup> 2272 2273getPointerColorSync(): number 2274 2275Obtains the pointer color. This API returns the result synchronously. 2276 2277**System capability**: SystemCapability.MultimodalInput.Input.Pointer 2278 2279**System API**: This is a system API. 2280 2281**Return value** 2282 2283| Name | Description | 2284| --------------------- | ------------------- | 2285| number | Pointer color.| 2286 2287**Error codes** 2288 2289For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 2290 2291| ID | Error Message | 2292| ---- | --------------------- | 2293| 202 | SystemAPI permission error. | 2294 2295 2296**Example** 2297 2298```js 2299try { 2300 let pointerColor = pointer.getPointerColorSync(); 2301 console.log(`getPointerColorSync success, pointerColor: ${JSON.stringify(pointerColor)}`); 2302} catch (error) { 2303 console.log(`getPointerColorSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`); 2304} 2305``` 2306