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 16/** 17 * @file 18 * @kit MindSporeLiteKit 19 */ 20 21import type { AsyncCallback, Callback } from './@ohos.base'; 22 23/** 24 * @namespace intelligentVoice 25 * @syscap SystemCapability.AI.IntelligentVoice.Core 26 * @systemapi 27 * @since 10 28 */ 29declare namespace intelligentVoice { 30 /** 31 * Obtains an {@link IntelligentVoiceManager} instance. 32 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 33 * @returns { IntelligentVoiceManager } this {@link IntelligentVoiceManager} object. 34 * @throws { BusinessError } 201 - Permission denied. 35 * @throws { BusinessError } 22700101 - No memory. 36 * @syscap SystemCapability.AI.IntelligentVoice.Core 37 * @systemapi 38 * @since 10 39 */ 40 function getIntelligentVoiceManager(): IntelligentVoiceManager; 41 42 /** 43 * Implements intelligent voice management. 44 * @typedef IntelligentVoiceManager 45 * @syscap SystemCapability.AI.IntelligentVoice.Core 46 * @systemapi 47 * @since 10 48 */ 49 interface IntelligentVoiceManager { 50 /** 51 * Obtains capability information. 52 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 53 * @returns { Array<IntelligentVoiceEngineType> } array of supported IntelligentVoiceEngineType. 54 * @throws { BusinessError } 201 - Permission denied. 55 * @syscap SystemCapability.AI.IntelligentVoice.Core 56 * @systemapi 57 * @since 10 58 */ 59 getCapabilityInfo(): Array<IntelligentVoiceEngineType>; 60 /** 61 * Subscribes service change events. When the state of intelligent voice service changes, 62 * the callback is invoked. 63 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 64 * @param { 'serviceChange' } type - Type of the event to listen for. Only the serviceChange event is supported. 65 * @param { Callback<ServiceChangeType> } callback - Callback is invoked when the event is triggered. 66 * @throws { BusinessError } 201 - Permission denied. 67 * @syscap SystemCapability.AI.IntelligentVoice.Core 68 * @systemapi 69 * @since 10 70 */ 71 on(type: 'serviceChange', callback: Callback<ServiceChangeType>): void; 72 /** 73 * Unsubscribes service change events. 74 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 75 * @param { 'serviceChange' } type - Type of the event to listen for. Only the serviceChange event is supported. 76 * @param { Callback<ServiceChangeType> } [callback] - Callback is invoked when the event is triggered. 77 * @throws { BusinessError } 201 - Permission denied. 78 * @syscap SystemCapability.AI.IntelligentVoice.Core 79 * @systemapi 80 * @since 10 81 */ 82 off(type: 'serviceChange', callback?: Callback<ServiceChangeType>): void; 83 } 84 85 /** 86 * Implements wakeup management. 87 * @typedef WakeupManager 88 * @syscap SystemCapability.AI.IntelligentVoice.Core 89 * @systemapi 90 * @since 12 91 */ 92 interface WakeupManager { 93 /** 94 * Sets an intelligent voice parameter. This method uses a promise to return the result. 95 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 96 * @param { string } key - the key of the intelligent voice parameter to set. 97 * @param { string } value - the value of the intelligent voice parameter to set. 98 * @returns { Promise<void> } the promise used to return the result. 99 * @throws { BusinessError } 201 - Permission denied. 100 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 101 * @throws { BusinessError } 22700102 - Input parameter value error. 102 * @throws { BusinessError } 22700107 - System error. 103 * @syscap SystemCapability.AI.IntelligentVoice.Core 104 * @systemapi 105 * @since 12 106 */ 107 setParameter(key: string, value: string): Promise<void>; 108 /** 109 * Obtains the value of an intelligent voice parameter. This method uses a promise to return the query result. 110 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 111 * @param { string } key - the key of the intelligent voice parameter whose value is to be obtained. 112 * @returns { Promise<string> } the promise used to return the value of the intelligent voice parameter. 113 * @throws { BusinessError } 201 - Permission denied. 114 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 115 * @throws { BusinessError } 22700102 - Input parameter value error. 116 * @throws { BusinessError } 22700107 - System error. 117 * @syscap SystemCapability.AI.IntelligentVoice.Core 118 * @systemapi 119 * @since 12 120 */ 121 getParameter(key: string): Promise<string>; 122 /** 123 * Obtains files needed to upload. This method uses a promise to return the files needed to upload. 124 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 125 * @param { number } maxCount - the maximum count of upload files. The maxCount should be greater than 0 and smaller than 101 126 * @returns { Promise<Array<UploadFile>> } the promise used to return the upload files. 127 * @throws { BusinessError } 201 - Permission denied. 128 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed. 129 * @throws { BusinessError } 22700101 - No memory. 130 * @throws { BusinessError } 22700102 - Input parameter value error. 131 * @throws { BusinessError } 22700107 - System error. 132 * @syscap SystemCapability.AI.IntelligentVoice.Core 133 * @systemapi 134 * @since 12 135 */ 136 getUploadFiles (maxCount: number): Promise<Array<UploadFile>>; 137 /** 138 * Obtains wakeup source files. This method uses a promise to return the wakeup source files. 139 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 140 * @returns { Promise<Array<WakeupSourceFile>> } the promise used to return the wakeup source files. 141 * @throws { BusinessError } 201 - Permission denied. 142 * @throws { BusinessError } 22700101 - No memory. 143 * @throws { BusinessError } 22700107 - System error. 144 * @syscap SystemCapability.AI.IntelligentVoice.Core 145 * @systemapi 146 * @since 12 147 */ 148 getWakeupSourceFiles(): Promise<Array<WakeupSourceFile>>; 149 /** 150 * Enrolls with wakeup files for result. This method uses a promise to return the enroll result. 151 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 152 * @param { Array<WakeupSourceFile> } wakeupFiles - the wakeup source files needed. 153 * @param { string } wakeupInfo - wakeup information. 154 * @returns { Promise<EnrollResult> } the promise used to return the enroll result. 155 * @throws { BusinessError } 201 - Permission denied. 156 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 157 * @throws { BusinessError } 22700101 - No memory. 158 * @throws { BusinessError } 22700102 - Input parameter value error. 159 * @throws { BusinessError } 22700107 - System error. 160 * @syscap SystemCapability.AI.IntelligentVoice.Core 161 * @systemapi 162 * @since 12 163 */ 164 enrollWithWakeupFilesForResult(wakeupFiles: Array<WakeupSourceFile>, wakeupInfo: string): Promise<EnrollResult>; 165 /** 166 * Clears user data. 167 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 168 * @returns { Promise<void> } the promise used to return the result. 169 * @throws { BusinessError } 201 - Permission denied. 170 * @throws { BusinessError } 22700107 - System error. 171 * @syscap SystemCapability.AI.IntelligentVoice.Core 172 * @systemapi 173 * @since 12 174 */ 175 clearUserData(): Promise<void>; 176 } 177 178 /** 179 * Enumerates upload file type. 180 * @enum {number} 181 * @syscap SystemCapability.AI.IntelligentVoice.Core 182 * @systemapi 183 * @since 12 184 */ 185 enum UploadFileType { 186 /** 187 * Enroll file. 188 * @syscap SystemCapability.AI.IntelligentVoice.Core 189 * @systemapi 190 * @since 12 191 */ 192 ENROLL_FILE = 0, 193 /** 194 * Wakeup file. 195 * @syscap SystemCapability.AI.IntelligentVoice.Core 196 * @systemapi 197 * @since 12 198 */ 199 WAKEUP_FILE = 1, 200 } 201 202 /** 203 * Describes upload file information. 204 * @typedef UploadFile 205 * @syscap SystemCapability.AI.IntelligentVoice.Core 206 * @systemapi 207 * @since 12 208 */ 209 interface UploadFile { 210 /** 211 * Report file type. 212 * @type { UploadFileType } 213 * @syscap SystemCapability.AI.IntelligentVoice.Core 214 * @systemapi 215 * @since 12 216 */ 217 type: UploadFileType; 218 /** 219 * Files description. 220 * @type { string } 221 * @syscap SystemCapability.AI.IntelligentVoice.Core 222 * @systemapi 223 * @since 12 224 */ 225 filesDescription: string; 226 /** 227 * Files content. 228 * @type { Array<ArrayBuffer> } 229 * @syscap SystemCapability.AI.IntelligentVoice.Core 230 * @systemapi 231 * @since 12 232 */ 233 filesContent: Array<ArrayBuffer>; 234 } 235 236 /** 237 * Describes wakeup source file information. 238 * @typedef WakeupSourceFile 239 * @syscap SystemCapability.AI.IntelligentVoice.Core 240 * @systemapi 241 * @since 12 242 */ 243 interface WakeupSourceFile { 244 /** 245 * File path. 246 * @type { string } 247 * @syscap SystemCapability.AI.IntelligentVoice.Core 248 * @systemapi 249 * @since 12 250 */ 251 filePath: string; 252 /** 253 * File content. 254 * @type { ArrayBuffer } 255 * @syscap SystemCapability.AI.IntelligentVoice.Core 256 * @systemapi 257 * @since 12 258 */ 259 fileContent: ArrayBuffer; 260 } 261 262 /** 263 * Enumerates service change type. 264 * @enum {number} 265 * @syscap SystemCapability.AI.IntelligentVoice.Core 266 * @systemapi 267 * @since 10 268 */ 269 enum ServiceChangeType { 270 /** 271 * Service unavailable. 272 * @syscap SystemCapability.AI.IntelligentVoice.Core 273 * @systemapi 274 * @since 10 275 */ 276 SERVICE_UNAVAILABLE = 0, 277 } 278 279 /** 280 * Enumerates intelligent voice engine type. 281 * @enum {number} 282 * @syscap SystemCapability.AI.IntelligentVoice.Core 283 * @systemapi 284 * @since 10 285 */ 286 enum IntelligentVoiceEngineType { 287 /** 288 * Enroll engine. 289 * @syscap SystemCapability.AI.IntelligentVoice.Core 290 * @systemapi 291 * @since 10 292 */ 293 ENROLL_ENGINE_TYPE = 0, 294 /** 295 * Wakeup engine. 296 * @syscap SystemCapability.AI.IntelligentVoice.Core 297 * @systemapi 298 * @since 10 299 */ 300 WAKEUP_ENGINE_TYPE = 1, 301 /** 302 * Update engine. 303 * @syscap SystemCapability.AI.IntelligentVoice.Core 304 * @systemapi 305 * @since 10 306 */ 307 UPDATE_ENGINE_TYPE = 2, 308 } 309 310 /** 311 * Describes enroll intelligent voice engine. 312 * @typedef EnrollIntelligentVoiceEngineDescriptor 313 * @syscap SystemCapability.AI.IntelligentVoice.Core 314 * @systemapi 315 * @since 10 316 */ 317 interface EnrollIntelligentVoiceEngineDescriptor { 318 /** 319 * Wakeup phrase. 320 * @type { string } 321 * @syscap SystemCapability.AI.IntelligentVoice.Core 322 * @systemapi 323 * @since 10 324 */ 325 wakeupPhrase: string; 326 } 327 328 /** 329 * Describes wakeup intelligent voice engine. 330 * @typedef WakeupIntelligentVoiceEngineDescriptor 331 * @syscap SystemCapability.AI.IntelligentVoice.Core 332 * @systemapi 333 * @since 10 334 */ 335 interface WakeupIntelligentVoiceEngineDescriptor { 336 /** 337 * Need reconfirm. 338 * @type { boolean } 339 * @syscap SystemCapability.AI.IntelligentVoice.Core 340 * @systemapi 341 * @since 10 342 */ 343 needReconfirm: boolean; 344 /** 345 * Wakeup phrase. 346 * @type { string } 347 * @syscap SystemCapability.AI.IntelligentVoice.Core 348 * @systemapi 349 * @since 10 350 */ 351 wakeupPhrase: string; 352 } 353 354 /** 355 * Enumerates evaluation result code. 356 * @enum {number} 357 * @syscap SystemCapability.AI.IntelligentVoice.Core 358 * @systemapi 359 * @since 12 360 */ 361 enum EvaluationResultCode { 362 /** 363 * Unknown. 364 * @syscap SystemCapability.AI.IntelligentVoice.Core 365 * @systemapi 366 * @since 12 367 */ 368 UNKNOWN = 0, 369 /** 370 * Pass. 371 * @syscap SystemCapability.AI.IntelligentVoice.Core 372 * @systemapi 373 * @since 12 374 */ 375 PASS = 1, 376 /** 377 * Word is empty. 378 * @syscap SystemCapability.AI.IntelligentVoice.Core 379 * @systemapi 380 * @since 12 381 */ 382 WORD_EMPTY = 2, 383 /** 384 * Only chinese is supported. 385 * @syscap SystemCapability.AI.IntelligentVoice.Core 386 * @systemapi 387 * @since 12 388 */ 389 CHINESE_ONLY = 3, 390 /** 391 * Invalid length. 392 * @syscap SystemCapability.AI.IntelligentVoice.Core 393 * @systemapi 394 * @since 12 395 */ 396 INVALID_LENGTH = 4, 397 /** 398 * Unusual word. 399 * @syscap SystemCapability.AI.IntelligentVoice.Core 400 * @systemapi 401 * @since 12 402 */ 403 UNUSUAL_WORD = 5, 404 /** 405 * Consecutive same word. 406 * @syscap SystemCapability.AI.IntelligentVoice.Core 407 * @systemapi 408 * @since 12 409 */ 410 CONSECUTIVE_SAME_WORD = 6, 411 /** 412 * Too few phonemes. 413 * @syscap SystemCapability.AI.IntelligentVoice.Core 414 * @systemapi 415 * @since 12 416 */ 417 TOO_FEW_PHONEMES = 7, 418 /** 419 * Too many phonemes. 420 * @syscap SystemCapability.AI.IntelligentVoice.Core 421 * @systemapi 422 * @since 12 423 */ 424 TOO_MANY_PHONEMES = 8, 425 /** 426 * Contain common instruction. 427 * @syscap SystemCapability.AI.IntelligentVoice.Core 428 * @systemapi 429 * @since 12 430 */ 431 COMMON_INSTRUCTION = 9, 432 /** 433 * Contain common spoken language. 434 * @syscap SystemCapability.AI.IntelligentVoice.Core 435 * @systemapi 436 * @since 12 437 */ 438 COMMON_SPOKEN_LANGUAGE = 10, 439 /** 440 * Contain sensitive word. 441 * @syscap SystemCapability.AI.IntelligentVoice.Core 442 * @systemapi 443 * @since 12 444 */ 445 SENSITIVE_WORD = 11, 446 /** 447 * Two consecutive words without initial consonant. 448 * @syscap SystemCapability.AI.IntelligentVoice.Core 449 * @systemapi 450 * @since 12 451 */ 452 NO_INITIAL_CONSONANT = 12, 453 /** 454 * Contain repeated phoneme. 455 * @syscap SystemCapability.AI.IntelligentVoice.Core 456 * @systemapi 457 * @since 12 458 */ 459 REPEATED_PHONEME = 13, 460 } 461 462 /** 463 * Describes evaluation result. 464 * @typedef EvaluationResult 465 * @syscap SystemCapability.AI.IntelligentVoice.Core 466 * @systemapi 467 * @since 12 468 */ 469 interface EvaluationResult { 470 /** 471 * Evaluation score. 472 * @type { number } 473 * @syscap SystemCapability.AI.IntelligentVoice.Core 474 * @systemapi 475 * @since 12 476 */ 477 score: number; 478 /** 479 * Describes evaluation result code. 480 * @type { EvaluationResultCode } 481 * @syscap SystemCapability.AI.IntelligentVoice.Core 482 * @systemapi 483 * @since 12 484 */ 485 resultCode: EvaluationResultCode; 486 } 487 488 /** 489 * Obtains an {@link WakeupManager} instance. 490 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 491 * @returns { WakeupManager } this {@link WakeupManager} object. 492 * @throws { BusinessError } 201 - Permission denied. 493 * @throws { BusinessError } 22700101 - No memory. 494 * @throws { BusinessError } 22700107 - System error. 495 * @syscap SystemCapability.AI.IntelligentVoice.Core 496 * @systemapi 497 * @since 12 498 */ 499 function getWakeupManager(): WakeupManager; 500 501 /** 502 * Obtains an {@link EnrollIntelligentVoiceEngine} instance. This method uses an asynchronous callback to return the EnrollIntelligentVoiceEngine instance. 503 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 504 * @param { EnrollIntelligentVoiceEngineDescriptor } descriptor - descriptor indicates enroll intelligent voice engine descriptor. 505 * @param { AsyncCallback<EnrollIntelligentVoiceEngine> } callback - the callback used to return the EnrollIntelligentVoiceEngine instance. 506 * @throws { BusinessError } 201 - Permission denied. 507 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 508 * @throws { BusinessError } 22700101 - No memory. 509 * @throws { BusinessError } 22700102 - Input parameter value error. 510 * @syscap SystemCapability.AI.IntelligentVoice.Core 511 * @systemapi 512 * @since 10 513 */ 514 function createEnrollIntelligentVoiceEngine(descriptor: EnrollIntelligentVoiceEngineDescriptor, callback: AsyncCallback<EnrollIntelligentVoiceEngine>): void; 515 516 /** 517 * Obtains an {@link EnrollIntelligentVoiceEngine} instance. This method uses a promise to return the EnrollIntelligentVoiceEngine instance. 518 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 519 * @param { EnrollIntelligentVoiceEngineDescriptor } descriptor - descriptor indicates enroll intelligent voice engine descriptor. 520 * @returns { Promise<EnrollIntelligentVoiceEngine> } the promise used to return the EnrollIntelligentVoiceEngine instance. 521 * @throws { BusinessError } 201 - Permission denied. 522 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 523 * @throws { BusinessError } 22700101 - No memory. 524 * @throws { BusinessError } 22700102 - Input parameter value error. 525 * @syscap SystemCapability.AI.IntelligentVoice.Core 526 * @systemapi 527 * @since 10 528 */ 529 function createEnrollIntelligentVoiceEngine(descriptor: EnrollIntelligentVoiceEngineDescriptor): Promise<EnrollIntelligentVoiceEngine>; 530 531 /** 532 * Obtains an {@link WakeupIntelligentVoiceEngine} instance. This method uses an asynchronous callback to return the WakeupIntelligentVoiceEngine instance. 533 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 534 * @param { WakeupIntelligentVoiceEngineDescriptor } descriptor - descriptor indicates wakeup intelligent voice engine descriptor. 535 * @param { AsyncCallback<WakeupIntelligentVoiceEngine> } callback - the callback used to return the WakeupIntelligentVoiceEngine instance. 536 * @throws { BusinessError } 201 - Permission denied. 537 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 538 * @throws { BusinessError } 22700101 - No memory. 539 * @throws { BusinessError } 22700102 - Input parameter value error. 540 * @syscap SystemCapability.AI.IntelligentVoice.Core 541 * @systemapi 542 * @since 10 543 */ 544 function createWakeupIntelligentVoiceEngine(descriptor: WakeupIntelligentVoiceEngineDescriptor, callback: AsyncCallback<WakeupIntelligentVoiceEngine>): void; 545 546 /** 547 * Obtains an {@link WakeupIntelligentVoiceEngine} instance. This method uses a promise to return the WakeupIntelligentVoiceEngine instance. 548 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 549 * @param { WakeupIntelligentVoiceEngineDescriptor } descriptor - descriptor indicates wakeup intelligent voice engine descriptor. 550 * @returns { Promise<WakeupIntelligentVoiceEngine> } the promise used to return the WakeupIntelligentVoiceEngine instance. 551 * @throws { BusinessError } 201 - Permission denied. 552 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 553 * @throws { BusinessError } 22700101 - No memory. 554 * @throws { BusinessError } 22700102 - Input parameter value error. 555 * @syscap SystemCapability.AI.IntelligentVoice.Core 556 * @systemapi 557 * @since 10 558 */ 559 function createWakeupIntelligentVoiceEngine(descriptor: WakeupIntelligentVoiceEngineDescriptor): Promise<WakeupIntelligentVoiceEngine>; 560 561 /** 562 * Describes enroll engine config. 563 * @typedef EnrollEngineConfig 564 * @syscap SystemCapability.AI.IntelligentVoice.Core 565 * @systemapi 566 * @since 10 567 */ 568 interface EnrollEngineConfig { 569 /** 570 * Language that enroll engine supports. 571 * @type { string } 572 * @syscap SystemCapability.AI.IntelligentVoice.Core 573 * @systemapi 574 * @since 10 575 */ 576 language: string; 577 /** 578 * Region that enroll engine supports. 579 * @type { string } 580 * @syscap SystemCapability.AI.IntelligentVoice.Core 581 * @systemapi 582 * @since 10 583 */ 584 region: string; 585 } 586 587 /** 588 * Enumerates sensibility type. 589 * @enum {number} 590 * @syscap SystemCapability.AI.IntelligentVoice.Core 591 * @systemapi 592 * @since 10 593 */ 594 enum SensibilityType { 595 /** 596 * Low sensibility. 597 * @syscap SystemCapability.AI.IntelligentVoice.Core 598 * @systemapi 599 * @since 10 600 */ 601 LOW_SENSIBILITY = 1, 602 /** 603 * Middle sensibility. 604 * @syscap SystemCapability.AI.IntelligentVoice.Core 605 * @systemapi 606 * @since 10 607 */ 608 MIDDLE_SENSIBILITY = 2, 609 /** 610 * High sensibility. 611 * @syscap SystemCapability.AI.IntelligentVoice.Core 612 * @systemapi 613 * @since 10 614 */ 615 HIGH_SENSIBILITY = 3, 616 } 617 618 /** 619 * Describes wakeup hap information. 620 * @typedef WakeupHapInfo 621 * @syscap SystemCapability.AI.IntelligentVoice.Core 622 * @systemapi 623 * @since 10 624 */ 625 interface WakeupHapInfo { 626 /** 627 * Bundle name. 628 * @type { string } 629 * @syscap SystemCapability.AI.IntelligentVoice.Core 630 * @systemapi 631 * @since 10 632 */ 633 bundleName: string; 634 /** 635 * Ability name. 636 * @type { string } 637 * @syscap SystemCapability.AI.IntelligentVoice.Core 638 * @systemapi 639 * @since 10 640 */ 641 abilityName: string; 642 } 643 644 /** 645 * Enumerates wakeup intelligent voice event type. 646 * @enum {number} 647 * @syscap SystemCapability.AI.IntelligentVoice.Core 648 * @systemapi 649 * @since 10 650 */ 651 enum WakeupIntelligentVoiceEventType { 652 /** 653 * Wakeup None. 654 * @syscap SystemCapability.AI.IntelligentVoice.Core 655 * @systemapi 656 * @since 10 657 */ 658 INTELLIGENT_VOICE_EVENT_WAKEUP_NONE = 0, 659 /** 660 * Recognize complete. 661 * @syscap SystemCapability.AI.IntelligentVoice.Core 662 * @systemapi 663 * @since 10 664 */ 665 INTELLIGENT_VOICE_EVENT_RECOGNIZE_COMPLETE = 1, 666 } 667 668 /** 669 * Enumerates intelligent voice error code. 670 * @enum {number} 671 * @syscap SystemCapability.AI.IntelligentVoice.Core 672 * @systemapi 673 * @since 10 674 */ 675 enum IntelligentVoiceErrorCode { 676 /** 677 * No memory. 678 * @syscap SystemCapability.AI.IntelligentVoice.Core 679 * @systemapi 680 * @since 10 681 */ 682 INTELLIGENT_VOICE_NO_MEMORY = 22700101, 683 /** 684 * Input parameter value error. 685 * @syscap SystemCapability.AI.IntelligentVoice.Core 686 * @systemapi 687 * @since 10 688 */ 689 INTELLIGENT_VOICE_INVALID_PARAM = 22700102, 690 /** 691 * Init failed. 692 * @syscap SystemCapability.AI.IntelligentVoice.Core 693 * @systemapi 694 * @since 10 695 */ 696 INTELLIGENT_VOICE_INIT_FAILED = 22700103, 697 /** 698 * Commit enroll failed. 699 * @syscap SystemCapability.AI.IntelligentVoice.Core 700 * @systemapi 701 * @since 10 702 */ 703 INTELLIGENT_VOICE_COMMIT_ENROLL_FAILED = 22700104, 704 /** 705 * Start capturer failed. 706 * @syscap SystemCapability.AI.IntelligentVoice.Core 707 * @systemapi 708 * @since 12 709 */ 710 INTELLIGENT_VOICE_START_CAPTURER_FAILED = 22700105, 711 /** 712 * Read failed. 713 * @syscap SystemCapability.AI.IntelligentVoice.Core 714 * @systemapi 715 * @since 12 716 */ 717 INTELLIGENT_VOICE_READ_FAILED = 22700106, 718 /** 719 * System error. 720 * @syscap SystemCapability.AI.IntelligentVoice.Core 721 * @systemapi 722 * @since 12 723 */ 724 INTELLIGENT_VOICE_SYSTEM_ERROR = 22700107, 725 } 726 727 /** 728 * Enumerates enroll result. 729 * @enum {number} 730 * @syscap SystemCapability.AI.IntelligentVoice.Core 731 * @systemapi 732 * @since 10 733 */ 734 enum EnrollResult { 735 /** 736 * Success. 737 * @syscap SystemCapability.AI.IntelligentVoice.Core 738 * @systemapi 739 * @since 10 740 */ 741 SUCCESS = 0, 742 /** 743 * Vpr train failed. 744 * @syscap SystemCapability.AI.IntelligentVoice.Core 745 * @systemapi 746 * @since 10 747 */ 748 VPR_TRAIN_FAILED = -1, 749 /** 750 * Wakeup phrase not match. 751 * @syscap SystemCapability.AI.IntelligentVoice.Core 752 * @systemapi 753 * @since 10 754 */ 755 WAKEUP_PHRASE_NOT_MATCH = -2, 756 /** 757 * Too noisy. 758 * @syscap SystemCapability.AI.IntelligentVoice.Core 759 * @systemapi 760 * @since 10 761 */ 762 TOO_NOISY = -3, 763 /** 764 * Too loud. 765 * @syscap SystemCapability.AI.IntelligentVoice.Core 766 * @systemapi 767 * @since 10 768 */ 769 TOO_LOUD = -4, 770 /** 771 * Interval large. 772 * @syscap SystemCapability.AI.IntelligentVoice.Core 773 * @systemapi 774 * @since 10 775 */ 776 INTERVAL_LARGE = -5, 777 /** 778 * Different person. 779 * @syscap SystemCapability.AI.IntelligentVoice.Core 780 * @systemapi 781 * @since 10 782 */ 783 DIFFERENT_PERSON = -6, 784 /** 785 * Unknown error. 786 * @syscap SystemCapability.AI.IntelligentVoice.Core 787 * @systemapi 788 * @since 10 789 */ 790 UNKNOWN_ERROR = -100, 791 } 792 793 /** 794 * Enumerates capturer channel. 795 * @enum {number} 796 * @syscap SystemCapability.AI.IntelligentVoice.Core 797 * @systemapi 798 * @since 12 799 */ 800 enum CapturerChannel { 801 /** 802 * Capturer channel 1. 803 * @syscap SystemCapability.AI.IntelligentVoice.Core 804 * @systemapi 805 * @since 12 806 */ 807 CAPTURER_CHANNEL_1 = 0x1 << 0, 808 /** 809 * Capturer channel 2. 810 * @syscap SystemCapability.AI.IntelligentVoice.Core 811 * @systemapi 812 * @since 12 813 */ 814 CAPTURER_CHANNEL_2 = 0x1 << 1, 815 /** 816 * Capturer channel 3. 817 * @syscap SystemCapability.AI.IntelligentVoice.Core 818 * @systemapi 819 * @since 12 820 */ 821 CAPTURER_CHANNEL_3 = 0x1 << 2, 822 /** 823 * Capturer channel 4. 824 * @syscap SystemCapability.AI.IntelligentVoice.Core 825 * @systemapi 826 * @since 12 827 */ 828 CAPTURER_CHANNEL_4 = 0x1 << 3, 829 } 830 831 /** 832 * Describes enroll callback information. 833 * @typedef EnrollCallbackInfo 834 * @syscap SystemCapability.AI.IntelligentVoice.Core 835 * @systemapi 836 * @since 10 837 */ 838 interface EnrollCallbackInfo { 839 /** 840 * Result. 841 * @type { EnrollResult } 842 * @syscap SystemCapability.AI.IntelligentVoice.Core 843 * @systemapi 844 * @since 10 845 */ 846 result: EnrollResult; 847 /** 848 * Describes enroll event context. 849 * @type { string } 850 * @syscap SystemCapability.AI.IntelligentVoice.Core 851 * @systemapi 852 * @since 10 853 */ 854 context: string; 855 } 856 857 /** 858 * Describes wakeup intelligent voice engine callback information. 859 * @typedef WakeupIntelligentVoiceEngineCallbackInfo 860 * @syscap SystemCapability.AI.IntelligentVoice.Core 861 * @systemapi 862 * @since 10 863 */ 864 interface WakeupIntelligentVoiceEngineCallbackInfo { 865 /** 866 * Wakeup event id. 867 * @type { WakeupIntelligentVoiceEventType } 868 * @syscap SystemCapability.AI.IntelligentVoice.Core 869 * @systemapi 870 * @since 10 871 */ 872 eventId: WakeupIntelligentVoiceEventType; 873 /** 874 * Is success. 875 * @type { boolean } 876 * @syscap SystemCapability.AI.IntelligentVoice.Core 877 * @systemapi 878 * @since 10 879 */ 880 isSuccess: boolean; 881 /** 882 * Describes wakeup event context. 883 * @type { string } 884 * @syscap SystemCapability.AI.IntelligentVoice.Core 885 * @systemapi 886 * @since 10 887 */ 888 context: string; 889 } 890 891 /** 892 * Implements enroll intelligent voice engine. 893 * @typedef EnrollIntelligentVoiceEngine 894 * @syscap SystemCapability.AI.IntelligentVoice.Core 895 * @systemapi 896 * @since 10 897 */ 898 interface EnrollIntelligentVoiceEngine { 899 /** 900 * Obtains the supported regions, This method uses an asynchronous callback to return the query result. 901 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 902 * @param { AsyncCallback<Array<string>> } callback - the callback used to return the supported regions. 903 * @throws { BusinessError } 201 - Permission denied. 904 * @syscap SystemCapability.AI.IntelligentVoice.Core 905 * @systemapi 906 * @since 10 907 */ 908 getSupportedRegions(callback: AsyncCallback<Array<string>>): void; 909 /** 910 * Obtains the supported regions, This method uses a promise to return the query result. 911 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 912 * @returns { Promise<Array<string>> } the promise used to return the supported regions. 913 * @throws { BusinessError } 201 - Permission denied. 914 * @syscap SystemCapability.AI.IntelligentVoice.Core 915 * @systemapi 916 * @since 10 917 */ 918 getSupportedRegions(): Promise<Array<string>>; 919 /** 920 * Initials the engine, This method uses an asynchronous callback to return the result. 921 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 922 * @param { EnrollEngineConfig } config - config indicates enroll engine configuration. 923 * @param { AsyncCallback<void> } callback - the callback used to return the result. 924 * @throws { BusinessError } 201 - Permission denied. 925 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 926 * @throws { BusinessError } 22700102 - Input parameter value error. 927 * @throws { BusinessError } 22700103 - Init failed. 928 * @syscap SystemCapability.AI.IntelligentVoice.Core 929 * @systemapi 930 * @since 10 931 */ 932 init(config: EnrollEngineConfig, callback: AsyncCallback<void>): void; 933 /** 934 * Initials the engine, This method uses a promise to return the result. 935 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 936 * @param { EnrollEngineConfig } config - config indicates enroll engine configuration. 937 * @returns { Promise<void> } the promise used to return the result. 938 * @throws { BusinessError } 201 - Permission denied. 939 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 940 * @throws { BusinessError } 22700102 - Input parameter value error. 941 * @throws { BusinessError } 22700103 - Init failed. 942 * @syscap SystemCapability.AI.IntelligentVoice.Core 943 * @systemapi 944 * @since 10 945 */ 946 init(config: EnrollEngineConfig): Promise<void>; 947 /** 948 * Enrolls for result, This method uses an asynchronous callback to return the result. 949 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 950 * @param { boolean } isLast - isLast indicates if it is the last time to enroll. 951 * @param { AsyncCallback<EnrollCallbackInfo> } callback - the callback used to return the result. 952 * @throws { BusinessError } 201 - Permission denied. 953 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 954 * @syscap SystemCapability.AI.IntelligentVoice.Core 955 * @systemapi 956 * @since 10 957 */ 958 enrollForResult(isLast: boolean, callback: AsyncCallback<EnrollCallbackInfo>): void; 959 /** 960 * Enrolls for result, This method uses a promise to return the result. 961 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 962 * @param { boolean } isLast - isLast indicates if it is the last time to enroll. 963 * @returns { Promise<EnrollCallbackInfo> } the promise used to return the result. 964 * @throws { BusinessError } 201 - Permission denied. 965 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 966 * @syscap SystemCapability.AI.IntelligentVoice.Core 967 * @systemapi 968 * @since 10 969 */ 970 enrollForResult(isLast: boolean): Promise<EnrollCallbackInfo>; 971 /** 972 * Stops the engine, This method uses an asynchronous callback to return the result. 973 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 974 * @param { AsyncCallback<void> } callback - the callback used to return the result. 975 * @throws { BusinessError } 201 - Permission denied. 976 * @syscap SystemCapability.AI.IntelligentVoice.Core 977 * @systemapi 978 * @since 10 979 */ 980 stop(callback: AsyncCallback<void>): void; 981 /** 982 * Stops the engine, This method uses a promise to return the result. 983 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 984 * @returns { Promise<void> } the promise used to return the result. 985 * @throws { BusinessError } 201 - Permission denied. 986 * @syscap SystemCapability.AI.IntelligentVoice.Core 987 * @systemapi 988 * @since 10 989 */ 990 stop(): Promise<void>; 991 /** 992 * Commit enroll, This method uses an asynchronous callback to return the result. 993 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 994 * @param { AsyncCallback<void> } callback - the callback used to return the result. 995 * @throws { BusinessError } 201 - Permission denied. 996 * @throws { BusinessError } 22700104 - Commit enroll failed. 997 * @syscap SystemCapability.AI.IntelligentVoice.Core 998 * @systemapi 999 * @since 10 1000 */ 1001 commit(callback: AsyncCallback<void>): void; 1002 /** 1003 * Commit enroll, This method uses a promise to return the result. 1004 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1005 * @returns { Promise<void> } the promise used to return the result. 1006 * @throws { BusinessError } 201 - Permission denied. 1007 * @throws { BusinessError } 22700104 - Commit enroll failed. 1008 * @syscap SystemCapability.AI.IntelligentVoice.Core 1009 * @systemapi 1010 * @since 10 1011 */ 1012 commit(): Promise<void>; 1013 /** 1014 * Sets wakeup hap information, This method uses an asynchronous callback to return the result. 1015 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1016 * @param { WakeupHapInfo } info - info indicates wakeup hap information. 1017 * @param { AsyncCallback<void> } callback - the callback used to return the result. 1018 * @throws { BusinessError } 201 - Permission denied. 1019 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 1020 * @throws { BusinessError } 22700102 - Input parameter value error. 1021 * @syscap SystemCapability.AI.IntelligentVoice.Core 1022 * @systemapi 1023 * @since 10 1024 */ 1025 setWakeupHapInfo(info: WakeupHapInfo, callback: AsyncCallback<void>): void; 1026 /** 1027 * Sets wakeup hap information, This method uses a promise to return the result. 1028 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1029 * @param { WakeupHapInfo } info - info indicates wakeup hap information. 1030 * @returns { Promise<void> } the promise used to return the result. 1031 * @throws { BusinessError } 201 - Permission denied. 1032 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 1033 * @throws { BusinessError } 22700102 - Input parameter value error. 1034 * @syscap SystemCapability.AI.IntelligentVoice.Core 1035 * @systemapi 1036 * @since 10 1037 */ 1038 setWakeupHapInfo(info: WakeupHapInfo): Promise<void>; 1039 /** 1040 * Sets sensibility, This method uses an asynchronous callback to return the result. 1041 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1042 * @param { SensibilityType } sensibility - sensibility to set. 1043 * @param { AsyncCallback<void> } callback - the callback used to return the result. 1044 * @throws { BusinessError } 201 - Permission denied. 1045 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 1046 * @throws { BusinessError } 22700102 - Input parameter value error. 1047 * @syscap SystemCapability.AI.IntelligentVoice.Core 1048 * @systemapi 1049 * @since 10 1050 */ 1051 setSensibility(sensibility: SensibilityType, callback: AsyncCallback<void>): void; 1052 /** 1053 * Sets sensibility, This method uses a promise to return the result. 1054 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1055 * @param { SensibilityType } sensibility - sensibility to set. 1056 * @returns { Promise<void> } the promise used to return the result. 1057 * @throws { BusinessError } 201 - Permission denied. 1058 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 1059 * @throws { BusinessError } 22700102 - Input parameter value error. 1060 * @syscap SystemCapability.AI.IntelligentVoice.Core 1061 * @systemapi 1062 * @since 10 1063 */ 1064 setSensibility(sensibility: SensibilityType): Promise<void>; 1065 /** 1066 * Sets an intelligent voice parameter. This method uses an asynchronous callback to return the result. 1067 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1068 * @param { string } key - the key of the intelligent voice parameter to set. 1069 * @param { string } value - the value of the intelligent voice parameter to set. 1070 * @param { AsyncCallback<void> } callback - the callback used to return the result. 1071 * @throws { BusinessError } 201 - Permission denied. 1072 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 1073 * @throws { BusinessError } 22700102 - Input parameter value error. 1074 * @syscap SystemCapability.AI.IntelligentVoice.Core 1075 * @systemapi 1076 * @since 10 1077 */ 1078 setParameter(key: string, value: string, callback: AsyncCallback<void>): void; 1079 /** 1080 * Sets an intelligent voice parameter. This method uses a promise to return the result. 1081 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1082 * @param { string } key - the key of the intelligent voice parameter to set. 1083 * @param { string } value - the value of the intelligent voice parameter to set. 1084 * @returns { Promise<void> } the promise used to return the result. 1085 * @throws { BusinessError } 201 - Permission denied. 1086 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 1087 * @throws { BusinessError } 22700102 - Input parameter value error. 1088 * @syscap SystemCapability.AI.IntelligentVoice.Core 1089 * @systemapi 1090 * @since 10 1091 */ 1092 setParameter(key: string, value: string): Promise<void>; 1093 /** 1094 * Obtains the value of an intelligent voice parameter. This method uses an asynchronous callback to return the query result. 1095 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1096 * @param { string } key - the key of the intelligent voice parameter whose value is to be obtained. 1097 * @param { AsyncCallback<string> } callback - the callback used to return the value of the intelligent voice parameter. 1098 * @throws { BusinessError } 201 - Permission denied. 1099 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 1100 * @throws { BusinessError } 22700102 - Input parameter value error. 1101 * @syscap SystemCapability.AI.IntelligentVoice.Core 1102 * @systemapi 1103 * @since 10 1104 */ 1105 getParameter(key: string, callback: AsyncCallback<string>): void; 1106 /** 1107 * Obtains the value of an intelligent voice parameter. This method uses a promise to return the query result. 1108 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1109 * @param { string } key - the key of the intelligent voice parameter whose value is to be obtained. 1110 * @returns { Promise<string> } the promise used to return the value of the intelligent voice parameter. 1111 * @throws { BusinessError } 201 - Permission denied. 1112 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 1113 * @throws { BusinessError } 22700102 - Input parameter value error. 1114 * @syscap SystemCapability.AI.IntelligentVoice.Core 1115 * @systemapi 1116 * @since 10 1117 */ 1118 getParameter(key: string): Promise<string>; 1119 /** 1120 * Evaluates for result, This method uses a promise to return the result. 1121 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1122 * @param { string } word - the word to evaluate. 1123 * @returns { Promise<EvaluationResult> } the promise used to return the result. 1124 * @throws { BusinessError } 201 - Permission denied. 1125 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 1126 * @throws { BusinessError } 22700107 - System error. 1127 * @syscap SystemCapability.AI.IntelligentVoice.Core 1128 * @systemapi 1129 * @since 12 1130 */ 1131 evaluateForResult(word: string): Promise<EvaluationResult>; 1132 /** 1133 * Releases the engine, This method uses an asynchronous callback to return the result. 1134 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1135 * @param { AsyncCallback<void> } callback - the callback used to return the result. 1136 * @throws { BusinessError } 201 - Permission denied. 1137 * @syscap SystemCapability.AI.IntelligentVoice.Core 1138 * @systemapi 1139 * @since 10 1140 */ 1141 release(callback: AsyncCallback<void>): void; 1142 /** 1143 * Releases the engine, This method uses a promise to return the result. 1144 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1145 * @returns { Promise<void> } the promise used to return the result. 1146 * @throws { BusinessError } 201 - Permission denied. 1147 * @syscap SystemCapability.AI.IntelligentVoice.Core 1148 * @systemapi 1149 * @since 10 1150 */ 1151 release(): Promise<void>; 1152 } 1153 1154 /** 1155 * Implements wakeup intelligent voice engine. 1156 * @typedef WakeupIntelligentVoiceEngine 1157 * @syscap SystemCapability.AI.IntelligentVoice.Core 1158 * @systemapi 1159 * @since 10 1160 */ 1161 interface WakeupIntelligentVoiceEngine { 1162 /** 1163 * Obtains the supported regions, This method uses an asynchronous callback to return the query result. 1164 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1165 * @param { AsyncCallback<Array<string>> } callback - the callback used to return the supported regions. 1166 * @throws { BusinessError } 201 - Permission denied. 1167 * @syscap SystemCapability.AI.IntelligentVoice.Core 1168 * @systemapi 1169 * @since 10 1170 */ 1171 getSupportedRegions(callback: AsyncCallback<Array<string>>): void; 1172 /** 1173 * Obtains the supported regions, This method uses a promise to return the query result. 1174 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1175 * @returns { Promise<Array<string>> } the promise used to return the supported regions. 1176 * @throws { BusinessError } 201 - Permission denied. 1177 * @syscap SystemCapability.AI.IntelligentVoice.Core 1178 * @systemapi 1179 * @since 10 1180 */ 1181 getSupportedRegions(): Promise<Array<string>>; 1182 /** 1183 * Sets wakeup hap information, This method uses an asynchronous callback to return the result. 1184 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1185 * @param { WakeupHapInfo } info - info indicates wakeup hap information. 1186 * @param { AsyncCallback<void> } callback - the callback used to return the result. 1187 * @throws { BusinessError } 201 - Permission denied. 1188 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 1189 * @throws { BusinessError } 22700102 - Input parameter value error. 1190 * @syscap SystemCapability.AI.IntelligentVoice.Core 1191 * @systemapi 1192 * @since 10 1193 */ 1194 setWakeupHapInfo(info: WakeupHapInfo, callback: AsyncCallback<void>): void; 1195 /** 1196 * Sets wakeup hap information, This method uses a promise to return the result. 1197 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1198 * @param { WakeupHapInfo } info - info indicates wakeup hap information. 1199 * @returns { Promise<void> } the promise used to return the result. 1200 * @throws { BusinessError } 201 - Permission denied. 1201 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 1202 * @throws { BusinessError } 22700102 - Input parameter value error. 1203 * @syscap SystemCapability.AI.IntelligentVoice.Core 1204 * @systemapi 1205 * @since 10 1206 */ 1207 setWakeupHapInfo(info: WakeupHapInfo): Promise<void>; 1208 /** 1209 * Sets sensibility, This method uses an asynchronous callback to return the result. 1210 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1211 * @param { SensibilityType } sensibility - sensibility to set. 1212 * @param { AsyncCallback<void> } callback - the callback used to return the result. 1213 * @throws { BusinessError } 201 - Permission denied. 1214 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 1215 * @throws { BusinessError } 22700102 - Input parameter value error. 1216 * @syscap SystemCapability.AI.IntelligentVoice.Core 1217 * @systemapi 1218 * @since 10 1219 */ 1220 setSensibility(sensibility: SensibilityType, callback: AsyncCallback<void>): void; 1221 /** 1222 * Sets sensibility, This method uses a promise to return the result. 1223 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1224 * @param { SensibilityType } sensibility - sensibility to set. 1225 * @returns { Promise<void> } the promise used to return the result. 1226 * @throws { BusinessError } 201 - Permission denied. 1227 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 1228 * @throws { BusinessError } 22700102 - Input parameter value error. 1229 * @syscap SystemCapability.AI.IntelligentVoice.Core 1230 * @systemapi 1231 * @since 10 1232 */ 1233 setSensibility(sensibility: SensibilityType): Promise<void>; 1234 /** 1235 * Sets an intelligent voice parameter. This method uses an asynchronous callback to return the result. 1236 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1237 * @param { string } key - the key of the intelligent voice parameter to set. 1238 * @param { string } value - the value of the intelligent voice parameter to set. 1239 * @param { AsyncCallback<void> } callback - the callback used to return the result. 1240 * @throws { BusinessError } 201 - Permission denied. 1241 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 1242 * @throws { BusinessError } 22700102 - Input parameter value error. 1243 * @syscap SystemCapability.AI.IntelligentVoice.Core 1244 * @systemapi 1245 * @since 10 1246 */ 1247 setParameter(key: string, value: string, callback: AsyncCallback<void>): void; 1248 /** 1249 * Sets an intelligent voice parameter. This method uses a promise to return the result. 1250 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1251 * @param { string } key - the key of the intelligent voice parameter to set. 1252 * @param { string } value - the value of the intelligent voice parameter to set. 1253 * @returns { Promise<void> } the promise used to return the result. 1254 * @throws { BusinessError } 201 - Permission denied. 1255 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 1256 * @throws { BusinessError } 22700102 - Input parameter value error. 1257 * @syscap SystemCapability.AI.IntelligentVoice.Core 1258 * @systemapi 1259 * @since 10 1260 */ 1261 setParameter(key: string, value: string): Promise<void>; 1262 /** 1263 * Obtains the value of an intelligent voice parameter. This method uses an asynchronous callback to return the query result. 1264 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1265 * @param { string } key - the key of the intelligent voice parameter whose value is to be obtained. 1266 * @param { AsyncCallback<string> } callback - the callback used to return the value of the intelligent voice parameter. 1267 * @throws { BusinessError } 201 - Permission denied. 1268 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 1269 * @throws { BusinessError } 22700102 - Input parameter value error. 1270 * @syscap SystemCapability.AI.IntelligentVoice.Core 1271 * @systemapi 1272 * @since 10 1273 */ 1274 getParameter(key: string, callback: AsyncCallback<string>): void; 1275 /** 1276 * Obtains the value of an intelligent voice parameter. This method uses a promise to return the query result. 1277 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1278 * @param { string } key - the key of the intelligent voice parameter whose value is to be obtained. 1279 * @returns { Promise<string> } the promise used to return the value of the intelligent voice parameter. 1280 * @throws { BusinessError } 201 - Permission denied. 1281 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 1282 * @throws { BusinessError } 22700102 - Input parameter value error. 1283 * @syscap SystemCapability.AI.IntelligentVoice.Core 1284 * @systemapi 1285 * @since 10 1286 */ 1287 getParameter(key: string): Promise<string>; 1288 /** 1289 * Gets pulse-code modulation audio. This method uses a promise to return the result. 1290 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1291 * @returns { Promise<ArrayBuffer> } the promise used to return the pulse-code modulation audio. 1292 * @throws { BusinessError } 201 - Permission denied. 1293 * @throws { BusinessError } 22700101 - No memory. 1294 * @throws { BusinessError } 22700107 - System error. 1295 * @syscap SystemCapability.AI.IntelligentVoice.Core 1296 * @systemapi 1297 * @since 12 1298 */ 1299 getPcm(): Promise<ArrayBuffer>; 1300 /** 1301 * Starts the capturer. This method uses a promise to return the result. 1302 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1303 * @param { number } channels - the channels needed in reading. The channels should be greater than 0 and smaller than 16. 1304 * @returns { Promise<void> } the promise used to return the result. 1305 * @throws { BusinessError } 201 - Permission denied. 1306 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed. 1307 * @throws { BusinessError } 22700102 - Input parameter value error. 1308 * @throws { BusinessError } 22700105 - Start capturer failed. 1309 * @throws { BusinessError } 22700107 - System error. 1310 * @syscap SystemCapability.AI.IntelligentVoice.Core 1311 * @systemapi 1312 * @since 12 1313 */ 1314 startCapturer(channels: number): Promise<void>; 1315 /** 1316 * Reads the buffer from wakeup engine. This method uses a promise to return the result. 1317 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1318 * @returns { Promise<ArrayBuffer> } the promise used to return the buffer. 1319 * @throws { BusinessError } 201 - Permission denied. 1320 * @throws { BusinessError } 22700101 - No memory. 1321 * @throws { BusinessError } 22700106 - Read failed. 1322 * @throws { BusinessError } 22700107 - System error. 1323 * @syscap SystemCapability.AI.IntelligentVoice.Core 1324 * @systemapi 1325 * @since 12 1326 */ 1327 read(): Promise<ArrayBuffer>; 1328 /** 1329 * Stops the capturer. This method uses a promise to return the result. 1330 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1331 * @returns { Promise<void> } the promise used to return the result. 1332 * @throws { BusinessError } 201 - Permission denied. 1333 * @throws { BusinessError } 22700107 - System error. 1334 * @syscap SystemCapability.AI.IntelligentVoice.Core 1335 * @systemapi 1336 * @since 12 1337 */ 1338 stopCapturer(): Promise<void>; 1339 /** 1340 * Releases the engine, This method uses an asynchronous callback to return the result. 1341 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1342 * @param { AsyncCallback<void> } callback - the callback used to return the result. 1343 * @throws { BusinessError } 201 - Permission denied. 1344 * @syscap SystemCapability.AI.IntelligentVoice.Core 1345 * @systemapi 1346 * @since 10 1347 */ 1348 release(callback: AsyncCallback<void>): void; 1349 /** 1350 * Releases the engine, This method uses a promise to return the result. 1351 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1352 * @returns { Promise<void> } the promise used to return the result. 1353 * @throws { BusinessError } 201 - Permission denied. 1354 * @syscap SystemCapability.AI.IntelligentVoice.Core 1355 * @systemapi 1356 * @since 10 1357 */ 1358 release(): Promise<void>; 1359 /** 1360 * Subscribes wakeup intelligent voice events. When wakeup intelligent voice events reach, 1361 * the callback is invoked. 1362 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1363 * @param { 'wakeupIntelligentVoiceEvent' } type - Type of the event to listen for. Only the wakeupIntelligentVoice event is supported. 1364 * @param { Callback<WakeupIntelligentVoiceEngineCallbackInfo> } callback - the callback invoked when the event is triggered. 1365 * @throws { BusinessError } 201 - Permission denied. 1366 * @syscap SystemCapability.AI.IntelligentVoice.Core 1367 * @systemapi 1368 * @since 10 1369 */ 1370 on(type: 'wakeupIntelligentVoiceEvent', callback: Callback<WakeupIntelligentVoiceEngineCallbackInfo>): void; 1371 /** 1372 * Unsubscribes wakeup intelligent voice events. 1373 * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE 1374 * @param { 'wakeupIntelligentVoiceEvent' } type - Type of the event to listen for. Only the wakeupIntelligentVoice event is supported. 1375 * @param { Callback<WakeupIntelligentVoiceEngineCallbackInfo> } [callback] - the callback invoked when the event is triggered. 1376 * @throws { BusinessError } 201 - Permission denied. 1377 * @syscap SystemCapability.AI.IntelligentVoice.Core 1378 * @systemapi 1379 * @since 10 1380 */ 1381 off(type: 'wakeupIntelligentVoiceEvent', callback?: Callback<WakeupIntelligentVoiceEngineCallbackInfo>): void; 1382 } 1383} 1384 1385export default intelligentVoice;