1 /** 2 * Copyright 2021, 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_MEDIA_TUNERFRONTEND_H 18 #define ANDROID_MEDIA_TUNERFRONTEND_H 19 20 #include <aidl/android/hardware/tv/tuner/BnFrontendCallback.h> 21 #include <aidl/android/hardware/tv/tuner/IFrontend.h> 22 #include <aidl/android/hardware/tv/tuner/IFrontendCallback.h> 23 #include <aidl/android/media/tv/tuner/BnTunerFrontend.h> 24 #include <utils/Log.h> 25 26 using ::aidl::android::hardware::tv::tuner::BnFrontendCallback; 27 using ::aidl::android::hardware::tv::tuner::FrontendEventType; 28 using ::aidl::android::hardware::tv::tuner::FrontendScanMessage; 29 using ::aidl::android::hardware::tv::tuner::FrontendScanMessageType; 30 using ::aidl::android::hardware::tv::tuner::FrontendScanType; 31 using ::aidl::android::hardware::tv::tuner::FrontendSettings; 32 using ::aidl::android::hardware::tv::tuner::FrontendStatus; 33 using ::aidl::android::hardware::tv::tuner::FrontendStatusReadiness; 34 using ::aidl::android::hardware::tv::tuner::FrontendStatusType; 35 using ::aidl::android::hardware::tv::tuner::IFrontend; 36 using ::aidl::android::hardware::tv::tuner::IFrontendCallback; 37 38 using namespace std; 39 40 namespace aidl { 41 namespace android { 42 namespace media { 43 namespace tv { 44 namespace tuner { 45 46 class TunerFrontend : public BnTunerFrontend { 47 48 public: 49 TunerFrontend(shared_ptr<IFrontend> frontend, int id); 50 virtual ~TunerFrontend(); 51 52 ::ndk::ScopedAStatus setCallback( 53 const shared_ptr<ITunerFrontendCallback>& in_tunerFrontendCallback) override; 54 ::ndk::ScopedAStatus tune(const FrontendSettings& in_settings) override; 55 ::ndk::ScopedAStatus stopTune() override; 56 ::ndk::ScopedAStatus scan(const FrontendSettings& in_settings, 57 FrontendScanType in_frontendScanType) override; 58 ::ndk::ScopedAStatus stopScan() override; 59 ::ndk::ScopedAStatus setLnb(const shared_ptr<ITunerLnb>& in_lnb) override; 60 ::ndk::ScopedAStatus linkCiCamToFrontend(int32_t in_ciCamId, int32_t* _aidl_return) override; 61 ::ndk::ScopedAStatus unlinkCiCamToFrontend(int32_t in_ciCamId) override; 62 ::ndk::ScopedAStatus close() override; 63 ::ndk::ScopedAStatus getStatus(const vector<FrontendStatusType>& in_statusTypes, 64 vector<FrontendStatus>* _aidl_return) override; 65 ::ndk::ScopedAStatus getFrontendId(int32_t* _aidl_return) override; 66 ::ndk::ScopedAStatus getHardwareInfo(std::string* _aidl_return) override; 67 ::ndk::ScopedAStatus removeOutputPid(int32_t in_pid) override; 68 ::ndk::ScopedAStatus getFrontendStatusReadiness( 69 const std::vector<FrontendStatusType>& in_statusTypes, 70 std::vector<FrontendStatusReadiness>* _aidl_return) override; 71 72 struct FrontendCallback : public BnFrontendCallback { FrontendCallbackFrontendCallback73 FrontendCallback(const shared_ptr<ITunerFrontendCallback> tunerFrontendCallback) 74 : mTunerFrontendCallback(tunerFrontendCallback){}; 75 76 ::ndk::ScopedAStatus onEvent(FrontendEventType frontendEventType) override; 77 ::ndk::ScopedAStatus onScanMessage(FrontendScanMessageType type, 78 const FrontendScanMessage& message) override; 79 80 shared_ptr<ITunerFrontendCallback> mTunerFrontendCallback; 81 }; 82 83 private: 84 int mId; 85 shared_ptr<IFrontend> mFrontend; 86 bool isClosed = false; 87 }; 88 89 } // namespace tuner 90 } // namespace tv 91 } // namespace media 92 } // namespace android 93 } // namespace aidl 94 95 #endif // ANDROID_MEDIA_TUNERFRONTEND_H 96