1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import type { AsyncCallback, Callback } from './@ohos.base'; 17 18/** 19 * @namespace intelligentVoice 20 * @syscap SystemCapability.AI.IntelligentVoice.Core 21 * @systemapi 22 * @since 10 23 */ 24declare namespace intelligentVoice { 25 /** 26 * Obtains an {@link IntelligentVoiceManager} instance. 27 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 28 * @returns { IntelligentVoiceManager } this {@link IntelligentVoiceManager} object. 29 * @throws { BusinessError } 201 - Permission denied. 30 * @throws { BusinessError } 22700101 - No memory. 31 * @syscap SystemCapability.AI.IntelligentVoice.Core 32 * @systemapi 33 * @since 10 34 */ 35 function getIntelligentVoiceManager(): IntelligentVoiceManager; 36 37 /** 38 * Implements intelligent voice management. 39 * @typedef IntelligentVoiceManager 40 * @syscap SystemCapability.AI.IntelligentVoice.Core 41 * @systemapi 42 * @since 10 43 */ 44 interface IntelligentVoiceManager { 45 /** 46 * Obtains capability information. 47 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 48 * @returns { Array<IntelligentVoiceEngineType> } array of supported IntelligentVoiceEngineType. 49 * @throws { BusinessError } 201 - Permission denied. 50 * @syscap SystemCapability.AI.IntelligentVoice.Core 51 * @systemapi 52 * @since 10 53 */ 54 getCapabilityInfo(): Array<IntelligentVoiceEngineType>; 55 /** 56 * Subscribes service change events. When the state of intelligent voice service changes, 57 * the callback is invoked. 58 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 59 * @param { 'serviceChange' } type - Type of the event to listen for. Only the serviceChange event is supported. 60 * @param { Callback<ServiceChangeType> } callback - Callback is invoked when the event is triggered. 61 * @throws { BusinessError } 201 - Permission denied. 62 * @syscap SystemCapability.AI.IntelligentVoice.Core 63 * @systemapi 64 * @since 10 65 */ 66 on(type: 'serviceChange', callback: Callback<ServiceChangeType>): void; 67 /** 68 * Unsubscribes service change events. 69 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 70 * @param { 'serviceChange' } type - Type of the event to listen for. Only the serviceChange event is supported. 71 * @param { Callback<ServiceChangeType> } [callback] - Callback is invoked when the event is triggered. 72 * @throws { BusinessError } 201 - Permission denied. 73 * @syscap SystemCapability.AI.IntelligentVoice.Core 74 * @systemapi 75 * @since 10 76 */ 77 off(type: 'serviceChange', callback?: Callback<ServiceChangeType>): void; 78 } 79 80 /** 81 * Enumerates service change type. 82 * @enum {number} 83 * @syscap SystemCapability.AI.IntelligentVoice.Core 84 * @systemapi 85 * @since 10 86 */ 87 enum ServiceChangeType { 88 /** 89 * Service unavailable. 90 * @syscap SystemCapability.AI.IntelligentVoice.Core 91 * @systemapi 92 * @since 10 93 */ 94 SERVICE_UNAVAILABLE = 0, 95 } 96 97 /** 98 * Enumerates intelligent voice engine type. 99 * @enum {number} 100 * @syscap SystemCapability.AI.IntelligentVoice.Core 101 * @systemapi 102 * @since 10 103 */ 104 enum IntelligentVoiceEngineType { 105 /** 106 * Enroll engine. 107 * @syscap SystemCapability.AI.IntelligentVoice.Core 108 * @systemapi 109 * @since 10 110 */ 111 ENROLL_ENGINE_TYPE = 0, 112 /** 113 * Wakeup engine. 114 * @syscap SystemCapability.AI.IntelligentVoice.Core 115 * @systemapi 116 * @since 10 117 */ 118 WAKEUP_ENGINE_TYPE = 1, 119 /** 120 * Update engine. 121 * @syscap SystemCapability.AI.IntelligentVoice.Core 122 * @systemapi 123 * @since 10 124 */ 125 UPDATE_ENGINE_TYPE = 2, 126 } 127 128 /** 129 * Describes enroll intelligent voice engine. 130 * @typedef EnrollIntelligentVoiceEngineDescriptor 131 * @syscap SystemCapability.AI.IntelligentVoice.Core 132 * @systemapi 133 * @since 10 134 */ 135 interface EnrollIntelligentVoiceEngineDescriptor { 136 /** 137 * Wakeup phrase. 138 * @type { string } 139 * @syscap SystemCapability.AI.IntelligentVoice.Core 140 * @systemapi 141 * @since 10 142 */ 143 wakeupPhrase: string; 144 } 145 146 /** 147 * Describes wakeup intelligent voice engine. 148 * @typedef WakeupIntelligentVoiceEngineDescriptor 149 * @syscap SystemCapability.AI.IntelligentVoice.Core 150 * @systemapi 151 * @since 10 152 */ 153 interface WakeupIntelligentVoiceEngineDescriptor { 154 /** 155 * Need reconfirm. 156 * @type { boolean } 157 * @syscap SystemCapability.AI.IntelligentVoice.Core 158 * @systemapi 159 * @since 10 160 */ 161 needReconfirm: boolean; 162 /** 163 * Wakeup phrase. 164 * @type { string } 165 * @syscap SystemCapability.AI.IntelligentVoice.Core 166 * @systemapi 167 * @since 10 168 */ 169 wakeupPhrase: string; 170 } 171 172 /** 173 * Obtains an {@link EnrollIntelligentVoiceEngine} instance. This method uses an asynchronous callback to return the EnrollIntelligentVoiceEngine instance. 174 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 175 * @param { EnrollIntelligentVoiceEngineDescriptor } descriptor - descriptor indicates enroll intelligent voice engine descriptor. 176 * @param { AsyncCallback<EnrollIntelligentVoiceEngine> } callback - the callback used to return the EnrollIntelligentVoiceEngine instance. 177 * @throws { BusinessError } 201 - Permission denied. 178 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 179 * @throws { BusinessError } 22700101 - No memory. 180 * @throws { BusinessError } 22700102 - Input parameter value error. 181 * @syscap SystemCapability.AI.IntelligentVoice.Core 182 * @systemapi 183 * @since 10 184 */ 185 function createEnrollIntelligentVoiceEngine(descriptor: EnrollIntelligentVoiceEngineDescriptor, callback: AsyncCallback<EnrollIntelligentVoiceEngine>): void; 186 187 /** 188 * Obtains an {@link EnrollIntelligentVoiceEngine} instance. This method uses a promise to return the EnrollIntelligentVoiceEngine instance. 189 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 190 * @param { EnrollIntelligentVoiceEngineDescriptor } descriptor - descriptor indicates enroll intelligent voice engine descriptor. 191 * @returns { Promise<EnrollIntelligentVoiceEngine> } the promise used to return the EnrollIntelligentVoiceEngine instance. 192 * @throws { BusinessError } 201 - Permission denied. 193 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 194 * @throws { BusinessError } 22700101 - No memory. 195 * @throws { BusinessError } 22700102 - Input parameter value error. 196 * @syscap SystemCapability.AI.IntelligentVoice.Core 197 * @systemapi 198 * @since 10 199 */ 200 function createEnrollIntelligentVoiceEngine(descriptor: EnrollIntelligentVoiceEngineDescriptor): Promise<EnrollIntelligentVoiceEngine>; 201 202 /** 203 * Obtains an {@link WakeupIntelligentVoiceEngine} instance. This method uses an asynchronous callback to return the WakeupIntelligentVoiceEngine instance. 204 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 205 * @param { WakeupIntelligentVoiceEngineDescriptor } descriptor - descriptor indicates wakeup intelligent voice engine descriptor. 206 * @param { AsyncCallback<WakeupIntelligentVoiceEngine> } callback - the callback used to return the WakeupIntelligentVoiceEngine instance. 207 * @throws { BusinessError } 201 - Permission denied. 208 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 209 * @throws { BusinessError } 22700101 - No memory. 210 * @throws { BusinessError } 22700102 - Input parameter value error. 211 * @syscap SystemCapability.AI.IntelligentVoice.Core 212 * @systemapi 213 * @since 10 214 */ 215 function createWakeupIntelligentVoiceEngine(descriptor: WakeupIntelligentVoiceEngineDescriptor, callback: AsyncCallback<WakeupIntelligentVoiceEngine>): void; 216 217 /** 218 * Obtains an {@link WakeupIntelligentVoiceEngine} instance. This method uses a promise to return the WakeupIntelligentVoiceEngine instance. 219 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 220 * @param { WakeupIntelligentVoiceEngineDescriptor } descriptor - descriptor indicates wakeup intelligent voice engine descriptor. 221 * @returns { Promise<WakeupIntelligentVoiceEngine> } the promise used to return the WakeupIntelligentVoiceEngine instance. 222 * @throws { BusinessError } 201 - Permission denied. 223 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 224 * @throws { BusinessError } 22700101 - No memory. 225 * @throws { BusinessError } 22700102 - Input parameter value error. 226 * @syscap SystemCapability.AI.IntelligentVoice.Core 227 * @systemapi 228 * @since 10 229 */ 230 function createWakeupIntelligentVoiceEngine(descriptor: WakeupIntelligentVoiceEngineDescriptor): Promise<WakeupIntelligentVoiceEngine>; 231 232 /** 233 * Describes enroll engine config. 234 * @typedef EnrollEngineConfig 235 * @syscap SystemCapability.AI.IntelligentVoice.Core 236 * @systemapi 237 * @since 10 238 */ 239 interface EnrollEngineConfig { 240 /** 241 * Language that enroll engine supports. 242 * @type { string } 243 * @syscap SystemCapability.AI.IntelligentVoice.Core 244 * @systemapi 245 * @since 10 246 */ 247 language: string; 248 /** 249 * Region that enroll engine supports. 250 * @type { string } 251 * @syscap SystemCapability.AI.IntelligentVoice.Core 252 * @systemapi 253 * @since 10 254 */ 255 region: string; 256 } 257 258 /** 259 * Enumerates sensibility type. 260 * @enum {number} 261 * @syscap SystemCapability.AI.IntelligentVoice.Core 262 * @systemapi 263 * @since 10 264 */ 265 enum SensibilityType { 266 /** 267 * Low sensibility. 268 * @syscap SystemCapability.AI.IntelligentVoice.Core 269 * @systemapi 270 * @since 10 271 */ 272 LOW_SENSIBILITY = 1, 273 /** 274 * Middle sensibility. 275 * @syscap SystemCapability.AI.IntelligentVoice.Core 276 * @systemapi 277 * @since 10 278 */ 279 MIDDLE_SENSIBILITY = 2, 280 /** 281 * High sensibility. 282 * @syscap SystemCapability.AI.IntelligentVoice.Core 283 * @systemapi 284 * @since 10 285 */ 286 HIGH_SENSIBILITY = 3, 287 } 288 289 /** 290 * Describes wakeup hap information. 291 * @typedef WakeupHapInfo 292 * @syscap SystemCapability.AI.IntelligentVoice.Core 293 * @systemapi 294 * @since 10 295 */ 296 interface WakeupHapInfo { 297 /** 298 * Bundle name. 299 * @type { string } 300 * @syscap SystemCapability.AI.IntelligentVoice.Core 301 * @systemapi 302 * @since 10 303 */ 304 bundleName: string; 305 /** 306 * Ability name. 307 * @type { string } 308 * @syscap SystemCapability.AI.IntelligentVoice.Core 309 * @systemapi 310 * @since 10 311 */ 312 abilityName: string; 313 } 314 315 /** 316 * Enumerates wakeup intelligent voice event type. 317 * @enum {number} 318 * @syscap SystemCapability.AI.IntelligentVoice.Core 319 * @systemapi 320 * @since 10 321 */ 322 enum WakeupIntelligentVoiceEventType { 323 /** 324 * Wakeup None. 325 * @syscap SystemCapability.AI.IntelligentVoice.Core 326 * @systemapi 327 * @since 10 328 */ 329 INTELLIGENT_VOICE_EVENT_WAKEUP_NONE = 0, 330 /** 331 * Recognize complete. 332 * @syscap SystemCapability.AI.IntelligentVoice.Core 333 * @systemapi 334 * @since 10 335 */ 336 INTELLIGENT_VOICE_EVENT_RECOGNIZE_COMPLETE = 1, 337 } 338 339 /** 340 * Enumerates intelligent voice error code. 341 * @enum {number} 342 * @syscap SystemCapability.AI.IntelligentVoice.Core 343 * @systemapi 344 * @since 10 345 */ 346 enum IntelligentVoiceErrorCode { 347 /** 348 * No memory. 349 * @syscap SystemCapability.AI.IntelligentVoice.Core 350 * @systemapi 351 * @since 10 352 */ 353 INTELLIGENT_VOICE_NO_MEMORY = 22700101, 354 /** 355 * Input parameter value error. 356 * @syscap SystemCapability.AI.IntelligentVoice.Core 357 * @systemapi 358 * @since 10 359 */ 360 INTELLIGENT_VOICE_INVALID_PARAM = 22700102, 361 /** 362 * Init failed. 363 * @syscap SystemCapability.AI.IntelligentVoice.Core 364 * @systemapi 365 * @since 10 366 */ 367 INTELLIGENT_VOICE_INIT_FAILED = 22700103, 368 /** 369 * Commit enroll failed. 370 * @syscap SystemCapability.AI.IntelligentVoice.Core 371 * @systemapi 372 * @since 10 373 */ 374 INTELLIGENT_VOICE_COMMIT_ENROLL_FAILED = 22700104, 375 } 376 377 /** 378 * Enumerates enroll result. 379 * @enum {number} 380 * @syscap SystemCapability.AI.IntelligentVoice.Core 381 * @systemapi 382 * @since 10 383 */ 384 enum EnrollResult { 385 /** 386 * Success. 387 * @syscap SystemCapability.AI.IntelligentVoice.Core 388 * @systemapi 389 * @since 10 390 */ 391 SUCCESS = 0, 392 /** 393 * Vpr train failed. 394 * @syscap SystemCapability.AI.IntelligentVoice.Core 395 * @systemapi 396 * @since 10 397 */ 398 VPR_TRAIN_FAILED = -1, 399 /** 400 * Wakeup phrase not match. 401 * @syscap SystemCapability.AI.IntelligentVoice.Core 402 * @systemapi 403 * @since 10 404 */ 405 WAKEUP_PHRASE_NOT_MATCH = -2, 406 /** 407 * Too noisy. 408 * @syscap SystemCapability.AI.IntelligentVoice.Core 409 * @systemapi 410 * @since 10 411 */ 412 TOO_NOISY = -3, 413 /** 414 * Too loud. 415 * @syscap SystemCapability.AI.IntelligentVoice.Core 416 * @systemapi 417 * @since 10 418 */ 419 TOO_LOUD = -4, 420 /** 421 * Interval large. 422 * @syscap SystemCapability.AI.IntelligentVoice.Core 423 * @systemapi 424 * @since 10 425 */ 426 INTERVAL_LARGE = -5, 427 /** 428 * Different person. 429 * @syscap SystemCapability.AI.IntelligentVoice.Core 430 * @systemapi 431 * @since 10 432 */ 433 DIFFERENT_PERSON = -6, 434 /** 435 * Unknown error. 436 * @syscap SystemCapability.AI.IntelligentVoice.Core 437 * @systemapi 438 * @since 10 439 */ 440 UNKNOWN_ERROR = -100, 441 } 442 443 /** 444 * Describes enroll callback information. 445 * @typedef EnrollCallbackInfo 446 * @syscap SystemCapability.AI.IntelligentVoice.Core 447 * @systemapi 448 * @since 10 449 */ 450 interface EnrollCallbackInfo { 451 /** 452 * Result. 453 * @type { EnrollResult } 454 * @syscap SystemCapability.AI.IntelligentVoice.Core 455 * @systemapi 456 * @since 10 457 */ 458 result: EnrollResult; 459 /** 460 * Describes enroll event context. 461 * @type { string } 462 * @syscap SystemCapability.AI.IntelligentVoice.Core 463 * @systemapi 464 * @since 10 465 */ 466 context: string; 467 } 468 469 /** 470 * Describes wakeup intelligent voice engine callback information. 471 * @typedef WakeupIntelligentVoiceEngineCallbackInfo 472 * @syscap SystemCapability.AI.IntelligentVoice.Core 473 * @systemapi 474 * @since 10 475 */ 476 interface WakeupIntelligentVoiceEngineCallbackInfo { 477 /** 478 * Wakeup event id. 479 * @type { WakeupIntelligentVoiceEventType } 480 * @syscap SystemCapability.AI.IntelligentVoice.Core 481 * @systemapi 482 * @since 10 483 */ 484 eventId: WakeupIntelligentVoiceEventType; 485 /** 486 * Is success. 487 * @type { boolean } 488 * @syscap SystemCapability.AI.IntelligentVoice.Core 489 * @systemapi 490 * @since 10 491 */ 492 isSuccess: boolean; 493 /** 494 * Describes wakeup event context. 495 * @type { string } 496 * @syscap SystemCapability.AI.IntelligentVoice.Core 497 * @systemapi 498 * @since 10 499 */ 500 context: string; 501 } 502 503 /** 504 * Implements enroll intelligent voice engine. 505 * @typedef EnrollIntelligentVoiceEngine 506 * @syscap SystemCapability.AI.IntelligentVoice.Core 507 * @systemapi 508 * @since 10 509 */ 510 interface EnrollIntelligentVoiceEngine { 511 /** 512 * Obtains the supported regions, This method uses an asynchronous callback to return the query result. 513 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 514 * @param { AsyncCallback<Array<string>> } callback - the callback used to return the supported regions. 515 * @throws { BusinessError } 201 - Permission denied. 516 * @syscap SystemCapability.AI.IntelligentVoice.Core 517 * @systemapi 518 * @since 10 519 */ 520 getSupportedRegions(callback: AsyncCallback<Array<string>>): void; 521 /** 522 * Obtains the supported regions, This method uses a promise to return the query result. 523 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 524 * @returns { Promise<Array<string>> } the promise used to return the supported regions. 525 * @throws { BusinessError } 201 - Permission denied. 526 * @syscap SystemCapability.AI.IntelligentVoice.Core 527 * @systemapi 528 * @since 10 529 */ 530 getSupportedRegions(): Promise<Array<string>>; 531 /** 532 * Initials the engine, This method uses an asynchronous callback to return the result. 533 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 534 * @param { EnrollEngineConfig } config - config indicates enroll engine configuration. 535 * @param { AsyncCallback<void> } callback - the callback used to return the result. 536 * @throws { BusinessError } 201 - Permission denied. 537 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 538 * @throws { BusinessError } 22700102 - Input parameter value error. 539 * @throws { BusinessError } 22700103 - Init failed. 540 * @syscap SystemCapability.AI.IntelligentVoice.Core 541 * @systemapi 542 * @since 10 543 */ 544 init(config: EnrollEngineConfig, callback: AsyncCallback<void>): void; 545 /** 546 * Initials the engine, This method uses a promise to return the result. 547 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 548 * @param { EnrollEngineConfig } config - config indicates enroll engine configuration. 549 * @returns { Promise<void> } the promise used to return the result. 550 * @throws { BusinessError } 201 - Permission denied. 551 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 552 * @throws { BusinessError } 22700102 - Input parameter value error. 553 * @throws { BusinessError } 22700103 - Init failed. 554 * @syscap SystemCapability.AI.IntelligentVoice.Core 555 * @systemapi 556 * @since 10 557 */ 558 init(config: EnrollEngineConfig): Promise<void>; 559 /** 560 * Enrolls for result, This method uses an asynchronous callback to return the result. 561 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 562 * @param { boolean } isLast - isLast indicates if it is the last time to enroll. 563 * @param { AsyncCallback<EnrollCallbackInfo> } callback - the callback used to return the result. 564 * @throws { BusinessError } 201 - Permission denied. 565 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 566 * @syscap SystemCapability.AI.IntelligentVoice.Core 567 * @systemapi 568 * @since 10 569 */ 570 enrollForResult(isLast: boolean, callback: AsyncCallback<EnrollCallbackInfo>): void; 571 /** 572 * Enrolls for result, This method uses a promise to return the result. 573 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 574 * @param { boolean } isLast - isLast indicates if it is the last time to enroll. 575 * @returns { Promise<EnrollCallbackInfo> } the promise used to return the result. 576 * @throws { BusinessError } 201 - Permission denied. 577 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 578 * @syscap SystemCapability.AI.IntelligentVoice.Core 579 * @systemapi 580 * @since 10 581 */ 582 enrollForResult(isLast: boolean): Promise<EnrollCallbackInfo>; 583 /** 584 * Stops the engine, This method uses an asynchronous callback to return the result. 585 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 586 * @param { AsyncCallback<void> } callback - the callback used to return the result. 587 * @throws { BusinessError } 201 - Permission denied. 588 * @syscap SystemCapability.AI.IntelligentVoice.Core 589 * @systemapi 590 * @since 10 591 */ 592 stop(callback: AsyncCallback<void>): void; 593 /** 594 * Stops the engine, This method uses a promise to return the result. 595 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 596 * @returns { Promise<void> } the promise used to return the result. 597 * @throws { BusinessError } 201 - Permission denied. 598 * @syscap SystemCapability.AI.IntelligentVoice.Core 599 * @systemapi 600 * @since 10 601 */ 602 stop(): Promise<void>; 603 /** 604 * Commit enroll, This method uses an asynchronous callback to return the result. 605 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 606 * @param { AsyncCallback<void> } callback - the callback used to return the result. 607 * @throws { BusinessError } 201 - Permission denied. 608 * @throws { BusinessError } 22700104 - Commit enroll failed. 609 * @syscap SystemCapability.AI.IntelligentVoice.Core 610 * @systemapi 611 * @since 10 612 */ 613 commit(callback: AsyncCallback<void>): void; 614 /** 615 * Commit enroll, This method uses a promise to return the result. 616 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 617 * @returns { Promise<void> } the promise used to return the result. 618 * @throws { BusinessError } 201 - Permission denied. 619 * @throws { BusinessError } 22700104 - Commit enroll failed. 620 * @syscap SystemCapability.AI.IntelligentVoice.Core 621 * @systemapi 622 * @since 10 623 */ 624 commit(): Promise<void>; 625 /** 626 * Sets wakeup hap information, This method uses an asynchronous callback to return the result. 627 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 628 * @param { WakeupHapInfo } info - info indicates wakeup hap information. 629 * @param { AsyncCallback<void> } callback - the callback used to return the result. 630 * @throws { BusinessError } 201 - Permission denied. 631 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 632 * @throws { BusinessError } 22700102 - Input parameter value error. 633 * @syscap SystemCapability.AI.IntelligentVoice.Core 634 * @systemapi 635 * @since 10 636 */ 637 setWakeupHapInfo(info: WakeupHapInfo, callback: AsyncCallback<void>): void; 638 /** 639 * Sets wakeup hap information, This method uses a promise to return the result. 640 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 641 * @param { WakeupHapInfo } info - info indicates wakeup hap information. 642 * @returns { Promise<void> } the promise used to return the result. 643 * @throws { BusinessError } 201 - Permission denied. 644 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 645 * @throws { BusinessError } 22700102 - Input parameter value error. 646 * @syscap SystemCapability.AI.IntelligentVoice.Core 647 * @systemapi 648 * @since 10 649 */ 650 setWakeupHapInfo(info: WakeupHapInfo): Promise<void>; 651 /** 652 * Sets sensibility, This method uses an asynchronous callback to return the result. 653 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 654 * @param { SensibilityType } sensibility - sensibility to set. 655 * @param { AsyncCallback<void> } callback - the callback used to return the result. 656 * @throws { BusinessError } 201 - Permission denied. 657 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 658 * @throws { BusinessError } 22700102 - Input parameter value error. 659 * @syscap SystemCapability.AI.IntelligentVoice.Core 660 * @systemapi 661 * @since 10 662 */ 663 setSensibility(sensibility: SensibilityType, callback: AsyncCallback<void>): void; 664 /** 665 * Sets sensibility, This method uses a promise to return the result. 666 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 667 * @param { SensibilityType } sensibility - sensibility to set. 668 * @returns { Promise<void> } the promise used to return the result. 669 * @throws { BusinessError } 201 - Permission denied. 670 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 671 * @throws { BusinessError } 22700102 - Input parameter value error. 672 * @syscap SystemCapability.AI.IntelligentVoice.Core 673 * @systemapi 674 * @since 10 675 */ 676 setSensibility(sensibility: SensibilityType): Promise<void>; 677 /** 678 * Sets an intelligent voice parameter. This method uses an asynchronous callback to return the result. 679 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 680 * @param { string } key - the key of the intelligent voice parameter to set. 681 * @param { string } value - the value of the intelligent voice parameter to set. 682 * @param { AsyncCallback<void> } callback - the callback used to return the result. 683 * @throws { BusinessError } 201 - Permission denied. 684 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 685 * @throws { BusinessError } 22700102 - Input parameter value error. 686 * @syscap SystemCapability.AI.IntelligentVoice.Core 687 * @systemapi 688 * @since 10 689 */ 690 setParameter(key: string, value: string, callback: AsyncCallback<void>): void; 691 /** 692 * Sets an intelligent voice parameter. This method uses a promise to return the result. 693 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 694 * @param { string } key - the key of the intelligent voice parameter to set. 695 * @param { string } value - the value of the intelligent voice parameter to set. 696 * @returns { Promise<void> } the promise used to return the result. 697 * @throws { BusinessError } 201 - Permission denied. 698 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 699 * @throws { BusinessError } 22700102 - Input parameter value error. 700 * @syscap SystemCapability.AI.IntelligentVoice.Core 701 * @systemapi 702 * @since 10 703 */ 704 setParameter(key: string, value: string): Promise<void>; 705 /** 706 * Obtains the value of an intelligent voice parameter. This method uses an asynchronous callback to return the query result. 707 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 708 * @param { string } key - the key of the intelligent voice parameter whose value is to be obtained. 709 * @param { AsyncCallback<string> } callback - the callback used to return the value of the intelligent voice parameter. 710 * @throws { BusinessError } 201 - Permission denied. 711 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 712 * @throws { BusinessError } 22700102 - Input parameter value error. 713 * @syscap SystemCapability.AI.IntelligentVoice.Core 714 * @systemapi 715 * @since 10 716 */ 717 getParameter(key: string, callback: AsyncCallback<string>): void; 718 /** 719 * Obtains the value of an intelligent voice parameter. This method uses an asynchronous callback to return the query result. 720 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 721 * @param { string } key - the key of the intelligent voice parameter whose value is to be obtained. 722 * @returns { Promise<string> } the promise used to return the value of the intelligent voice parameter. 723 * @throws { BusinessError } 201 - Permission denied. 724 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 725 * @throws { BusinessError } 22700102 - Input parameter value error. 726 * @syscap SystemCapability.AI.IntelligentVoice.Core 727 * @systemapi 728 * @since 10 729 */ 730 getParameter(key: string): Promise<string>; 731 /** 732 * Releases the engine, This method uses an asynchronous callback to return the result. 733 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 734 * @param { AsyncCallback<void> } callback - the callback used to return the result. 735 * @throws { BusinessError } 201 - Permission denied. 736 * @syscap SystemCapability.AI.IntelligentVoice.Core 737 * @systemapi 738 * @since 10 739 */ 740 release(callback: AsyncCallback<void>): void; 741 /** 742 * Releases the engine, This method uses a promise to return the result. 743 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 744 * @returns { Promise<void> } the promise used to return the result. 745 * @throws { BusinessError } 201 - Permission denied. 746 * @syscap SystemCapability.AI.IntelligentVoice.Core 747 * @systemapi 748 * @since 10 749 */ 750 release(): Promise<void>; 751 } 752 753 /** 754 * Implements wakeup intelligent voice engine. 755 * @typedef WakeupIntelligentVoiceEngine 756 * @syscap SystemCapability.AI.IntelligentVoice.Core 757 * @systemapi 758 * @since 10 759 */ 760 interface WakeupIntelligentVoiceEngine { 761 /** 762 * Obtains the supported regions, This method uses an asynchronous callback to return the query result. 763 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 764 * @param { AsyncCallback<Array<string>> } callback - the callback used to return the supported regions. 765 * @throws { BusinessError } 201 - Permission denied. 766 * @syscap SystemCapability.AI.IntelligentVoice.Core 767 * @systemapi 768 * @since 10 769 */ 770 getSupportedRegions(callback: AsyncCallback<Array<string>>): void; 771 /** 772 * Obtains the supported regions, This method uses a promise to return the query result. 773 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 774 * @returns { Promise<Array<string>> } the promise used to return the supported regions. 775 * @throws { BusinessError } 201 - Permission denied. 776 * @syscap SystemCapability.AI.IntelligentVoice.Core 777 * @systemapi 778 * @since 10 779 */ 780 getSupportedRegions(): Promise<Array<string>>; 781 /** 782 * Sets wakeup hap information, This method uses an asynchronous callback to return the result. 783 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 784 * @param { WakeupHapInfo } info - info indicates wakeup hap information. 785 * @param { AsyncCallback<void> } callback - the callback used to return the result. 786 * @throws { BusinessError } 201 - Permission denied. 787 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 788 * @throws { BusinessError } 22700102 - Input parameter value error. 789 * @syscap SystemCapability.AI.IntelligentVoice.Core 790 * @systemapi 791 * @since 10 792 */ 793 setWakeupHapInfo(info: WakeupHapInfo, callback: AsyncCallback<void>): void; 794 /** 795 * Sets wakeup hap information, This method uses a promise to return the result. 796 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 797 * @param { WakeupHapInfo } info - info indicates wakeup hap information. 798 * @returns { Promise<void> } the promise used to return the result. 799 * @throws { BusinessError } 201 - Permission denied. 800 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 801 * @throws { BusinessError } 22700102 - Input parameter value error. 802 * @syscap SystemCapability.AI.IntelligentVoice.Core 803 * @systemapi 804 * @since 10 805 */ 806 setWakeupHapInfo(info: WakeupHapInfo): Promise<void>; 807 /** 808 * Sets sensibility, This method uses an asynchronous callback to return the result. 809 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 810 * @param { SensibilityType } sensibility - sensibility to set. 811 * @param { AsyncCallback<void> } callback - the callback used to return the result. 812 * @throws { BusinessError } 201 - Permission denied. 813 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 814 * @throws { BusinessError } 22700102 - Input parameter value error. 815 * @syscap SystemCapability.AI.IntelligentVoice.Core 816 * @systemapi 817 * @since 10 818 */ 819 setSensibility(sensibility: SensibilityType, callback: AsyncCallback<void>): void; 820 /** 821 * Sets sensibility, This method uses a promise to return the result. 822 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 823 * @param { SensibilityType } sensibility - sensibility to set. 824 * @returns { Promise<void> } the promise used to return the result. 825 * @throws { BusinessError } 201 - Permission denied. 826 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 827 * @throws { BusinessError } 22700102 - Input parameter value error. 828 * @syscap SystemCapability.AI.IntelligentVoice.Core 829 * @systemapi 830 * @since 10 831 */ 832 setSensibility(sensibility: SensibilityType): Promise<void>; 833 /** 834 * Sets an intelligent voice parameter. This method uses an asynchronous callback to return the result. 835 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 836 * @param { string } key - the key of the intelligent voice parameter to set. 837 * @param { string } value - the value of the intelligent voice parameter to set. 838 * @param { AsyncCallback<void> } callback - the callback used to return the result. 839 * @throws { BusinessError } 201 - Permission denied. 840 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 841 * @throws { BusinessError } 22700102 - Input parameter value error. 842 * @syscap SystemCapability.AI.IntelligentVoice.Core 843 * @systemapi 844 * @since 10 845 */ 846 setParameter(key: string, value: string, callback: AsyncCallback<void>): void; 847 /** 848 * Sets an intelligent voice parameter. This method uses a promise to return the result. 849 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 850 * @param { string } key - the key of the intelligent voice parameter to set. 851 * @param { string } value - the value of the intelligent voice parameter to set. 852 * @returns { Promise<void> } the promise used to return the result. 853 * @throws { BusinessError } 201 - Permission denied. 854 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 855 * @throws { BusinessError } 22700102 - Input parameter value error. 856 * @syscap SystemCapability.AI.IntelligentVoice.Core 857 * @systemapi 858 * @since 10 859 */ 860 setParameter(key: string, value: string): Promise<void>; 861 /** 862 * Obtains the value of an intelligent voice parameter. This method uses an asynchronous callback to return the query result. 863 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 864 * @param { string } key - the key of the intelligent voice parameter whose value is to be obtained. 865 * @param { AsyncCallback<string> } callback - the callback used to return the value of the intelligent voice parameter. 866 * @throws { BusinessError } 201 - Permission denied. 867 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 868 * @throws { BusinessError } 22700102 - Input parameter value error. 869 * @syscap SystemCapability.AI.IntelligentVoice.Core 870 * @systemapi 871 * @since 10 872 */ 873 getParameter(key: string, callback: AsyncCallback<string>): void; 874 /** 875 * Obtains the value of an intelligent voice parameter. This method uses an asynchronous callback to return the query result. 876 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 877 * @param { string } key - the key of the intelligent voice parameter whose value is to be obtained. 878 * @returns { Promise<string> } the promise used to return the value of the intelligent voice parameter. 879 * @throws { BusinessError } 201 - Permission denied. 880 * @throws { BusinessError } 401 - if input parameter type or number mismatch. 881 * @throws { BusinessError } 22700102 - Input parameter value error. 882 * @syscap SystemCapability.AI.IntelligentVoice.Core 883 * @systemapi 884 * @since 10 885 */ 886 getParameter(key: string): Promise<string>; 887 /** 888 * Releases the engine, This method uses an asynchronous callback to return the result. 889 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 890 * @param { AsyncCallback<void> } callback - the callback used to return the result. 891 * @throws { BusinessError } 201 - Permission denied. 892 * @syscap SystemCapability.AI.IntelligentVoice.Core 893 * @systemapi 894 * @since 10 895 */ 896 release(callback: AsyncCallback<void>): void; 897 /** 898 * Releases the engine, This method uses a promise to return the result. 899 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 900 * @returns { Promise<void> } the promise used to return the result. 901 * @throws { BusinessError } 201 - Permission denied. 902 * @syscap SystemCapability.AI.IntelligentVoice.Core 903 * @systemapi 904 * @since 10 905 */ 906 release(): Promise<void>; 907 /** 908 * Subscribes wakeup intelligent voice events. When wakeup intelligent voice events reach, 909 * the callback is invoked. 910 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 911 * @param { 'wakeupIntelligentVoiceEvent' } type - Type of the event to listen for. Only the wakeupIntelligentVoice event is supported. 912 * @param { Callback<WakeupIntelligentVoiceEngineCallbackInfo> } callback - the callback invoked when the event is triggered. 913 * @throws { BusinessError } 201 - Permission denied. 914 * @syscap SystemCapability.AI.IntelligentVoice.Core 915 * @systemapi 916 * @since 10 917 */ 918 on(type: 'wakeupIntelligentVoiceEvent', callback: Callback<WakeupIntelligentVoiceEngineCallbackInfo>): void; 919 /** 920 * Unsubscribes wakeup intelligent voice events. 921 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 922 * @param { 'wakeupIntelligentVoiceEvent' } type - Type of the event to listen for. Only the wakeupIntelligentVoice event is supported. 923 * @param { Callback<WakeupIntelligentVoiceEngineCallbackInfo> } [callback] - the callback invoked when the event is triggered. 924 * @throws { BusinessError } 201 - Permission denied. 925 * @syscap SystemCapability.AI.IntelligentVoice.Core 926 * @systemapi 927 * @since 10 928 */ 929 off(type: 'wakeupIntelligentVoiceEvent', callback?: Callback<WakeupIntelligentVoiceEngineCallbackInfo>): void; 930 } 931} 932 933export default intelligentVoice;