# MultiMedia\_CameraStateCallback ## **Overview** Provides callbacks for camera states to configure responses to the states. **Since:** 1.0 **Version:** 1.0 ## **Summary** ## Files

File Name

Description

camera_state_callback.h

Declares functions in the CameraStateCallback class.

## Data Structures

Data Structure Name

Description

OHOS::Media::CameraStateCallback

Provides functions to response to camera states.

## Functions

Function Name

Description

OHOS::Media::CameraStateCallback::CameraStateCallback ()=default

 

A constructor used to create a CameraStateCallback instance.

OHOS::Media::CameraStateCallback::~CameraStateCallback ()

virtual 

A destructor used to delete the CameraStateCallback instance.

OHOS::Media::CameraStateCallback::OnCreated (Camera &c)

virtual void 

Called when the camera is successfully created.

OHOS::Media::CameraStateCallback::OnCreateFailed (const std::string cameraId, int32_t errorCode)

virtual void 

Called when the camera fails to be created.

OHOS::Media::CameraStateCallback::OnReleased (Camera &c)

virtual void 

Called when the camera is released.

OHOS::Media::CameraStateCallback::OnConfigured (Camera &c)

virtual void 

Called when the camera is configured.

OHOS::Media::CameraStateCallback::OnConfigureFailed (const std::string cameraId, int32_t errorCode)

virtual void 

Called when the camera fails to be configured.

## **Details** ## **Function Documentation** ## CameraStateCallback\(\) ``` OHOS::Media::CameraStateCallback::CameraStateCallback () ``` **Description:** A constructor used to create a **[CameraStateCallback](OHOS-Media-CameraStateCallback.md)** instance. ## OnConfigured\(\) ``` virtual void OHOS::Media::CameraStateCallback::OnConfigured ([Camera](OHOS-Media-Camera.md) & c) ``` **Description:** Called when the camera is configured. **Parameters:**

Name

Description

c camera Indicates the Camera object.
## OnConfigureFailed\(\) ``` virtual void OHOS::Media::CameraStateCallback::OnConfigureFailed (const std::string cameraId, int32_t errorCode ) ``` **Description:** Called when the camera fails to be configured. **Parameters:**

Name

Description

c Indicates the Camera object.
errorCode Indicates the error code.
## OnCreated\(\) ``` virtual void OHOS::Media::CameraStateCallback::OnCreated ([Camera](OHOS-Media-Camera.md) & c) ``` **Description:** Called when the camera is successfully created. **Parameters:**

Name

Description

c Indicates the Camera object.
## OnCreateFailed\(\) ``` virtual void OHOS::Media::CameraStateCallback::OnCreateFailed (const std::string cameraId, int32_t errorCode ) ``` **Description:** Called when the camera fails to be created. **Parameters:**

Name

Description

cameraId Indicates the camera ID.
errorCode Indicates the error code.
## OnReleased\(\) ``` virtual void OHOS::Media::CameraStateCallback::OnReleased ([Camera](OHOS-Media-Camera.md) & c) ``` **Description:** Called when the camera is released. **Parameters:**

Name

Description

c Indicates the Camera object.
## \~CameraStateCallback\(\) ``` virtual OHOS::Media::CameraStateCallback::~CameraStateCallback () ``` **Description:** A destructor used to delete the **[CameraStateCallback](OHOS-Media-CameraStateCallback.md)** instance.