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