1/* 2 * Copyright (c) 2023-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 MDMKit 19 */ 20 21import type { AsyncCallback } from './@ohos.base'; 22import type Want from './@ohos.app.ability.Want'; 23 24/** 25 * This module offers set wifi policies on the devices. 26 * 27 * @namespace wifiManager 28 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 29 * @stagemodelonly 30 * @since 10 31 */ 32declare namespace wifiManager { 33 /** 34 * Describes the wifi security type. 35 * 36 * @enum { number } 37 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 38 * @stagemodelonly 39 * @since 12 40 */ 41 enum WifiSecurityType { 42 /** 43 * Invalid security type 44 * 45 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 46 * @stagemodelonly 47 * @since 12 48 */ 49 WIFI_SEC_TYPE_INVALID = 0, 50 51 /** 52 * Open 53 * 54 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 55 * @stagemodelonly 56 * @since 12 57 */ 58 WIFI_SEC_TYPE_OPEN = 1, 59 60 /** 61 * Wired Equivalent Privacy (WEP) 62 * 63 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 64 * @stagemodelonly 65 * @since 12 66 */ 67 WIFI_SEC_TYPE_WEP = 2, 68 69 /** 70 * Pre-shared key (PSK) 71 * 72 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 73 * @stagemodelonly 74 * @since 12 75 */ 76 WIFI_SEC_TYPE_PSK = 3, 77 78 /** 79 * Simultaneous Authentication of Equals (SAE) 80 * 81 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 82 * @stagemodelonly 83 * @since 12 84 */ 85 WIFI_SEC_TYPE_SAE = 4, 86 87 /** 88 * EAP authentication. 89 * 90 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 91 * @stagemodelonly 92 * @since 12 93 */ 94 WIFI_SEC_TYPE_EAP = 5, 95 96 /** 97 * SUITE_B_192 192 bit level. 98 * 99 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 100 * @stagemodelonly 101 * @since 12 102 */ 103 WIFI_SEC_TYPE_EAP_SUITE_B = 6, 104 105 /** 106 * Opportunistic Wireless Encryption. 107 * 108 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 109 * @stagemodelonly 110 * @since 12 111 */ 112 WIFI_SEC_TYPE_OWE = 7, 113 114 /** 115 * WAPI certificate to be specified. 116 * 117 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 118 * @stagemodelonly 119 * @since 12 120 */ 121 WIFI_SEC_TYPE_WAPI_CERT = 8, 122 123 /** 124 * WAPI pre-shared key to be specified. 125 * 126 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 127 * @stagemodelonly 128 * @since 12 129 */ 130 WIFI_SEC_TYPE_WAPI_PSK = 9 131 } 132 133 /** 134 * Wi-Fi IP type enumeration. 135 * 136 * @enum { number } 137 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 138 * @stagemodelonly 139 * @since 12 140 */ 141 enum IpType { 142 /** 143 * Use statically configured IP settings 144 * 145 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 146 * @stagemodelonly 147 * @since 12 148 */ 149 STATIC, 150 151 /** 152 * Use dynamically configured IP settings 153 * 154 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 155 * @stagemodelonly 156 * @since 12 157 */ 158 DHCP, 159 160 /** 161 * No IP details are assigned 162 * 163 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 164 * @stagemodelonly 165 * @since 12 166 */ 167 UNKNOWN 168 } 169 170 /** 171 * Wi-Fi IP profile. 172 * 173 * @typedef IpProfile 174 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 175 * @stagemodelonly 176 * @since 12 177 */ 178 interface IpProfile { 179 /** 180 * The ip address 181 * 182 * @type { number } 183 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 184 * @stagemodelonly 185 * @since 12 186 */ 187 ipAddress: number; 188 189 /** 190 * The gateway 191 * 192 * @type { number } 193 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 194 * @stagemodelonly 195 * @since 12 196 */ 197 gateway: number; 198 199 /** 200 * The length of prefix 201 * 202 * @type { number } 203 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 204 * @stagemodelonly 205 * @since 12 206 */ 207 prefixLength: number; 208 209 /** 210 * The DNS services 211 * 212 * @type { number[] } 213 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 214 * @stagemodelonly 215 * @since 12 216 */ 217 dnsServers: number[]; 218 219 /** 220 * The domains 221 * 222 * @type { Array<string> } 223 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 224 * @stagemodelonly 225 * @since 12 226 */ 227 domains: Array<string>; 228 } 229 230 /** 231 * Wi-Fi EAP method. 232 * 233 * @enum { number } 234 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 235 * @stagemodelonly 236 * @since 12 237 */ 238 enum EapMethod { 239 /** 240 * Not specified 241 * 242 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 243 * @stagemodelonly 244 * @since 12 245 */ 246 EAP_NONE, 247 248 /** 249 * Protected extensible authentication protocol 250 * 251 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 252 * @stagemodelonly 253 * @since 12 254 */ 255 EAP_PEAP, 256 257 /** 258 * Transport layer security 259 * 260 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 261 * @stagemodelonly 262 * @since 12 263 */ 264 EAP_TLS, 265 266 /** 267 * Tunneled transport layer security 268 * 269 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 270 * @stagemodelonly 271 * @since 12 272 */ 273 EAP_TTLS, 274 275 /** 276 * Password 277 * 278 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 279 * @stagemodelonly 280 * @since 12 281 */ 282 EAP_PWD, 283 284 /** 285 * Subscriber identity module 286 * 287 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 288 * @stagemodelonly 289 * @since 12 290 */ 291 EAP_SIM, 292 293 /** 294 * Authentication and key agreement 295 * 296 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 297 * @stagemodelonly 298 * @since 12 299 */ 300 EAP_AKA, 301 302 /** 303 * AKA prime 304 * 305 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 306 * @stagemodelonly 307 * @since 12 308 */ 309 EAP_AKA_PRIME, 310 311 /** 312 * Unauth TLS 313 * 314 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 315 * @stagemodelonly 316 * @since 12 317 */ 318 EAP_UNAUTH_TLS 319 } 320 321 /** 322 * Wi-Fi phase 2 method. 323 * 324 * @enum { number } 325 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 326 * @stagemodelonly 327 * @since 12 328 */ 329 enum Phase2Method { 330 /** 331 * Not specified 332 * 333 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 334 * @stagemodelonly 335 * @since 12 336 */ 337 PHASE2_NONE, 338 339 /** 340 * Password authentication protocol 341 * 342 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 343 * @stagemodelonly 344 * @since 12 345 */ 346 PHASE2_PAP, 347 348 /** 349 * Microsoft challenge handshake authentication protocol 350 * 351 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 352 * @stagemodelonly 353 * @since 12 354 */ 355 PHASE2_MSCHAP, 356 357 /** 358 * Microsoft challenge handshake authentication protocol version 2 359 * 360 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 361 * @stagemodelonly 362 * @since 12 363 */ 364 PHASE2_MSCHAPV2, 365 366 /** 367 * Generic token card 368 * 369 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 370 * @stagemodelonly 371 * @since 12 372 */ 373 PHASE2_GTC, 374 375 /** 376 * Subscriber identity module 377 * 378 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 379 * @stagemodelonly 380 * @since 12 381 */ 382 PHASE2_SIM, 383 384 /** 385 * Authentication and key agreement 386 * 387 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 388 * @stagemodelonly 389 * @since 12 390 */ 391 PHASE2_AKA, 392 393 /** 394 * AKA Prime 395 * 396 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 397 * @stagemodelonly 398 * @since 12 399 */ 400 PHASE2_AKA_PRIME 401 } 402 403 /** 404 * Wi-Fi EAP profile. 405 * 406 * @typedef WifiEapProfile 407 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 408 * @stagemodelonly 409 * @since 12 410 */ 411 interface WifiEapProfile { 412 /** 413 * EAP authentication method 414 * 415 * @type { EapMethod } 416 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 417 * @stagemodelonly 418 * @since 12 419 */ 420 eapMethod: EapMethod; 421 422 /** 423 * Phase 2 authentication method 424 * 425 * @type { Phase2Method } 426 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 427 * @stagemodelonly 428 * @since 12 429 */ 430 phase2Method: Phase2Method; 431 432 /** 433 * The identity 434 * 435 * @type { string } 436 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 437 * @stagemodelonly 438 * @since 12 439 */ 440 identity: string; 441 442 /** 443 * Anonymous identity 444 * 445 * @type { string } 446 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 447 * @stagemodelonly 448 * @since 12 449 */ 450 anonymousIdentity: string; 451 452 /** 453 * Password 454 * 455 * @type { string } 456 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 457 * @stagemodelonly 458 * @since 12 459 */ 460 password: string; 461 462 /** 463 * CA certificate alias 464 * 465 * @type { string } 466 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 467 * @stagemodelonly 468 * @since 12 469 */ 470 caCertAliases: string; 471 472 /** 473 * CA certificate path 474 * 475 * @type { string } 476 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 477 * @stagemodelonly 478 * @since 12 479 */ 480 caPath: string; 481 482 /** 483 * Client certificate alias 484 * 485 * @type { string } 486 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 487 * @stagemodelonly 488 * @since 12 489 */ 490 clientCertAliases: string; 491 492 /** 493 * content of user's certificate 494 * 495 * @type { Uint8Array } 496 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 497 * @stagemodelonly 498 * @since 12 499 */ 500 certEntry: Uint8Array; 501 502 /** 503 * Password of user's certificate 504 * 505 * @type { string } 506 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 507 * @stagemodelonly 508 * @since 12 509 */ 510 certPassword: string; 511 512 /** 513 * Alternate subject match 514 * 515 * @type { string } 516 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 517 * @stagemodelonly 518 * @since 12 519 */ 520 altSubjectMatch: string; 521 522 /** 523 * Domain suffix match 524 * 525 * @type { string } 526 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 527 * @stagemodelonly 528 * @since 12 529 */ 530 domainSuffixMatch: string; 531 532 /** 533 * Realm for Passpoint credential 534 * 535 * @type { string } 536 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 537 * @stagemodelonly 538 * @since 12 539 */ 540 realm: string; 541 542 /** 543 * Public Land Mobile Network of the provider of Passpoint credential 544 * 545 * @type { string } 546 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 547 * @stagemodelonly 548 * @since 12 549 */ 550 plmn: string; 551 552 /** 553 * Sub ID of the SIM card 554 * 555 * @type { number } 556 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 557 * @stagemodelonly 558 * @since 12 559 */ 560 eapSubId: number; 561 } 562 563 /** 564 * Wi-Fi profile. 565 * 566 * @typedef WifiProfile 567 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 568 * @stagemodelonly 569 * @since 12 570 */ 571 interface WifiProfile { 572 /** 573 * Wi-Fi SSID: the maximum length is 32 574 * 575 * @type { string } 576 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 577 * @stagemodelonly 578 * @since 12 579 */ 580 ssid: string; 581 582 /** 583 * Wi-Fi bssid(MAC): the length is 6 584 * 585 * @type { ?string } 586 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 587 * @stagemodelonly 588 * @since 12 589 */ 590 bssid?: string; 591 592 /** 593 * Wi-Fi key: maximum length is 64 594 * 595 * @type { string } 596 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 597 * @stagemodelonly 598 * @since 12 599 */ 600 preSharedKey: string; 601 602 /** 603 * Hide SSID or not, false(default): not hide 604 * 605 * @type { ?boolean } 606 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 607 * @stagemodelonly 608 * @since 12 609 */ 610 isHiddenSsid?: boolean; 611 612 /** 613 * Security type: reference definition of WifiSecurityType 614 * 615 * @type { WifiSecurityType } 616 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 617 * @stagemodelonly 618 * @since 12 619 */ 620 securityType: WifiSecurityType; 621 622 /** 623 * The UID of the Wi-Fi profile creator 624 * 625 * @type { ?number } 626 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 627 * @stagemodelonly 628 * @since 12 629 */ 630 creatorUid?: number; 631 632 /** 633 * Disable reason 634 * 635 * @type { ?number } 636 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 637 * @stagemodelonly 638 * @since 12 639 */ 640 disableReason?: number; 641 642 /** 643 * Allocated networkId 644 * 645 * @type { ?number } 646 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 647 * @stagemodelonly 648 * @since 12 649 */ 650 netId?: number; 651 652 /** 653 * Random mac type 654 * 655 * @type { ?number } 656 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 657 * @stagemodelonly 658 * @since 12 659 */ 660 randomMacType?: number; 661 662 /** 663 * Random mac address, the length is 6 664 * 665 * @type { ?string } 666 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 667 * @stagemodelonly 668 * @since 12 669 */ 670 randomMacAddr?: string; 671 672 /** 673 * IP Type 674 * 675 * @type { ?IpType } 676 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 677 * @stagemodelonly 678 * @since 12 679 */ 680 ipType?: IpType; 681 682 /** 683 * IP profile of static 684 * 685 * @type { ?IpProfile } 686 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 687 * @stagemodelonly 688 * @since 12 689 */ 690 staticIp?: IpProfile; 691 692 /** 693 * EAP profile info. 694 * 695 * @type { ?WifiEapProfile } 696 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 697 * @stagemodelonly 698 * @since 12 699 */ 700 eapProfile?: WifiEapProfile; 701 } 702 703 /** 704 * Gets state of whether the wifi is active. 705 * This function can be called by a super administrator. 706 * 707 * @permission ohos.permission.ENTERPRISE_SET_WIFI 708 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 709 * The admin must have the corresponding permission. 710 * @param { AsyncCallback<boolean> } callback - the callback of isWifiActive. 711 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 712 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 713 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 714 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 715 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 716 * 2. Incorrect parameter types; 3. Parameter verification failed. 717 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 718 * @systemapi 719 * @stagemodelonly 720 * @since 10 721 */ 722 function isWifiActive(admin: Want, callback: AsyncCallback<boolean>): void; 723 724 /** 725 * Gets state of whether the wifi is active. 726 * This function can be called by a super administrator. 727 * 728 * @permission ohos.permission.ENTERPRISE_SET_WIFI 729 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 730 * The admin must have the corresponding permission. 731 * @returns { Promise<boolean> } the promise returned by isWifiActive. 732 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 733 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 734 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 735 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 736 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 737 * 2. Incorrect parameter types; 3. Parameter verification failed. 738 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 739 * @systemapi 740 * @stagemodelonly 741 * @since 10 742 */ 743 function isWifiActive(admin: Want): Promise<boolean>; 744 745 /** 746 * Gets state of whether the Wi-Fi is active. 747 * This function can be called by a super administrator. 748 * 749 * @permission ohos.permission.ENTERPRISE_MANAGE_WIFI 750 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 751 * The admin must have the corresponding permission. 752 * @returns { boolean } true if Wi-Fi is active. 753 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 754 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 755 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 756 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 757 * 2. Incorrect parameter types; 3. Parameter verification failed. 758 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 759 * @stagemodelonly 760 * @since 12 761 */ 762 function isWifiActiveSync(admin: Want): boolean; 763 764 /** 765 * Sets the wifi profile. 766 * 767 * @permission ohos.permission.ENTERPRISE_SET_WIFI 768 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 769 * The admin must have the corresponding permission. 770 * @param { WifiProfile } profile - profile indicates the profile of wifi. 771 * @param { AsyncCallback<void> } callback - the callback of setWifiProfile. 772 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 773 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 774 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 775 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 776 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 777 * 2. Incorrect parameter types; 3. Parameter verification failed. 778 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 779 * @systemapi 780 * @stagemodelonly 781 * @since 10 782 */ 783 function setWifiProfile(admin: Want, profile: WifiProfile, callback: AsyncCallback<void>): void; 784 785 /** 786 * Sets the wifi profile. 787 * 788 * @permission ohos.permission.ENTERPRISE_SET_WIFI 789 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 790 * The admin must have the corresponding permission. 791 * @param { WifiProfile } profile - profile indicates the profile of wifi. 792 * @returns { Promise<void> } the promise returned by setWifiProfile. 793 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 794 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 795 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 796 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 797 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 798 * 2. Incorrect parameter types; 3. Parameter verification failed. 799 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 800 * @systemapi 801 * @stagemodelonly 802 * @since 10 803 */ 804 function setWifiProfile(admin: Want, profile: WifiProfile): Promise<void>; 805 806 /** 807 * Sets the Wi-Fi profile. 808 * 809 * @permission ohos.permission.ENTERPRISE_MANAGE_WIFI 810 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 811 * The admin must have the corresponding permission. 812 * @param { WifiProfile } profile - profile indicates the profile of Wi-Fi. 813 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 814 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 815 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 816 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 817 * 2. Incorrect parameter types; 3. Parameter verification failed. 818 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 819 * @stagemodelonly 820 * @since 12 821 */ 822 function setWifiProfileSync(admin: Want, profile: WifiProfile): void; 823 824 /** 825 * Sets the Wi-Fi disabled. 826 * This function can be called by a super administrator. 827 * 828 * @permission ohos.permission.ENTERPRISE_MANAGE_WIFI 829 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 830 * The admin must have the corresponding permission. 831 * @param { boolean } disabled - true if set the Wi-Fi disabled, otherwise false. 832 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 833 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 834 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 835 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 836 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 837 * 2. Incorrect parameter types; 3. Parameter verification failed. 838 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 839 * @systemapi 840 * @stagemodelonly 841 * @since 11 842 */ 843 function setWifiDisabled(admin: Want, disabled: boolean): void; 844 845 /** 846 * Gets state of whether the Wi-Fi is disabled. 847 * This function can be called by a super administrator. 848 * 849 * @permission ohos.permission.ENTERPRISE_MANAGE_WIFI 850 * @param { Want } admin - admin indicates the administrator ability information.If the admin is not empty, it must 851 * have the corresponding permission. 852 * @returns { boolean } true if the Wi-Fi is disabled, otherwise false. 853 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 854 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 855 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 856 * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 857 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 858 * 2. Incorrect parameter types; 3. Parameter verification failed. 859 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 860 * @systemapi 861 * @stagemodelonly 862 * @since 11 863 */ 864 function isWifiDisabled(admin: Want): boolean; 865 866 /** 867 * Wi-Fi access information. 868 * 869 * @typedef WifiAccessInfo 870 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 871 * @stagemodelonly 872 * @since 19 873 */ 874 interface WifiAccessInfo { 875 876 /** 877 * ssid info. 878 * 879 * @type { string } 880 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 881 * @stagemodelonly 882 * @since 19 883 */ 884 ssid: string; 885 886 /** 887 * bssid info. 888 * 889 * @type { ?string } 890 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 891 * @stagemodelonly 892 * @since 19 893 */ 894 bssid?: string; 895 } 896 897 /** 898 * Adds disallowed wifi list by {@link WifiAccessInfo} array. 899 * This function can be called by a super administrator. 900 * 901 * @permission ohos.permission.ENTERPRISE_MANAGE_WIFI 902 * @param { Want } admin - admin indicates the administrator ability information. 903 * @param { Array<WifiAccessInfo> } list - an array of added Wi-Fi access information. 904 * The size of the array after setting cannot be greater 200. 905 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 906 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 907 * @throws { BusinessError } 9200010 - A conflict policy has been configured. 908 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 909 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 910 * @stagemodelonly 911 * @since 19 912 */ 913 function addDisallowedWifiList(admin: Want, list: Array<WifiAccessInfo>): void; 914 915 /** 916 * Removes disallowed wifi list by {@link WifiAccessInfo} array. 917 * This function can be called by a super administrator. 918 * 919 * @permission ohos.permission.ENTERPRISE_MANAGE_WIFI 920 * @param { Want } admin - admin indicates the administrator ability information. 921 * @param { Array<WifiAccessInfo> } list - an array of removed Wi-Fi access information. 922 * The size of the array after setting cannot be greater 200. 923 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 924 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 925 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 926 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 927 * @stagemodelonly 928 * @since 19 929 */ 930 function removeDisallowedWifiList(admin: Want, list: Array<WifiAccessInfo>): void; 931 932 /** 933 * Gets the disallowed wifi list. 934 * This function can be called by a super administrator. 935 * 936 * @permission ohos.permission.ENTERPRISE_MANAGE_WIFI 937 * @param { Want } admin - admin indicates the administrator ability information. 938 * @returns { Array<WifiAccessInfo> } disallowed Wi-Fi access information. 939 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 940 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 941 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 942 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 943 * @stagemodelonly 944 * @since 19 945 */ 946 function getDisallowedWifiList(admin: Want): Array<WifiAccessInfo>; 947 948 /** 949 * Adds allowed wifi list by {@link WifiAccessInfo} array. 950 * This function can be called by a super administrator. 951 * 952 * @permission ohos.permission.ENTERPRISE_MANAGE_WIFI 953 * @param { Want } admin - admin indicates the administrator ability information. 954 * @param { Array<WifiAccessInfo> } list - an array of added Wi-Fi access information. 955 * The size of the array after setting cannot be greater 200. 956 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 957 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 958 * @throws { BusinessError } 9200010 - A conflict policy has been configured. 959 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 960 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 961 * @stagemodelonly 962 * @since 19 963 */ 964 function addAllowedWifiList(admin: Want, list: Array<WifiAccessInfo>): void; 965 966 /** 967 * Removes allowed wifi list by {@link WifiAccessInfo} array. 968 * This function can be called by a super administrator. 969 * 970 * @permission ohos.permission.ENTERPRISE_MANAGE_WIFI 971 * @param { Want } admin - admin indicates the administrator ability information. 972 * @param { Array<WifiAccessInfo> } list - an array of removed Wi-Fi access information. 973 * The size of the array after setting cannot be greater 200. 974 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 975 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 976 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 977 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 978 * @stagemodelonly 979 * @since 19 980 */ 981 function removeAllowedWifiList(admin: Want, list: Array<WifiAccessInfo>): void; 982 983 /** 984 * Gets the allowed wifi list. 985 * This function can be called by a super administrator. 986 * 987 * @permission ohos.permission.ENTERPRISE_MANAGE_WIFI 988 * @param { Want } admin - admin indicates the administrator ability information. 989 * @returns { Array<WifiAccessInfo> } allowed Wi-Fi access information. 990 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 991 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 992 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 993 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 994 * @stagemodelonly 995 * @since 19 996 */ 997 function getAllowedWifiList(admin: Want): Array<WifiAccessInfo>; 998 999 /** 1000 * Turn on wifi. 1001 * This function can be called by a super administrator. 1002 * 1003 * @permission ohos.permission.ENTERPRISE_MANAGE_WIFI 1004 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1005 * If the admin is not empty, it must have the corresponding permission. 1006 * @param { boolean } isForce - True means force open wifi, user can not turn off it, false means user can turn off it. 1007 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1008 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1009 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1010 * @throws { BusinessError } 203 - This function is prohibited by enterprise management policies. 1011 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1012 * @stagemodelonly 1013 * @since 20 1014 */ 1015 function turnOnWifi(admin: Want, isForce: boolean): void; 1016 1017 /** 1018 * Turn off wifi. 1019 * This function can be called by a super administrator. 1020 * 1021 * @permission ohos.permission.ENTERPRISE_MANAGE_WIFI 1022 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 1023 * If the admin is not empty, it must have the corresponding permission. 1024 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 1025 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 1026 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 1027 * @throws { BusinessError } 203 - This function is prohibited by enterprise management policies. 1028 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 1029 * @stagemodelonly 1030 * @since 20 1031 */ 1032 function turnOffWifi(admin: Want): void; 1033} 1034 1035export default wifiManager; 1036