Merge "Add Lnbs for CTS" into rvc-dev am: 8350572765

Change-Id: I265a01e4ef50510cd45ad6c69e50b0447a65d40d
This commit is contained in:
TreeHugger Robot 2020-04-24 23:48:55 +00:00 committed by Automerger Merge Worker
commit 199bf5002c
4 changed files with 29 additions and 5 deletions

View file

@ -27,6 +27,9 @@ namespace V1_0 {
namespace implementation {
Lnb::Lnb() {}
Lnb::Lnb(int id) {
mId = id;
}
Lnb::~Lnb() {}
@ -66,9 +69,13 @@ Return<Result> Lnb::close() {
return Result::SUCCESS;
}
int Lnb::getId() {
return mId;
}
} // namespace implementation
} // namespace V1_0
} // namespace tuner
} // namespace tv
} // namespace hardware
} // namespace android
} // namespace android

View file

@ -38,6 +38,7 @@ using ::android::hardware::tv::tuner::V1_0::Result;
class Lnb : public ILnb {
public:
Lnb();
Lnb(int id);
virtual Return<Result> setCallback(const sp<ILnbCallback>& callback) override;
@ -51,7 +52,10 @@ class Lnb : public ILnb {
virtual Return<Result> close() override;
int getId();
private:
int mId;
virtual ~Lnb();
};
@ -62,4 +66,4 @@ class Lnb : public ILnb {
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_TV_TUNER_V1_0_LNB_H_
#endif // ANDROID_HARDWARE_TV_TUNER_V1_0_LNB_H_

View file

@ -88,6 +88,10 @@ Tuner::Tuner() {
caps = FrontendInfo::FrontendCapabilities();
caps.atscCaps(FrontendAtscCapabilities());
mFrontendCaps[7] = caps;
mLnbs.resize(2);
mLnbs[0] = new Lnb(0);
mLnbs[1] = new Lnb(1);
}
Tuner::~Tuner() {}
@ -194,17 +198,24 @@ Return<void> Tuner::getLnbIds(getLnbIds_cb _hidl_cb) {
ALOGV("%s", __FUNCTION__);
vector<LnbId> lnbIds;
lnbIds.resize(mLnbs.size());
for (int i = 0; i < lnbIds.size(); i++) {
lnbIds[i] = mLnbs[i]->getId();
}
_hidl_cb(Result::SUCCESS, lnbIds);
return Void();
}
Return<void> Tuner::openLnbById(LnbId /* lnbId */, openLnbById_cb _hidl_cb) {
Return<void> Tuner::openLnbById(LnbId lnbId, openLnbById_cb _hidl_cb) {
ALOGV("%s", __FUNCTION__);
sp<ILnb> lnb = new Lnb();
if (lnbId >= mLnbs.size()) {
_hidl_cb(Result::INVALID_ARGUMENT, nullptr);
return Void();
}
_hidl_cb(Result::SUCCESS, lnb);
_hidl_cb(Result::SUCCESS, mLnbs[lnbId]);
return Void();
}

View file

@ -21,6 +21,7 @@
#include <map>
#include "Demux.h"
#include "Frontend.h"
#include "Lnb.h"
using namespace std;
@ -76,6 +77,7 @@ class Tuner : public ITuner {
// The last used demux id. Initial value is -1.
// First used id will be 0.
int mLastUsedId = -1;
vector<sp<Lnb>> mLnbs;
};
} // namespace implementation