/* * Copyright (C) 2021 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. */ #pragma once #include "CameraMetadata.h" #include #include #include #include "vsock_camera_device_session_3_4.h" #include "vsock_camera_metadata.h" #include "vsock_connection.h" #include "vsock_frame_provider.h" #include namespace android::hardware::camera::device::V3_4::implementation { using namespace ::android::hardware::camera::device; using ::android::sp; using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; 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_2::ICameraDevice; using ::android::hardware::camera::device::V3_2::ICameraDeviceCallback; class VsockCameraDevice : public ICameraDevice { public: using Settings = struct { int32_t width; int32_t height; double frame_rate; }; VsockCameraDevice(const std::string& id, const Settings& settings, std::shared_ptr connection); virtual ~VsockCameraDevice(); /* Methods from ::android::hardware::camera::device::V3_2::ICameraDevice * follow. */ Return getResourceCost(ICameraDevice::getResourceCost_cb _hidl_cb); Return getCameraCharacteristics( ICameraDevice::getCameraCharacteristics_cb _hidl_cb); Return setTorchMode(TorchMode); Return open(const sp&, ICameraDevice::open_cb); Return dumpState(const ::android::hardware::hidl_handle&); /* End of Methods from * ::android::hardware::camera::device::V3_2::ICameraDevice */ private: std::string id_; VsockCameraMetadata metadata_; std::shared_ptr connection_; std::shared_ptr frame_provider_; std::atomic is_open_; sp session_; }; } // namespace android::hardware::camera::device::V3_4::implementation