From 0187433f27bf12e6349895de22e38f383b78d202 Mon Sep 17 00:00:00 2001 From: wuwenchao Date: Mon, 24 Feb 2025 14:52:20 +0800 Subject: [PATCH] camera concurrent open Signed-off-by: wuwenchao --- api/@ohos.multimedia.camera.d.ts | 118 +++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/api/@ohos.multimedia.camera.d.ts b/api/@ohos.multimedia.camera.d.ts index 622757a177..cfd5fc7fb4 100644 --- a/api/@ohos.multimedia.camera.d.ts +++ b/api/@ohos.multimedia.camera.d.ts @@ -814,6 +814,36 @@ declare namespace camera { */ createSession(mode: SceneMode): T; + /** + * Queries a specified device based on position and type. + * + * @param { CameraPosition } position - Camera position. + * @param { CameraType } type - Camera type. + * @returns { CameraDevice } A device queried base on position and type. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 16 + */ + getCameraDevice(position: CameraPosition, type: CameraType): CameraDevice; + + /** + * Obtains the concurrent information of specified cameras, + * the empty return means concurrency is not supported. + * + * @param { Array } cameras - Set of camera devices to be queried. + * @returns { Array } Set of queried concurrent information. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 16 + */ + getCameraConcurrentInfos(cameras: Array): Array; + /** * Subscribes camera status change event callback. * @@ -1633,6 +1663,20 @@ declare namespace camera { */ open(isSecureEnabled: boolean): Promise; + /** + * Open camera with specified concurrent type. + * + * @param { CameraConcurrentType } type - Camera concurrent type. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400107 - Can not use camera cause of conflict. + * @throws { BusinessError } 7400108 - Camera disabled cause of security reason. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 16 + */ + open(type: CameraConcurrentType): Promise; + /** * Close camera. * @@ -10966,6 +11010,80 @@ declare namespace camera { enableDepthFusion(enabled: boolean): void; } + /** + * Enum for camera concurrent type. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 16 + */ + enum CameraConcurrentType { + /** + * Cameras concurrency with limited capabilities. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 16 + */ + CAMERA_LIMITED_CAPABILITY = 0, + + /** + * Cameras concurrency with full capabilities. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 16 + */ + CAMERA_FULL_CAPABILITY = 1, + } + + /** + * Camera concurrent information. + * + * @interface CameraConcurrentInfo + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 16 + */ + interface CameraConcurrentInfo { + /** + * Camera instance. + * + * @type { CameraDevice } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 16 + */ + readonly device: CameraDevice; + + /** + * Camera concurrent type. + * + * @type { CameraConcurrentType } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 16 + */ + readonly type: CameraConcurrentType; + + /** + * Supported scene modes. + * + * @type { Array } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 16 + */ + readonly modes: Array; + + /** + * Supported outputCapability. + * + * @type { Array } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 16 + */ + readonly outputCapabilities: Array; + } + /** * Enum for color reservation type. * -- Gitee