• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_CAMERAPROVIDER_H
18 #define ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_CAMERAPROVIDER_H
19 
20 #include <android/hardware/camera/provider/2.5/ICameraProvider.h>
21 #include <hidl/Status.h>
22 #include <hidl/MQDescriptor.h>
23 
24 namespace android {
25 namespace hardware {
26 namespace camera {
27 namespace provider {
28 namespace V2_5 {
29 namespace implementation {
30 
31 using ::android::hardware::camera::common::V1_0::Status;
32 using ::android::hardware::camera::provider::V2_5::ICameraProvider;
33 using ::android::hardware::camera::provider::V2_4::ICameraProviderCallback;
34 using ::android::hardware::Return;
35 using ::android::hardware::hidl_string;
36 using ::android::sp;
37 
38 // Default recommended RPC thread count for camera provider implementations
39 const int HWBINDER_THREAD_COUNT = 6;
40 
41 template<typename IMPL>
42 struct CameraProvider : public ICameraProvider {
CameraProviderCameraProvider43     CameraProvider() : impl() {}
~CameraProviderCameraProvider44     ~CameraProvider() {}
45 
46     // Caller must use this method to check if CameraProvider ctor failed
isInitFailedCameraProvider47     bool isInitFailed() { return impl.isInitFailed(); }
48 
49     // Methods from ::android::hardware::camera::provider::V2_4::ICameraProvider follow.
setCallbackCameraProvider50     Return<Status> setCallback(const sp<ICameraProviderCallback>& callback) override {
51         return impl.setCallback(callback);
52     }
53 
getVendorTagsCameraProvider54     Return<void> getVendorTags(getVendorTags_cb _hidl_cb) override {
55         return impl.getVendorTags(_hidl_cb);
56     }
57 
getCameraIdListCameraProvider58     Return<void> getCameraIdList(getCameraIdList_cb _hidl_cb) override {
59         return impl.getCameraIdList(_hidl_cb);
60     }
61 
isSetTorchModeSupportedCameraProvider62     Return<void> isSetTorchModeSupported(isSetTorchModeSupported_cb _hidl_cb) override {
63         return impl.isSetTorchModeSupported(_hidl_cb);
64     }
65 
getCameraDeviceInterface_V1_xCameraProvider66     Return<void> getCameraDeviceInterface_V1_x(
67             const hidl_string& cameraDeviceName,
68             getCameraDeviceInterface_V1_x_cb _hidl_cb) override {
69         return impl.getCameraDeviceInterface_V1_x(cameraDeviceName, _hidl_cb);
70     }
71 
getCameraDeviceInterface_V3_xCameraProvider72     Return<void> getCameraDeviceInterface_V3_x(
73             const hidl_string& cameraDeviceName,
74             getCameraDeviceInterface_V3_x_cb _hidl_cb) override {
75         return impl.getCameraDeviceInterface_V3_x(cameraDeviceName, _hidl_cb);
76     }
77 
78     // Methods from ::android::hardware::camera::provider::V2_5::ICameraProvider follow.
notifyDeviceStateChangeCameraProvider79     Return<void> notifyDeviceStateChange(hardware::hidl_bitfield<DeviceState> newState) override {
80         return impl.notifyDeviceStateChange(newState);
81     }
82 
83 private:
84     IMPL impl;
85 };
86 
87 }  // namespace implementation
88 }  // namespace V2_5
89 }  // namespace provider
90 }  // namespace camera
91 }  // namespace hardware
92 }  // namespace android
93 
94 #endif  // ANDROID_HARDWARE_CAMERA_PROVIDER_V2_5_CAMERAPROVIDER_H
95