Enable LnbCallback in hidl/aidl default tuner implementation
Bug: 210960436
Test: cts.TunerTest#testLnbAddAndRemoveSharee
Change-Id: I11443144dcd1979afe9b077c446faaa293ccb61c
diff --git a/tv/tuner/1.1/default/Lnb.cpp b/tv/tuner/1.1/default/Lnb.cpp
index 044727f..5dd0147 100644
--- a/tv/tuner/1.1/default/Lnb.cpp
+++ b/tv/tuner/1.1/default/Lnb.cpp
@@ -33,9 +33,10 @@
Lnb::~Lnb() {}
-Return<Result> Lnb::setCallback(const sp<ILnbCallback>& /* callback */) {
+Return<Result> Lnb::setCallback(const sp<ILnbCallback>& callback) {
ALOGV("%s", __FUNCTION__);
+ mCallback = callback;
return Result::SUCCESS;
}
@@ -57,9 +58,16 @@
return Result::SUCCESS;
}
-Return<Result> Lnb::sendDiseqcMessage(const hidl_vec<uint8_t>& /* diseqcMessage */) {
+Return<Result> Lnb::sendDiseqcMessage(const hidl_vec<uint8_t>& diseqcMessage) {
ALOGV("%s", __FUNCTION__);
+ if (mCallback != nullptr) {
+ // The correct implementation should be to return the response from the
+ // device via onDiseqcMessage(). The below implementation is only to enable
+ // testing for LnbCallbacks.
+ ALOGV("[hidl] %s - this is for test purpose only, and must be replaced!", __FUNCTION__);
+ mCallback->onDiseqcMessage(diseqcMessage);
+ }
return Result::SUCCESS;
}
diff --git a/tv/tuner/1.1/default/Lnb.h b/tv/tuner/1.1/default/Lnb.h
index 70a8e41..b34ca39 100644
--- a/tv/tuner/1.1/default/Lnb.h
+++ b/tv/tuner/1.1/default/Lnb.h
@@ -51,6 +51,7 @@
private:
int mId;
virtual ~Lnb();
+ sp<ILnbCallback> mCallback;
};
} // namespace implementation