1# Interface (WhiteBalanceQuery) 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 20. 12 13WhiteBalanceQuery provides APIs to check whether a white balance mode is supported and obtain the white balance mode range supported. 14 15## Modules to Import 16 17```ts 18import { camera } from '@kit.CameraKit'; 19``` 20 21## isWhiteBalanceModeSupported<sup>20+</sup> 22 23isWhiteBalanceModeSupported(mode: WhiteBalanceMode): boolean 24 25Checks whether a white balance mode is supported. 26 27**Atomic service API**: This API can be used in atomic services since API version 20. 28 29**System capability**: SystemCapability.Multimedia.Camera.Core 30 31**Parameters** 32 33| Name | Type | Mandatory | Description | 34| -------- |-----------------------------------------| ---- | ----------------------------- | 35| mode | [WhiteBalanceMode](arkts-apis-camera-e.md#whitebalancemode20) | Yes | White balance mode. | 36 37**Return value** 38 39| Type | Description | 40| ---------- | ----------------------------- | 41| boolean | Check result for the support of the white balance mode. **true** if supported, **false** otherwise.| 42 43**Error codes** 44 45For details about the error codes, see [Camera Error Codes](errorcode-camera.md). 46 47| ID | Error Message | 48| --------------- | --------------- | 49| 7400101 | Parameter missing or parameter type incorrect. | 50| 7400103 | Session not config, only throw in session usage. | 51 52**Example** 53 54```ts 55import { BusinessError } from '@kit.BasicServicesKit'; 56 57function isWhiteBalanceModeSupported(session: camera.PhotoSession | camera.VideoSession): boolean { 58 let status: boolean = false; 59 try { 60 let mode: camera.WhiteBalanceMode = camera.WhiteBalanceMode.DAYLIGHT; 61 status = session.isWhiteBalanceModeSupported(mode); 62 } catch (error) { 63 let err = error as BusinessError; 64 console.error(`The isWhiteBalanceModeSupported call failed. error code: ${err.code}`); 65 } 66 return status; 67} 68``` 69 70## getWhiteBalanceRange<sup>20+</sup> 71 72getWhiteBalanceRange(): Array\<number\> 73 74Obtains the range of white balance values in manual white balance mode. 75 76**Atomic service API**: This API can be used in atomic services since API version 20. 77 78**System capability**: SystemCapability.Multimedia.Camera.Core 79 80**Return value** 81 82| Type | Description | 83| ---------- | ----------------------------- | 84| Array\<number\> | Range of white balance values, for example, [2800, ...,10000], in units of K (Kelvin). The actual value depends on the bottom-layer capability.| 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 getWhiteBalanceRange(session: camera.PhotoSession | camera.VideoSession): Array<number> { 100 let range: Array<number> = []; 101 try { 102 range = session.getWhiteBalanceRange(); 103 } catch (error) { 104 let err = error as BusinessError; 105 console.error(`The getWhiteBalanceRange call failed. error code: ${err.code}`); 106 } 107 return range; 108} 109``` 110