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