/* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef HARDWARE_GOOGLE_CAMERA_HAL_HIDL_SERVICE_HIDL_CAMERA_DEVICE_H_ #define HARDWARE_GOOGLE_CAMERA_HAL_HIDL_SERVICE_HIDL_CAMERA_DEVICE_H_ #include #include #include "camera_device.h" #include "hidl_profiler.h" namespace android { namespace hardware { namespace camera { namespace device { namespace V3_7 { namespace implementation { using ::android::hardware::camera::common::V1_0::CameraResourceCost; using ::android::hardware::camera::common::V1_0::Status; using ::android::hardware::camera::common::V1_0::TorchMode; using ::android::hardware::camera::device::V3_5::ICameraDeviceCallback; using ::android::hardware::camera::device::V3_7::ICameraDevice; using ::android::hardware::camera::implementation::HidlProfiler; using ::android::google_camera_hal::CameraDevice; // HidlCameraDevice implements the HIDL camera device interface, ICameraDevice, // using Google Camera HAL to provide information about the associated camera // device. class HidlCameraDevice : public ICameraDevice { public: static const std::string kDeviceVersion; // Create a HidlCameraDevice. // google_camera_device is a google camera device that HidlCameraDevice // is going to manage. Creating a HidlCameraDevice will fail if // google_camera_device is nullptr. static std::unique_ptr Create( std::unique_ptr google_camera_device); virtual ~HidlCameraDevice() = default; // Override functions in ICameraDevice Return getResourceCost( ICameraDevice::getResourceCost_cb _hidl_cb) override; Return getCameraCharacteristics( ICameraDevice::getCameraCharacteristics_cb _hidl_cb) override; Return setTorchMode(TorchMode mode) override; Return open(const sp& callback, ICameraDevice::open_cb _hidl_cb) override; Return dumpState(const ::android::hardware::hidl_handle& handle) override; Return getPhysicalCameraCharacteristics( const hidl_string& physicalCameraId, ICameraDevice::getPhysicalCameraCharacteristics_cb _hidl_cb) override; Return isStreamCombinationSupported( const V3_4::StreamConfiguration& streams, ICameraDevice::isStreamCombinationSupported_cb _hidl_cb) override; Return isStreamCombinationSupported_3_7( const StreamConfiguration& streams, ICameraDevice::isStreamCombinationSupported_cb _hidl_cb) override; // End of override functions in ICameraDevice protected: HidlCameraDevice() = default; private: status_t Initialize(std::unique_ptr google_camera_device); std::unique_ptr google_camera_device_; uint32_t camera_id_ = 0; std::shared_ptr hidl_profiler_; }; } // namespace implementation } // namespace V3_7 } // namespace device } // namespace camera } // namespace hardware } // namespace android #endif // HARDWARE_GOOGLE_CAMERA_HAL_HIDL_SERVICE_HIDL_CAMERA_DEVICE_H_