• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Interface (AutoExposureQuery)
2<!--Kit: Camera Kit-->
3<!--Subsystem: Multimedia-->
4<!--Owner: @qano-->
5<!--SE: @leo_ysl-->
6<!--TSE: @xchaosioda-->
7
8> **NOTE**
9>
10> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
11> - The initial APIs of this interface are supported since API version 12.
12> - In this version, a compatibility change was made that preserved the initial version information of inner elements. As a result, you might see outer element's @since version number being higher than that of the inner elements. However, this discrepancy does not affect the functionality of the interface.
13
14AutoExposureQuery provides APIs to query the automatic exposure feature of a camera device.
15
16## Modules to Import
17
18```ts
19import { camera } from '@kit.CameraKit';
20```
21
22## isExposureModeSupported<sup>11+</sup>
23
24isExposureModeSupported(aeMode: ExposureMode): boolean
25
26Checks whether an exposure mode is supported.
27
28**Atomic service API**: This API can be used in atomic services since API version 19.
29
30**System capability**: SystemCapability.Multimedia.Camera.Core
31
32**Parameters**
33
34| Name     | Type                          | Mandatory | Description                          |
35| -------- | -------------------------------| ---- | ----------------------------- |
36| aeMode   | [ExposureMode](arkts-apis-camera-e.md#exposuremode)  | Yes  | Exposure mode. If the input parameter is null or undefined, it is treated as 0 and exposure is locked.                |
37
38**Return value**
39
40| Type       | Description                         |
41| ---------- | ----------------------------- |
42| boolean    | Check result for the support of the exposure mode. **true** if supported, **false** otherwise. If the operation fails, an error code defined in [CameraErrorCode](arkts-apis-camera-e.md#cameraerrorcode) is returned.|
43
44**Error codes**
45
46For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
47
48| ID        | Error Message       |
49| --------------- | --------------- |
50| 7400103                |  Session not config, only throw in session usage.          |
51
52**Example**
53
54```ts
55import { BusinessError } from '@kit.BasicServicesKit';
56
57function isExposureModeSupported(photoSession: camera.PhotoSession): boolean {
58  let isSupported: boolean = false;
59  try {
60    isSupported = photoSession.isExposureModeSupported(camera.ExposureMode.EXPOSURE_MODE_LOCKED);
61  } catch (error) {
62    // If the operation fails, error.code is returned and processed.
63    let err = error as BusinessError;
64    console.error(`The isExposureModeSupported call failed. error code: ${err.code}`);
65  }
66  return isSupported;
67}
68```
69
70## getExposureBiasRange<sup>11+</sup>
71
72getExposureBiasRange(): Array\<number\>
73
74Obtains the exposure compensation values of the camera device.
75
76**Atomic service API**: This API can be used in atomic services since API version 19.
77
78**System capability**: SystemCapability.Multimedia.Camera.Core
79
80**Return value**
81
82| Type       | Description                         |
83| ---------- | ----------------------------- |
84| Array\<number\>   | Array of compensation values. If the operation fails, an error code defined in [CameraErrorCode](arkts-apis-camera-e.md#cameraerrorcode) is returned.|
85
86**Error codes**
87
88For details about the error codes, see [Camera Error Codes](errorcode-camera.md).
89
90| ID        | Error Message       |
91| --------------- | --------------- |
92| 7400103                |  Session not config, only throw in session usage.               |
93
94**Example**
95
96```ts
97import { BusinessError } from '@kit.BasicServicesKit';
98
99function getExposureBiasRange(photoSession: camera.PhotoSession): Array<number> {
100  let biasRangeArray: Array<number> = [];
101  try {
102    biasRangeArray = photoSession.getExposureBiasRange();
103  } catch (error) {
104    // If the operation fails, error.code is returned and processed.
105    let err = error as BusinessError;
106    console.error(`The getExposureBiasRange call failed. error code: ${err.code}`);
107  }
108  return biasRangeArray;
109}
110```
111