1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef CAMERA_HAL_GOOGLE_CAMERA_HAL_CAMERA_PROVIDER_CALLBACK_H_
18 #define CAMERA_HAL_GOOGLE_CAMERA_HAL_CAMERA_PROVIDER_CALLBACK_H_
19 
20 #include <utils/Errors.h>
21 #include <memory>
22 
23 namespace android {
24 namespace google_camera_hal {
25 
26 // See the definition of
27 // ::android::hardware::camera::provider::V2_4::ICameraProviderCallback
28 using CameraDeviceStatusChangeFunc = std::function<void(
29     std::string /*camera_id*/, CameraDeviceStatus /*new_status*/)>;
30 
31 // See the definition of
32 // ::android::hardware::camera::provider::V2_6::ICameraProviderCallback
33 using PhysicalCameraDeviceStatusChangeFunc = std::function<void(
34     std::string /*camera_id*/, std::string /*physical_camera_id*/,
35     CameraDeviceStatus /*new_status*/)>;
36 
37 // See the definition of
38 // ::android::hardware::camera::provider::V2_4::ICameraProviderCallback
39 using TorchModeStatusChangeFunc =
40     std::function<void(std::string /*camera_id*/, TorchModeStatus /*new_status*/)>;
41 
42 // Defines callbacks to notify when a status changed.
43 struct CameraProviderCallback {
44   // Callback to notify when a camera device's status changed.
45   CameraDeviceStatusChangeFunc camera_device_status_change;
46 
47   // Callback to notify when a physical camera device's status changed.
48   PhysicalCameraDeviceStatusChangeFunc physical_camera_device_status_change;
49 
50   // Callback to notify when a torch mode status changed.
51   TorchModeStatusChangeFunc torch_mode_status_change;
52 };
53 
54 }  // namespace google_camera_hal
55 }  // namespace android
56 
57 #endif  // HARDWARE_GOOGLE_CAMERA_HAL_GOOGLE_CAMERA_HAL_CAMERA_PROVIDER_H_
58