1 /* 2 * Copyright (C) 2022 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 CPP_EVS_MANAGER_AIDL_WRAPPERS_INCLUDE_HIDLCAMERASTREAM_H 18 #define CPP_EVS_MANAGER_AIDL_WRAPPERS_INCLUDE_HIDLCAMERASTREAM_H 19 20 #include <aidl/android/hardware/automotive/evs/IEvsCameraStream.h> 21 #include <android/hardware/automotive/evs/1.1/IEvsCameraStream.h> 22 #include <android/hardware/automotive/evs/1.1/types.h> 23 24 #include <list> 25 26 namespace aidl::android::automotive::evs::implementation { 27 28 namespace aidlevs = ::aidl::android::hardware::automotive::evs; 29 namespace hidlevs = ::android::hardware::automotive::evs; 30 31 class HidlCameraStream final : public ::android::hardware::automotive::evs::V1_1::IEvsCameraStream { 32 public: 33 // Methods from ::android::hardware::automotive::evs::V1_0::IEvsCameraStream follow. 34 ::android::hardware::Return<void> deliverFrame( 35 const hidlevs::V1_0::BufferDesc& buffer) override; 36 37 // Methods from ::android::hardware::automotive::evs::V1_1::IEvsCameraStream follow. 38 ::android::hardware::Return<void> deliverFrame_1_1( 39 const ::android::hardware::hidl_vec<hidlevs::V1_1::BufferDesc>& buffers) override; 40 ::android::hardware::Return<void> notify(const hidlevs::V1_1::EvsEventDesc& event) override; 41 HidlCameraStream(const std::string & id,const std::shared_ptr<aidlevs::IEvsCameraStream> & camera)42 HidlCameraStream(const std::string& id, 43 const std::shared_ptr<aidlevs::IEvsCameraStream>& camera) : 44 mSourceDeviceId(id), mAidlStream(camera) {} 45 46 bool getHidlBuffer(int id, hidlevs::V1_0::BufferDesc* _return); 47 bool getHidlBuffer(int id, hidlevs::V1_1::BufferDesc* _return); 48 49 private: 50 std::string mSourceDeviceId; 51 std::shared_ptr<aidlevs::IEvsCameraStream> mAidlStream; 52 std::list<hidlevs::V1_0::BufferDesc> mHidlV0Buffers; 53 std::list<hidlevs::V1_1::BufferDesc> mHidlV1Buffers; 54 }; 55 56 } // namespace aidl::android::automotive::evs::implementation 57 58 #endif // CPP_EVS_MANAGER_AIDL_WRAPPERS_INCLUDE_HIDLCAMERASTREAM_H 59