1/* 2 * Copyright (c) 2022-2025 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 PerformanceAnalysisKit 19 * @arkts 1.1&1.2 20 */ 21 22import type { AsyncCallback } from './@ohos.base'; 23 24/** 25 * Provides the event logging function for applications to log the fault, statistical, security, 26 * and user behavior events reported during running. Based on event information, 27 * you will be able to analyze the running status of applications. 28 * 29 * @namespace hiAppEvent 30 * @syscap SystemCapability.HiviewDFX.HiAppEvent 31 * @since 9 32 */ 33/** 34 * Provides the event logging function for applications to log the fault, statistical, security, 35 * and user behavior events reported during running. Based on event information, 36 * you will be able to analyze the running status of applications. 37 * 38 * @namespace hiAppEvent 39 * @syscap SystemCapability.HiviewDFX.HiAppEvent 40 * @atomicservice 41 * @since 11 42 */ 43/** 44 * Provides the event logging function for applications to log the fault, statistical, security, 45 * and user behavior events reported during running. Based on event information, 46 * you will be able to analyze the running status of applications. 47 * 48 * @namespace hiAppEvent 49 * @syscap SystemCapability.HiviewDFX.HiAppEvent 50 * @crossplatform 51 * @atomicservice 52 * @since arkts {'1.1':'19','1.2':'20'} 53 * @arkts 1.1&1.2 54 */ 55declare namespace hiAppEvent { 56 /** 57 * Enumerates event types. 58 * 59 * @enum { number } 60 * @syscap SystemCapability.HiviewDFX.HiAppEvent 61 * @since 9 62 */ 63 /** 64 * Enumerates event types. 65 * 66 * @enum { number } 67 * @syscap SystemCapability.HiviewDFX.HiAppEvent 68 * @atomicservice 69 * @since 11 70 */ 71 /** 72 * Enumerates event types. 73 * 74 * @enum { number } 75 * @syscap SystemCapability.HiviewDFX.HiAppEvent 76 * @crossplatform 77 * @atomicservice 78 * @since arkts {'1.1':'19','1.2':'20'} 79 * @arkts 1.1&1.2 80 */ 81 enum EventType { 82 /** 83 * Fault event. 84 * 85 * @syscap SystemCapability.HiviewDFX.HiAppEvent 86 * @since 9 87 */ 88 /** 89 * Fault event. 90 * 91 * @syscap SystemCapability.HiviewDFX.HiAppEvent 92 * @atomicservice 93 * @since 11 94 */ 95 /** 96 * Fault event. 97 * 98 * @syscap SystemCapability.HiviewDFX.HiAppEvent 99 * @crossplatform 100 * @atomicservice 101 * @since arkts {'1.1':'19','1.2':'20'} 102 * @arkts 1.1&1.2 103 */ 104 FAULT = 1, 105 106 /** 107 * Statistic event. 108 * 109 * @syscap SystemCapability.HiviewDFX.HiAppEvent 110 * @since 9 111 */ 112 /** 113 * Statistic event. 114 * 115 * @syscap SystemCapability.HiviewDFX.HiAppEvent 116 * @atomicservice 117 * @since 11 118 */ 119 /** 120 * Statistic event. 121 * 122 * @syscap SystemCapability.HiviewDFX.HiAppEvent 123 * @crossplatform 124 * @atomicservice 125 * @since arkts {'1.1':'19','1.2':'20'} 126 * @arkts 1.1&1.2 127 */ 128 STATISTIC = 2, 129 130 /** 131 * Security event. 132 * 133 * @syscap SystemCapability.HiviewDFX.HiAppEvent 134 * @since 9 135 */ 136 /** 137 * Security event. 138 * 139 * @syscap SystemCapability.HiviewDFX.HiAppEvent 140 * @atomicservice 141 * @since 11 142 */ 143 /** 144 * Security event. 145 * 146 * @syscap SystemCapability.HiviewDFX.HiAppEvent 147 * @crossplatform 148 * @atomicservice 149 * @since arkts {'1.1':'19','1.2':'20'} 150 * @arkts 1.1&1.2 151 */ 152 SECURITY = 3, 153 154 /** 155 * Behavior event. 156 * 157 * @syscap SystemCapability.HiviewDFX.HiAppEvent 158 * @since 9 159 */ 160 /** 161 * Behavior event. 162 * 163 * @syscap SystemCapability.HiviewDFX.HiAppEvent 164 * @atomicservice 165 * @since 11 166 */ 167 /** 168 * Behavior event. 169 * 170 * @syscap SystemCapability.HiviewDFX.HiAppEvent 171 * @crossplatform 172 * @atomicservice 173 * @since arkts {'1.1':'19','1.2':'20'} 174 * @arkts 1.1&1.2 175 */ 176 BEHAVIOR = 4 177 } 178 179 /** 180 * Provides domain name constants. 181 * 182 * @namespace domain 183 * @syscap SystemCapability.HiviewDFX.HiAppEvent 184 * @atomicservice 185 * @since 11 186 */ 187 /** 188 * Provides domain name constants. 189 * 190 * @namespace domain 191 * @syscap SystemCapability.HiviewDFX.HiAppEvent 192 * @crossplatform 193 * @atomicservice 194 * @since arkts {'1.1':'19','1.2':'20'} 195 * @arkts 1.1&1.2 196 */ 197 namespace domain { 198 /** 199 * System domain. 200 * 201 * @syscap SystemCapability.HiviewDFX.HiAppEvent 202 * @atomicservice 203 * @since 11 204 */ 205 /** 206 * System domain. 207 * 208 * @syscap SystemCapability.HiviewDFX.HiAppEvent 209 * @crossplatform 210 * @atomicservice 211 * @since arkts {'1.1':'19','1.2':'20'} 212 * @arkts 1.1&1.2 213 */ 214 const OS: string; 215 } 216 217 /** 218 * Provides event name constants, including system event name constants and application event name constants. 219 * <br>The application event name constants are optional custom event names reserved when you call Write for 220 * application event logging. 221 * 222 * @namespace event 223 * @syscap SystemCapability.HiviewDFX.HiAppEvent 224 * @since 9 225 */ 226 /** 227 * Provides event name constants, including system event name constants and application event name constants. 228 * <br>The application event name constants are optional custom event names reserved when you call Write for 229 * application event logging. 230 * 231 * @namespace event 232 * @syscap SystemCapability.HiviewDFX.HiAppEvent 233 * @atomicservice 234 * @since 11 235 */ 236 /** 237 * Provides event name constants, including system event name constants and application event name constants. 238 * <br>The application event name constants are optional custom event names reserved when you call Write for 239 * application event logging. 240 * 241 * @namespace event 242 * @syscap SystemCapability.HiviewDFX.HiAppEvent 243 * @crossplatform 244 * @atomicservice 245 * @since arkts {'1.1':'19','1.2':'20'} 246 * @arkts 1.1&1.2 247 */ 248 namespace event { 249 /** 250 * User login event. This is a reserved application event name constant. 251 * 252 * @syscap SystemCapability.HiviewDFX.HiAppEvent 253 * @since 9 254 */ 255 /** 256 * User login event. This is a reserved application event name constant. 257 * 258 * @syscap SystemCapability.HiviewDFX.HiAppEvent 259 * @atomicservice 260 * @since arkts {'1.1':'11','1.2':'20'} 261 * @arkts 1.1&1.2 262 */ 263 const USER_LOGIN: string; 264 265 /** 266 * User logout event. This is a reserved application event name constant. 267 * 268 * @syscap SystemCapability.HiviewDFX.HiAppEvent 269 * @since 9 270 */ 271 /** 272 * User logout event. This is a reserved application event name constant. 273 * 274 * @syscap SystemCapability.HiviewDFX.HiAppEvent 275 * @atomicservice 276 * @since arkts {'1.1':'11','1.2':'20'} 277 * @arkts 1.1&1.2 278 */ 279 const USER_LOGOUT: string; 280 281 /** 282 * Distributed service startup event. This is a reserved application event name constant. 283 * 284 * @syscap SystemCapability.HiviewDFX.HiAppEvent 285 * @since 9 286 */ 287 /** 288 * Distributed service startup event. This is a reserved application event name constant. 289 * 290 * @syscap SystemCapability.HiviewDFX.HiAppEvent 291 * @atomicservice 292 * @since arkts {'1.1':'11','1.2':'20'} 293 * @arkts 1.1&1.2 294 */ 295 const DISTRIBUTED_SERVICE_START: string; 296 297 /** 298 * Application crash event. This is a system event name constant. 299 * 300 * @syscap SystemCapability.HiviewDFX.HiAppEvent 301 * @atomicservice 302 * @since 11 303 */ 304 /** 305 * Application crash event. This is a system event name constant. 306 * 307 * @syscap SystemCapability.HiviewDFX.HiAppEvent 308 * @crossplatform 309 * @atomicservice 310 * @since arkts {'1.1':'19','1.2':'20'} 311 * @arkts 1.1&1.2 312 */ 313 const APP_CRASH: string; 314 315 /** 316 * Application freeze event. This is a system event name constant. 317 * 318 * @syscap SystemCapability.HiviewDFX.HiAppEvent 319 * @atomicservice 320 * @since arkts {'1.1':'11','1.2':'20'} 321 * @arkts 1.1&1.2 322 */ 323 const APP_FREEZE: string; 324 325 /** 326 * Event indicating the application launch duration. This is a system event name constant. 327 * 328 * @syscap SystemCapability.HiviewDFX.HiAppEvent 329 * @atomicservice 330 * @since arkts {'1.1':'12','1.2':'20'} 331 * @arkts 1.1&1.2 332 */ 333 const APP_LAUNCH: string; 334 335 /** 336 * Event indicating frame loss during swiping. This is a system event name constant. 337 * 338 * @syscap SystemCapability.HiviewDFX.HiAppEvent 339 * @atomicservice 340 * @since arkts {'1.1':'12','1.2':'20'} 341 * @arkts 1.1&1.2 342 */ 343 const SCROLL_JANK: string; 344 345 /** 346 * Event indicating a high CPU usage. This is a system event name constant. 347 * 348 * @syscap SystemCapability.HiviewDFX.HiAppEvent 349 * @atomicservice 350 * @since arkts {'1.1':'12','1.2':'20'} 351 * @arkts 1.1&1.2 352 */ 353 const CPU_USAGE_HIGH: string; 354 355 /** 356 * Event indicating battery usage statistics. This is a system event name constant. 357 * 358 * @syscap SystemCapability.HiviewDFX.HiAppEvent 359 * @atomicservice 360 * @since arkts {'1.1':'12','1.2':'20'} 361 * @arkts 1.1&1.2 362 */ 363 const BATTERY_USAGE: string; 364 365 /** 366 * Event indicating an application resource leakage. This is a system event name constant. 367 * 368 * @syscap SystemCapability.HiviewDFX.HiAppEvent 369 * @atomicservice 370 * @since arkts {'1.1':'12','1.2':'20'} 371 * @arkts 1.1&1.2 372 */ 373 const RESOURCE_OVERLIMIT: string; 374 375 /** 376 * Address sanitizer event. This is a system event name constant. 377 * 378 * @syscap SystemCapability.HiviewDFX.HiAppEvent 379 * @atomicservice 380 * @since arkts {'1.1':'12','1.2':'20'} 381 * @arkts 1.1&1.2 382 */ 383 const ADDRESS_SANITIZER: string; 384 385 /** 386 * Main thread jank event. This is a system event name constant. 387 * 388 * @syscap SystemCapability.HiviewDFX.HiAppEvent 389 * @atomicservice 390 * @since arkts {'1.1':'12','1.2':'20'} 391 * @arkts 1.1&1.2 392 */ 393 const MAIN_THREAD_JANK: string; 394 395 /** 396 * App killed event. This is a system event name constant. 397 * 398 * @type { string } 399 * @syscap SystemCapability.HiviewDFX.HiAppEvent 400 * @atomicservice 401 * @since 20 402 */ 403 const APP_KILLED: string; 404 } 405 406 /** 407 * Provides parameter name constants. 408 * 409 * @namespace param 410 * @syscap SystemCapability.HiviewDFX.HiAppEvent 411 * @since 9 412 */ 413 /** 414 * Provides parameter name constants. 415 * 416 * @namespace param 417 * @syscap SystemCapability.HiviewDFX.HiAppEvent 418 * @atomicservice 419 * @since 11 420 */ 421 /** 422 * Provides parameter name constants. 423 * 424 * @namespace param 425 * @syscap SystemCapability.HiviewDFX.HiAppEvent 426 * @crossplatform 427 * @atomicservice 428 * @since arkts {'1.1':'19','1.2':'20'} 429 * @arkts 1.1&1.2 430 */ 431 namespace param { 432 /** 433 * Custom user ID. 434 * 435 * @syscap SystemCapability.HiviewDFX.HiAppEvent 436 * @since 9 437 */ 438 /** 439 * Custom user ID. 440 * 441 * @syscap SystemCapability.HiviewDFX.HiAppEvent 442 * @atomicservice 443 * @since 11 444 */ 445 /** 446 * Custom user ID. 447 * 448 * @syscap SystemCapability.HiviewDFX.HiAppEvent 449 * @crossplatform 450 * @atomicservice 451 * @since arkts {'1.1':'19','1.2':'20'} 452 * @arkts 1.1&1.2 453 */ 454 const USER_ID: string; 455 456 /** 457 * Distributed service name. 458 * 459 * @syscap SystemCapability.HiviewDFX.HiAppEvent 460 * @since 9 461 */ 462 /** 463 * Distributed service name. 464 * 465 * @syscap SystemCapability.HiviewDFX.HiAppEvent 466 * @atomicservice 467 * @since 11 468 */ 469 /** 470 * Distributed service name. 471 * 472 * @syscap SystemCapability.HiviewDFX.HiAppEvent 473 * @crossplatform 474 * @atomicservice 475 * @since arkts {'1.1':'19','1.2':'20'} 476 * @arkts 1.1&1.2 477 */ 478 const DISTRIBUTED_SERVICE_NAME: string; 479 480 /** 481 * Distributed service instance ID. 482 * 483 * @syscap SystemCapability.HiviewDFX.HiAppEvent 484 * @since 9 485 */ 486 /** 487 * Distributed service instance ID. 488 * 489 * @syscap SystemCapability.HiviewDFX.HiAppEvent 490 * @atomicservice 491 * @since 11 492 */ 493 /** 494 * Distributed service instance ID. 495 * 496 * @syscap SystemCapability.HiviewDFX.HiAppEvent 497 * @crossplatform 498 * @atomicservice 499 * @since arkts {'1.1':'19','1.2':'20'} 500 * @arkts 1.1&1.2 501 */ 502 const DISTRIBUTED_SERVICE_INSTANCE_ID: string; 503 } 504 505 /** 506 * Configures the application event logging function, such as setting the logging switch and directory storage quota. 507 * 508 * @param { ConfigOption } config Configuration items for application event logging. 509 * @throws { BusinessError } 401 - Parameter error. 510 * @throws { BusinessError } 11103001 - Invalid max storage quota value. Possible caused by incorrectly formatted. 511 * @static 512 * @syscap SystemCapability.HiviewDFX.HiAppEvent 513 * @since 9 514 */ 515 /** 516 * Configures the application event logging function, such as setting the logging switch and directory storage quota. 517 * 518 * @param { ConfigOption } config Configuration items for application event logging. 519 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 520 * <br>2. Incorrect parameter types. 521 * @throws { BusinessError } 11103001 - Invalid max storage quota value. Possible caused by incorrectly formatted. 522 * @static 523 * @syscap SystemCapability.HiviewDFX.HiAppEvent 524 * @atomicservice 525 * @since 11 526 */ 527 /** 528 * Configures the application event logging function, such as setting the logging switch and directory storage quota. 529 * 530 * @param { ConfigOption } config Configuration items for application event logging. 531 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 532 * <br>2. Incorrect parameter types. 533 * @throws { BusinessError } 11103001 - Invalid max storage quota value. Possible caused by incorrectly formatted. 534 * @static 535 * @syscap SystemCapability.HiviewDFX.HiAppEvent 536 * @crossplatform 537 * @atomicservice 538 * @since arkts {'1.1':'19','1.2':'20'} 539 * @arkts 1.1&1.2 540 */ 541 function configure(config: ConfigOption): void; 542 543 /** 544 * Provides configuration options for application event logging. 545 * 546 * @interface ConfigOption 547 * @syscap SystemCapability.HiviewDFX.HiAppEvent 548 * @since 9 549 */ 550 /** 551 * Provides configuration options for application event logging. 552 * 553 * @interface ConfigOption 554 * @syscap SystemCapability.HiviewDFX.HiAppEvent 555 * @atomicservice 556 * @since 11 557 */ 558 /** 559 * Provides configuration options for application event logging. 560 * 561 * @interface ConfigOption 562 * @syscap SystemCapability.HiviewDFX.HiAppEvent 563 * @crossplatform 564 * @atomicservice 565 * @since arkts {'1.1':'19','1.2':'20'} 566 * @arkts 1.1&1.2 567 */ 568 interface ConfigOption { 569 /** 570 * Whether to enable the event logging function. The default value is false. 571 * <br>If this parameter is set to true, the logging function is disabled. Otherwise, the logging function is 572 * enabled. 573 * 574 * @type { ?boolean } 575 * @syscap SystemCapability.HiviewDFX.HiAppEvent 576 * @since 9 577 */ 578 /** 579 * Whether to enable the event logging function. The default value is false. 580 * <br>If this parameter is set to true, the logging function is disabled. Otherwise, the logging function is 581 * enabled. 582 * 583 * @type { ?boolean } 584 * @syscap SystemCapability.HiviewDFX.HiAppEvent 585 * @atomicservice 586 * @since 11 587 */ 588 /** 589 * Whether to enable the event logging function. The default value is false. 590 * <br>If this parameter is set to true, the logging function is disabled. Otherwise, the logging function is 591 * enabled. 592 * 593 * @type { ?boolean } 594 * @syscap SystemCapability.HiviewDFX.HiAppEvent 595 * @crossplatform 596 * @atomicservice 597 * @since arkts {'1.1':'19','1.2':'20'} 598 * @arkts 1.1&1.2 599 */ 600 disable?: boolean; 601 602 /** 603 * Quota for the directory that stores event logging files. The default value is 10M. 604 * <br>It is recommended that the quota be less than or equal to 10 MB. Otherwise, the API efficiency may be 605 * affected. If the directory size exceeds the specified quota when application event logging is performed, event 606 * logging files in the directory will be cleared one by one based on the generation time to ensure that directory 607 * size does not exceed the quota. 608 * <br>The quota value must meet the following requirements: 609 * <br>- The quota value consists of only digits and a unit (which can be one of [b|k|kb|m|mb|g|gb|t|tb], which are 610 * case insensitive.) 611 * <br>- The quota value must start with a digit. You can determine whether to pass the unit. If the unit is left 612 * empty, b (that is, byte) is used by default. 613 * 614 * @type { ?string } 615 * @syscap SystemCapability.HiviewDFX.HiAppEvent 616 * @since 9 617 */ 618 /** 619 * Quota for the directory that stores event logging files. The default value is 10M. 620 * <br>It is recommended that the quota be less than or equal to 10 MB. Otherwise, the API efficiency may be 621 * affected. If the directory size exceeds the specified quota when application event logging is performed, event 622 * logging files in the directory will be cleared one by one based on the generation time to ensure that directory 623 * size does not exceed the quota. 624 * <br>The quota value must meet the following requirements: 625 * <br>- The quota value consists of only digits and a unit (which can be one of [b|k|kb|m|mb|g|gb|t|tb], which are 626 * case insensitive.) 627 * <br>- The quota value must start with a digit. You can determine whether to pass the unit. If the unit is left 628 * empty, b (that is, byte) is used by default. 629 * 630 * @type { ?string } 631 * @syscap SystemCapability.HiviewDFX.HiAppEvent 632 * @atomicservice 633 * @since arkts {'1.1':'11','1.2':'20'} 634 * @arkts 1.1&1.2 635 */ 636 maxStorage?: string; 637 } 638 639 /** 640 * Defines parameters of the event information. 641 * 642 * @interface AppEventInfo 643 * @syscap SystemCapability.HiviewDFX.HiAppEvent 644 * @since 9 645 */ 646 /** 647 * Defines parameters of the event information. 648 * 649 * @interface AppEventInfo 650 * @syscap SystemCapability.HiviewDFX.HiAppEvent 651 * @atomicservice 652 * @since 11 653 */ 654 /** 655 * Defines parameters of the event information. 656 * 657 * @interface AppEventInfo 658 * @syscap SystemCapability.HiviewDFX.HiAppEvent 659 * @crossplatform 660 * @atomicservice 661 * @since arkts {'1.1':'19','1.2':'20'} 662 * @arkts 1.1&1.2 663 */ 664 interface AppEventInfo { 665 /** 666 * Event domain. The value is a string of up to 32 characters, including digits (0 to 9), letters (a to z), and 667 * underscores (_). It must start with a letter and cannot end with an underscore (_). 668 * 669 * @type { string } 670 * @syscap SystemCapability.HiviewDFX.HiAppEvent 671 * @since 9 672 */ 673 /** 674 * Event domain. The value is a string of up to 32 characters, including digits (0 to 9), letters (a to z), and 675 * underscores (_). It must start with a letter and cannot end with an underscore (_). 676 * 677 * @type { string } 678 * @syscap SystemCapability.HiviewDFX.HiAppEvent 679 * @atomicservice 680 * @since 11 681 */ 682 /** 683 * Event domain. The value is a string of up to 32 characters, including digits (0 to 9), letters (a to z), and 684 * underscores (_). It must start with a letter and cannot end with an underscore (_). 685 * 686 * @type { string } 687 * @syscap SystemCapability.HiviewDFX.HiAppEvent 688 * @crossplatform 689 * @atomicservice 690 * @since arkts {'1.1':'19','1.2':'20'} 691 * @arkts 1.1&1.2 692 */ 693 domain: string; 694 695 /** 696 * Event name. The value is string that contains a maximum of 48 characters, including digits (0 to 9), letters 697 * (a to z), underscore (_), and dollar sign ($). It must start with a letter or dollar sign ($) and end with a 698 * digit or letter. 699 * 700 * @type { string } 701 * @syscap SystemCapability.HiviewDFX.HiAppEvent 702 * @since 9 703 */ 704 /** 705 * Event name. The value is string that contains a maximum of 48 characters, including digits (0 to 9), letters 706 * (a to z), underscore (_), and dollar sign ($). It must start with a letter or dollar sign ($) and end with a 707 * digit or letter. 708 * 709 * @type { string } 710 * @syscap SystemCapability.HiviewDFX.HiAppEvent 711 * @atomicservice 712 * @since 11 713 */ 714 /** 715 * Event name. The value is string that contains a maximum of 48 characters, including digits (0 to 9), letters 716 * (a to z), underscore (_), and dollar sign ($). It must start with a letter or dollar sign ($) and end with a 717 * digit or letter. 718 * 719 * @type { string } 720 * @syscap SystemCapability.HiviewDFX.HiAppEvent 721 * @crossplatform 722 * @atomicservice 723 * @since arkts {'1.1':'19','1.2':'20'} 724 * @arkts 1.1&1.2 725 */ 726 name: string; 727 728 /** 729 * Event type. 730 * 731 * @type { EventType } 732 * @syscap SystemCapability.HiviewDFX.HiAppEvent 733 * @since 9 734 */ 735 /** 736 * Event type. 737 * 738 * @type { EventType } 739 * @syscap SystemCapability.HiviewDFX.HiAppEvent 740 * @atomicservice 741 * @since 11 742 */ 743 /** 744 * Event type. 745 * 746 * @type { EventType } 747 * @syscap SystemCapability.HiviewDFX.HiAppEvent 748 * @crossplatform 749 * @atomicservice 750 * @since arkts {'1.1':'19','1.2':'20'} 751 * @arkts 1.1&1.2 752 */ 753 eventType: EventType; 754 755 /** 756 * Event parameter object, which consists of a parameter name and a parameter value. In system events, the fields 757 * contained in params are defined by system. For details about the fields, you can see the overviews of system 758 * events, for example, Crash Event Overview. For application events, you need to define the parameters of the 759 * Write API. The specifications are as follows: 760 * <br>- A parameter name is a string that contains a maximum of 32 characters, including digits (0 to 9), letters 761 * (a to z), underscore (_), and dollar sign ($). It must start with a letter or dollar sign ($) and end with a 762 * digit or letter. For example, testName and $123_name. 763 * <br>- The parameter value can be a string, number, boolean, or array. The string type parameter can contain a 764 * maximum of 8 x 1024 characters. If the length exceeds the limit, the parameter and its name will be discarded. 765 * The value of the number type parameter must be within the range of Number.MIN_SAFE_INTEGER to 766 * Number.MAX_SAFE_INTEGER. If the value exceeds the range, an uncertain value may be generated. The element type 767 * in the array type parameter can only be string, number, or boolean. The number of elements must be less than 768 * 100. If this limit is exceeded, excess elements will be discarded. 769 * <br>- The maximum number of parameters is 32. If this limit is exceeded, excess parameters will be discarded. 770 * 771 * @type { object } 772 * @syscap SystemCapability.HiviewDFX.HiAppEvent 773 * @since 9 774 */ 775 /** 776 * Event parameter object, which consists of a parameter name and a parameter value. In system events, the fields 777 * contained in params are defined by system. For details about the fields, you can see the overviews of system 778 * events, for example, Crash Event Overview. For application events, you need to define the parameters of the 779 * Write API. The specifications are as follows: 780 * <br>- A parameter name is a string that contains a maximum of 32 characters, including digits (0 to 9), letters 781 * (a to z), underscore (_), and dollar sign ($). It must start with a letter or dollar sign ($) and end with a 782 * digit or letter. For example, testName and $123_name. 783 * <br>- The parameter value can be a string, number, boolean, or array. The string type parameter can contain a 784 * maximum of 8 x 1024 characters. If the length exceeds the limit, the parameter and its name will be discarded. 785 * The value of the number type parameter must be within the range of Number.MIN_SAFE_INTEGER to 786 * Number.MAX_SAFE_INTEGER. If the value exceeds the range, an uncertain value may be generated. The element type 787 * in the array type parameter can only be string, number, or boolean. The number of elements must be less than 788 * 100. If this limit is exceeded, excess elements will be discarded. 789 * <br>- The maximum number of parameters is 32. If this limit is exceeded, excess parameters will be discarded. 790 * 791 * @type { object } 792 * @syscap SystemCapability.HiviewDFX.HiAppEvent 793 * @atomicservice 794 * @since 11 795 */ 796 /** 797 * Event parameter object, which consists of a parameter name and a parameter value. In system events, the fields 798 * contained in params are defined by system. For details about the fields, you can see the overviews of system 799 * events, for example, Crash Event Overview. For application events, you need to define the parameters of the 800 * Write API. The specifications are as follows: 801 * <br>- A parameter name is a string that contains a maximum of 32 characters, including digits (0 to 9), letters 802 * (a to z), underscore (_), and dollar sign ($). It must start with a letter or dollar sign ($) and end with a 803 * digit or letter. For example, testName and $123_name. 804 * <br>- The parameter value can be a string, number, boolean, or array. The string type parameter can contain a 805 * maximum of 8 x 1024 characters. If the length exceeds the limit, the parameter and its name will be discarded. 806 * The value of the number type parameter must be within the range of Number.MIN_SAFE_INTEGER to 807 * Number.MAX_SAFE_INTEGER. If the value exceeds the range, an uncertain value may be generated. The element type 808 * in the array type parameter can only be string, number, or boolean. The number of elements must be less than 809 * 100. If this limit is exceeded, excess elements will be discarded. 810 * <br>- The maximum number of parameters is 32. If this limit is exceeded, excess parameters will be discarded. 811 * 812 * @type { object } 813 * @syscap SystemCapability.HiviewDFX.HiAppEvent 814 * @crossplatform 815 * @atomicservice 816 * @since arkts {'1.1':'19','1.2':'20'} 817 * @arkts 1.1&1.2 818 */ 819 params: object; 820 } 821 822 /** 823 * Writes events of the AppEventInfo type. This API uses a promise to return the result. The event object written by 824 * calling this API is a custom object. To avoid conflicts with system events, you are not advised to write it to 825 * system events (system event name constants defined in Event). The events written by this API can be subscribed to 826 * through (addWatcher). 827 * 828 * @param { AppEventInfo } Application event object. You are advised to avoid the conflict between the custom event 829 * name and the system event name constant defined in Event. 830 * @returns { Promise<void> } Promise that returns no value. 831 * @throws { BusinessError } 401 - Parameter error. 832 * @throws { BusinessError } 11100001 - Function disabled. Possible caused by the param disable in ConfigOption is true. 833 * @throws { BusinessError } 11101001 - Invalid event domain. Possible causes: 1. Contain invalid characters; 834 * <br>2. Length is invalid. 835 * @throws { BusinessError } 11101002 - Invalid event name. Possible causes: 1. Contain invalid characters; 836 * <br>2. Length is invalid. 837 * @throws { BusinessError } 11101003 - Invalid number of event parameters. Possible caused by the number of parameters 838 * <br>is over 32. 839 * @throws { BusinessError } 11101004 - Invalid string length of the event parameter. 840 * @throws { BusinessError } 11101005 - Invalid event parameter name. Possible causes: 1. Contain invalid characters; 841 * <br>2. Length is invalid. 842 * @throws { BusinessError } 11101006 - Invalid array length of the event parameter. 843 * @static 844 * @syscap SystemCapability.HiviewDFX.HiAppEvent 845 * @since 9 846 */ 847 /** 848 * Writes events of the AppEventInfo type. This API uses a promise to return the result. The event object written by 849 * calling this API is a custom object. To avoid conflicts with system events, you are not advised to write it to 850 * system events (system event name constants defined in Event). The events written by this API can be subscribed to 851 * through (addWatcher). 852 * 853 * @param { AppEventInfo } info Application event object. You are advised to avoid the conflict between the custom 854 * event name and the system event name constant defined in Event. 855 * @returns { Promise<void> } Promise that returns no value. 856 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 857 * <br>2. Incorrect parameter types. 858 * @throws { BusinessError } 11100001 - Function disabled. Possible caused by the param disable in ConfigOption is true. 859 * @throws { BusinessError } 11101001 - Invalid event domain. Possible causes: 1. Contain invalid characters; 860 * <br>2. Length is invalid. 861 * @throws { BusinessError } 11101002 - Invalid event name. Possible causes: 1. Contain invalid characters; 862 * <br>2. Length is invalid. 863 * @throws { BusinessError } 11101003 - Invalid number of event parameters. Possible caused by the number of parameters 864 * <br>is over 32. 865 * @throws { BusinessError } 11101004 - Invalid string length of the event parameter. 866 * @throws { BusinessError } 11101005 - Invalid event parameter name. Possible causes: 1. Contain invalid characters; 867 * <br>2. Length is invalid. 868 * @throws { BusinessError } 11101006 - Invalid array length of the event parameter. 869 * @static 870 * @syscap SystemCapability.HiviewDFX.HiAppEvent 871 * @atomicservice 872 * @since 11 873 */ 874 /** 875 * Writes events of the AppEventInfo type. This API uses a promise to return the result. The event object written by 876 * calling this API is a custom object. To avoid conflicts with system events, you are not advised to write it to 877 * system events (system event name constants defined in Event). The events written by this API can be subscribed to 878 * through (addWatcher). 879 * 880 * @param { AppEventInfo } info Application event object. You are advised to avoid the conflict between the custom 881 * event name and the system event name constant defined in Event. 882 * @returns { Promise<void> } Promise that returns no value. 883 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 884 * <br>2. Incorrect parameter types. 885 * @throws { BusinessError } 11100001 - Function disabled. Possible caused by the param disable in ConfigOption is true. 886 * @throws { BusinessError } 11101001 - Invalid event domain. Possible causes: 1. Contain invalid characters; 887 * <br>2. Length is invalid. 888 * @throws { BusinessError } 11101002 - Invalid event name. Possible causes: 1. Contain invalid characters; 889 * <br>2. Length is invalid. 890 * @throws { BusinessError } 11101003 - Invalid number of event parameters. Possible caused by the number of parameters 891 * <br>is over 32. 892 * @throws { BusinessError } 11101004 - Invalid string length of the event parameter. 893 * @throws { BusinessError } 11101005 - Invalid event parameter name. Possible causes: 1. Contain invalid characters; 894 * <br>2. Length is invalid. 895 * @throws { BusinessError } 11101006 - Invalid array length of the event parameter. 896 * @static 897 * @syscap SystemCapability.HiviewDFX.HiAppEvent 898 * @crossplatform 899 * @atomicservice 900 * @since arkts {'1.1':'19','1.2':'20'} 901 * @arkts 1.1&1.2 902 */ 903 function write(info: AppEventInfo): Promise<void>; 904 905 /** 906 * Writes events of the AppEventInfo type. This API uses an asynchronous callback to return the result. The event 907 * object written by calling this API is a custom object. To avoid conflicts with system events, you are not advised 908 * to write it to system events (system event name constants defined in Event). The events written by this API can be 909 * subscribed to through (addWatcher). 910 * 911 * @param { AppEventInfo } info Application event object. You are advised to avoid the conflict between the custom 912 * event name and the system event name constant defined in Event. 913 * @param { AsyncCallback<void> } callback Callback used to return the result. 914 * @throws { BusinessError } 401 - Parameter error. 915 * @throws { BusinessError } 11100001 - Function disabled. Possible caused by the param disable in ConfigOption is true. 916 * @throws { BusinessError } 11101001 - Invalid event domain. Possible causes: 1. Contain invalid characters; 917 * <br>2. Length is invalid. 918 * @throws { BusinessError } 11101002 - Invalid event name. Possible causes: 1. Contain invalid characters; 919 * <br>2. Length is invalid. 920 * @throws { BusinessError } 11101003 - Invalid number of event parameters. Possible caused by the number of parameters 921 * <br>is over 32. 922 * @throws { BusinessError } 11101004 - Invalid string length of the event parameter. 923 * @throws { BusinessError } 11101005 - Invalid event parameter name. Possible causes: 1. Contain invalid characters; 924 * <br>2. Length is invalid. 925 * @throws { BusinessError } 11101006 - Invalid array length of the event parameter. 926 * @static 927 * @syscap SystemCapability.HiviewDFX.HiAppEvent 928 * @since 9 929 */ 930 /** 931 * Writes events of the AppEventInfo type. This API uses an asynchronous callback to return the result. The event 932 * object written by calling this API is a custom object. To avoid conflicts with system events, you are not advised 933 * to write it to system events (system event name constants defined in Event). The events written by this API can be 934 * subscribed to through (addWatcher). 935 * 936 * @param { AppEventInfo } info Application event object. You are advised to avoid the conflict between the custom 937 * event name and the system event name constant defined in Event. 938 * @param { AsyncCallback<void> } callback Callback used to return the result. 939 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 940 * <br>2. Incorrect parameter types. 941 * @throws { BusinessError } 11100001 - Function disabled. Possible caused by the param disable in ConfigOption is true. 942 * @throws { BusinessError } 11101001 - Invalid event domain. Possible causes: 1. Contain invalid characters; 943 * <br>2. Length is invalid. 944 * @throws { BusinessError } 11101002 - Invalid event name. Possible causes: 1. Contain invalid characters; 945 * <br>2. Length is invalid. 946 * @throws { BusinessError } 11101003 - Invalid number of event parameters. Possible caused by the number of parameters 947 * <br>is over 32. 948 * @throws { BusinessError } 11101004 - Invalid string length of the event parameter. 949 * @throws { BusinessError } 11101005 - Invalid event parameter name. Possible causes: 1. Contain invalid characters; 950 * <br>2. Length is invalid. 951 * @throws { BusinessError } 11101006 - Invalid array length of the event parameter. 952 * @static 953 * @syscap SystemCapability.HiviewDFX.HiAppEvent 954 * @atomicservice 955 * @since 11 956 */ 957 /** 958 * Writes events of the AppEventInfo type. This API uses an asynchronous callback to return the result. The event 959 * object written by calling this API is a custom object. To avoid conflicts with system events, you are not advised 960 * to write it to system events (system event name constants defined in Event). The events written by this API can be 961 * subscribed to through (addWatcher). 962 * 963 * @param { AppEventInfo } info Application event object. You are advised to avoid the conflict between the custom 964 * event name and the system event name constant defined in Event. 965 * @param { AsyncCallback<void> } callback Callback used to return the result. 966 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 967 * <br>2. Incorrect parameter types. 968 * @throws { BusinessError } 11100001 - Function disabled. Possible caused by the param disable in ConfigOption is true. 969 * @throws { BusinessError } 11101001 - Invalid event domain. Possible causes: 1. Contain invalid characters; 970 * <br>2. Length is invalid. 971 * @throws { BusinessError } 11101002 - Invalid event name. Possible causes: 1. Contain invalid characters; 972 * <br>2. Length is invalid. 973 * @throws { BusinessError } 11101003 - Invalid number of event parameters. Possible caused by the number of parameters 974 * <br>is over 32. 975 * @throws { BusinessError } 11101004 - Invalid string length of the event parameter. 976 * @throws { BusinessError } 11101005 - Invalid event parameter name. Possible causes: 1. Contain invalid characters; 977 * <br>2. Length is invalid. 978 * @throws { BusinessError } 11101006 - Invalid array length of the event parameter. 979 * @static 980 * @syscap SystemCapability.HiviewDFX.HiAppEvent 981 * @crossplatform 982 * @atomicservice 983 * @since arkts {'1.1':'19','1.2':'20'} 984 * @arkts 1.1&1.2 985 */ 986 function write(info: AppEventInfo, callback: AsyncCallback<void>): void; 987 988 /** 989 * Type of a custom event parameter value. 990 * 991 * @typedef {number | string | boolean | Array<string>} 992 * @syscap SystemCapability.HiviewDFX.HiAppEvent 993 * @atomicservice 994 * @since 12 995 */ 996 /** 997 * Type of a custom event parameter value. 998 * 999 * @typedef {number | string | boolean | Array<string>} 1000 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1001 * @crossplatform 1002 * @atomicservice 1003 * @since arkts {'1.1':'19','1.2':'20'} 1004 * @arkts 1.1&1.2 1005 */ 1006 type ParamType = number | string | boolean | Array<string>; 1007 1008 /** 1009 * Sets custom event parameters. This API uses a promise to return the result. During the same lifecycle, system 1010 * events and application events can be associated through event domain and event name. System events only support 1011 * crash and freeze events. 1012 * 1013 * @param { Record<string, ParamType> } params Custom parameter object. The parameter name and value are defined as 1014 * follows: 1015 * <br>- A parameter name is a string that contains a maximum of 32 characters, including digits (0 to 9), letters 1016 * (a to z), underscore (_), and dollar sign ($). It must start with a letter or dollar sign ($) and end with a digit 1017 * or letter. 1018 * <br>- The parameter value is of the ParamType and contains a maximum of 1024 characters. 1019 * <br>- The number of parameters must be less than 64. 1020 * @param { string } domain Event domain. The event domain can be associated with application events and system 1021 * events (hiAppEvent.domain.OS). 1022 * @param { string } name Event name. The default value is an empty string, which indicates all event names in the 1023 * associated event domain. The event name can be associated with application events and system events. System events 1024 * can be associated only with crash events (hiAppEvent.event.APP_CRASH) and freeze events 1025 * (hiAppEvent.event.APP_FREEZE). 1026 * @returns { Promise<void> } Promise that returns no value. 1027 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1028 * <br>2. Incorrect parameter types. 1029 * @throws { BusinessError } 11100001 - Function disabled. Possible caused by the param disable in ConfigOption is true. 1030 * @throws { BusinessError } 11101001 - Invalid event domain. Possible causes: 1. Contain invalid characters; 1031 * <br>2. Length is invalid. 1032 * @throws { BusinessError } 11101002 - Invalid event name. Possible causes: 1. Contain invalid characters; 1033 * <br>2. Length is invalid. 1034 * @throws { BusinessError } 11101004 - Invalid string length of the event parameter. 1035 * @throws { BusinessError } 11101005 - Invalid event parameter name. Possible causes: 1. Contain invalid characters; 1036 * <br>2. Length is invalid. 1037 * @throws { BusinessError } 11101007 - The number of parameter keys exceeds the limit. 1038 * @static 1039 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1040 * @atomicservice 1041 * @since 12 1042 */ 1043 /** 1044 * Sets custom event parameters. This API uses a promise to return the result. During the same lifecycle, system 1045 * events and application events can be associated through event domain and event name. System events only support 1046 * crash and freeze events. 1047 * 1048 * @param { Record<string, ParamType> } params Custom parameter object. The parameter name and value are defined as 1049 * follows: 1050 * <br>- A parameter name is a string that contains a maximum of 32 characters, including digits (0 to 9), letters 1051 * (a to z), underscore (_), and dollar sign ($). It must start with a letter or dollar sign ($) and end with a digit 1052 * or letter. 1053 * <br>- The parameter value is of the ParamType and contains a maximum of 1024 characters. 1054 * <br>- The number of parameters must be less than 64. 1055 * @param { string } domain Event domain. The event domain can be associated with application events and system 1056 * events (hiAppEvent.domain.OS). 1057 * @param { string } name Event name. The default value is an empty string, which indicates all event names in the 1058 * associated event domain. The event name can be associated with application events and system events. System events 1059 * can be associated only with crash events (hiAppEvent.event.APP_CRASH) and freeze events 1060 * (hiAppEvent.event.APP_FREEZE). 1061 * @returns { Promise<void> } Promise that returns no value. 1062 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1063 * <br>2. Incorrect parameter types. 1064 * @throws { BusinessError } 11100001 - Function disabled. Possible caused by the param disable in ConfigOption is true. 1065 * @throws { BusinessError } 11101001 - Invalid event domain. Possible causes: 1. Contain invalid characters; 1066 * <br>2. Length is invalid. 1067 * @throws { BusinessError } 11101002 - Invalid event name. Possible causes: 1. Contain invalid characters; 1068 * <br>2. Length is invalid. 1069 * @throws { BusinessError } 11101004 - Invalid string length of the event parameter. 1070 * @throws { BusinessError } 11101005 - Invalid event parameter name. Possible causes: 1. Contain invalid characters; 1071 * <br>2. Length is invalid. 1072 * @throws { BusinessError } 11101007 - The number of parameter keys exceeds the limit. 1073 * @static 1074 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1075 * @crossplatform 1076 * @atomicservice 1077 * @since arkts {'1.1':'19','1.2':'20'} 1078 * @arkts 1.1&1.2 1079 */ 1080 function setEventParam(params: Record<string, ParamType>, domain: string, name?: string): Promise<void>; 1081 1082 /** 1083 * Sets the custom threshold triggering condition for an event. This API uses a promise to return the result. In the 1084 * same lifecycle, you can customize the parameters related to the event threshold triggering condition based on the 1085 * event name. Currently, only the MAIN_THREAD_JANK event is supported. For details about the parameter configuration, 1086 * see Main Thread Jank Event Overview. 1087 * 1088 * @param { string } name Event name. 1089 * @param { Record<string, ParamType> } config Custom parameter object. The parameter name and value are defined as 1090 * follows: 1091 * <br>- The parameter name contains a maximum of 1024 characters, which is of the string type and cannot be empty. 1092 * <br>- The parameter value is of the ParamType and contains a maximum of 1024 characters. 1093 * @returns { Promise<void> } Promise used to return the result. 1094 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1095 * <br>2. Incorrect parameter types; 3.Parameter verification failed. 1096 * @static 1097 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1098 * @atomicservice 1099 * @since arkts {'1.1':'15','1.2':'20'} 1100 * @arkts 1.1&1.2 1101 */ 1102 function setEventConfig(name: string, config: Record<string, ParamType>): Promise<void>; 1103 1104 /** 1105 * Defines parameters of an AppEventPackage object. This API is used to obtain detail information about an event 1106 * package, which is obtained using the takeNext API. 1107 * 1108 * @interface AppEventPackage 1109 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1110 * @since 9 1111 */ 1112 /** 1113 * Defines parameters of an AppEventPackage object. This API is used to obtain detail information about an event 1114 * package, which is obtained using the takeNext API. 1115 * 1116 * @interface AppEventPackage 1117 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1118 * @atomicservice 1119 * @since 11 1120 */ 1121 /** 1122 * Defines parameters of an AppEventPackage object. This API is used to obtain detail information about an event 1123 * package, which is obtained using the takeNext API. 1124 * 1125 * @interface AppEventPackage 1126 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1127 * @crossplatform 1128 * @atomicservice 1129 * @since arkts {'1.1':'19','1.2':'20'} 1130 * @arkts 1.1&1.2 1131 */ 1132 interface AppEventPackage { 1133 /** 1134 * Event package ID, which is named from 0 in ascending order. 1135 * 1136 * @type { number } 1137 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1138 * @since 9 1139 */ 1140 /** 1141 * Event package ID, which is named from 0 in ascending order. 1142 * 1143 * @type { number } 1144 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1145 * @atomicservice 1146 * @since 11 1147 */ 1148 /** 1149 * Event package ID, which is named from 0 in ascending order. 1150 * 1151 * @type { number } 1152 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1153 * @crossplatform 1154 * @atomicservice 1155 * @since arkts {'1.1':'19','1.2':'20'} 1156 * @arkts 1.1&1.2 1157 */ 1158 packageId: number; 1159 1160 /** 1161 * Number of events in the event package. 1162 * 1163 * @type { number } 1164 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1165 * @since 9 1166 */ 1167 /** 1168 * Number of events in the event package. 1169 * 1170 * @type { number } 1171 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1172 * @atomicservice 1173 * @since 11 1174 */ 1175 /** 1176 * Number of events in the event package. 1177 * 1178 * @type { number } 1179 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1180 * @crossplatform 1181 * @atomicservice 1182 * @since arkts {'1.1':'19','1.2':'20'} 1183 * @arkts 1.1&1.2 1184 */ 1185 row: number; 1186 1187 /** 1188 * Event size of the event package, in bytes. 1189 * 1190 * @type { number } 1191 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1192 * @since 9 1193 */ 1194 /** 1195 * Event size of the event package, in bytes. 1196 * 1197 * @type { number } 1198 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1199 * @atomicservice 1200 * @since 11 1201 */ 1202 /** 1203 * Event size of the event package, in bytes. 1204 * 1205 * @type { number } 1206 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1207 * @crossplatform 1208 * @atomicservice 1209 * @since arkts {'1.1':'19','1.2':'20'} 1210 * @arkts 1.1&1.2 1211 */ 1212 size: number; 1213 1214 /** 1215 * Event data in the event package. 1216 * 1217 * @type { string[] } 1218 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1219 * @since 9 1220 */ 1221 /** 1222 * Event data in the event package. 1223 * 1224 * @type { string[] } 1225 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1226 * @atomicservice 1227 * @since 11 1228 */ 1229 /** 1230 * Event data in the event package. 1231 * 1232 * @type { string[] } 1233 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1234 * @crossplatform 1235 * @atomicservice 1236 * @since arkts {'1.1':'19','1.2':'20'} 1237 * @arkts 1.1&1.2 1238 */ 1239 data: string[]; 1240 1241 /** 1242 * Event object group. 1243 * 1244 * @type { Array<AppEventInfo> } 1245 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1246 * @atomicservice 1247 * @since 12 1248 */ 1249 /** 1250 * Event object group. 1251 * 1252 * @type { Array<AppEventInfo> } 1253 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1254 * @crossplatform 1255 * @atomicservice 1256 * @since arkts {'1.1':'19','1.2':'20'} 1257 * @arkts 1.1&1.2 1258 */ 1259 appEventInfos: Array<AppEventInfo>; 1260 } 1261 1262 /** 1263 * Defines a subscription data holder for processing event information. 1264 * 1265 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1266 * @since 9 1267 */ 1268 /** 1269 * Defines a subscription data holder for processing event information. 1270 * 1271 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1272 * @atomicservice 1273 * @since 11 1274 */ 1275 /** 1276 * Defines a subscription data holder for processing event information. 1277 * 1278 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1279 * @crossplatform 1280 * @atomicservice 1281 * @since arkts {'1.1':'19','1.2':'20'} 1282 * @arkts 1.1&1.2 1283 */ 1284 class AppEventPackageHolder { 1285 /** 1286 * Constructs an AppEventPackageHolder instance. You can call addWatcher to add an event watcher, and then 1287 * associate the AppEventPackageHolder instance with the watcher added in the application based on the watcher name. 1288 * 1289 * @param { string } watcherName Name of the event watcher added through addWatcher. If no watcher is added, no 1290 * data is displayed by default. 1291 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1292 * @since 9 1293 */ 1294 /** 1295 * Constructs an AppEventPackageHolder instance. You can call addWatcher to add an event watcher, and then 1296 * associate the AppEventPackageHolder instance with the watcher added in the application based on the watcher name. 1297 * 1298 * @param { string } watcherName Name of the event watcher added through addWatcher. If no watcher is added, no 1299 * data is displayed by default. 1300 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1301 * @atomicservice 1302 * @since 11 1303 */ 1304 /** 1305 * Constructs an AppEventPackageHolder instance. You can call addWatcher to add an event watcher, and then 1306 * associate the AppEventPackageHolder instance with the watcher added in the application based on the watcher name. 1307 * 1308 * @param { string } watcherName Name of the event watcher added through addWatcher. If no watcher is added, no 1309 * data is displayed by default. 1310 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1311 * @crossplatform 1312 * @atomicservice 1313 * @since arkts {'1.1':'19','1.2':'20'} 1314 * @arkts 1.1&1.2 1315 */ 1316 constructor(watcherName: string); 1317 1318 /** 1319 * Sets the threshold for the data size of the event package obtained each time. 1320 * 1321 * @param { number } size Data size threshold, in bytes. The value range is [0, $2^{31}$-1]. If the value is out of 1322 * the range, an exception is thrown. 1323 * @throws { BusinessError } 401 - Parameter error. 1324 * @throws { BusinessError } 11104001 - Invalid size value. Possible caused by the size value is less than or equal 1325 * <br>to zero. 1326 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1327 * @since 9 1328 */ 1329 /** 1330 * Sets the threshold for the data size of the event package obtained each time. 1331 * 1332 * @param { number } size Data size threshold, in bytes. The value range is [0, $2^{31}$-1]. If the value is out of 1333 * the range, an exception is thrown. 1334 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1335 * <br>2. Incorrect parameter types. 1336 * @throws { BusinessError } 11104001 - Invalid size value. Possible caused by the size value is less than or equal 1337 * <br>to zero. 1338 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1339 * @atomicservice 1340 * @since 11 1341 */ 1342 /** 1343 * Sets the threshold for the data size of the event package obtained each time. 1344 * 1345 * @param { number } size Data size threshold, in bytes. The value range is [0, $2^{31}$-1]. If the value is out of 1346 * the range, an exception is thrown. 1347 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1348 * <br>2. Incorrect parameter types. 1349 * @throws { BusinessError } 11104001 - Invalid size value. Possible caused by the size value is less than or equal 1350 * <br>to zero. 1351 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1352 * @crossplatform 1353 * @atomicservice 1354 * @since arkts {'1.1':'19','1.2':'20'} 1355 * @arkts 1.1&1.2 1356 */ 1357 setSize(size: number): void; 1358 1359 /** 1360 * Sets the number of data records of the event package obtained each time. When setRow() and setSize() are called 1361 * at the same time, only setRow() takes effect. 1362 * 1363 * @param { number } size Number of events. The value range is (0, $2^{31}$-1]. If the value is out of the range, an 1364 * exception is thrown. 1365 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1366 * <br>2. Incorrect parameter types. 1367 * @throws { BusinessError } 11104001 - Invalid size value. Possible caused by the size value is less than or equal 1368 * <br>to zero. 1369 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1370 * @atomicservice 1371 * @since 12 1372 */ 1373 /** 1374 * Sets the number of data records of the event package obtained each time. When setRow() and setSize() are called 1375 * at the same time, only setRow() takes effect. 1376 * 1377 * @param { number } size Number of events. The value range is (0, $2^{31}$-1]. If the value is out of the range, an 1378 * exception is thrown. 1379 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1380 * <br>2. Incorrect parameter types. 1381 * @throws { BusinessError } 11104001 - Invalid size value. Possible caused by the size value is less than or equal 1382 * <br>to zero. 1383 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1384 * @crossplatform 1385 * @atomicservice 1386 * @since arkts {'1.1':'19','1.2':'20'} 1387 * @arkts 1.1&1.2 1388 */ 1389 setRow(size: number): void; 1390 1391 /** 1392 * Obtains the subscription event. 1393 * <br>The system obtains the subscription event data based on the data size threshold specified by setSize or the 1394 * number of data records specified by setRow. By default, one subscription event data record is obtained. When all 1395 * subscription event data is obtained, null is returned. 1396 * <br>When setRow and setSize are called at the same time, only setRow takes effect. 1397 * 1398 * @returns { AppEventPackage } Event package object. If all subscription event data has been retrieved, null is 1399 * returned. 1400 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1401 * @since 9 1402 */ 1403 /** 1404 * Obtains the subscription event. 1405 * <br>The system obtains the subscription event data based on the data size threshold specified by setSize or the 1406 * number of data records specified by setRow. By default, one subscription event data record is obtained. When all 1407 * subscription event data is obtained, null is returned. 1408 * <br>When setRow and setSize are called at the same time, only setRow takes effect. 1409 * 1410 * @returns { AppEventPackage } Event package object. If all subscription event data has been retrieved, null is 1411 * returned. 1412 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1413 * @atomicservice 1414 * @since 11 1415 */ 1416 /** 1417 * Obtains the subscription event. 1418 * <br>The system obtains the subscription event data based on the data size threshold specified by setSize or the 1419 * number of data records specified by setRow. By default, one subscription event data record is obtained. When all 1420 * subscription event data is obtained, null is returned. 1421 * <br>When setRow and setSize are called at the same time, only setRow takes effect. 1422 * 1423 * @returns { AppEventPackage } Event package object. If all subscription event data has been retrieved, null is 1424 * returned. 1425 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1426 * @crossplatform 1427 * @atomicservice 1428 * @since arkts {'1.1':'19','1.2':'20'} 1429 * @arkts 1.1&1.2 1430 */ 1431 takeNext(): AppEventPackage; 1432 } 1433 1434 /** 1435 * Defines the triggering condition parameters of the onTrigger callback of a Watcher. 1436 * 1437 * @interface TriggerCondition 1438 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1439 * @since 9 1440 */ 1441 /** 1442 * Defines the triggering condition parameters of the onTrigger callback of a Watcher. 1443 * 1444 * @interface TriggerCondition 1445 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1446 * @atomicservice 1447 * @since 11 1448 */ 1449 /** 1450 * Defines the triggering condition parameters of the onTrigger callback of a Watcher. 1451 * 1452 * @interface TriggerCondition 1453 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1454 * @crossplatform 1455 * @atomicservice 1456 * @since arkts {'1.1':'19','1.2':'20'} 1457 * @arkts 1.1&1.2 1458 */ 1459 interface TriggerCondition { 1460 /** 1461 * Total number of events that trigger callback. The value is a positive integer. The default value is 0, 1462 * indicating that no callback is triggered. If this parameter is set to a negative value, the default 1463 * value is used. 1464 * 1465 * @type { ?number } 1466 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1467 * @since 9 1468 */ 1469 /** 1470 * Total number of events that trigger callback. The value is a positive integer. The default value is 0, 1471 * indicating that no callback is triggered. If this parameter is set to a negative value, the default 1472 * value is used. 1473 * 1474 * @type { ?number } 1475 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1476 * @atomicservice 1477 * @since 11 1478 */ 1479 /** 1480 * Total number of events that trigger callback. The value is a positive integer. The default value is 0, 1481 * indicating that no callback is triggered. If this parameter is set to a negative value, the default 1482 * value is used. 1483 * 1484 * @type { ?number } 1485 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1486 * @crossplatform 1487 * @atomicservice 1488 * @since arkts {'1.1':'19','1.2':'20'} 1489 * @arkts 1.1&1.2 1490 */ 1491 row?: number; 1492 1493 /** 1494 * Total size of events that trigger callback. The value is a positive integer, in bytes. The default value is 0, 1495 * indicating that no callback is triggered. If this parameter is set to a negative value, the default value is 1496 * used. 1497 * 1498 * @type { ?number } 1499 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1500 * @since 9 1501 */ 1502 /** 1503 * Total size of events that trigger callback. The value is a positive integer, in bytes. The default value is 0, 1504 * indicating that no callback is triggered. If this parameter is set to a negative value, the default value is 1505 * used. 1506 * 1507 * @type { ?number } 1508 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1509 * @atomicservice 1510 * @since 11 1511 */ 1512 /** 1513 * Total size of events that trigger callback. The value is a positive integer, in bytes. The default value is 0, 1514 * indicating that no callback is triggered. If this parameter is set to a negative value, the default value is 1515 * used. 1516 * 1517 * @type { ?number } 1518 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1519 * @crossplatform 1520 * @atomicservice 1521 * @since arkts {'1.1':'19','1.2':'20'} 1522 * @arkts 1.1&1.2 1523 */ 1524 size?: number; 1525 1526 /** 1527 * Timeout interval for triggering callback. The value is a positive integer, in unit of 30s. The default value is 1528 * 0, indicating that no callback is triggered. If this parameter is set to a negative value, the default value is 1529 * used. 1530 * 1531 * @type { ?number } 1532 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1533 * @since 9 1534 */ 1535 /** 1536 * Timeout interval for triggering callback. The value is a positive integer, in unit of 30s. The default value is 1537 * 0, indicating that no callback is triggered. If this parameter is set to a negative value, the default value is 1538 * used. 1539 * 1540 * @type { ?number } 1541 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1542 * @atomicservice 1543 * @since 11 1544 */ 1545 /** 1546 * Timeout interval for triggering callback. The value is a positive integer, in unit of 30s. The default value is 1547 * 0, indicating that no callback is triggered. If this parameter is set to a negative value, the default value is 1548 * used. 1549 * 1550 * @type { ?number } 1551 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1552 * @crossplatform 1553 * @atomicservice 1554 * @since arkts {'1.1':'19','1.2':'20'} 1555 * @arkts 1.1&1.2 1556 */ 1557 timeOut?: number; 1558 } 1559 1560 /** 1561 * Defines parameters of subscription filtering conditions of a Watcher. This API is used to set event filtering 1562 * conditions in the event watcher to ensure that only the events that meet the filtering conditions are subscribed 1563 * to. 1564 * 1565 * @interface AppEventFilter 1566 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1567 * @since 9 1568 */ 1569 /** 1570 * Defines parameters of subscription filtering conditions of a Watcher. This API is used to set event filtering 1571 * conditions in the event watcher to ensure that only the events that meet the filtering conditions are subscribed 1572 * to. 1573 * 1574 * @interface AppEventFilter 1575 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1576 * @atomicservice 1577 * @since 11 1578 */ 1579 /** 1580 * Defines parameters of subscription filtering conditions of a Watcher. This API is used to set event filtering 1581 * conditions in the event watcher to ensure that only the events that meet the filtering conditions are subscribed 1582 * to. 1583 * 1584 * @interface AppEventFilter 1585 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1586 * @crossplatform 1587 * @atomicservice 1588 * @since arkts {'1.1':'19','1.2':'20'} 1589 * @arkts 1.1&1.2 1590 */ 1591 interface AppEventFilter { 1592 /** 1593 * Event domain, which can be the system event domain (hiAppEvent.domain.OS) or the event domain of the custom 1594 * event information (AppEventInfo) passed through the Write API. 1595 * 1596 * @type { string } 1597 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1598 * @since 9 1599 */ 1600 /** 1601 * Event domain, which can be the system event domain (hiAppEvent.domain.OS) or the event domain of the custom 1602 * event information (AppEventInfo) passed through the Write API. 1603 * 1604 * @type { string } 1605 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1606 * @atomicservice 1607 * @since 11 1608 */ 1609 /** 1610 * Event domain, which can be the system event domain (hiAppEvent.domain.OS) or the event domain of the custom 1611 * event information (AppEventInfo) passed through the Write API. 1612 * 1613 * @type { string } 1614 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1615 * @crossplatform 1616 * @atomicservice 1617 * @since arkts {'1.1':'19','1.2':'20'} 1618 * @arkts 1.1&1.2 1619 */ 1620 domain: string; 1621 1622 /** 1623 * Event types. If this parameter is not set, events are not filtered by default. 1624 * 1625 * @type { ?EventType[] } 1626 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1627 * @since 9 1628 */ 1629 /** 1630 * Event types. If this parameter is not set, events are not filtered by default. 1631 * 1632 * @type { ?EventType[] } 1633 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1634 * @atomicservice 1635 * @since 11 1636 */ 1637 /** 1638 * Event types. If this parameter is not set, events are not filtered by default. 1639 * 1640 * @type { ?EventType[] } 1641 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1642 * @crossplatform 1643 * @atomicservice 1644 * @since arkts {'1.1':'19','1.2':'20'} 1645 * @arkts 1.1&1.2 1646 */ 1647 eventTypes?: EventType[]; 1648 1649 /** 1650 * Names of the events to be subscribed. If this parameter is not set, events are not filtered by default. 1651 * 1652 * @type { ?string[] } 1653 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1654 * @atomicservice 1655 * @since 11 1656 */ 1657 /** 1658 * Names of the events to be subscribed. If this parameter is not set, events are not filtered by default. 1659 * 1660 * @type { ?string[] } 1661 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1662 * @crossplatform 1663 * @atomicservice 1664 * @since arkts {'1.1':'19','1.2':'20'} 1665 * @arkts 1.1&1.2 1666 */ 1667 names?: string[]; 1668 } 1669 1670 /** 1671 * Defines parameters of the event group returned by a subscription. This API can be used to obtain detail 1672 * information about an event group, which is often used in the onReceive callback of Watcher. 1673 * 1674 * @interface AppEventGroup 1675 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1676 * @atomicservice 1677 * @since 11 1678 */ 1679 /** 1680 * Defines parameters of the event group returned by a subscription. This API can be used to obtain detail 1681 * information about an event group, which is often used in the onReceive callback of Watcher. 1682 * 1683 * @interface AppEventGroup 1684 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1685 * @crossplatform 1686 * @atomicservice 1687 * @since arkts {'1.1':'19','1.2':'20'} 1688 * @arkts 1.1&1.2 1689 */ 1690 interface AppEventGroup { 1691 /** 1692 * Event name. 1693 * 1694 * @type { string } 1695 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1696 * @atomicservice 1697 * @since 11 1698 */ 1699 /** 1700 * Event name. 1701 * 1702 * @type { string } 1703 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1704 * @crossplatform 1705 * @atomicservice 1706 * @since arkts {'1.1':'19','1.2':'20'} 1707 * @arkts 1.1&1.2 1708 */ 1709 name: string; 1710 1711 /** 1712 * Event object group. 1713 * 1714 * @type { Array<AppEventInfo> } 1715 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1716 * @atomicservice 1717 * @since 11 1718 */ 1719 /** 1720 * Event object group. 1721 * 1722 * @type { Array<AppEventInfo> } 1723 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1724 * @crossplatform 1725 * @atomicservice 1726 * @since arkts {'1.1':'19','1.2':'20'} 1727 * @arkts 1.1&1.2 1728 */ 1729 appEventInfos: Array<AppEventInfo>; 1730 } 1731 1732 /** 1733 * Defines parameters for a Watcher object. This API is used to configure and manage event watchers to subscribe to 1734 * and process specified events. 1735 * 1736 * @interface Watcher 1737 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1738 * @since 9 1739 */ 1740 /** 1741 * Defines parameters for a Watcher object. This API is used to configure and manage event watchers to subscribe to 1742 * and process specified events. 1743 * 1744 * @interface Watcher 1745 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1746 * @atomicservice 1747 * @since 11 1748 */ 1749 /** 1750 * Defines parameters for a Watcher object. This API is used to configure and manage event watchers to subscribe to 1751 * and process specified events. 1752 * 1753 * @interface Watcher 1754 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1755 * @crossplatform 1756 * @atomicservice 1757 * @since arkts {'1.1':'19','1.2':'20'} 1758 * @arkts 1.1&1.2 1759 */ 1760 interface Watcher { 1761 /** 1762 * Unique name of a watcher. The value contains a maximum of 32 characters, including digits (0 to 9), letters 1763 * (a to z), underscore (_). It must start with a letter and end with a digit or letter. For example, testName1 1764 * and crash_Watcher. 1765 * 1766 * @type { string } 1767 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1768 * @since 9 1769 */ 1770 /** 1771 * Unique name of a watcher. The value contains a maximum of 32 characters, including digits (0 to 9), letters 1772 * (a to z), underscore (_). It must start with a letter and end with a digit or letter. For example, testName1 1773 * and crash_Watcher. 1774 * 1775 * @type { string } 1776 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1777 * @atomicservice 1778 * @since 11 1779 */ 1780 /** 1781 * Unique name of a watcher. The value contains a maximum of 32 characters, including digits (0 to 9), letters 1782 * (a to z), underscore (_). It must start with a letter and end with a digit or letter. For example, testName1 1783 * and crash_Watcher. 1784 * 1785 * @type { string } 1786 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1787 * @crossplatform 1788 * @atomicservice 1789 * @since arkts {'1.1':'19','1.2':'20'} 1790 * @arkts 1.1&1.2 1791 */ 1792 name: string; 1793 1794 /** 1795 * Subscription callback triggering condition. This parameter takes effect only when it is passed together with 1796 * onTrigger. If this parameter is not set, the onTrigger callback is not triggered by default. 1797 * 1798 * @type { ?TriggerCondition } 1799 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1800 * @since 9 1801 */ 1802 /** 1803 * Subscription callback triggering condition. This parameter takes effect only when it is passed together with 1804 * onTrigger. If this parameter is not set, the onTrigger callback is not triggered by default. 1805 * 1806 * @type { ?TriggerCondition } 1807 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1808 * @atomicservice 1809 * @since 11 1810 */ 1811 /** 1812 * Subscription callback triggering condition. This parameter takes effect only when it is passed together with 1813 * onTrigger. If this parameter is not set, the onTrigger callback is not triggered by default. 1814 * 1815 * @type { ?TriggerCondition } 1816 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1817 * @crossplatform 1818 * @atomicservice 1819 * @since arkts {'1.1':'19','1.2':'20'} 1820 * @arkts 1.1&1.2 1821 */ 1822 triggerCondition?: TriggerCondition; 1823 1824 /** 1825 * Subscription filtering condition. This parameter is passed only when subscription events need to be filtered. 1826 * If this parameter is not set, events are not filtered by default. 1827 * 1828 * @type { ?AppEventFilter[] } 1829 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1830 * @since 9 1831 */ 1832 /** 1833 * Subscription filtering condition. This parameter is passed only when subscription events need to be filtered. 1834 * If this parameter is not set, events are not filtered by default. 1835 * 1836 * @type { ?AppEventFilter[] } 1837 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1838 * @atomicservice 1839 * @since 11 1840 */ 1841 /** 1842 * Subscription filtering condition. This parameter is passed only when subscription events need to be filtered. 1843 * If this parameter is not set, events are not filtered by default. 1844 * 1845 * @type { ?AppEventFilter[] } 1846 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1847 * @crossplatform 1848 * @atomicservice 1849 * @since arkts {'1.1':'19','1.2':'20'} 1850 * @arkts 1.1&1.2 1851 */ 1852 appEventFilters?: AppEventFilter[]; 1853 1854 /** 1855 * Subscription callback. This parameter takes effect only when it is passed together with triggerCondition. 1856 * The input arguments are described as follows: 1857 * <br>curRow: total number of subscription events when the callback is triggered. 1858 * <br>curSize: total size of subscribed events when the callback is triggered, in bytes. 1859 * <br>holder: subscription data holder, which can be used to process subscribed events. 1860 * 1861 * @type { ?function } 1862 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1863 * @since 9 1864 */ 1865 /** 1866 * Subscription callback. This parameter takes effect only when it is passed together with triggerCondition. 1867 * The input arguments are described as follows: 1868 * <br>curRow: total number of subscription events when the callback is triggered. 1869 * <br>curSize: total size of subscribed events when the callback is triggered, in bytes. 1870 * <br>holder: subscription data holder, which can be used to process subscribed events. 1871 * 1872 * @type { ?function } 1873 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1874 * @atomicservice 1875 * @since 11 1876 */ 1877 /** 1878 * Subscription callback. This parameter takes effect only when it is passed together with triggerCondition. 1879 * The input arguments are described as follows: 1880 * <br>curRow: total number of subscription events when the callback is triggered. 1881 * <br>curSize: total size of subscribed events when the callback is triggered, in bytes. 1882 * <br>holder: subscription data holder, which can be used to process subscribed events. 1883 * 1884 * @type { ?function } 1885 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1886 * @crossplatform 1887 * @atomicservice 1888 * @since arkts {'1.1':'19','1.2':'20'} 1889 * @arkts 1.1&1.2 1890 */ 1891 onTrigger?: (curRow: number, curSize: number, holder: AppEventPackageHolder) => void; 1892 1893 /** 1894 * Real-time subscription callback. Only this callback function is triggered if it is passed together with 1895 * onTrigger. The input arguments are described as follows: 1896 * <br>domain: domain name. 1897 * <br>appEventGroups: event group. 1898 * 1899 * @type { ?function } 1900 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1901 * @atomicservice 1902 * @since 11 1903 */ 1904 /** 1905 * Real-time subscription callback. Only this callback function is triggered if it is passed together with 1906 * onTrigger. The input arguments are described as follows: 1907 * <br>domain: domain name. 1908 * <br>appEventGroups: event group. 1909 * 1910 * @type { ?function } 1911 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1912 * @crossplatform 1913 * @atomicservice 1914 * @since arkts {'1.1':'19','1.2':'20'} 1915 * @arkts 1.1&1.2 1916 */ 1917 onReceive?: (domain: string, appEventGroups: Array<AppEventGroup>) => void; 1918 } 1919 1920 /** 1921 * Adds an event watcher. You can use the callback of the event watcher to subscribe to events. 1922 * 1923 * @param { Watcher } watcher Event watcher. 1924 * @returns { AppEventPackageHolder } Subscription data holder. If the subscription fails, null is returned. 1925 * @throws { BusinessError } 401 - Parameter error. 1926 * @throws { BusinessError } 11102001 - Invalid watcher name. Possible causes: 1. Contain invalid characters; 1927 * <br>2. Length is invalid. 1928 * @throws { BusinessError } 11102002 - Invalid filtering event domain. Possible causes: 1. Contain invalid characters; 1929 * <br>2. Length is invalid. 1930 * @throws { BusinessError } 11102003 - Invalid row value. Possible caused by the row value is less than zero. 1931 * @throws { BusinessError } 11102004 - Invalid size value. Possible caused by the size value is less than zero. 1932 * @throws { BusinessError } 11102005 - Invalid timeout value. Possible caused by the timeout value is less than zero. 1933 * @static 1934 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1935 * @since 9 1936 */ 1937 /** 1938 * Adds an event watcher. You can use the callback of the event watcher to subscribe to events. 1939 * 1940 * @param { Watcher } watcher Event watcher. 1941 * @returns { AppEventPackageHolder } Subscription data holder. If the subscription fails, null is returned. 1942 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1943 * <br>2. Incorrect parameter types. 1944 * @throws { BusinessError } 11102001 - Invalid watcher name. Possible causes: 1. Contain invalid characters; 1945 * <br>2. Length is invalid. 1946 * @throws { BusinessError } 11102002 - Invalid filtering event domain. Possible causes: 1. Contain invalid characters; 1947 * <br>2. Length is invalid. 1948 * @throws { BusinessError } 11102003 - Invalid row value. Possible caused by the row value is less than zero. 1949 * @throws { BusinessError } 11102004 - Invalid size value. Possible caused by the size value is less than zero. 1950 * @throws { BusinessError } 11102005 - Invalid timeout value. Possible caused by the timeout value is less than zero. 1951 * @static 1952 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1953 * @atomicservice 1954 * @since 11 1955 */ 1956 /** 1957 * Adds an event watcher. You can use the callback of the event watcher to subscribe to events. 1958 * 1959 * @param { Watcher } watcher Event watcher. 1960 * @returns { AppEventPackageHolder } Subscription data holder. If the subscription fails, null is returned. 1961 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1962 * <br>2. Incorrect parameter types. 1963 * @throws { BusinessError } 11102001 - Invalid watcher name. Possible causes: 1. Contain invalid characters; 1964 * <br>2. Length is invalid. 1965 * @throws { BusinessError } 11102002 - Invalid filtering event domain. Possible causes: 1. Contain invalid characters; 1966 * <br>2. Length is invalid. 1967 * @throws { BusinessError } 11102003 - Invalid row value. Possible caused by the row value is less than zero. 1968 * @throws { BusinessError } 11102004 - Invalid size value. Possible caused by the size value is less than zero. 1969 * @throws { BusinessError } 11102005 - Invalid timeout value. Possible caused by the timeout value is less than zero. 1970 * @static 1971 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1972 * @crossplatform 1973 * @atomicservice 1974 * @since arkts {'1.1':'19','1.2':'20'} 1975 * @arkts 1.1&1.2 1976 */ 1977 function addWatcher(watcher: Watcher): AppEventPackageHolder; 1978 1979 /** 1980 * Removes an event watcher. 1981 * 1982 * @param { Watcher } watcher Event watcher. 1983 * @throws { BusinessError } 401 - Parameter error. 1984 * @throws { BusinessError } 11102001 - Invalid watcher name. Possible causes: 1. Contain invalid characters; 1985 * <br>2. Length is invalid. 1986 * @static 1987 * @syscap SystemCapability.HiviewDFX.HiAppEvent 1988 * @since 9 1989 */ 1990 /** 1991 * Removes an event watcher. 1992 * 1993 * @param { Watcher } watcher Event watcher. 1994 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 1995 * <br>2. Incorrect parameter types. 1996 * @throws { BusinessError } 11102001 - Invalid watcher name. Possible causes: 1. Contain invalid characters; 1997 * <br>2. Length is invalid. 1998 * @static 1999 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2000 * @atomicservice 2001 * @since 11 2002 */ 2003 /** 2004 * Removes an event watcher. 2005 * 2006 * @param { Watcher } watcher Event watcher. 2007 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2008 * <br>2. Incorrect parameter types. 2009 * @throws { BusinessError } 11102001 - Invalid watcher name. Possible causes: 1. Contain invalid characters; 2010 * <br>2. Length is invalid. 2011 * @static 2012 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2013 * @crossplatform 2014 * @atomicservice 2015 * @since arkts {'1.1':'19','1.2':'20'} 2016 * @arkts 1.1&1.2 2017 */ 2018 function removeWatcher(watcher: Watcher): void; 2019 2020 /** 2021 * Clears local logging data of the application. 2022 * 2023 * @static 2024 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2025 * @since 9 2026 */ 2027 /** 2028 * Clears local logging data of the application. 2029 * 2030 * @static 2031 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2032 * @atomicservice 2033 * @since 11 2034 */ 2035 /** 2036 * Clears local logging data of the application. 2037 * 2038 * @static 2039 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2040 * @crossplatform 2041 * @atomicservice 2042 * @since arkts {'1.1':'19','1.2':'20'} 2043 * @arkts 1.1&1.2 2044 */ 2045 function clearData(): void; 2046 2047 /** 2048 * Sets a user ID, which is used for association when a Processor is configured. 2049 * 2050 * @param { string } name Key of a user ID. The value is string that contains a maximum of 256 characters, including 2051 * digits (0 to 9), letters (a to z), underscore (_), and dollar sign ($). It must not start with a digit. 2052 * @param { string } value Value of a user ID. It can contain a maximum of 256 characters. If the value is null or 2053 * left empty, the user ID is cleared. 2054 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2055 * <br>2. Incorrect parameter types. 2056 * @static 2057 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2058 * @atomicservice 2059 * @since 11 2060 */ 2061 /** 2062 * Sets a user ID, which is used for association when a Processor is configured. 2063 * 2064 * @param { string } name Key of a user ID. The value is string that contains a maximum of 256 characters, including 2065 * digits (0 to 9), letters (a to z), underscore (_), and dollar sign ($). It must not start with a digit. 2066 * @param { string } value Value of a user ID. It can contain a maximum of 256 characters. If the value is null or 2067 * left empty, the user ID is cleared. 2068 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2069 * <br>2. Incorrect parameter types. 2070 * @static 2071 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2072 * @crossplatform 2073 * @atomicservice 2074 * @since arkts {'1.1':'19','1.2':'20'} 2075 * @arkts 1.1&1.2 2076 */ 2077 function setUserId(name: string, value: string): void; 2078 2079 /** 2080 * Obtains the value set through setUserId. 2081 * 2082 * @param { string } name Key of a user ID. The value is string that contains a maximum of 256 characters, including 2083 * digits (0 to 9), letters (a to z), underscore (_), and dollar sign ($). It must not start with a digit. 2084 * @returns { string } Value of a user ID. If no user ID is found, an empty string is returned. 2085 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2086 * <br>2. Incorrect parameter types. 2087 * @static 2088 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2089 * @atomicservice 2090 * @since 11 2091 */ 2092 /** 2093 * Obtains the value set through setUserId. 2094 * 2095 * @param { string } name Key of a user ID. The value is string that contains a maximum of 256 characters, including 2096 * digits (0 to 9), letters (a to z), underscore (_), and dollar sign ($). It must not start with a digit. 2097 * @returns { string } Value of a user ID. If no user ID is found, an empty string is returned. 2098 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2099 * <br>2. Incorrect parameter types. 2100 * @static 2101 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2102 * @crossplatform 2103 * @atomicservice 2104 * @since arkts {'1.1':'19','1.2':'20'} 2105 * @arkts 1.1&1.2 2106 */ 2107 function getUserId(name: string): string; 2108 2109 /** 2110 * Sets a user property, which is used for association when a Processor is configured. 2111 * 2112 * @param { string } name Key of a user property. The value is string that contains a maximum of 256 characters, 2113 * including digits (0 to 9), letters (a to z), underscore (_), and dollar sign ($). It must not start with a digit. 2114 * @param { string } value Value of a user property. It can contain a maximum of 1024 characters. If the value is 2115 * null or left empty, the user property is cleared. 2116 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2117 * <br>2. Incorrect parameter types. 2118 * @static 2119 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2120 * @atomicservice 2121 * @since 11 2122 */ 2123 /** 2124 * Sets a user property, which is used for association when a Processor is configured. 2125 * 2126 * @param { string } name Key of a user property. The value is string that contains a maximum of 256 characters, 2127 * including digits (0 to 9), letters (a to z), underscore (_), and dollar sign ($). It must not start with a digit. 2128 * @param { string } value Value of a user property. It can contain a maximum of 1024 characters. If the value is 2129 * null or left empty, the user property is cleared. 2130 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2131 * <br>2. Incorrect parameter types. 2132 * @static 2133 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2134 * @crossplatform 2135 * @atomicservice 2136 * @since arkts {'1.1':'19','1.2':'20'} 2137 * @arkts 1.1&1.2 2138 */ 2139 function setUserProperty(name: string, value: string): void; 2140 2141 /** 2142 * Obtains the value set through setUserProperty. 2143 * 2144 * @param { string } name Key of a user property. The value is string that contains a maximum of 256 characters, 2145 * including digits (0 to 9), letters (a to z), underscore (_), and dollar sign ($). It must not start with a digit. 2146 * @returns { string } Value of a user property. If no user ID is found, an empty string is returned. 2147 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2148 * <br>2. Incorrect parameter types. 2149 * @static 2150 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2151 * @atomicservice 2152 * @since 11 2153 */ 2154 /** 2155 * Obtains the value set through setUserProperty. 2156 * 2157 * @param { string } name Key of a user property. The value is string that contains a maximum of 256 characters, 2158 * including digits (0 to 9), letters (a to z), underscore (_), and dollar sign ($). It must not start with a digit. 2159 * @returns { string } Value of a user property. If no user ID is found, an empty string is returned. 2160 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2161 * <br>2. Incorrect parameter types. 2162 * @static 2163 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2164 * @crossplatform 2165 * @atomicservice 2166 * @since arkts {'1.1':'19','1.2':'20'} 2167 * @arkts 1.1&1.2 2168 */ 2169 function getUserProperty(name: string): string; 2170 2171 /** 2172 * Event description configuration that can be reported by the data processor 2173 * 2174 * @interface AppEventReportConfig 2175 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2176 * @atomicservice 2177 * @since arkts {'1.1':'11','1.2':'20'} 2178 * @arkts 1.1&1.2 2179 */ 2180 interface AppEventReportConfig { 2181 /** 2182 * Event domain. The value is a string that contains a maximum of 32 characters, including digits (0 to 9), letters 2183 * (a to z), and underscore (_). It must start with a letter and cannot end with an underscore (_). The default 2184 * value is an empty string. 2185 * 2186 * @type { ?string } 2187 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2188 * @atomicservice 2189 * @since arkts {'1.1':'11','1.2':'20'} 2190 * @arkts 1.1&1.2 2191 */ 2192 domain?: string; 2193 2194 /** 2195 * Event name. The value is string that contains a maximum of 48 characters, including digits (0 to 9), letters 2196 * (a to z), underscore (_), and dollar sign ($). It must start with a letter or dollar sign ($) and end with a 2197 * digit or letter. The default value is an empty string. 2198 * 2199 * @type { ?string } 2200 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2201 * @atomicservice 2202 * @since arkts {'1.1':'11','1.2':'20'} 2203 * @arkts 1.1&1.2 2204 */ 2205 name?: string; 2206 2207 /** 2208 * Whether to report events in real time. The value true indicates that events are reported in real time, and the 2209 * value false indicates the opposite. The default value is false. 2210 * 2211 * @type { ?boolean } 2212 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2213 * @atomicservice 2214 * @since arkts {'1.1':'11','1.2':'20'} 2215 * @arkts 1.1&1.2 2216 */ 2217 isRealTime?: boolean; 2218 } 2219 2220 /** 2221 * Defines a data processor for reporting and managing events. You can customize processor configurations as required. 2222 * 2223 * @interface Processor 2224 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2225 * @atomicservice 2226 * @since arkts {'1.1':'11','1.2':'20'} 2227 * @arkts 1.1&1.2 2228 */ 2229 interface Processor { 2230 /** 2231 * Name of a data processor. The value is string that contains a maximum of 256 characters, including digits (0 to 2232 * 9), letters (a to z), underscore (_), and dollar sign ($). It must not start with a digit. 2233 * 2234 * @type { string } 2235 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2236 * @atomicservice 2237 * @since arkts {'1.1':'11','1.2':'20'} 2238 * @arkts 1.1&1.2 2239 */ 2240 name: string; 2241 2242 /** 2243 * Whether to enable the debug mode. The default value is false. The value true means to enable the debugging mode, 2244 * and the value false means the opposite. 2245 * 2246 * @type { ?boolean } 2247 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2248 * @atomicservice 2249 * @since arkts {'1.1':'11','1.2':'20'} 2250 * @arkts 1.1&1.2 2251 */ 2252 debugMode?: boolean; 2253 2254 /** 2255 * Server location information. It is left empty by default. The length of the input string cannot exceed 8 KB. If 2256 * the length exceeds 8 KB, the default value is used. 2257 * 2258 * @type { ?string } 2259 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2260 * @atomicservice 2261 * @since arkts {'1.1':'11','1.2':'20'} 2262 * @arkts 1.1&1.2 2263 */ 2264 routeInfo?: string; 2265 2266 /** 2267 * Application ID. It is left empty by default. The length of the input string cannot exceed 8 KB. If the length 2268 * exceeds 8 KB, the default value is used. 2269 * 2270 * @type { ?string } 2271 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2272 * @atomicservice 2273 * @since arkts {'1.1':'11','1.2':'20'} 2274 * @arkts 1.1&1.2 2275 */ 2276 appId?: string; 2277 2278 /** 2279 * Whether to report an event when the data processor starts. The default value is false. The value true means to 2280 * report events, and the value false means the opposite. 2281 * 2282 * @type { ?boolean } 2283 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2284 * @atomicservice 2285 * @since arkts {'1.1':'11','1.2':'20'} 2286 * @arkts 1.1&1.2 2287 */ 2288 onStartReport?: boolean; 2289 2290 /** 2291 * Whether to report an event when an application switches to the background. The default value is false. The value 2292 * true means to report events, and the value false means the opposite. 2293 * 2294 * @type { ?boolean } 2295 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2296 * @atomicservice 2297 * @since arkts {'1.1':'11','1.2':'20'} 2298 * @arkts 1.1&1.2 2299 */ 2300 onBackgroundReport?: boolean; 2301 2302 /** 2303 * Interval for event reporting, in seconds. The input value must be greater than or equal to 0. If the input value 2304 * is less than 0, the default value 0 is used and periodic reporting is not performed. 2305 * 2306 * @type { ?number } 2307 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2308 * @atomicservice 2309 * @since arkts {'1.1':'11','1.2':'20'} 2310 * @arkts 1.1&1.2 2311 */ 2312 periodReport?: number; 2313 2314 /** 2315 * Event reporting threshold. When the number of events reaches the threshold, an event is reported. The value must 2316 * be greater than 0 and less than 1000. If the value is not within the range, the default value 0 is used and no 2317 * events are reported. 2318 * 2319 * @type { ?number } 2320 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2321 * @atomicservice 2322 * @since arkts {'1.1':'11','1.2':'20'} 2323 * @arkts 1.1&1.2 2324 */ 2325 batchReport?: number; 2326 2327 /** 2328 * Name array of user IDs that can be reported by the data processor. name corresponds to the name parameter of the 2329 * setUserId API. The default value is an empty array. 2330 * 2331 * @type { ?string[] } 2332 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2333 * @atomicservice 2334 * @since arkts {'1.1':'11','1.2':'20'} 2335 * @arkts 1.1&1.2 2336 */ 2337 userIds?: string[]; 2338 2339 /** 2340 * Name array of user properties that can be reported by the data processor. name corresponds to the name parameter 2341 * of the setUserProperty API. The default value is an empty array. 2342 * 2343 * @type { ?string[] } 2344 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2345 * @atomicservice 2346 * @since arkts {'1.1':'11','1.2':'20'} 2347 * @arkts 1.1&1.2 2348 */ 2349 userProperties?: string[]; 2350 2351 /** 2352 * Event description configuration array that can be reported by the data processor. The default value is an empty 2353 * array. 2354 * 2355 * @type { ?AppEventReportConfig[] } 2356 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2357 * @atomicservice 2358 * @since arkts {'1.1':'11','1.2':'20'} 2359 * @arkts 1.1&1.2 2360 */ 2361 eventConfigs?: AppEventReportConfig[]; 2362 2363 /** 2364 * Configuration ID for data processor. The input value must be greater than or equal to 0. If the input value is 2365 * less than 0, the default value 0 is used. If the input value is greater than 0, the value uniquely identifies a 2366 * data processor with its name. 2367 * 2368 * @type { ?number } 2369 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2370 * @atomicservice 2371 * @since arkts {'1.1':'12','1.2':'20'} 2372 * @arkts 1.1&1.2 2373 */ 2374 configId?: number; 2375 2376 /** 2377 * Custom extended parameters. If the input parameter name and value do not meet the specifications, extended 2378 * parameters are not configured by default. The specifications are as follows: 2379 * <br>- A parameter name is a string that contains a maximum of 32 characters, including digits (0 to 9), letters 2380 * (a to z), underscore (_), and dollar sign ($). It must start with a letter or dollar sign ($) and end with a 2381 * digit or letter. 2382 * <br>- A parameter value is a string contains a maximum of 1024 characters. 2383 * <br>- The number of parameters must be less than 32. 2384 * 2385 * @type { ?Record<string, string> } 2386 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2387 * @atomicservice 2388 * @since arkts {'1.1':'12','1.2':'20'} 2389 * @arkts 1.1&1.2 2390 */ 2391 customConfigs?: Record<string, string>; 2392 2393 /** 2394 * Initialize the processor by reading the configuration file based on the name. 2395 * 2396 * @type { ?string } 2397 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2398 * @atomicservice 2399 * @since 20 2400 */ 2401 configName?: string; 2402 } 2403 2404 /** 2405 * Adds a data processor to migrate event data to the cloud. You can preset the implementation of the processor on 2406 * the device and set its properties based on its constraints. 2407 * <br>The configuration information of Processor must be provided by the data processor. Yet, as no data processor 2408 * is preset in the device for interaction for the moment, migrating events to the cloud is unavailable. 2409 * 2410 * @param { Processor } processor Data processor. 2411 * @returns { number } ID of the data processor of the reported event, which uniquely identifies the data processor 2412 * and can be used to remove the data processor. If the operation fails, -1 is returned. If the operation is 2413 * successful, a value greater than 0 is returned. 2414 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2415 * <br>2. Incorrect parameter types. 2416 * @static 2417 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2418 * @atomicservice 2419 * @since arkts {'1.1':'11','1.2':'20'} 2420 * @arkts 1.1&1.2 2421 */ 2422 function addProcessor(processor: Processor): number; 2423 2424 /** 2425 * Add the processor from config asynchronously, who can report the event. 2426 * 2427 * @param { string } processorName The name of the processor. 2428 * @param { string } [configName] Initialize the processor by reading the configuration file based on the name. 2429 * @returns { Promise<number> } The processor unique ID. 2430 * @throws { BusinessError } 11105001 - Invalid parameter value. Possible causes: 1. Incorrect parameter length; 2431 * <br>2. Incorrect parameter format. 2432 * @static 2433 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2434 * @atomicservice 2435 * @since 20 2436 */ 2437 function addProcessorFromConfig(processorName: string, configName?: string): Promise<number>; 2438 2439 /** 2440 * Removes the data processor of a reported event. 2441 * 2442 * @param { number } id ID of a data processor. The value must be greater than 0. The value is obtained by calling 2443 * addProcessor. 2444 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2445 * <br>2. Incorrect parameter types. 2446 * @static 2447 * @syscap SystemCapability.HiviewDFX.HiAppEvent 2448 * @atomicservice 2449 * @since arkts {'1.1':'11','1.2':'20'} 2450 * @arkts 1.1&1.2 2451 */ 2452 function removeProcessor(id: number): void; 2453} 2454 2455export default hiAppEvent; 2456