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 /** 17 * @addtogroup MultiMedia_CameraDeviceCallback 18 * @{ 19 * 20 * @brief Defines the <b>CameraDeviceCallback</b> class to response to device changes. 21 * 22 * @since 1.0 23 * @version 1.0 24 */ 25 26 /** 27 * @file camera_device_callback.h 28 * 29 * @brief Declares functions in the <b>CameraDeviceCallback</b> class to response to device changes. 30 * 31 * 32 * @since 1.0 33 * @version 1.0 34 */ 35 36 #ifndef OHOS_CAMERA_DEVICE_CALLBACK_H 37 #define OHOS_CAMERA_DEVICE_CALLBACK_H 38 39 #include <string> 40 41 namespace OHOS { 42 namespace Media { 43 constexpr int32_t CAMERA_DEVICE_STATE_AVAILABLE = 0; 44 constexpr int32_t CAMERA_DEVICE_STATE_UNAVAILABLE = 1; 45 /** 46 * 47 * @brief Provides functions to response to device changes. 48 * 49 * 50 * @since 1.0 51 * @version 1.0 52 */ 53 class CameraDeviceCallback { 54 public: 55 /** 56 * @brief A constructor used to create a <b>CameraDeviceCallback</b> instance. 57 * 58 */ 59 CameraDeviceCallback() = default; 60 61 /** 62 * @brief A destructor used to delete the <b>CameraDeviceCallback</b> instance. 63 * 64 */ 65 virtual ~CameraDeviceCallback() = default; 66 67 /** 68 * @brief Called when the camera state changes. 69 * 70 * @param cameraId Indicates the camera ID. 71 * @param status Indicates the camera state. 72 */ OnCameraStatus(std::string cameraId,int32_t status)73 virtual void OnCameraStatus(std::string cameraId, int32_t status) {} 74 }; 75 } // namespace Media 76 } // namespace OHOS 77 #endif 78