diff --git a/api/@ohos.ai.intelligentVoice.d.ts b/api/@ohos.ai.intelligentVoice.d.ts index 47b6dc2d0..a7e00e4a3 100755 --- a/api/@ohos.ai.intelligentVoice.d.ts +++ b/api/@ohos.ai.intelligentVoice.d.ts @@ -82,6 +82,183 @@ declare namespace intelligentVoice { off(type: 'serviceChange', callback?: Callback): void; } + /** + * Implements wakeup management. + * @typedef WakeupManager + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + interface WakeupManager { + /** + * Sets an intelligent voice parameter. This method uses a promise to return the result. + * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE + * @param { string } key - the key of the intelligent voice parameter to set. + * @param { string } value - the value of the intelligent voice parameter to set. + * @returns { Promise } the promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - if input parameter type or number mismatch. + * @throws { BusinessError } 22700102 - Input parameter value error. + * @throws { BusinessError } 22700107 - System error. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + setParameter(key: string, value: string): Promise; + /** + * Obtains the value of an intelligent voice parameter. This method uses a promise to return the query result. + * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE + * @param { string } key - the key of the intelligent voice parameter whose value is to be obtained. + * @returns { Promise } the promise used to return the value of the intelligent voice parameter. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - if input parameter type or number mismatch. + * @throws { BusinessError } 22700102 - Input parameter value error. + * @throws { BusinessError } 22700107 - System error. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + getParameter(key: string): Promise; + /** + * Obtains files needed to upload. This method uses a promise to return the files needed to upload. + * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE + * @param { number } maxCount - the maximum count of upload files. + * @returns { Promise> } the promise used to return the upload files. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - if input parameter type or number mismatch. + * @throws { BusinessError } 22700101 - No memory. + * @throws { BusinessError } 22700102 - Input parameter value error. + * @throws { BusinessError } 22700107 - System error. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + getUploadFiles (maxCount: number): Promise>; + /** + * Obtains wakeup source files. This method uses a promise to return the wakeup source files. + * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE + * @returns { Promise> } the promise used to return the wakeup source files. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 22700101 - No memory. + * @throws { BusinessError } 22700107 - System error. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + getWakeupSourceFiles(): Promise>; + /** + * Enrolls with wakeup files for result. This method uses a promise to return the enroll result. + * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE + * @param { Array } wakeupFiles - the wakeup source files needed. + * @param { string } wakeupInfo - wakeup information. + * @returns { Promise } the promise used to return the enroll result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - if input parameter type or number mismatch. + * @throws { BusinessError } 22700101 - No memory. + * @throws { BusinessError } 22700102 - Input parameter value error. + * @throws { BusinessError } 22700107 - System error. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + enrollWithWakeupFilesForResult(wakeupFiles: Array, wakeupInfo: string): Promise; + /** + * Clears user data. + * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE + * @returns { Promise } the promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 22700107 - System error. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + clearUserData(): Promise; + } + + /** + * Enumerates upload file type. + * @enum {number} + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + enum UploadFileType { + /** + * Enroll file. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + ENROLL_FILE = 0, + /** + * Wakeup file. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + WAKEUP_FILE = 1, + } + + /** + * Describes upload file information. + * @typedef UploadFile + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + interface UploadFile { + /** + * Report file type. + * @type { UploadFileType } + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + type: UploadFileType; + /** + * Files description. + * @type { string } + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + filesDescription: string; + /** + * Files content. + * @type { Array } + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + filesContent: Array; + } + + /** + * Describes wakeup source file information. + * @typedef WakeupSourceFile + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + interface WakeupSourceFile { + /** + * File path. + * @type { string } + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + filePath: string; + /** + * File content. + * @type { ArrayBuffer } + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + fileContent: ArrayBuffer; + } + /** * Enumerates service change type. * @enum {number} @@ -174,6 +351,153 @@ declare namespace intelligentVoice { wakeupPhrase: string; } + /** + * Enumerates evaluation result code. + * @enum {number} + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + enum EvaluationResultCode { + /** + * Unknown. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + UNKNOWN = 0, + /** + * Pass. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + PASS = 1, + /** + * Word is empty. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + WORD_EMPTY = 2, + /** + * Only chinese is supported. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + CHINESE_ONLY = 3, + /** + * Invalid length. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + INVALID_LENGTH = 4, + /** + * Unusual word. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + UNUSUAL_WORD = 5, + /** + * Consecutive same word. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + CONSECUTIVE_SAME_WORD = 6, + /** + * Too few phonemes. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + TOO_FEW_PHONEMES = 7, + /** + * Too many phonemes. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + TOO_MANY_PHONEMES = 8, + /** + * Contain common instruction. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + COMMON_INSTRUCTION = 9, + /** + * Contain common spoken language. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + COMMON_SPOKEN_LANGUAGE = 10, + /** + * Contain sensitive word. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + SENSITIVE_WORD = 11, + /** + * Two consecutive words without initial consonant. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + NO_INITIAL_CONSONANT = 12, + /** + * Contain repeated phoneme. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + REPEATED_PHONEME = 13, + } + + /** + * Describes evaluation result. + * @typedef EvaluationResult + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + interface EvaluationResult { + /** + * Evaluation score. + * @type { number } + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + score: number; + /** + * Describes evaluation result code. + * @type { EvaluationResultCode } + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + resultCode: EvaluationResultCode; + } + + /** + * Obtains an {@link WakeupManager} instance. + * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE + * @returns { WakeupManager } this {@link WakeupManager} object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 22700101 - No memory. + * @throws { BusinessError } 22700107 - System error. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + function getWakeupManager(): WakeupManager; + /** * Obtains an {@link EnrollIntelligentVoiceEngine} instance. This method uses an asynchronous callback to return the EnrollIntelligentVoiceEngine instance. * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE @@ -377,6 +701,27 @@ declare namespace intelligentVoice { * @since 10 */ INTELLIGENT_VOICE_COMMIT_ENROLL_FAILED = 22700104, + /** + * Start capturer failed. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + INTELLIGENT_VOICE_START_CAPTURER_FAILED = 22700105, + /** + * Read failed. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + INTELLIGENT_VOICE_READ_FAILED = 22700106, + /** + * System error. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + INTELLIGENT_VOICE_SYSTEM_ERROR = 22700107, } /** @@ -445,6 +790,44 @@ declare namespace intelligentVoice { UNKNOWN_ERROR = -100, } + /** + * Enumerates capturer channel. + * @enum {number} + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + enum CapturerChannel { + /** + * Capturer channel 1. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + CAPTURER_CHANNEL_1 = 0x1 << 0, + /** + * Capturer channel 2. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + CAPTURER_CHANNEL_2 = 0x1 << 1, + /** + * Capturer channel 3. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + CAPTURER_CHANNEL_3 = 0x1 << 2, + /** + * Capturer channel 4. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + CAPTURER_CHANNEL_4 = 0x1 << 3, + } + /** * Describes enroll callback information. * @typedef EnrollCallbackInfo @@ -721,7 +1104,7 @@ declare namespace intelligentVoice { */ getParameter(key: string, callback: AsyncCallback): void; /** - * Obtains the value of an intelligent voice parameter. This method uses an asynchronous callback to return the query result. + * Obtains the value of an intelligent voice parameter. This method uses a promise to return the query result. * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE * @param { string } key - the key of the intelligent voice parameter whose value is to be obtained. * @returns { Promise } the promise used to return the value of the intelligent voice parameter. @@ -733,6 +1116,19 @@ declare namespace intelligentVoice { * @since 10 */ getParameter(key: string): Promise; + /** + * Evaluates for result, This method uses a promise to return the result. + * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE + * @param { string } word - the word to evaluate. + * @returns { Promise } the promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - if input parameter type or number mismatch. + * @throws { BusinessError } 22700107 - System error. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + evaluateForResult(word: string): Promise; /** * Releases the engine, This method uses an asynchronous callback to return the result. * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE @@ -877,7 +1273,7 @@ declare namespace intelligentVoice { */ getParameter(key: string, callback: AsyncCallback): void; /** - * Obtains the value of an intelligent voice parameter. This method uses an asynchronous callback to return the query result. + * Obtains the value of an intelligent voice parameter. This method uses a promise to return the query result. * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE * @param { string } key - the key of the intelligent voice parameter whose value is to be obtained. * @returns { Promise } the promise used to return the value of the intelligent voice parameter. @@ -889,6 +1285,57 @@ declare namespace intelligentVoice { * @since 10 */ getParameter(key: string): Promise; + /** + * Gets pulse-code modulation audio. This method uses a promise to return the result. + * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE + * @returns { Promise } the promise used to return the pulse-code modulation audio. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 22700101 - No memory. + * @throws { BusinessError } 22700107 - System error. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + getPcm(): Promise; + /** + * Starts the capturer. This method uses a promise to return the result. + * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE + * @param { number } channels - the channels needed in reading. + * @returns { Promise } the promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - if input parameter type or number mismatch. + * @throws { BusinessError } 22700102 - Input parameter value error. + * @throws { BusinessError } 22700105 - Start capturer failed. + * @throws { BusinessError } 22700107 - System error. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + startCapturer(channels: number): Promise; + /** + * Reads the buffer from wakeup engine. This method uses a promise to return the result. + * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE + * @returns { Promise } the promise used to return the buffer. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 22700101 - No memory. + * @throws { BusinessError } 22700106 - Read failed. + * @throws { BusinessError } 22700107 - System error. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + read(): Promise; + /** + * Stops the capturer. This method uses a promise to return the result. + * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE + * @returns { Promise } the promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 22700107 - System error. + * @syscap SystemCapability.AI.IntelligentVoice.Core + * @systemapi + * @since 12 + */ + stopCapturer(): Promise; /** * Releases the engine, This method uses an asynchronous callback to return the result. * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE diff --git a/build-tools/api_check_plugin/plugin/dictionaries_supplementary.txt b/build-tools/api_check_plugin/plugin/dictionaries_supplementary.txt index 02c6aee03..e0e040c97 100644 --- a/build-tools/api_check_plugin/plugin/dictionaries_supplementary.txt +++ b/build-tools/api_check_plugin/plugin/dictionaries_supplementary.txt @@ -618,6 +618,7 @@ pfa pfb pgo photographing +phonemes phy pickers pixelmap