1 /* 2 * Copyright (c) 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 * @file icamera_device_callback.h 18 * 19 * @brief Declares callbacks for reporting camera device errors and metadata. 20 * 21 * @since 1.0 22 * @version 1.0 23 */ 24 25 #ifndef HDI_CAMERA_DEVICE_CALLBACK_SERVER_H 26 #define HDI_CAMERA_DEVICE_CALLBACK_SERVER_H 27 28 #include <list> 29 #include <map> 30 #include <vector> 31 #include <hdf_log.h> 32 #include <iremote_broker.h> 33 #include "types.h" 34 35 namespace OHOS::Camera { 36 enum { 37 CMD_CAMERA_DEVICE_CALLBACK_ON_ERROR = 0, 38 CMD_CAMERA_DEVICE_CALLBACK_ON_RESULT, 39 }; 40 41 class ICameraDeviceCallback : public IRemoteBroker { 42 public: 43 DECLARE_INTERFACE_DESCRIPTOR(u"HDI.Camera.V1_0.DeviceCallback"); ~ICameraDeviceCallback()44 virtual ~ICameraDeviceCallback() {} 45 46 public: 47 /** 48 * @brief Called when an error occurs on the camera device. The caller needs to implement this function. 49 * 50 * @param type Indicates the error type. For details, see {@link ErrorType}. 51 * @param errorCode Indicates the error code. This parameter is not used currently. 52 * 53 * @since 1.0 54 * @version 1.0 55 */ 56 virtual void OnError(ErrorType type, int32_t errorCode) = 0; 57 58 /** 59 * @brief Called to report metadata related to the camera device. For details about the reporting mode, see {@link SetResultMode}. 60 * 61 * @param timestamp Indicates the timestamp when the metadata is reported. 62 * @param result Indicates the metadata reported. The reported metadata is specified by {@link EnableResult}. 63 * You can call {@link GetEnabledResults} to obtain enabled metadata and call {@link DisableResult} to disable metadata reporting. 64 * 65 * @since 1.0 66 * @version 1.0 67 */ 68 virtual void OnResult(uint64_t timestamp, const std::shared_ptr<CameraStandard::CameraMetadata> &result) = 0; 69 }; 70 } 71 #endif // HDI_CAMERA_DEVICE_CALLBACK_SERVER_H 72