• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.ai.intelligentVoice (智能语音)
2
3智能语音主要提供了语音注册及语音唤醒相关功能。
4
5该模块提供以下智能语音相关的常用功能:
6
7- [IntelligentVoiceManager](#intelligentvoicemanager):智能语音管理类,明确当前智能语音提供的相关功能,当前支持语音注册、语音唤醒。在进行智能语音相关开发前,需先调用[getIntelligentVoiceManager()](#intelligentvoicegetintelligentvoicemanager)确认当前支持智能语音的相关功能,再进行语音注册和语音唤醒的相关开发。
8- [EnrollIntelligentVoiceEngine](#enrollintelligentvoiceengine):实现语音注册。开发者需要先进行智能语音的注册,然后才能进行唤醒。
9- [WakeupIntelligentVoiceEngine](#wakeupintelligentvoiceengine):实现语音唤醒。开发者需要先进行智能语音的注册,然后才能进行唤醒。
10
11> **说明:**
12>
13> - 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
14>
15> - 本模块接口为系统接口。
16
17## 导入模块
18```ts
19import intelligentVoice from '@ohos.ai.intelligentVoice';
20```
21
22## intelligentVoice.getIntelligentVoiceManager
23
24getIntelligentVoiceManager(): IntelligentVoiceManager
25
26获取智能语音管理类。
27
28**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
29
30**系统能力:** SystemCapability.AI.IntelligentVoice.Core
31
32**返回值:**
33
34| 类型                          | 说明         |
35| ----------------------------- | ------------ |
36| [IntelligentVoiceManager](#intelligentvoicemanager) | 智能语音管理类。 |
37
38**错误码:**
39
40以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
41
42| 错误码ID | 错误信息 |
43| ------- | --------------------------------------------|
44| 22700101 | No memory.                              |
45
46**示例:**
47
48```ts
49import { BusinessError } from '@ohos.base';
50
51let intelligentVoiceManager: intelligentVoice.IntelligentVoiceManager | null = null;
52try {
53  intelligentVoiceManager = intelligentVoice.getIntelligentVoiceManager();
54} catch (err) {
55  let error = err as BusinessError;
56  console.error(`Get IntelligentVoiceManager failed. Code:${error.code}, message:${error.message}`);
57}
58```
59
60## intelligentVoice.createEnrollIntelligentVoiceEngine
61
62createEnrollIntelligentVoiceEngine(descriptor: EnrollIntelligentVoiceEngineDescriptor, callback: AsyncCallback<EnrollIntelligentVoiceEngine>): void
63
64创建智能语音注册引擎实例,使用callback异步回调。
65
66**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
67
68**系统能力:** SystemCapability.AI.IntelligentVoice.Core
69
70**参数:**
71
72| 参数名   | 类型                                | 必填 | 说明                   |
73| -------- | ----------------------------------- | ---- | ---------------------- |
74| descriptor    | [EnrollIntelligentVoiceEngineDescriptor](#enrollintelligentvoiceenginedescriptor)                              | 是   | 智能语音注册引擎描述符。   |
75| callback    | AsyncCallback\<[EnrollIntelligentVoiceEngine](#enrollintelligentvoiceengine)\>         | 是   | 返回注册智能语音引擎。   |
76
77**错误码:**
78
79以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
80
81| 错误码ID | 错误信息 |
82| ------- | --------------------------------------------|
83| 22700101 | No memory.                           |
84| 22700102 | Input parameter value error.                            |
85
86**示例:**
87
88```ts
89import { BusinessError } from '@ohos.base';
90
91let engineDescriptor: intelligentVoice.EnrollIntelligentVoiceEngineDescriptor = {
92  wakeupPhrase: '小华小华',
93}
94let enrollIntelligentVoiceEngine: intelligentVoice.EnrollIntelligentVoiceEngine | null = null;
95intelligentVoice.createEnrollIntelligentVoiceEngine(engineDescriptor, (err: BusinessError, data: intelligentVoice.EnrollIntelligentVoiceEngine) => {
96  if (err) {
97    console.error(`Failed to create enrollIntelligentVoice engine, Code:${err.code}, message:${err.message}`);
98  } else {
99    console.info(`Succeeded in creating enrollIntelligentVoice engine.`);
100    enrollIntelligentVoiceEngine = data;
101  }
102});
103```
104
105## intelligentVoice.createEnrollIntelligentVoiceEngine
106
107createEnrollIntelligentVoiceEngine(descriptor: EnrollIntelligentVoiceEngineDescriptor): Promise&lt;EnrollIntelligentVoiceEngine&gt;
108
109
110创建智能语音注册引擎实例,使用Promise异步回调。
111
112**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
113
114**系统能力:** SystemCapability.AI.IntelligentVoice.Core
115
116**参数:**
117
118| 参数名   | 类型                                | 必填 | 说明                   |
119| -------- | ----------------------------------- | ---- | ---------------------- |
120| descriptor    | [EnrollIntelligentVoiceEngineDescriptor](#enrollintelligentvoiceenginedescriptor)                              | 是   | 智能语音注册引擎描述符。   |
121
122**返回值:**
123
124| 类型                                             | 说明                           |
125| ----------------------------------------------- | ---------------------------- |
126| Promise\<[EnrollIntelligentVoiceEngine](#enrollintelligentvoiceengine)\>           | 返回注册智能语音引擎。                   |
127
128**错误码:**
129
130以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
131
132| 错误码ID | 错误信息 |
133| ------- | --------------------------------------------|
134| 22700101 | No memory.                           |
135| 22700102 | Input parameter value error.                            |
136
137**示例:**
138
139```ts
140import { BusinessError } from '@ohos.base';
141
142let engineDescriptor: intelligentVoice.EnrollIntelligentVoiceEngineDescriptor = {
143  wakeupPhrase: '小华小华',
144}
145let enrollIntelligentVoiceEngine: intelligentVoice.EnrollIntelligentVoiceEngine | null = null;
146intelligentVoice.createEnrollIntelligentVoiceEngine(engineDescriptor).then((data: intelligentVoice.EnrollIntelligentVoiceEngine) => {
147  enrollIntelligentVoiceEngine = data;
148  console.info(`Succeeded in creating enrollIntelligentVoice engine.`);
149}).catch((err: BusinessError) => {
150  console.error(`Failed to create enrollIntelligentVoice engine, Code:${err.code}, message:${err.message}`);
151});
152```
153
154## intelligentVoice.createWakeupIntelligentVoiceEngine
155
156createWakeupIntelligentVoiceEngine(descriptor: WakeupIntelligentVoiceEngineDescriptor, callback: AsyncCallback&lt;WakeupIntelligentVoiceEngine&gt;): void
157
158
159创建智能语音唤醒引擎实例,使用callback异步回调。
160
161**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
162
163**系统能力:** SystemCapability.AI.IntelligentVoice.Core
164
165**参数:**
166
167| 参数名   | 类型                                | 必填 | 说明                   |
168| -------- | ----------------------------------- | ---- | ---------------------- |
169| descriptor    | [WakeupIntelligentVoiceEngineDescriptor](#wakeupintelligentvoiceenginedescriptor)                              | 是   | 唤醒智能语音引擎描述符。   |
170| callback    | AsyncCallback\<[WakeupIntelligentVoiceEngine](#wakeupintelligentvoiceengine)\>         | 是   | 返回唤醒智能语音引擎。   |
171
172**错误码:**
173
174以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
175
176| 错误码ID | 错误信息 |
177| ------- | --------------------------------------------|
178| 22700101 | No memory.                           |
179| 22700102 | Input parameter value error.                            |
180
181**示例:**
182
183```ts
184import { BusinessError } from '@ohos.base';
185
186let wakeupEngineDescriptor: intelligentVoice.WakeupIntelligentVoiceEngineDescriptor = {
187  needReconfirm: true,
188  wakeupPhrase: '小华小华',
189}
190let wakeupIntelligentVoiceEngine: intelligentVoice.WakeupIntelligentVoiceEngine | null = null;
191intelligentVoice.createWakeupIntelligentVoiceEngine(wakeupEngineDescriptor, (err: BusinessError, data: intelligentVoice.WakeupIntelligentVoiceEngine) => {
192  if (err) {
193    console.error(`Failed to create wakeupIntelligentVoice engine, Code:${err.code}, message:${err.message}`);
194  } else {
195    console.info(`Succeeded in creating wakeupIntelligentVoice engine.`);
196    wakeupIntelligentVoiceEngine = data;
197  }
198});
199```
200
201## intelligentVoice.createWakeupIntelligentVoiceEngine
202
203createWakeupIntelligentVoiceEngine(descriptor: WakeupIntelligentVoiceEngineDescriptor): Promise&lt;WakeupIntelligentVoiceEngine&gt;
204
205创建智能语音唤醒引擎实例,使用Promise异步回调。
206
207**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
208
209**系统能力:** SystemCapability.AI.IntelligentVoice.Core
210
211**参数:**
212
213| 参数名   | 类型                                | 必填 | 说明                   |
214| -------- | ----------------------------------- | ---- | ---------------------- |
215| descriptor    | [WakeupIntelligentVoiceEngineDescriptor](#wakeupintelligentvoiceenginedescriptor)                              | 是   | 唤醒智能语音引擎描述符。   |
216
217**返回值:**
218
219| 类型                                             | 说明                           |
220| ----------------------------------------------- | ---------------------------- |
221| Promise\<[WakeupIntelligentVoiceEngine](#wakeupintelligentvoiceengine)>           | 返回唤醒智能语音引擎。                   |
222
223**错误码:**
224
225以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
226
227| 错误码ID | 错误信息 |
228| ------- | --------------------------------------------|
229| 22700101 | No memory.                           |
230| 22700102 | Input parameter value error.                            |
231
232**示例:**
233
234```ts
235import { BusinessError } from '@ohos.base';
236
237let wakeupEngineDescriptor: intelligentVoice.WakeupIntelligentVoiceEngineDescriptor = {
238  needReconfirm: true,
239  wakeupPhrase: '小华小华',
240}
241let wakeupIntelligentVoiceEngine: intelligentVoice.WakeupIntelligentVoiceEngine | null = null;
242intelligentVoice.createWakeupIntelligentVoiceEngine(wakeupEngineDescriptor).then((data: intelligentVoice.WakeupIntelligentVoiceEngine) => {
243  wakeupIntelligentVoiceEngine = data;
244  console.info(`Succeeded in creating wakeupIntelligentVoice engine.`);
245}).catch((err: BusinessError) => {
246  console.error(`Failed to create wakeupIntelligentVoice engine, Code:${err.code}, message:${err.message}`);
247});
248```
249
250## IntelligentVoiceManager
251
252智能语音管理类,使用前需要通过[getIntelligentVoiceManager()](#intelligentvoicegetintelligentvoicemanager)获取智能语音管理实例。
253
254### getCapabilityInfo
255
256getCapabilityInfo(): Array&lt;IntelligentVoiceEngineType&gt;
257
258获取支持的智能语音引擎列表信息。
259
260**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
261
262**系统能力:** SystemCapability.AI.IntelligentVoice.Core
263
264**返回值:**
265
266| 类型                                             | 说明                           |
267| ----------------------------------------------- | ---------------------------- |
268|  Array\<[IntelligentVoiceEngineType](#intelligentvoiceenginetype)\>            | 支持的智能语音引擎类型数组。              |
269
270**示例:**
271
272```ts
273if (intelligentVoiceManager != null) {
274  let info = intelligentVoiceManager.getCapabilityInfo();
275}
276```
277
278### on('serviceChange')
279
280on(type: 'serviceChange', callback: Callback&lt;ServiceChangeType&gt;): void
281
282订阅服务变更事件。当智能语音业务状态发生变化时,调用回调。
283
284**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
285
286**系统能力:** SystemCapability.AI.IntelligentVoice.Core
287
288**参数:**
289
290| 参数名     | 类型                              | 必填 | 说明                                          |
291| -------- | -------------------------------- | --- | ------------------------------------------- |
292| type     | string                           | 是   | 系统服务变更事件,固定取值为'serviceChange',表示服务变更事件。 |
293| callback | Callback\<[ServiceChangeType](#servicechangetype)\> | 是   | 服务状态变更对应的处理。|
294
295**示例:**
296
297```ts
298if (intelligentVoiceManager != null) {
299  intelligentVoiceManager.on('serviceChange', (serviceChangeType: intelligentVoice.ServiceChangeType) => {});
300}
301```
302
303### off('serviceChange')
304
305off(type: 'serviceChange', callback?: Callback\<ServiceChangeType\>): void
306
307取消订阅服务变更事件。
308
309**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
310
311**系统能力:** SystemCapability.AI.IntelligentVoice.Core
312
313**参数:**
314
315| 参数名     | 类型                              | 必填 | 说明                                          |
316| -------- | -------------------------------- | --- | ------------------------------------------- |
317| type     | string                           | 是   | 系统服务变更事件,固定取值为'serviceChange'。 |
318| callback | Callback\<[ServiceChangeType](#servicechangetype)\> | 否   | 服务状态变更对应的处理,无参数,则取消所有订阅,否则,取消对应的处理。|
319
320**示例:**
321
322```ts
323if (intelligentVoiceManager != null) {
324  intelligentVoiceManager.off('serviceChange');
325}
326```
327
328## ServiceChangeType
329
330枚举,服务状态变更类型。
331
332**系统能力:** SystemCapability.AI.IntelligentVoice.Core
333
334| 名称                       | 值   | 说明            |
335| ------------------------- | ---- | ------------    |
336| SERVICE_UNAVAILABLE      | 0    | 服务状态不可用。   |
337
338## IntelligentVoiceEngineType
339
340枚举,智能语音引擎类型。
341
342**系统能力:** SystemCapability.AI.IntelligentVoice.Core
343
344| 名称                       | 值   | 说明            |
345| ------------------------- | ---- | ------------    |
346| ENROLL_ENGINE_TYPE      | 0    | 语音注册引擎。   |
347| WAKEUP_ENGINE_TYPE      | 1    | 语音唤醒引擎。   |
348| UPDATE_ENGINE_TYPE      | 2    | 静默升级引擎。   |
349
350## EnrollIntelligentVoiceEngineDescriptor
351
352注册智能语音引擎描述符。
353
354**系统能力:** SystemCapability.AI.IntelligentVoice.Core
355
356| 名称   | 类型                            |     必填     | 说明       |
357| ------ | ----------------------------- | -------------- | ---------- |
358| wakeupPhrase | string |        是       | 唤醒词。 |
359
360## WakeupIntelligentVoiceEngineDescriptor
361
362唤醒智能语音引擎描述符。
363
364**系统能力:** SystemCapability.AI.IntelligentVoice.Core
365
366| 名称   | 类型                            |     必填     | 说明       |
367| ------ | ----------------------------- | -------------- | ---------- |
368| needReconfirm | boolean |        是       | 是否需要再次确认唤醒结果,true为需要,false为不需要。 |
369| wakeupPhrase | string |        是       | 唤醒词。 |
370
371## EnrollEngineConfig
372
373描述注册引擎配置。
374
375**系统能力:** SystemCapability.AI.IntelligentVoice.Core
376
377| 名称   | 类型                            |     必填     | 说明       |
378| ------ | ----------------------------- | -------------- | ---------- |
379| language | string |        是       | 注册引擎支持的语言,当前仅支持中文,取值为'zh'。 |
380| region | string |        是       | 注册引擎支持的区域。当前仅支持中国,取值为'CN'。 |
381
382## SensibilityType
383
384枚举,唤醒灵敏度类型。
385灵敏度用于调整唤醒的门限,灵敏度越高,门限越低,就越容易唤醒。
386
387**系统能力:** SystemCapability.AI.IntelligentVoice.Core
388
389| 名称                       | 值   | 说明            |
390| ------------------------- | ---- | ------------    |
391| LOW_SENSIBILITY      | 1    | 低灵敏度。   |
392| MIDDLE_SENSIBILITY      | 2    | 中灵敏度。   |
393| HIGH_SENSIBILITY      | 3    | 高灵敏度。   |
394
395## WakeupHapInfo
396
397描述唤醒应用的hap信息。
398
399**系统能力:** SystemCapability.AI.IntelligentVoice.Core
400
401| 名称   | 类型                            |     必填     | 说明       |
402| ------ | ----------------------------- | -------------- | ---------- |
403| bundleName | string |        是       | 唤醒应用的bundleName。 |
404| abilityName | string |        是       | 唤醒应用的ailityName。 |
405
406## WakeupIntelligentVoiceEventType
407
408枚举,唤醒智能语音事件类型。
409
410**系统能力:** SystemCapability.AI.IntelligentVoice.Core
411
412| 名称                       | 值   | 说明            |
413| ------------------------- | ---- | ------------    |
414| INTELLIGENT_VOICE_EVENT_WAKEUP_NONE      | 0    | 无唤醒。   |
415| INTELLIGENT_VOICE_EVENT_RECOGNIZE_COMPLETE      | 1    | 唤醒识别完成。   |
416
417## IntelligentVoiceErrorCode
418
419枚举,智能语音错误码。
420
421**系统能力:** SystemCapability.AI.IntelligentVoice.Core
422
423| 名称                       | 值   | 说明            |
424| ------------------------- | ---- | ------------    |
425| INTELLIGENT_VOICE_NO_MEMORY      | 22700101    | 内存不足。   |
426| INTELLIGENT_VOICE_INVALID_PARAM      | 22700102    | 参数无效。  |
427| INTELLIGENT_VOICE_INIT_FAILED      | 22700103    | 注册失败。   |
428| INTELLIGENT_VOICE_COMMIT_ENROLL_FAILED      | 22700104    | 确认注册结果失败。   |
429
430## EnrollResult
431
432枚举,注册结果。
433
434**系统能力:** SystemCapability.AI.IntelligentVoice.Core
435
436| 名称                       | 值   | 说明            |
437| ------------------------- | ---- | ------------    |
438| SUCCESS      | 0    | 注册成功。   |
439| VPR_TRAIN_FAILED      | -1    | 声纹训练失败。  |
440| WAKEUP_PHRASE_NOT_MATCH      | -2    | 唤醒短语不匹配。   |
441| TOO_NOISY      | -3    | 周边环境太吵。   |
442| TOO_LOUD      | -4    | 声音太大。   |
443| INTERVAL_LARGE      | -5    | 唤醒词时间间隔太大。   |
444| DIFFERENT_PERSON      | -6    | 不同人注册唤醒词。   |
445| UNKNOWN_ERROR      | -100    | 未知错误。   |
446
447## EnrollCallbackInfo
448
449注册回调信息。
450
451**系统能力:** SystemCapability.AI.IntelligentVoice.Core
452
453| 名称   | 类型                            |     必填     | 说明       |
454| ------ | ----------------------------- | -------------- | ---------- |
455| result | [EnrollResult](#enrollresult) |        是       | 注册结果。 |
456| context | string |        是       | 描述注册事件上下文。 |
457
458## WakeupIntelligentVoiceEngineCallbackInfo
459
460描述唤醒智能语音引擎回调信息。
461
462**系统能力:** SystemCapability.AI.IntelligentVoice.Core
463
464| 名称   | 类型                            |     必填     | 说明       |
465| ------ | ----------------------------- | -------------- | ---------- |
466| eventId | [WakeupIntelligentVoiceEventType](#wakeupintelligentvoiceeventtype) |        是       | 唤醒智能语音事件类型。 |
467| isSuccess | boolean |        是       | 是否唤醒成功,false为唤醒失败,true为唤醒成功。 |
468| context | string |        是       | 描述唤醒事件上下文。 |
469
470## EnrollIntelligentVoiceEngine
471
472实现注册智能语音引擎,通过[createEnrollIntelligentVoiceEngine()](#intelligentvoicecreateenrollintelligentvoiceengine)获取注册智能语音引擎。
473
474### getSupportedRegions
475
476getSupportedRegions(callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
477
478获取支持的区域,使用callback异步回调。
479
480**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
481
482**系统能力:** SystemCapability.AI.IntelligentVoice.Core
483
484**参数:**
485
486| 参数名     | 类型                              | 必填 | 说明                                          |
487| -------- | -------------------------------- | --- | ------------------------------------------- |
488| callback     | AsyncCallback&lt;Array&lt;string&gt;&gt;         | 是   | 返回支持区域的数组,当前只支持中国,对应取值为'CN'。 |
489
490**示例:**
491
492```ts
493import { BusinessError } from '@ohos.base';
494
495let regions: Array<string> | null = null;
496if (enrollIntelligentVoiceEngine != null) {
497  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).getSupportedRegions((err: BusinessError, data: Array<string>) => {
498    if (err) {
499      console.error(`Failed to get supported regions, Code:${err.code}, message:${err.message}`);
500    } else {
501      regions = data;
502      console.info(`Succeeded in getting supported regions, regions:${regions}.`);
503    }
504  });
505}
506```
507
508### getSupportedRegions
509
510getSupportedRegions(): Promise&lt;Array&lt;string&gt;&gt;
511
512获取支持的区域,使用Promise异步回调。
513
514**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
515
516**系统能力:** SystemCapability.AI.IntelligentVoice.Core
517
518**返回值:**
519
520| 类型                                             | 说明                           |
521| ----------------------------------------------- | ---------------------------- |
522|  Promise&lt;Array&lt;string&gt;&gt;            | 返回支持区域的数组,当前只支持中国,对应取值为'CN'。                   |
523
524**示例:**
525
526```ts
527import { BusinessError } from '@ohos.base';
528
529let regions: Array<string> | null = null;
530if (enrollIntelligentVoiceEngine != null) {
531  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).getSupportedRegions().then((data: Array<string>) => {
532    regions = data;
533    console.info('Succeeded in getting supported regions, regions:${regions}.');
534  }).catch((err: BusinessError) => {
535    console.error(`Failed to get supported regions, Code:${err.code}, message:${err.message}`);
536  });
537}
538```
539
540### init
541
542init(config: EnrollEngineConfig, callback: AsyncCallback&lt;void&gt;): void
543
544初始化注册智能语音引擎,使用callback异步回调。
545
546**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
547
548**系统能力:** SystemCapability.AI.IntelligentVoice.Core
549
550**参数:**
551
552| 参数名     | 类型                              | 必填 | 说明                                          |
553| -------- | -------------------------------- | --- | ------------------------------------------- |
554| config     | [EnrollEngineConfig](#enrollengineconfig)                           | 是   | 注册引擎配置。 |
555| callback     |AsyncCallback&lt;void&gt;                           | 是   | 返回初始化结果。 |
556
557**错误码:**
558
559以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
560
561| 错误码ID | 错误信息 |
562| ------- | --------------------------------------------|
563| 22700102 | Input parameter value error.                            |
564| 22700103 | Init failed.                           |
565
566**示例:**
567
568```ts
569import { BusinessError } from '@ohos.base';
570
571let config: intelligentVoice.EnrollEngineConfig = {
572  language: 'zh',
573  region: 'CN',
574}
575if (enrollIntelligentVoiceEngine != null) {
576  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).init(config, (err: BusinessError) => {
577    if (err) {
578      console.error(`Failed to initialize enrollIntelligentVoice engine. Code:${err.code}, message:${err.message}`);
579    } else {
580      console.info(`Succeeded in initialzing enrollIntelligentVoice engine.`);
581    }
582  });
583}
584```
585
586### init
587
588init(config: EnrollEngineConfig): Promise&lt;void&gt;
589
590初始化注册智能语音引擎,使用Promise异步回调。
591
592**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
593
594**系统能力:** SystemCapability.AI.IntelligentVoice.Core
595
596**参数:**
597
598| 参数名     | 类型                              | 必填 | 说明                                          |
599| -------- | -------------------------------- | --- | ------------------------------------------- |
600| config     | [EnrollEngineConfig](#enrollengineconfig)                           | 是   | config表示注册引擎配置。 |
601
602**返回值:**
603
604| 类型                                             | 说明                           |
605| ----------------------------------------------- | ---------------------------- |
606|  Promise&lt;void&gt;           | 无返回结果的Promise对象。                   |
607
608**错误码:**
609
610以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
611
612| 错误码ID | 错误信息 |
613| ------- | --------------------------------------------|
614| 22700102 | Input parameter value error.                            |
615| 22700103 | Init failed.                           |
616
617**示例:**
618
619```ts
620import { BusinessError } from '@ohos.base';
621
622let config: intelligentVoice.EnrollEngineConfig = {
623  language: 'zh',
624  region: 'CN',
625}
626if (enrollIntelligentVoiceEngine != null) {
627  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).init(config).then(() => {
628    console.info(`Succeeded in initializing enrollIntelligentVoice engine.`);
629  }).catch((err: BusinessError) => {
630    console.error(`Failed to initialize enrollIntelligentVoice engine. Code:${err.code}, message:${err.message}`);
631  });
632}
633
634```
635
636### enrollForResult
637
638enrollForResult(isLast: boolean, callback: AsyncCallback&lt;EnrollCallbackInfo&gt;): void
639
640获取注册结果,使用callback异步回调。
641
642**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
643
644**系统能力:** SystemCapability.AI.IntelligentVoice.Core
645
646**参数:**
647
648| 参数名     | 类型                              | 必填 | 说明                                          |
649| -------- | -------------------------------- | --- | ------------------------------------------- |
650| isLast     | boolean                           | 是   | isLast表示是否为最后一次注册,false为非最后一次,true为最后一次。 |
651| callback     | AsyncCallback&lt;[EnrollCallbackInfo](#enrollcallbackinfo)&gt;                           | 是   | 返回注册结果。 |
652
653**示例:**
654
655```ts
656import { BusinessError } from '@ohos.base';
657
658let callbackInfo: intelligentVoice.EnrollCallbackInfo | null = null;
659if (enrollIntelligentVoiceEngine != null) {
660  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).enrollForResult(true, (err: BusinessError, data: intelligentVoice.EnrollCallbackInfo) => {
661    if (err) {
662      console.error(`Failed to enroll for result, Code:${err.code}, message:${err.message}`);
663    } else {
664      callbackInfo = data;
665      console.info(`Succeeded in enrolling for result, info:${callbackInfo}.`);
666    }
667  });
668}
669```
670
671### enrollForResult
672
673enrollForResult(isLast: boolean): Promise&lt;EnrollCallbackInfo&gt;
674
675获取注册结果,使用Promise异步回调。
676
677**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
678
679**系统能力:** SystemCapability.AI.IntelligentVoice.Core
680
681**参数:**
682
683| 参数名     | 类型                              | 必填 | 说明                                          |
684| -------- | -------------------------------- | --- | ------------------------------------------- |
685| isLast     | boolean                           | 是   | isLast表示是否为最后一次注册,false为非最后一次,true为最后一次。 |
686
687**返回值:**
688
689| 类型                                             | 说明                           |
690| ----------------------------------------------- | ---------------------------- |
691|  Promise&lt;[EnrollCallbackInfo](#enrollcallbackinfo)&gt;            | 返回注册结果。                   |
692
693**示例:**
694
695```ts
696import { BusinessError } from '@ohos.base';
697
698let callbackInfo: intelligentVoice.EnrollCallbackInfo | null = null;
699if (enrollIntelligentVoiceEngine != null) {
700  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).enrollForResult(true).then((data: intelligentVoice.EnrollCallbackInfo) => {
701    callbackInfo = data;
702    console.info(`Succeeded in enrolling for result, info:${callbackInfo}.`);
703  }).catch((err: BusinessError) => {
704    console.error(`Failed to enroll for result, Code:${err.code}, message:${err.message}`);
705  });
706}
707```
708
709### stop
710
711stop(callback: AsyncCallback&lt;void&gt;): void
712
713停止注册,使用callback异步回调。
714
715**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
716
717**系统能力:** SystemCapability.AI.IntelligentVoice.Core
718
719| 参数名     | 类型                              | 必填 | 说明                                          |
720| -------- | -------------------------------- | --- | ------------------------------------------- |
721| callback     |  AsyncCallback&lt;void&gt;                           | 是   | 返回停止结果。 |
722
723**示例:**
724
725```ts
726import { BusinessError } from '@ohos.base';
727
728if (enrollIntelligentVoiceEngine != null) {
729  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).stop((err: BusinessError) => {
730    if (err) {
731      console.error(`Failed to stop enrollIntelligentVoice engine, Code:${err.code}, message:${err.message}`);
732    } else {
733      console.info(`Succeeded in stopping enrollIntelligentVoice engine.`);
734    }
735  });
736}
737```
738
739### stop
740
741stop(): Promise&lt;void&gt;
742
743停止注册,使用Promise异步回调。
744
745**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
746
747**系统能力:** SystemCapability.AI.IntelligentVoice.Core
748
749**返回值:**
750
751| 类型                                             | 说明                           |
752| ----------------------------------------------- | ---------------------------- |
753|  Promise&lt;void&gt;            | 无返回结果的Promise对象。                   |
754
755**示例:**
756
757```ts
758import { BusinessError } from '@ohos.base';
759
760if (enrollIntelligentVoiceEngine != null) {
761  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).stop().then(() => {
762    console.info(`Succeeded in stopping enrollIntelligentVoice engine.`);
763  }).catch((err:BusinessError) => {
764    console.error(`Failed to stop enrollIntelligentVoice engine, Code:${err.code}, message:${err.message}`);
765  });
766}
767```
768
769### commit
770
771commit(callback: AsyncCallback&lt;void&gt;): void
772
773提交注册,使用callback异步回调。
774
775**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
776
777**系统能力:** SystemCapability.AI.IntelligentVoice.Core
778
779**参数:**
780
781| 参数名     | 类型                              | 必填 | 说明                                          |
782| -------- | -------------------------------- | --- | ------------------------------------------- |
783| callback     | AsyncCallback&lt;void&gt;                           | 是   | 返回确认注册结果。 |
784
785**错误码:**
786
787以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
788
789| 错误码ID | 错误信息 |
790| ------- | --------------------------------------------|
791| 22700104 | Commit enroll failed.                           |
792
793**示例:**
794
795```ts
796import { BusinessError } from '@ohos.base';
797
798if (enrollIntelligentVoiceEngine != null) {
799  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).commit((err: BusinessError) => {
800    if (err) {
801      console.error(`Failed to commit enroll, Code:${err.code}, message:${err.message}`);
802    } else {
803      console.info(`Succeeded in committing enroll.`);
804    }
805  });
806}
807```
808
809### commit
810
811commit(): Promise&lt;void&gt;
812
813提交注册,使用Promise异步回调。
814
815**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
816
817**系统能力:** SystemCapability.AI.IntelligentVoice.Core
818
819**返回值:**
820
821| 类型                                             | 说明                           |
822| ----------------------------------------------- | ---------------------------- |
823|  Promise&lt;void&gt;           | 无返回结果的Promise对象。                   |
824
825**错误码:**
826
827以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
828
829| 错误码ID | 错误信息 |
830| ------- | --------------------------------------------|
831| 22700104 | Commit enroll failed.                           |
832
833**示例:**
834
835```ts
836import { BusinessError } from '@ohos.base';
837
838if (enrollIntelligentVoiceEngine != null) {
839  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).commit().then(() => {
840    console.info(`Succeeded in committing enroll.`);
841  }).catch((err: BusinessError) => {
842    console.error(`Failed to commit enroll, Code:${err.code}, message:${err.message}`);
843  });
844}
845```
846
847### setWakeupHapInfo
848
849setWakeupHapInfo(info: WakeupHapInfo, callback: AsyncCallback\<void>): void
850
851设置唤醒应用的hap信息,使用callback异步回调。
852
853**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
854
855**系统能力:** SystemCapability.AI.IntelligentVoice.Core
856
857**参数:**
858
859| 参数名     | 类型                              | 必填 | 说明                                          |
860| -------- | -------------------------------- | --- | ------------------------------------------- |
861| info     | [WakeupHapInfo](#wakeuphapinfo)                           | 是   | 唤醒hap信息。 |
862| callback     | AsyncCallback\<void\>                          | 是   | 返回设置唤醒hap信息的结果。 |
863
864**错误码:**
865
866以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
867
868| 错误码ID | 错误信息 |
869| ------- | --------------------------------------------|
870| 22700102 | Input parameter value error.                            |
871
872**示例:**
873
874```ts
875import { BusinessError } from '@ohos.base';
876
877let info: intelligentVoice.WakeupHapInfo = {
878  bundleName: 'com.wakeup',
879  abilityName: 'WakeUpExtAbility',
880}
881if (enrollIntelligentVoiceEngine != null) {
882  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).setWakeupHapInfo(info, (err: BusinessError) => {
883    if (err) {
884      console.error(`Failed to set wakeup hap info, Code:${err.code}, message:${err.message}`);
885    } else {
886      console.info(`Succeeded in setting wakeup hap info.`);
887    }
888  });
889}
890```
891
892### setWakeupHapInfo
893
894setWakeupHapInfo(info: WakeupHapInfo): Promise\<void\>
895
896设置唤醒应用的hap信息,使用Promise异步回调。
897
898**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
899
900**系统能力:** SystemCapability.AI.IntelligentVoice.Core
901
902**返回值:**
903
904| 类型                                             | 说明                           |
905| ----------------------------------------------- | ---------------------------- |
906|  Promise&lt;void&gt;            | 无返回结果的Promise对象。                   |
907
908**错误码:**
909
910以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
911
912| 错误码ID | 错误信息 |
913| ------- | --------------------------------------------|
914| 22700102 | Input parameter value error.                            |
915
916**示例:**
917
918```ts
919import { BusinessError } from '@ohos.base';
920
921let info: intelligentVoice.WakeupHapInfo = {
922  bundleName: 'com.wakeup',
923  abilityName: 'WakeUpExtAbility',
924}
925if (enrollIntelligentVoiceEngine != null) {
926  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).setWakeupHapInfo(info).then(() => {
927    console.info(`Succeeded in setting wakeup hap info.`);
928  }).catch((err: BusinessError) => {
929    console.error(`Failed to set wakeup hap info, Code:${err.code}, message:${err.message}`);
930  });
931}
932```
933
934### setSensibility
935
936setSensibility(sensibility: SensibilityType, callback: AsyncCallback\<void\>): void
937
938设置唤醒灵敏度,使用callback异步回调。
939
940**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
941
942**系统能力:** SystemCapability.AI.IntelligentVoice.Core
943
944**参数:**
945
946| 参数名     | 类型                              | 必填 | 说明                                          |
947| -------- | -------------------------------- | --- | ------------------------------------------- |
948| sensibility     | [SensibilityType](#sensibilitytype)                           | 是   | 灵敏度类型。 |
949| callback     | AsyncCallback\<void\>                         | 是   | 返回设置灵敏度的结果。 |
950
951**错误码:**
952
953以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
954
955| 错误码ID | 错误信息 |
956| ------- | --------------------------------------------|
957| 22700102 | Input parameter value error.                            |
958
959**示例:**
960
961```ts
962import { BusinessError } from '@ohos.base';
963
964if (enrollIntelligentVoiceEngine != null) {
965  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).setSensibility(intelligentVoice.SensibilityType.LOW_SENSIBILITY, (err: BusinessError) => {
966    if (err) {
967      console.error(`Failed to set sensibility, Code:${err.code}, message:${err.message}`);
968    } else {
969      console.info(`Succeeded in setting sensibility.`);
970    }
971  });
972}
973```
974
975### setSensibility
976
977setSensibility(sensibility: SensibilityType): Promise\<void\>
978
979设置唤醒灵敏度,使用Promise异步回调。
980
981**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
982
983**系统能力:** SystemCapability.AI.IntelligentVoice.Core
984
985**参数:**
986
987| 参数名     | 类型                              | 必填 | 说明                                          |
988| -------- | -------------------------------- | --- | ------------------------------------------- |
989| sensibility     | [SensibilityType](#sensibilitytype)                           | 是   | 灵敏度类型。 |
990
991**返回值:**
992
993| 类型                                             | 说明                           |
994| ----------------------------------------------- | ---------------------------- |
995|  Promise&lt;void&gt;            | 无返回结果的Promise对象。                   |
996
997**错误码:**
998
999以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
1000
1001| 错误码ID | 错误信息 |
1002| ------- | --------------------------------------------|
1003| 22700102 | Input parameter value error.                            |
1004
1005**示例:**
1006
1007```ts
1008import { BusinessError } from '@ohos.base';
1009
1010if (enrollIntelligentVoiceEngine != null) {
1011  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).setSensibility(intelligentVoice.SensibilityType.LOW_SENSIBILITY).then(() => {
1012    console.info(`Succeeded in setting sensibility.`);
1013  }).catch((err: BusinessError) => {
1014    console.error(`Failed to set sensibility, Code:${err.code}, message:${err.message}`);
1015  });
1016}
1017```
1018
1019### setParameter
1020
1021setParameter(key: string, value: string, callback: AsyncCallback\<void\>): void
1022
1023设置指定的智能语音参数,使用callback异步回调。
1024
1025**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1026
1027**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1028
1029**参数:**
1030
1031| 参数名     | 类型                              | 必填 | 说明                                          |
1032| -------- | -------------------------------- | --- | ------------------------------------------- |
1033| key     | string                           | 是   | 键。 |
1034| value     | string                           | 是   | 值。 |
1035| callback     | AsyncCallback\<void\>                           | 是   | 返回设置智能语音参数的结果。 |
1036
1037**错误码:**
1038
1039以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
1040
1041| 错误码ID | 错误信息 |
1042| ------- | --------------------------------------------|
1043| 22700102 | Input parameter value error.                            |
1044
1045**示例:**
1046
1047```ts
1048import { BusinessError } from '@ohos.base';
1049
1050if (enrollIntelligentVoiceEngine != null) {
1051  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).setParameter('scene', '0', (err: BusinessError) => {
1052    if (err) {
1053      console.error(`Failed to set parameter, Code:${err.code}, message:${err.message}`);
1054    } else {
1055      console.info(`Succeeded in setting parameter`);
1056    }
1057  });
1058}
1059```
1060
1061### setParameter
1062
1063setParameter(key: string, value: string): Promise\<void\>
1064
1065设置指定的智能语音参数,使用Promise异步回调。
1066
1067**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1068
1069**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1070
1071**参数:**
1072
1073| 参数名     | 类型                              | 必填 | 说明                                          |
1074| -------- | -------------------------------- | --- | ------------------------------------------- |
1075| key     | string                           | 是   | 键。 |
1076| value     | string                           | 是   | 值。 |
1077
1078**返回值:**
1079
1080| 类型                                             | 说明                           |
1081| ----------------------------------------------- | ---------------------------- |
1082|  Promise&lt;void&gt;            | 无返回结果的Promise对象。                   |
1083
1084**错误码:**
1085
1086以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
1087
1088| 错误码ID | 错误信息 |
1089| ------- | --------------------------------------------|
1090| 22700102 | Input parameter value error.                            |
1091
1092**示例:**
1093
1094```ts
1095import { BusinessError } from '@ohos.base';
1096
1097if (enrollIntelligentVoiceEngine != null) {
1098  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).setParameter('scene', '0').then(() => {
1099    console.info(`Succeeded in setting parameter`);
1100  }).catch((err: BusinessError) => {
1101    console.error(`Failed to set parameter, Code:${err.code}, message:${err.message}`);
1102  });
1103}
1104```
1105
1106### getParameter
1107
1108getParameter(key: string, callback: AsyncCallback\<string\>): void
1109
1110获取指定的智能语音参数,使用callback异步回调。
1111
1112**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1113
1114**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1115
1116**参数:**
1117
1118| 参数名     | 类型                              | 必填 | 说明                                          |
1119| -------- | -------------------------------- | --- | ------------------------------------------- |
1120| key     | string                           | 是   | 键。 |
1121| callback     | AsyncCallback\<string\>                           | 是   | 返回智能语音参数。 |
1122
1123**错误码:**
1124
1125以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
1126
1127| 错误码ID | 错误信息 |
1128| ------- | --------------------------------------------|
1129| 22700102 | Input parameter value error.                            |
1130
1131**示例:**
1132
1133```ts
1134import { BusinessError } from '@ohos.base';
1135
1136if (enrollIntelligentVoiceEngine != null) {
1137  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).getParameter('key', (err: BusinessError, data: string) => {
1138    if (err) {
1139      console.error(`Failed to get parameter, Code:${err.code}, message:${err.message}`);
1140    } else {
1141      let param: string = data;
1142      console.info(`Succeeded in getting parameter, param:${param}`);
1143    }
1144  });
1145}
1146```
1147
1148### getParameter
1149
1150getParameter(key: string): Promise\<string\>
1151
1152获取指定的智能语音参数,使用Promise异步回调。
1153
1154**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1155
1156**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1157
1158**参数:**
1159
1160| 参数名     | 类型                              | 必填 | 说明                                          |
1161| -------- | -------------------------------- | --- | ------------------------------------------- |
1162| key     | string                           | 是   | 键。 |
1163
1164**返回值:**
1165
1166| 类型                                             | 说明                           |
1167| ----------------------------------------------- | ---------------------------- |
1168|  Promise\<string\>            | 返回智能语音参数。                   |
1169
1170**错误码:**
1171
1172以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
1173
1174| 错误码ID | 错误信息 |
1175| ------- | --------------------------------------------|
1176| 22700102 | Input parameter value error.                            |
1177
1178**示例:**
1179
1180```ts
1181import { BusinessError } from '@ohos.base';
1182
1183if (enrollIntelligentVoiceEngine != null) {
1184  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).getParameter('key').then((data: string) => {
1185    let param: string = data;
1186    console.info(`Succeeded in getting parameter, param:${param}`);
1187  }).catch((err: BusinessError) => {
1188    console.error(`Failed to get parameter, Code:${err.code}, message:${err.message}`);
1189  });
1190}
1191```
1192
1193### release
1194
1195release(callback: AsyncCallback&lt;void&gt;): void
1196
1197释放注册智能语音引擎,使用callback异步回调。
1198
1199**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1200
1201**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1202
1203**参数:**
1204
1205| 参数名     | 类型                              | 必填 | 说明                                          |
1206| -------- | -------------------------------- | --- | ------------------------------------------- |
1207| callback     | AsyncCallback\<void\>                           | 是   | 返回释放注册引擎的结果。 |
1208
1209**示例:**
1210
1211```ts
1212import { BusinessError } from '@ohos.base';
1213
1214if (enrollIntelligentVoiceEngine != null) {
1215  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).release((err: BusinessError) => {
1216    if (err) {
1217      console.error(`Failed to release enrollIntelligentVoice engine, Code:${err.code}, message:${err.message}`);
1218    } else {
1219      console.info(`Succeeded in releasing enrollIntelligentVoice engine.`);
1220    }
1221  });
1222}
1223```
1224
1225### release
1226
1227release(): Promise&lt;void&gt;
1228
1229释放注册智能语音引擎,使用Promise异步回调。
1230
1231**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1232
1233**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1234
1235**返回值:**
1236
1237| 类型                                             | 说明                           |
1238| ----------------------------------------------- | ---------------------------- |
1239|  Promise&lt;void&gt;            | 无返回结果的Promise对象。                  |
1240
1241**示例:**
1242
1243```ts
1244import { BusinessError } from '@ohos.base';
1245
1246if (enrollIntelligentVoiceEngine != null) {
1247  (enrollIntelligentVoiceEngine as intelligentVoice.EnrollIntelligentVoiceEngine).release().then(() => {
1248    console.info(`Succeeded in releasing enrollIntelligentVoice engine.`);
1249  }).catch((err: BusinessError) => {
1250    console.error(`Failed to release enrollIntelligentVoice engine, Code:${err.code}, message:${err.message}`);
1251  });
1252}
1253```
1254
1255## WakeupIntelligentVoiceEngine
1256
1257实现唤醒智能语音引擎,通过[createWakeupIntelligentVoiceEngine()](#intelligentvoicecreatewakeupintelligentvoiceengine)获取唤醒智能语音引擎。
1258
1259### getSupportedRegions
1260
1261getSupportedRegions(callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
1262
1263获取支持的区域,使用callback异步回调。
1264
1265**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1266
1267**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1268
1269| 参数名     | 类型                              | 必填 | 说明                                          |
1270| -------- | -------------------------------- | --- | ------------------------------------------- |
1271| callback     | AsyncCallback&lt;Array&lt;string&gt;&gt;                           | 是   | 返回支持区域的数组,当前只支持中国,对应取值为'CN'。 |
1272
1273**示例:**
1274
1275```ts
1276import { BusinessError } from '@ohos.base';
1277
1278if (wakeupIntelligentVoiceEngine != null) {
1279  (wakeupIntelligentVoiceEngine as intelligentVoice.WakeupIntelligentVoiceEngine).getSupportedRegions((err: BusinessError, data: Array<string>) => {
1280    if (err) {
1281      console.error(`Failed to get supported regions, Code:${err.code}, message:${err.message}`);
1282    } else {
1283      let regions: Array<string> = data;
1284      console.info(`Succeeded in getting supported regions, regions:${regions}.`);
1285    }
1286  });
1287}
1288```
1289
1290### getSupportedRegions
1291
1292getSupportedRegions(): Promise&lt;Array&lt;string&gt;&gt;
1293
1294获取支持的区域,使用Promise异步回调。
1295
1296**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1297
1298**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1299
1300**返回值:**
1301
1302| 类型                                             | 说明                           |
1303| ----------------------------------------------- | ---------------------------- |
1304|  Promise&lt;Array&lt;string&gt;&gt;            | 返回支持区域的数组,当前只支持中国,对应取值为'CN'。                   |
1305
1306**示例:**
1307
1308```ts
1309import { BusinessError } from '@ohos.base';
1310
1311if (wakeupIntelligentVoiceEngine != null) {
1312  (wakeupIntelligentVoiceEngine as intelligentVoice.WakeupIntelligentVoiceEngine).getSupportedRegions().then((data: Array<string>) => {
1313    let regions: Array<string> = data;
1314    console.info(`Succeeded in getting supported regions, regions:${regions}.`);
1315  }).catch((err: BusinessError) => {
1316    console.error(`Failed to get supported regions, Code:${err.code}, message:${err.message}`);
1317  });
1318}
1319```
1320
1321### setWakeupHapInfo
1322
1323setWakeupHapInfo(info: WakeupHapInfo, callback: AsyncCallback\<void\>): void
1324
1325设置唤醒应用的hap信息,使用callback异步回调。
1326
1327**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1328
1329**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1330
1331**参数:**
1332
1333| 参数名     | 类型                              | 必填 | 说明                                          |
1334| -------- | -------------------------------- | --- | ------------------------------------------- |
1335| info     | [WakeupHapInfo](#wakeuphapinfo)                           | 是   | 唤醒hap信息。 |
1336| callback     | AsyncCallback\<void\>                           | 是   | 返回设置唤醒hap信息的结果。 |
1337
1338**错误码:**
1339
1340以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
1341
1342| 错误码ID | 错误信息 |
1343| ------- | --------------------------------------------|
1344| 22700102 | Input parameter value error.                            |
1345
1346**示例:**
1347
1348```ts
1349import { BusinessError } from '@ohos.base';
1350
1351let hapInfo: intelligentVoice.WakeupHapInfo = {
1352  bundleName: 'com.wakeup',
1353  abilityName: 'WakeUpExtAbility',
1354}
1355
1356if (wakeupIntelligentVoiceEngine != null) {
1357  (wakeupIntelligentVoiceEngine as intelligentVoice.WakeupIntelligentVoiceEngine).setWakeupHapInfo(hapInfo, (err: BusinessError) => {
1358    if (err) {
1359      console.error(`Failed to set wakeup hap info, Code:${err.code}, message:${err.message}`);
1360    } else {
1361      console.info(`Succeeded in setting wakeup hap info.`);
1362    }
1363  });
1364}
1365```
1366
1367### setWakeupHapInfo
1368
1369setWakeupHapInfo(info: WakeupHapInfo): Promise\<void\>
1370
1371设置唤醒应用的hap信息,使用promise异步回调。
1372
1373**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1374
1375**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1376
1377**参数:**
1378
1379| 参数名     | 类型                              | 必填 | 说明                                          |
1380| -------- | -------------------------------- | --- | ------------------------------------------- |
1381| info     | [WakeupHapInfo](#wakeuphapinfo)                           | 是   | 唤醒hap信息。 |
1382
1383**返回值:**
1384
1385| 类型                                             | 说明                           |
1386| ----------------------------------------------- | ---------------------------- |
1387|  Promise&lt;void&gt;            | 无返回结果的Promise对象。                   |
1388
1389**错误码:**
1390
1391以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
1392
1393| 错误码ID | 错误信息 |
1394| ------- | --------------------------------------------|
1395| 22700102 | Input parameter value error.                            |
1396
1397**示例:**
1398
1399```ts
1400import { BusinessError } from '@ohos.base';
1401
1402let hapInfo: intelligentVoice.WakeupHapInfo = {
1403  bundleName: 'com.wakeup',
1404  abilityName: 'WakeUpExtAbility',
1405}
1406if (wakeupIntelligentVoiceEngine != null) {
1407  (wakeupIntelligentVoiceEngine as intelligentVoice.WakeupIntelligentVoiceEngine).setWakeupHapInfo(hapInfo).then(() => {
1408    console.info(`Succeeded in setting wakeup hap info.`);
1409  }).catch((err: BusinessError) => {
1410    console.error(`Failed to set wakeup hap info, Code:${err.code}, message:${err.message}`);
1411  });
1412}
1413```
1414
1415### setSensibility
1416
1417setSensibility(sensibility: SensibilityType, callback: AsyncCallback\<void\>): void
1418
1419设置唤醒灵敏度,使用callback异步回调。
1420
1421**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1422
1423**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1424
1425**参数:**
1426
1427| 参数名     | 类型                              | 必填 | 说明                                          |
1428| -------- | -------------------------------- | --- | ------------------------------------------- |
1429| sensibility     | [SensibilityType](#sensibilitytype)                           | 是   | 灵敏度类型。 |
1430| callback     | AsyncCallback\<void\>                           | 是   | 返回设置灵敏度的结果。 |
1431
1432**错误码:**
1433
1434以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
1435
1436| 错误码ID | 错误信息 |
1437| ------- | --------------------------------------------|
1438| 22700102 | Input parameter value error.                            |
1439
1440**示例:**
1441
1442```ts
1443import { BusinessError } from '@ohos.base';
1444
1445if (wakeupIntelligentVoiceEngine != null) {
1446  (wakeupIntelligentVoiceEngine as intelligentVoice.WakeupIntelligentVoiceEngine).setSensibility(intelligentVoice.SensibilityType.LOW_SENSIBILITY, (err: BusinessError) => {
1447    if (err) {
1448      console.error(`Failed to set sensibility, Code:${err.code}, message:${err.message}`);
1449    } else {
1450      console.info(`Succeeded in setting sensibility.`);
1451    }
1452  });
1453}
1454```
1455
1456### setSensibility
1457
1458setSensibility(sensibility: SensibilityType): Promise\<void\>
1459
1460设置唤醒灵敏度,使用Promise异步回调。
1461
1462**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1463
1464**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1465
1466**参数:**
1467
1468| 参数名     | 类型                              | 必填 | 说明                                          |
1469| -------- | -------------------------------- | --- | ------------------------------------------- |
1470| sensibility     | [SensibilityType](#sensibilitytype)                           | 是   | 灵敏度类型。 |
1471
1472**返回值:**
1473
1474| 类型                                             | 说明                           |
1475| ----------------------------------------------- | ---------------------------- |
1476|  Promise&lt;void&gt;            | 无返回结果的Promise对象。                   |
1477
1478**错误码:**
1479
1480以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
1481
1482| 错误码ID | 错误信息 |
1483| ------- | --------------------------------------------|
1484| 22700102 | Input parameter value error.                            |
1485
1486**示例:**
1487
1488```ts
1489import { BusinessError } from '@ohos.base';
1490
1491if (wakeupIntelligentVoiceEngine != null) {
1492  (wakeupIntelligentVoiceEngine as intelligentVoice.WakeupIntelligentVoiceEngine).setSensibility(intelligentVoice.SensibilityType.LOW_SENSIBILITY).then(() => {
1493    console.info(`Succeeded in setting sensibility.`);
1494  }).catch((err: BusinessError) => {
1495    console.error(`Failed to set sensibility, Code:${err.code}, message:${err.message}`);
1496  });
1497}
1498```
1499
1500### setParameter
1501
1502setParameter(key: string, value: string, callback: AsyncCallback\<void\>): void
1503
1504设置指定的智能语音参数,使用callback异步回调。
1505
1506**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1507
1508**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1509
1510**参数:**
1511
1512| 参数名     | 类型                              | 必填 | 说明                                          |
1513| -------- | -------------------------------- | --- | ------------------------------------------- |
1514| key     | string                           | 是   | 键。 |
1515| value     | string                           | 是   | 值。 |
1516| callback     | AsyncCallback\<void\>                           | 是   | 返回设置智能语音参数的结果。 |
1517
1518**错误码:**
1519
1520以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
1521
1522| 错误码ID | 错误信息 |
1523| ------- | --------------------------------------------|
1524| 22700102 | Input parameter value error.                            |
1525
1526**示例:**
1527
1528```ts
1529import { BusinessError } from '@ohos.base';
1530
1531if (wakeupIntelligentVoiceEngine != null) {
1532  (wakeupIntelligentVoiceEngine as intelligentVoice.WakeupIntelligentVoiceEngine).setParameter('scene', '0', (err: BusinessError) => {
1533    if (err) {
1534      console.error(`Failed to set parameter, Code:${err.code}, message:${err.message}`);
1535    } else {
1536      console.info(`Succeeded in setting parameter`);
1537    }
1538  });
1539}
1540```
1541
1542### setParameter
1543
1544setParameter(key: string, value: string): Promise\<void\>
1545
1546设置指定的智能语音参数,使用Promise异步回调。
1547
1548**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1549
1550**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1551
1552**参数:**
1553
1554| 参数名     | 类型                              | 必填 | 说明                                          |
1555| -------- | -------------------------------- | --- | ------------------------------------------- |
1556| key     | string                           | 是   | 键。 |
1557| value     | string                           | 是   | 值。 |
1558
1559**返回值:**
1560
1561| 类型                                             | 说明                           |
1562| ----------------------------------------------- | ---------------------------- |
1563|  Promise&lt;void&gt;            | 无返回结果的Promise对象。                   |
1564
1565**错误码:**
1566
1567以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
1568
1569| 错误码ID | 错误信息 |
1570| ------- | --------------------------------------------|
1571| 22700102 | Input parameter value error.                            |
1572
1573**示例:**
1574
1575```ts
1576import { BusinessError } from '@ohos.base';
1577
1578if (wakeupIntelligentVoiceEngine != null) {
1579  (wakeupIntelligentVoiceEngine as intelligentVoice.WakeupIntelligentVoiceEngine).setParameter('scene', '0').then(() => {
1580    console.info(`Succeeded in setting parameter`);
1581  }).catch((err: BusinessError) => {
1582    console.error(`Failed to set parameter, Code:${err.code}, message:${err.message}`);
1583  });
1584}
1585```
1586
1587### getParameter
1588
1589getParameter(key: string, callback: AsyncCallback\<string\>): void
1590
1591获取指定的智能语音参数,使用callback异步回调。
1592
1593**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1594
1595**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1596
1597**参数:**
1598
1599| 参数名     | 类型                              | 必填 | 说明                                          |
1600| -------- | -------------------------------- | --- | ------------------------------------------- |
1601| key     | string                           | 是   | 键。 |
1602| callback     | AsyncCallback\<string\>                           | 是   | 返回智能语音参数。 |
1603
1604**错误码:**
1605
1606以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
1607
1608| 错误码ID | 错误信息 |
1609| ------- | --------------------------------------------|
1610| 22700102 | Input parameter value error.                            |
1611
1612**示例:**
1613
1614```ts
1615import { BusinessError } from '@ohos.base';
1616
1617if (wakeupIntelligentVoiceEngine != null) {
1618  (wakeupIntelligentVoiceEngine as intelligentVoice.WakeupIntelligentVoiceEngine).getParameter('key', (err: BusinessError, data: string) => {
1619    if (err) {
1620      console.error(`Failed to get parameter, Code:${err.code}, message:${err.message}`);
1621    } else {
1622      let param: string = data;
1623      console.info(`Succeeded in getting parameter, param:${param}`);
1624    }
1625  });
1626}
1627```
1628
1629### getParameter
1630
1631getParameter(key: string): Promise\<string\>
1632
1633获取指定的智能语音参数,使用Promise异步回调。
1634
1635**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1636
1637**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1638
1639**参数:**
1640
1641| 参数名     | 类型                              | 必填 | 说明                                          |
1642| -------- | -------------------------------- | --- | ------------------------------------------- |
1643| key     | string                           | 是   | 键。 |
1644
1645**返回值:**
1646
1647| 类型                                             | 说明                           |
1648| ----------------------------------------------- | ---------------------------- |
1649|  Promise\<string\>            | 返回智能语音参数。                   |
1650
1651**错误码:**
1652
1653以下错误码的详细介绍请参见[智能语音错误码](../errorcodes/errorcode-intelligentVoice.md)。
1654
1655| 错误码ID | 错误信息 |
1656| ------- | --------------------------------------------|
1657| 22700102 | Input parameter value error.                            |
1658
1659**示例:**
1660
1661```ts
1662import { BusinessError } from '@ohos.base';
1663
1664if (wakeupIntelligentVoiceEngine != null) {
1665  (wakeupIntelligentVoiceEngine as intelligentVoice.WakeupIntelligentVoiceEngine).getParameter('key').then((data: string) => {
1666    let param: string = data;
1667    console.info(`Succeeded in getting parameter, param:${param}`);
1668  }).catch((err: BusinessError) => {
1669    console.error(`Failed to get parameter, Code:${err.code}, message:${err.message}`);
1670  });
1671}
1672```
1673
1674### release
1675
1676release(callback: AsyncCallback\<void\>): void
1677
1678释放唤醒智能语音引擎,使用callback异步回调。
1679
1680**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1681
1682**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1683
1684**参数:**
1685
1686| 参数名     | 类型                              | 必填 | 说明                                          |
1687| -------- | -------------------------------- | --- | ------------------------------------------- |
1688| callback     | AsyncCallback\<void\>                           | 是   | 返回释放唤醒引擎的结果。 |
1689
1690**示例:**
1691
1692```ts
1693import { BusinessError } from '@ohos.base';
1694
1695if (wakeupIntelligentVoiceEngine != null) {
1696  (wakeupIntelligentVoiceEngine as intelligentVoice.WakeupIntelligentVoiceEngine).release((err: BusinessError) => {
1697    if (err) {
1698      console.error(`Failed to release wakeupIntelligentVoice engine, Code:${err.code}, message:${err.message}`);
1699    } else {
1700      console.info(`Succeeded in releasing wakeupIntelligentVoice engine.`);
1701    }
1702  });
1703}
1704```
1705
1706### release
1707
1708release(): Promise\<void\>
1709
1710释放唤醒智能语音引擎,使用Promise异步回调。
1711
1712**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1713
1714**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1715
1716**返回值:**
1717
1718| 类型                                             | 说明                           |
1719| ----------------------------------------------- | ---------------------------- |
1720|  Promise&lt;void&gt;            | 无返回结果的Promise对象。                   |
1721
1722**示例:**
1723
1724```ts
1725import { BusinessError } from '@ohos.base';
1726
1727if (wakeupIntelligentVoiceEngine != null) {
1728  (wakeupIntelligentVoiceEngine as intelligentVoice.WakeupIntelligentVoiceEngine).release().then(() => {
1729    console.info(`Succeeded in releasing wakeupIntelligentVoice engine.`);
1730  }).catch((err: BusinessError) => {
1731    console.error(`Failed to release wakeupIntelligentVoice engine, Code:${err.code}, message:${err.message}`);
1732  });
1733}
1734```
1735
1736### on
1737
1738on(type: 'wakeupIntelligentVoiceEvent', callback: Callback\<WakeupIntelligentVoiceEngineCallbackInfo\>): void
1739
1740订阅唤醒事件。
1741
1742**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1743
1744**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1745
1746**参数:**
1747
1748| 参数名     | 类型                              | 必填 | 说明                                          |
1749| -------- | -------------------------------- | --- | ------------------------------------------- |
1750| type     | string          | 是   | 唤醒智能语音事件,固定取为'wakeupIntelligentVoiceEvent',表示智能语音唤醒事件。 |
1751| callback     | Callback\<[WakeupIntelligentVoiceEngineCallbackInfo](#wakeupintelligentvoiceenginecallbackinfo)\>                           | 是   | 收到唤醒事件的对应处理。 |
1752
1753**示例:**
1754
1755```ts
1756if (wakeupIntelligentVoiceEngine != null) {
1757  (wakeupIntelligentVoiceEngine as intelligentVoice.WakeupIntelligentVoiceEngine).on('wakeupIntelligentVoiceEvent',
1758    (info: intelligentVoice.WakeupIntelligentVoiceEngineCallbackInfo) => {
1759    let callbackInfo: intelligentVoice.WakeupIntelligentVoiceEngineCallbackInfo = info;
1760    console.info(`wakeup intelligentvoice event, info:${callbackInfo}`);
1761  });
1762}
1763```
1764
1765### off
1766
1767off(type: 'wakeupIntelligentVoiceEvent', callback?: Callback\<WakeupIntelligentVoiceEngineCallbackInfo\>): void;
1768
1769取消订阅唤醒事件。
1770
1771**需要权限:** ohos.permission.MANAGE_INTELLIGENT_VOICE
1772
1773**系统能力:** SystemCapability.AI.IntelligentVoice.Core
1774
1775**参数:**
1776
1777| 参数名     | 类型                              | 必填 | 说明                                          |
1778| -------- | -------------------------------- | --- | ------------------------------------------- |
1779| type     |string           | 是   | 唤醒智能语音事件,固定取为'wakeupIntelligentVoiceEvent'。 |
1780| callback     | Callback\<[WakeupIntelligentVoiceEngineCallbackInfo](#wakeupintelligentvoiceenginecallbackinfo)\>                           | 否   | 收到唤醒事件的对应处理。无参数,则取消所有的订阅,否则,取消对应的订阅 |
1781
1782**示例:**
1783
1784```ts
1785if (wakeupIntelligentVoiceEngine != null) {
1786  (wakeupIntelligentVoiceEngine as intelligentVoice.WakeupIntelligentVoiceEngine).off('wakeupIntelligentVoiceEvent');
1787}
1788```
1789