1/* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit BasicServicesKit 19 */ 20 21/** 22 * A static class pertaining to the product information. 23 * 24 * @namespace deviceInfo 25 * @syscap SystemCapability.Startup.SystemInfo 26 * @since 6 27 */ 28/** 29 * A static class pertaining to the product information. 30 * 31 * @namespace deviceInfo 32 * @syscap SystemCapability.Startup.SystemInfo 33 * @crossplatform 34 * @atomicservice 35 * @since 11 36 */ 37declare namespace deviceInfo { 38 /** 39 * Enumerates thedevice types. 40 * @enum { string } 41 * @syscap SystemCapability.Startup.SystemInfo 42 * @crossplatform 43 * @atomicservice 44 * @since 20 45 */ 46 enum DeviceTypes { 47 /** 48 * Default device for phones 49 * 50 * @syscap SystemCapability.Startup.SystemInfo 51 * @crossplatform 52 * @atomicservice 53 * @since 20 54 */ 55 TYPE_DEFAULT = 'default', 56 57 /** 58 * Phone device 59 * 60 * @syscap SystemCapability.Startup.SystemInfo 61 * @crossplatform 62 * @atomicservice 63 * @since 20 64 */ 65 TYPE_PHONE = 'phone', 66 67 /** 68 * Tablet device 69 * 70 * @syscap SystemCapability.Startup.SystemInfo 71 * @crossplatform 72 * @atomicservice 73 * @since 20 74 */ 75 TYPE_TABLET = 'tablet', 76 77 /** 78 * 2in1 device 79 * 80 * @syscap SystemCapability.Startup.SystemInfo 81 * @crossplatform 82 * @atomicservice 83 * @since 20 84 */ 85 TYPE_2IN1 = '2in1', 86 87 /** 88 * Tv device 89 * 90 * @syscap SystemCapability.Startup.SystemInfo 91 * @crossplatform 92 * @atomicservice 93 * @since 20 94 */ 95 TYPE_TV = 'tv', 96 97 /** 98 * Wearable device 99 * 100 * @syscap SystemCapability.Startup.SystemInfo 101 * @crossplatform 102 * @atomicservice 103 * @since 20 104 */ 105 TYPE_WEARABLE = 'wearable', 106 107 /** 108 * Car device 109 * 110 * @syscap SystemCapability.Startup.SystemInfo 111 * @crossplatform 112 * @atomicservice 113 * @since 20 114 */ 115 TYPE_CAR = 'car' 116 } 117 /** 118 * Obtains the device type represented by a string, 119 * which can be {@code phone} (or {@code default} for phones), {@code wearable}, {@code liteWearable}, 120 * {@code tablet}, {@code tv}, {@code car}, or {@code smartVision}. 121 * 122 * @syscap SystemCapability.Startup.SystemInfo 123 * @since 6 124 */ 125 /** 126 * Obtains the device type represented by a string, 127 * which can be {@code phone} (or {@code default} for phones), {@code wearable}, {@code liteWearable}, 128 * {@code tablet}, {@code tv}, {@code car}, or {@code smartVision}. 129 * 130 * @syscap SystemCapability.Startup.SystemInfo 131 * @crossplatform 132 * @since 10 133 */ 134 /** 135 * Obtains the device type represented by a string, 136 * which can be {@code phone} (or {@code default} for phones), {@code wearable}, {@code liteWearable}, 137 * {@code tablet}, {@code tv}, {@code car}, or {@code smartVision}. 138 * 139 * @syscap SystemCapability.Startup.SystemInfo 140 * @crossplatform 141 * @atomicservice 142 * @since 11 143 */ 144 const deviceType: string; 145 146 /** 147 * Obtains the device manufacturer represented by a string. 148 * 149 * @syscap SystemCapability.Startup.SystemInfo 150 * @since 6 151 */ 152 /** 153 * Obtains the device manufacturer represented by a string. 154 * 155 * @syscap SystemCapability.Startup.SystemInfo 156 * @crossplatform 157 * @since 10 158 */ 159 const manufacture: string; 160 161 /** 162 * Obtains the device brand represented by a string. 163 * 164 * @syscap SystemCapability.Startup.SystemInfo 165 * @since 6 166 */ 167 /** 168 * Obtains the device brand represented by a string. 169 * 170 * @syscap SystemCapability.Startup.SystemInfo 171 * @crossplatform 172 * @since 10 173 */ 174 /** 175 * Obtains the device brand represented by a string. 176 * 177 * @syscap SystemCapability.Startup.SystemInfo 178 * @crossplatform 179 * @atomicservice 180 * @since 11 181 */ 182 const brand: string; 183 184 /** 185 * Obtains the external product series represented by a string. 186 * 187 * 188 * @syscap SystemCapability.Startup.SystemInfo 189 * @since 6 190 */ 191 /** 192 * Obtains the external product series represented by a string. 193 * 194 * 195 * @syscap SystemCapability.Startup.SystemInfo 196 * @crossplatform 197 * @since 10 198 */ 199 const marketName: string; 200 201 /** 202 * Obtains the product series represented by a string. 203 * 204 * @constant 205 * @syscap SystemCapability.Startup.SystemInfo 206 * @since 6 207 */ 208 /** 209 * Obtains the product series represented by a string. 210 * 211 * @syscap SystemCapability.Startup.SystemInfo 212 * @crossplatform 213 * @since 10 214 */ 215 const productSeries: string; 216 217 /** 218 * Obtains the product model represented by a string. 219 * 220 * @syscap SystemCapability.Startup.SystemInfo 221 * @since 6 222 */ 223 /** 224 * Obtains the product model represented by a string. 225 * 226 * @syscap SystemCapability.Startup.SystemInfo 227 * @crossplatform 228 * @since 10 229 */ 230 /** 231 * Obtains the product model represented by a string. 232 * 233 * @syscap SystemCapability.Startup.SystemInfo 234 * @crossplatform 235 * @atomicservice 236 * @since 11 237 */ 238 const productModel: string; 239 240 /** 241 * Obtains the product model alias represented by a string. 242 * 243 * @syscap SystemCapability.Startup.SystemInfo 244 * @crossplatform 245 * @atomicservice 246 * @since 14 247 */ 248 const productModelAlias: string; 249 250 /** 251 * Obtains the software model represented by a string. 252 * 253 * @syscap SystemCapability.Startup.SystemInfo 254 * @since 6 255 */ 256 /** 257 * Obtains the software model represented by a string. 258 * 259 * @syscap SystemCapability.Startup.SystemInfo 260 * @crossplatform 261 * @since 10 262 */ 263 const softwareModel: string; 264 265 /** 266 * Obtains the hardware model represented by a string. 267 * 268 * @syscap SystemCapability.Startup.SystemInfo 269 * @since 6 270 */ 271 /** 272 * Obtains the hardware model represented by a string. 273 * 274 * @syscap SystemCapability.Startup.SystemInfo 275 * @crossplatform 276 * @since 10 277 */ 278 const hardwareModel: string; 279 280 /** 281 * Obtains the hardware profile represented by a string. 282 * 283 * @syscap SystemCapability.Startup.SystemInfo 284 * @since 6 285 * @deprecated since 9 286 */ 287 const hardwareProfile: string; 288 289 /** 290 * Obtains the device serial number represented by a string. 291 * 292 * @permission ohos.permission.sec.ACCESS_UDID 293 * 294 * @syscap SystemCapability.Startup.SystemInfo 295 * @since 6 296 */ 297 const serial: string; 298 299 /** 300 * Obtains the bootloader version number represented by a string. 301 * 302 * @syscap SystemCapability.Startup.SystemInfo 303 * @since 6 304 */ 305 /** 306 * Obtains the bootloader version number represented by a string. 307 * 308 * @syscap SystemCapability.Startup.SystemInfo 309 * @crossplatform 310 * @since 10 311 */ 312 const bootloaderVersion: string; 313 314 /** 315 * Obtains the application binary interface (Abi) list represented by a string. 316 * 317 * 318 * @syscap SystemCapability.Startup.SystemInfo 319 * @since 6 320 */ 321 /** 322 * Obtains the application binary interface (Abi) list represented by a string. 323 * 324 * @syscap SystemCapability.Startup.SystemInfo 325 * @crossplatform 326 * @since 10 327 */ 328 const abiList: string; 329 330 /** 331 * Obtains the security patch level represented by a string. 332 * 333 * @syscap SystemCapability.Startup.SystemInfo 334 * @since 6 335 */ 336 /** 337 * Obtains the security patch level represented by a string. 338 * 339 * @syscap SystemCapability.Startup.SystemInfo 340 * @crossplatform 341 * @since 10 342 */ 343 const securityPatchTag: string; 344 345 /** 346 * Obtains the product version represented by a string. 347 * 348 * @syscap SystemCapability.Startup.SystemInfo 349 * @since 6 350 */ 351 /** 352 * Obtains the product version represented by a string. 353 * 354 * @syscap SystemCapability.Startup.SystemInfo 355 * @crossplatform 356 * @since 10 357 */ 358 const displayVersion: string; 359 360 /** 361 * Obtains the incremental version represented by a string. 362 * 363 * @syscap SystemCapability.Startup.SystemInfo 364 * @since 6 365 */ 366 /** 367 * Obtains the incremental version represented by a string. 368 * 369 * @syscap SystemCapability.Startup.SystemInfo 370 * @crossplatform 371 * @since 10 372 */ 373 const incrementalVersion: string; 374 375 /** 376 * Obtains the OS release type represented by a string. 377 * <p>The OS release category can be {@code Release}, {@code Beta}, or {@code Canary}. 378 * The specific release type may be {@code Release}, {@code Beta1}, or others alike. 379 * 380 * @syscap SystemCapability.Startup.SystemInfo 381 * @since 6 382 */ 383 /** 384 * Obtains the OS release type represented by a string. 385 * <p>The OS release category can be {@code Release}, {@code Beta}, or {@code Canary}. 386 * The specific release type may be {@code Release}, {@code Beta1}, or others alike. 387 * 388 * @syscap SystemCapability.Startup.SystemInfo 389 * @crossplatform 390 * @since 10 391 */ 392 const osReleaseType: string; 393 394 /** 395 * Obtains the OS version represented by a string. 396 * 397 * @syscap SystemCapability.Startup.SystemInfo 398 * @since 6 399 */ 400 /** 401 * Obtains the OS version represented by a string. 402 * 403 * @syscap SystemCapability.Startup.SystemInfo 404 * @crossplatform 405 * @since 10 406 */ 407 /** 408 * Obtains the OS version represented by a string. 409 * 410 * @syscap SystemCapability.Startup.SystemInfo 411 * @crossplatform 412 * @atomicservice 413 * @since 11 414 */ 415 const osFullName: string; 416 417 /** 418 * Obtains the major (M) version number, which increases with any updates to the overall architecture. 419 * <p>The M version number monotonically increases from 1 to 99. 420 * 421 * @syscap SystemCapability.Startup.SystemInfo 422 * @since 6 423 */ 424 /** 425 * Obtains the major (M) version number, which increases with any updates to the overall architecture. 426 * <p>The M version number monotonically increases from 1 to 99. 427 * 428 * @syscap SystemCapability.Startup.SystemInfo 429 * @crossplatform 430 * @since 10 431 */ 432 const majorVersion: number; 433 434 /** 435 * Obtains the senior (S) version number, which increases with any updates to the partial 436 * architecture or major features. 437 * <p>The S version number monotonically increases from 0 to 99. 438 * 439 * @syscap SystemCapability.Startup.SystemInfo 440 * @since 6 441 */ 442 /** 443 * Obtains the senior (S) version number, which increases with any updates to the partial 444 * architecture or major features. 445 * <p>The S version number monotonically increases from 0 to 99. 446 * 447 * @syscap SystemCapability.Startup.SystemInfo 448 * @crossplatform 449 * @since 10 450 */ 451 const seniorVersion: number; 452 453 /** 454 * Obtains the feature (F) version number, which increases with any planned new features. 455 * <p>The F version number monotonically increases from 0 or 1 to 99. 456 * 457 * @syscap SystemCapability.Startup.SystemInfo 458 * @since 6 459 */ 460 /** 461 * Obtains the feature (F) version number, which increases with any planned new features. 462 * <p>The F version number monotonically increases from 0 or 1 to 99. 463 * 464 * @syscap SystemCapability.Startup.SystemInfo 465 * @crossplatform 466 * @since 10 467 */ 468 const featureVersion: number; 469 470 /** 471 * Obtains the build (B) version number, which increases with each new development build. 472 * <p>The B version number monotonically increases from 0 or 1 to 999. 473 * 474 * @syscap SystemCapability.Startup.SystemInfo 475 * @since 6 476 */ 477 /** 478 * Obtains the build (B) version number, which increases with each new development build. 479 * <p>The B version number monotonically increases from 0 or 1 to 999. 480 * 481 * @syscap SystemCapability.Startup.SystemInfo 482 * @crossplatform 483 * @since 10 484 */ 485 const buildVersion: number; 486 487 /** 488 * Obtains the SDK API version number. 489 * 490 * @syscap SystemCapability.Startup.SystemInfo 491 * @since 6 492 */ 493 /** 494 * Obtains the SDK API version number. 495 * 496 * @syscap SystemCapability.Startup.SystemInfo 497 * @crossplatform 498 * @since 10 499 */ 500 /** 501 * Obtains the SDK API version number. 502 * 503 * @syscap SystemCapability.Startup.SystemInfo 504 * @crossplatform 505 * @atomicservice 506 * @since 14 507 */ 508 const sdkApiVersion: number; 509 510 /** 511 * Obtains the first API version number. 512 * 513 * @syscap SystemCapability.Startup.SystemInfo 514 * @since 6 515 */ 516 /** 517 * Obtains the first API version number. 518 * 519 * @syscap SystemCapability.Startup.SystemInfo 520 * @crossplatform 521 * @since 10 522 */ 523 const firstApiVersion: number; 524 525 /** 526 * Obtains the version ID by a string. 527 * 528 * @syscap SystemCapability.Startup.SystemInfo 529 * @since 6 530 */ 531 /** 532 * Obtains the version ID by a string. 533 * 534 * @syscap SystemCapability.Startup.SystemInfo 535 * @crossplatform 536 * @since 10 537 */ 538 const versionId: string; 539 540 /** 541 * Obtains the build types of the same baseline code. 542 * 543 * @syscap SystemCapability.Startup.SystemInfo 544 * @since 6 545 */ 546 /** 547 * Obtains the build types of the same baseline code. 548 * 549 * @syscap SystemCapability.Startup.SystemInfo 550 * @crossplatform 551 * @since 10 552 */ 553 const buildType: string; 554 555 /** 556 * Obtains the different build user of the same baseline code. 557 * 558 * @syscap SystemCapability.Startup.SystemInfo 559 * @since 6 560 */ 561 /** 562 * Obtains the different build user of the same baseline code. 563 * 564 * @syscap SystemCapability.Startup.SystemInfo 565 * @crossplatform 566 * @since 10 567 */ 568 const buildUser: string; 569 570 /** 571 * Obtains the different build host of the same baseline code. 572 * 573 * @syscap SystemCapability.Startup.SystemInfo 574 * @since 6 575 */ 576 /** 577 * Obtains the different build host of the same baseline code. 578 * 579 * @syscap SystemCapability.Startup.SystemInfo 580 * @crossplatform 581 * @since 10 582 */ 583 const buildHost: string; 584 585 /** 586 * Obtains the build time. 587 * 588 * @syscap SystemCapability.Startup.SystemInfo 589 * @since 6 590 */ 591 /** 592 * Obtains the build time. 593 * 594 * @syscap SystemCapability.Startup.SystemInfo 595 * @crossplatform 596 * @since 10 597 */ 598 const buildTime: string; 599 600 /** 601 * Obtains the version hash. 602 * 603 * @syscap SystemCapability.Startup.SystemInfo 604 * @since 6 605 */ 606 /** 607 * Obtains the version hash. 608 * 609 * @syscap SystemCapability.Startup.SystemInfo 610 * @crossplatform 611 * @since 10 612 */ 613 const buildRootHash: string; 614 615 /** 616 * Obtains the device udid. 617 * 618 * @permission ohos.permission.sec.ACCESS_UDID 619 * 620 * @syscap SystemCapability.Startup.SystemInfo 621 * @since 7 622 */ 623 const udid: string; 624 625 /** 626 * Obtains the Distribution OS name. 627 * <p>Independent Software Vendor (ISV) may distribute OHOS with their own OS name. 628 * distributionOsName will return the ISV OS name 629 * If ISV not specified, it will return an empty string 630 * 631 * @syscap SystemCapability.Startup.SystemInfo 632 * @since 10 633 */ 634 const distributionOSName: string; 635 636 /** 637 * Obtains the Distribution OS version. 638 * <p>Independent Software Vendor (ISV) may distribute OHOS with their own OS version. 639 * distributionOSVersion will return the ISV OS version 640 * If ISV not specified, it will return the same value as osFullName 641 * 642 * @syscap SystemCapability.Startup.SystemInfo 643 * @since 10 644 */ 645 const distributionOSVersion: string; 646 647 /** 648 * Obtains the Distribution OS version. 649 * <p>Independent Software Vendor (ISV) may distribute OHOS with their own OS api version. 650 * distributionOSVersion will return the ISV OS api version 651 * If ISV not specified, it will return the same value as sdkApiVersion 652 * 653 * @syscap SystemCapability.Startup.SystemInfo 654 * @since 10 655 */ 656 const distributionOSApiVersion: number; 657 658 /** 659 * Obtains the Distribution OS api name. 660 * <p>Independent Software Vendor (ISV) may distribute OHOS with their own OS api name. 661 * distributionOSApiName will return the ISV OS api name 662 * 663 * @syscap SystemCapability.Startup.SystemInfo 664 * @since 13 665 */ 666 const distributionOSApiName: string; 667 668 /** 669 * Obtains the Distribution OS release type. 670 * <p>Independent Software Vendor (ISV) may distribute OHOS with their own OS release type. 671 * distributionOSVersion will return the ISV OS release type 672 * If ISV not specified, it will return the same value as osReleaseType 673 * 674 * @syscap SystemCapability.Startup.SystemInfo 675 * @since 10 676 */ 677 const distributionOSReleaseType: string; 678 679 /** 680 * Open Device Identifier (ODID): a developer-level non-permanent device identifier. 681 * A developer can be an enterprise or individual developer. 682 * Example: dff3cdfd-7beb-1e7d-fdf7-1dbfddd7d30c 683 * 684 * An ODID will be regenerate in the following scenarios: 685 * Restore a phone to its factory settings. 686 * Uninstall and reinstall all apps of one developer on one device. 687 * 688 * An ODID is generated based on the following rules: 689 * For apps from the same developer, which are running on the same device, they have the same ODID. 690 * For apps from different developers, which are running on the same device, each of them has its own ODID. 691 * For apps from the same developer, which are running on different devices, each of them has its own ODID. 692 * For apps from different developers, which are running on different devices, each of them has its own ODID. 693 * 694 * @syscap SystemCapability.Startup.SystemInfo 695 * @since 12 696 */ 697 const ODID: string; 698 699 /** 700 * Obtaining the hard drive serial number. 701 * 702 * @permission ohos.permission.ACCESS_DISK_PHY_INFO 703 * @syscap SystemCapability.Startup.SystemInfo 704 * @since 15 705 */ 706 const diskSN: string; 707 708/** 709 * Performance Class level of a device. 710 * 711 * @enum { number } 712 * @syscap SystemCapability.Startup.SystemInfo 713 * @crossplatform 714 * @since 19 715 */ 716 export enum PerformanceClassLevel { 717 /** 718 * Device Capability Level is high. 719 * 720 * @syscap SystemCapability.Startup.SystemInfo 721 * @crossplatform 722 * @since 19 723 */ 724 CLASS_LEVEL_HIGH, 725 /** 726 * Device Capability Level is medium. 727 * 728 * @syscap SystemCapability.Startup.SystemInfo 729 * @crossplatform 730 * @since 19 731 */ 732 CLASS_LEVEL_MEDIUM, 733 /** 734 * Device Capability Level is low. 735 * 736 * @syscap SystemCapability.Startup.SystemInfo 737 * @crossplatform 738 * @since 19 739 */ 740 CLASS_LEVEL_LOW 741 } 742 743 /** 744 * Obtaining the performance class. 745 * 746 * @syscap SystemCapability.Startup.SystemInfo 747 * @crossplatform 748 * @since 19 749 */ 750 const performanceClass: PerformanceClassLevel; 751} 752 753export default deviceInfo; 754