From ed6d262dd7b9567b15292b94f83b2f400e4b901b Mon Sep 17 00:00:00 2001 From: hongtao Date: Tue, 24 Jun 2025 14:20:43 +0000 Subject: [PATCH 1/5] add user status d.ts Signed-off-by: hongtao --- api/@ohos.multimodalAwareness.userStatus.d.ts | 118 ++++++++++++++++++ kits/@kit.MultimodalAwarenessKit.d.ts | 3 +- 2 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 api/@ohos.multimodalAwareness.userStatus.d.ts diff --git a/api/@ohos.multimodalAwareness.userStatus.d.ts b/api/@ohos.multimodalAwareness.userStatus.d.ts new file mode 100644 index 0000000000..1f5deb9a34 --- /dev/null +++ b/api/@ohos.multimodalAwareness.userStatus.d.ts @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * @kit MultimodalAwarenessKit + */ + +import type { Callback } from "./@ohos.base"; + +/** + * This module provides the capability to subscribe to report the user status. + * + * @namespace userStatus + * @syscap SystemCapability.MultimodalAwareness.UserStatus + * @since 20 + */ +declare namespace userStatus { + /** + * Represents the classification result of the user based on age group, + * including the detected category (e.g., child or adult) and the confidence score. + * + * @interface UserClassification + * @syscap SystemCapability.MultimodalAwareness.UserStatus + * @since 20 + */ + export interface UserClassification { + /** + * ageGroup + * + * @type { UserAgeGroup } + * @sysCap SystemCapability.MultimodalAwareness.UserStatus + * @since 20 + */ + ageGroup?:UserAgeGroup; + + /** + * confidence for the detected ageGroup + * + * @type { number } + * @sysCap SystemCapability.MultimodalAwareness.UserStatus + * @since 20 + */ + confidence?:number; + } + + /** + * Represents the user's age group (e.g., child, adult). + * + * @enum { number } UserAgeGroup + * @syscap SystemCapability.MultimodalAwareness.UserStatus + * @since 20 + */ + export enum UserAgeGroup { + /** + * Indicates that the operator is not a child. + * + * @syscap SystemCapability.MultimodalAwareness.UserStatus + * @since 20 + */ + OTHERS = 0, + + /** + * Indicates that the operator is a child. + * + * @syscap SystemCapability.MultimodalAwareness.UserStatus + * @since 20 + */ + CHILD = 1 + } + + /** + * Subscribe to age group detection feature. + * @param { 'userAgeGroupDetected' } type - Indicates the event type. + * @param { Callback } callback - Indicates the callback for getting the event data. + * @throws { BusinessError } 401 - Parameter error. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Function can not work correctly due to limited + *
device capabilities. + * @throws { BusinessError } 33900001 - Service exception. Possible causes: 1. System error, such as null pointer and container-related exception; + *
2. Node-API invocation exception, such as invalid Node-API status. + * @throws { BusinessError } 33900002 - Subscription failed. Possible causes: 1. Callback registration failed; + *
2. Failed to bind the native object to JS wrapper; 3. Node-API invocation exception, such as invalid Node-API status; 4. IPC request exception. + * @syscap SystemCapability.MultimodalAwareness.UserStatus + * @since 20 + * @arkts 1.1&1.2 + */ + function on(type: 'userAgeGroupDetected', callback: Callback): void; + + /** + * Unsubscribe to age group detection feature. + * @param { 'userAgeGroupDetected' } type - Indicates the event type. + * @param { Callback } [callback] - Indicates the callback for getting the event data. + * @throws { BusinessError } 401 - Parameter error. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Function can not work correctly due to limited + *
device capabilities. + * @throws { BusinessError } 33900001 - Service exception. Possible causes: 1. System error, such as null pointer and container-related exception; + *
2. Node-API invocation exception, such as invalid Node-API status. + * @throws { BusinessError } 33900003 - Unsubscription failed. Possible causes: 1. Callback failure; + *
2. Node-API invocation exception, such as invalid Node-API status; 3. IPC request exception. + * @syscap SystemCapability.MultimodalAwareness.UserStatus + * @since 20 + * @arkts 1.1&1.2 + */ + function off(type: 'userAgeGroupDetected', callback?: Callback): void; +} +export default userStatus; \ No newline at end of file diff --git a/kits/@kit.MultimodalAwarenessKit.d.ts b/kits/@kit.MultimodalAwarenessKit.d.ts index ff75eea560..605939d0a7 100644 --- a/kits/@kit.MultimodalAwarenessKit.d.ts +++ b/kits/@kit.MultimodalAwarenessKit.d.ts @@ -22,5 +22,6 @@ import stationary from '@ohos.stationary'; import motion from '@ohos.multimodalAwareness.motion'; import deviceStatus from '@ohos.multimodalAwareness.deviceStatus'; import metadataBinding from '@ohos.multimodalAwareness.metadataBinding'; +import userStatus from '@ohos.multimodalAwareness.userStatus'; -export { stationary, motion, deviceStatus, metadataBinding }; +export { stationary, motion, deviceStatus, metadataBinding, userStatus }; -- Gitee From 429033210b36f0a013b668fb5973457b87e7034a Mon Sep 17 00:00:00 2001 From: hongtao Date: Wed, 25 Jun 2025 02:58:55 +0000 Subject: [PATCH 2/5] modify dts commit Signed-off-by: hongtao --- api/@ohos.multimodalAwareness.userStatus.d.ts | 58 ++++++++++--------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/api/@ohos.multimodalAwareness.userStatus.d.ts b/api/@ohos.multimodalAwareness.userStatus.d.ts index 1f5deb9a34..b8bfd4a5ad 100644 --- a/api/@ohos.multimodalAwareness.userStatus.d.ts +++ b/api/@ohos.multimodalAwareness.userStatus.d.ts @@ -1,6 +1,6 @@ /* * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); + * Licensed under the Apache License, Version 2.0 (the "License"), * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * @@ -18,7 +18,7 @@ * @kit MultimodalAwarenessKit */ -import type { Callback } from "./@ohos.base"; +import type { Callback } from './@ohos.base'; /** * This module provides the capability to subscribe to report the user status. @@ -38,22 +38,22 @@ declare namespace userStatus { */ export interface UserClassification { /** - * ageGroup - * - * @type { UserAgeGroup } - * @sysCap SystemCapability.MultimodalAwareness.UserStatus - * @since 20 - */ - ageGroup?:UserAgeGroup; - + * ageGroup + * + * @type { UserAgeGroup } + * @sysCap SystemCapability.MultimodalAwareness.UserStatus + * @since 20 + */ + ageGroup?: UserAgeGroup; + /** - * confidence for the detected ageGroup - * - * @type { number } - * @sysCap SystemCapability.MultimodalAwareness.UserStatus - * @since 20 - */ - confidence?:number; + * confidence for the detected ageGroup + * + * @type { float } + * @sysCap SystemCapability.MultimodalAwareness.UserStatus + * @since 20 + */ + confidence?: float; } /** @@ -78,20 +78,23 @@ declare namespace userStatus { * @syscap SystemCapability.MultimodalAwareness.UserStatus * @since 20 */ - CHILD = 1 + CHILD = 1 } /** * Subscribe to age group detection feature. * @param { 'userAgeGroupDetected' } type - Indicates the event type. * @param { Callback } callback - Indicates the callback for getting the event data. - * @throws { BusinessError } 401 - Parameter error. Parameter verification failed. * @throws { BusinessError } 801 - Capability not supported. Function can not work correctly due to limited *
device capabilities. - * @throws { BusinessError } 33900001 - Service exception. Possible causes: 1. System error, such as null pointer and container-related exception; + * @throws { BusinessError } 33900001 - Service exception. Possible causes: + *
1. System error, such as a null pointer and container-related exception. *
2. Node-API invocation exception, such as invalid Node-API status. - * @throws { BusinessError } 33900002 - Subscription failed. Possible causes: 1. Callback registration failed; - *
2. Failed to bind the native object to JS wrapper; 3. Node-API invocation exception, such as invalid Node-API status; 4. IPC request exception. + * @throws { BusinessError } 33900002 - Subscription failed. Possible causes: + *
1. Callback registration failed. + *
2. Failed to bind the native object to the JS wrapper + *
3. Node-API invocation exception, such as invalid Node-API status. + *
4. IPC request exception. * @syscap SystemCapability.MultimodalAwareness.UserStatus * @since 20 * @arkts 1.1&1.2 @@ -102,17 +105,20 @@ declare namespace userStatus { * Unsubscribe to age group detection feature. * @param { 'userAgeGroupDetected' } type - Indicates the event type. * @param { Callback } [callback] - Indicates the callback for getting the event data. - * @throws { BusinessError } 401 - Parameter error. Parameter verification failed. * @throws { BusinessError } 801 - Capability not supported. Function can not work correctly due to limited *
device capabilities. - * @throws { BusinessError } 33900001 - Service exception. Possible causes: 1. System error, such as null pointer and container-related exception; + * @throws { BusinessError } 33900001 - Service exception. Possible causes: + *
1. System error, such as a null pointer and container-related exception. *
2. Node-API invocation exception, such as invalid Node-API status. - * @throws { BusinessError } 33900003 - Unsubscription failed. Possible causes: 1. Callback failure; - *
2. Node-API invocation exception, such as invalid Node-API status; 3. IPC request exception. + * @throws { BusinessError } 33900003 - Unsubscription failed. Possible causes: + *
1. Callback failure. + *
2. Node-API invocation exception, such as invalid Node-API status. + *
3. IPC request exception. * @syscap SystemCapability.MultimodalAwareness.UserStatus * @since 20 * @arkts 1.1&1.2 */ function off(type: 'userAgeGroupDetected', callback?: Callback): void; + } export default userStatus; \ No newline at end of file -- Gitee From b0119b268e8b7d30f6db69609492e04252391921 Mon Sep 17 00:00:00 2001 From: hongtao Date: Wed, 25 Jun 2025 03:11:05 +0000 Subject: [PATCH 3/5] modify commit Signed-off-by: hongtao --- api/@ohos.multimodalAwareness.userStatus.d.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/api/@ohos.multimodalAwareness.userStatus.d.ts b/api/@ohos.multimodalAwareness.userStatus.d.ts index b8bfd4a5ad..5227d23a22 100644 --- a/api/@ohos.multimodalAwareness.userStatus.d.ts +++ b/api/@ohos.multimodalAwareness.userStatus.d.ts @@ -41,7 +41,7 @@ declare namespace userStatus { * ageGroup * * @type { UserAgeGroup } - * @sysCap SystemCapability.MultimodalAwareness.UserStatus + * @syscap SystemCapability.MultimodalAwareness.UserStatus * @since 20 */ ageGroup?: UserAgeGroup; @@ -50,7 +50,7 @@ declare namespace userStatus { * confidence for the detected ageGroup * * @type { float } - * @sysCap SystemCapability.MultimodalAwareness.UserStatus + * @syscap SystemCapability.MultimodalAwareness.UserStatus * @since 20 */ confidence?: float; @@ -92,7 +92,7 @@ declare namespace userStatus { *
2. Node-API invocation exception, such as invalid Node-API status. * @throws { BusinessError } 33900002 - Subscription failed. Possible causes: *
1. Callback registration failed. - *
2. Failed to bind the native object to the JS wrapper + *
2. Failed to bind the native object to the JS wrapper. *
3. Node-API invocation exception, such as invalid Node-API status. *
4. IPC request exception. * @syscap SystemCapability.MultimodalAwareness.UserStatus @@ -119,6 +119,5 @@ declare namespace userStatus { * @arkts 1.1&1.2 */ function off(type: 'userAgeGroupDetected', callback?: Callback): void; - } export default userStatus; \ No newline at end of file -- Gitee From 5bb87c625dcf1869f590c803c3c4904ab08df011 Mon Sep 17 00:00:00 2001 From: hongtao Date: Wed, 25 Jun 2025 05:38:22 +0000 Subject: [PATCH 4/5] fix code check Signed-off-by: hongtao --- api/@ohos.multimodalAwareness.userStatus.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/@ohos.multimodalAwareness.userStatus.d.ts b/api/@ohos.multimodalAwareness.userStatus.d.ts index 5227d23a22..a6db4a5eed 100644 --- a/api/@ohos.multimodalAwareness.userStatus.d.ts +++ b/api/@ohos.multimodalAwareness.userStatus.d.ts @@ -44,7 +44,7 @@ declare namespace userStatus { * @syscap SystemCapability.MultimodalAwareness.UserStatus * @since 20 */ - ageGroup?: UserAgeGroup; + ageGroup: UserAgeGroup; /** * confidence for the detected ageGroup @@ -53,7 +53,7 @@ declare namespace userStatus { * @syscap SystemCapability.MultimodalAwareness.UserStatus * @since 20 */ - confidence?: float; + confidence: float; } /** -- Gitee From 71c2d9f1a0b4846815073ded343b8c0437b38314 Mon Sep 17 00:00:00 2001 From: hongtao Date: Wed, 25 Jun 2025 06:02:12 +0000 Subject: [PATCH 5/5] fix code check Signed-off-by: hongtao --- api/@ohos.multimodalAwareness.userStatus.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/@ohos.multimodalAwareness.userStatus.d.ts b/api/@ohos.multimodalAwareness.userStatus.d.ts index a6db4a5eed..59ed91b179 100644 --- a/api/@ohos.multimodalAwareness.userStatus.d.ts +++ b/api/@ohos.multimodalAwareness.userStatus.d.ts @@ -40,20 +40,20 @@ declare namespace userStatus { /** * ageGroup * - * @type { UserAgeGroup } + * @type { ?UserAgeGroup } * @syscap SystemCapability.MultimodalAwareness.UserStatus * @since 20 */ - ageGroup: UserAgeGroup; + ageGroup?: UserAgeGroup; /** * confidence for the detected ageGroup * - * @type { float } + * @type { ?float } * @syscap SystemCapability.MultimodalAwareness.UserStatus * @since 20 */ - confidence: float; + confidence?: float; } /** -- Gitee