1 /*
2  * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15  /**
16  * @addtogroup MultiMedia_CameraStateCallback
17  * @{
18  *
19  * @brief Provides callbacks for camera states to configure responses to the states.
20  *
21  * @since 1.0
22  * @version 1.0
23  */
24  /**
25  * @file camera_state_callback.h
26  *
27  * @brief Declares functions in the <b>CameraStateCallback</b> class.
28  *
29  * @since 1.0
30  * @version 1.0
31  */
32 #ifndef OHOS_CAMERA_STATE_CALLBACK_H
33 #define OHOS_CAMERA_STATE_CALLBACK_H
34 
35 #include <string>
36 #include "camera.h"
37 
38 namespace OHOS {
39 namespace Media {
40 /**
41 *
42 * @brief Provides functions to response to camera states.
43 *
44 * @since 1.0
45 * @version 1.0
46 */
47 class CameraStateCallback {
48 public:
49     /**
50      * @brief A constructor used to create a <b>CameraStateCallback</b> instance.
51      *
52      */
53     CameraStateCallback() = default;
54     /**
55      * @brief A destructor used to delete the <b>CameraStateCallback</b> instance.
56      *
57      */
~CameraStateCallback()58     virtual ~CameraStateCallback() {}
59     /**
60      * @brief Called when the camera is successfully created.
61      *
62      * @param c Indicates the <b>Camera</b> object.
63      */
OnCreated(Camera & c)64     virtual void OnCreated(Camera &c) {}
65     /**
66      * @brief Called when the camera fails to be created.
67      *
68      * @param cameraId Indicates the camera ID.
69      * @param errorCode Indicates the error code.
70      */
OnCreateFailed(const std::string cameraId,int32_t errorCode)71     virtual void OnCreateFailed(const std::string cameraId, int32_t errorCode) {}
72     /**
73      * @brief Called when the camera is released.
74      *
75      * @param c Indicates the <b>Camera</b> object.
76      */
OnReleased(Camera & c)77     virtual void OnReleased(Camera &c) {}
78     /**
79      * @brief Called when the camera is configured.
80      * @param c camera Indicates the <b>Camera</b> object.
81      */
OnConfigured(Camera & c)82     virtual void OnConfigured(Camera &c) {}
83     /**
84      * @brief Called when the camera fails to be configured.
85      *
86      * @param c Indicates the <b>Camera</b> object.
87      * @param errorCode Indicates the error code.
88      */
OnConfigureFailed(const std::string cameraId,int32_t errorCode)89     virtual void OnConfigureFailed(const std::string cameraId, int32_t errorCode) {}
90 };
91 } // namespace Media
92 } // namespace OHOS
93 #endif // OHOS_CAMERA_STATE_CALLBACK_H
94