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 #pragma once 18 19 #include <android/hardware/automotive/sv/1.0/ISurroundViewSession.h> 20 #include <android/hardware/automotive/sv/1.0/ISurroundViewStream.h> 21 #include <android/hardware/automotive/sv/1.0/types.h> 22 23 #include <thread> 24 #include <vector> 25 26 namespace android::hardware::automotive::sv::V1_0::implementation::fuzzer { 27 28 using android::sp; 29 using android::hardware::Return; 30 using std::mutex; 31 using std::vector; 32 33 class SurroundViewStream : public ISurroundViewStream { 34 public: 35 SurroundViewStream(sp<ISurroundViewSession> session); 36 37 Return<void> notify(SvEvent svEvent) override; 38 Return<void> receiveFrames(const SvFramesDesc& svFramesDesc) override; 39 40 bool checkEventReceived(SvEvent svEvent); 41 SvFramesDesc getLastReceivedFrames(); 42 int getReceiveFramesCount(); 43 bool areAllFramesValid(); 44 void setDoNotReturnFrames(bool flag); 45 46 private: 47 mutex mLock; 48 49 vector<SvEvent> mReceivedEvents; 50 sp<ISurroundViewSession> mSession; 51 SvFramesDesc mLastReceivedFrames; 52 int mReceiveFramesCount; 53 bool mAllFramesValid = true; 54 }; 55 } // namespace android::hardware::automotive::sv::V1_0::implementation::fuzzer 56