Home | History | Annotate | Download | only in default
      1 /*
      2  * Copyright (C) 2017 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_DEVICE_V3_3_CAMERADEVICE_H
     18 #define ANDROID_HARDWARE_CAMERA_DEVICE_V3_3_CAMERADEVICE_H
     19 
     20 #include "utils/Mutex.h"
     21 #include "CameraModule.h"
     22 #include "CameraMetadata.h"
     23 #include "CameraDeviceSession.h"
     24 #include <../../3.2/default/CameraDevice_3_2.h>
     25 
     26 #include <android/hardware/camera/device/3.2/ICameraDevice.h>
     27 #include <hidl/Status.h>
     28 #include <hidl/MQDescriptor.h>
     29 
     30 namespace android {
     31 namespace hardware {
     32 namespace camera {
     33 namespace device {
     34 namespace V3_3 {
     35 namespace implementation {
     36 
     37 using namespace ::android::hardware::camera::device;
     38 using ::android::hardware::camera::common::V1_0::helper::CameraModule;
     39 using ::android::hardware::Return;
     40 using ::android::hardware::Void;
     41 using ::android::hardware::hidl_vec;
     42 using ::android::hardware::hidl_string;
     43 using ::android::sp;
     44 
     45 /*
     46  * The camera device HAL implementation is opened lazily (via the open call)
     47  */
     48 struct CameraDevice : public V3_2::implementation::CameraDevice {
     49 
     50     // Called by provider HAL.
     51     // Provider HAL must ensure the uniqueness of CameraDevice object per cameraId, or there could
     52     // be multiple CameraDevice trying to access the same physical camera.  Also, provider will have
     53     // to keep track of all CameraDevice objects in order to notify CameraDevice when the underlying
     54     // camera is detached.
     55     // Delegates nearly all work to CameraDevice_3_2
     56     CameraDevice(sp<CameraModule> module,
     57                  const std::string& cameraId,
     58                  const SortedVector<std::pair<std::string, std::string>>& cameraDeviceNames);
     59     ~CameraDevice();
     60 
     61 protected:
     62     virtual sp<V3_2::implementation::CameraDeviceSession> createSession(camera3_device_t*,
     63             const camera_metadata_t* deviceInfo,
     64             const sp<V3_2::ICameraDeviceCallback>&) override;
     65 
     66 };
     67 
     68 }  // namespace implementation
     69 }  // namespace V3_3
     70 }  // namespace device
     71 }  // namespace camera
     72 }  // namespace hardware
     73 }  // namespace android
     74 
     75 #endif  // ANDROID_HARDWARE_CAMERA_DEVICE_V3_3_CAMERADEVICE_H
     76