1# Interface (FocusQuery) 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> - This interface was first introduced in API version 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. 12 13FocusQuery provides APIs to check whether a focus mode is supported. 14 15## Modules to Import 16 17```ts 18import { camera } from '@kit.CameraKit'; 19``` 20 21## isFocusModeSupported<sup>11+</sup> 22 23isFocusModeSupported(afMode: FocusMode): boolean 24 25Checks whether a focus mode is supported. 26 27**Atomic service API**: This API can be used in atomic services since API version 19. 28 29**System capability**: SystemCapability.Multimedia.Camera.Core 30 31**Parameters** 32 33| Name | Type | Mandatory| Description | 34| -------- | ----------------------- | ---- | -------------------------------- | 35| afMode | [FocusMode](arkts-apis-camera-e.md#focusmode) | Yes | Focus mode. If the input parameter is null or undefined, it is treated as 0 and manual focus is used. | 36 37**Return value** 38 39| Type | Description | 40| ---------- | ----------------------------- | 41| boolean | Check result for the support of the focus mode. **true** if supported, **false** otherwise. If the operation fails, an error code defined in [CameraErrorCode](arkts-apis-camera-e.md#cameraerrorcode) is returned.| 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| 7400103 | Session not config, only throw in session usage. | 50 51**Example** 52 53```ts 54import { BusinessError } from '@kit.BasicServicesKit'; 55 56function isFocusModeSupported(photoSession: camera.PhotoSession): boolean { 57 let status: boolean = false; 58 try { 59 status = photoSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_AUTO); 60 } catch (error) { 61 // If the operation fails, error.code is returned and processed. 62 let err = error as BusinessError; 63 console.error(`The isFocusModeSupported call failed. error code: ${err.code}`); 64 } 65 return status; 66} 67``` 68