Changyeon Jo | 8018901 | 2021-10-10 16:34:21 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 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 AUTOMOTIVE_EVS_VTS_FRAMEHANDLERULTRASONICS_H |
| 18 | #define AUTOMOTIVE_EVS_VTS_FRAMEHANDLERULTRASONICS_H |
| 19 | |
| 20 | #include <aidl/android/hardware/automotive/evs/BnEvsUltrasonicsArrayStream.h> |
| 21 | #include <aidl/android/hardware/automotive/evs/IEvsUltrasonicsArray.h> |
| 22 | |
| 23 | #include <vector> |
| 24 | |
| 25 | class FrameHandlerUltrasonics |
| 26 | : public ::aidl::android::hardware::automotive::evs::BnEvsUltrasonicsArrayStream { |
| 27 | public: |
| 28 | FrameHandlerUltrasonics( |
| 29 | const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray>& |
| 30 | pArray); |
| 31 | |
| 32 | // Implementation for ::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArrayStream |
| 33 | ::ndk::ScopedAStatus notify( |
| 34 | const ::aidl::android::hardware::automotive::evs::EvsEventDesc& event) override; |
| 35 | ::ndk::ScopedAStatus deliverDataFrame( |
| 36 | const ::aidl::android::hardware::automotive::evs::UltrasonicsDataFrameDesc& desc) |
| 37 | override; |
| 38 | |
| 39 | bool checkEventReceived( |
| 40 | const ::aidl::android::hardware::automotive::evs::EvsEventDesc& evsEvent); |
| 41 | int getReceiveFramesCount(); |
| 42 | bool areAllFramesValid(); |
| 43 | |
| 44 | private: |
| 45 | std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray> |
| 46 | mEvsUltrasonicsArray; |
| 47 | std::vector<::aidl::android::hardware::automotive::evs::EvsEventDesc> mReceivedEvents; |
| 48 | int mReceiveFramesCount; |
| 49 | bool mAllFramesValid = true; |
| 50 | }; |
| 51 | |
| 52 | #endif // AUTOMOTIVE_EVS_VTS_FRAMEHANDLERULTRASONICS_H |