• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "types.h"
32 #include "icamera_interface.h"
33 
34 namespace OHOS::Camera {
35 class ICameraDeviceCallback : public ICameraInterface {
36 public:
37     DECLARE_INTERFACE_DESCRIPTOR(u"HDI.Camera.V1_0.DeviceCallback");
~ICameraDeviceCallback()38     virtual ~ICameraDeviceCallback() {}
39 
40 public:
41     /**
42      * @brief Called when an error occurs on the camera device. The caller needs to implement this function.
43      *
44      * @param type Indicates the error type. For details, see {@link ErrorType}.
45      * @param errorCode Indicates the error code. This parameter is not used currently.
46      *
47      * @since 1.0
48      * @version 1.0
49      */
50     virtual void OnError(ErrorType type, int32_t errorCode) = 0;
51 
52     /**
53      * @brief Called to report metadata related to the camera device.
54      * For details about the reporting mode, see {@link SetResultMode}.
55      *
56      * @param timestamp Indicates the timestamp when the metadata is reported.
57      * @param result Indicates the metadata reported. The reported metadata is specified by {@link EnableResult}.
58      * You can call {@link GetEnabledResults} to obtain enabled metadata and
59      * call {@link DisableResult} to disable metadata reporting.
60      *
61      * @since 1.0
62      * @version 1.0
63      */
64     virtual void OnResult(uint64_t timestamp, const std::shared_ptr<CameraMetadata> &result) = 0;
65 };
66 }
67 #endif // HDI_CAMERA_DEVICE_CALLBACK_SERVER_H