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

View file

@ -38,6 +38,7 @@ using ::android::hardware::tv::tuner::V1_0::Result;
class Lnb : public ILnb { class Lnb : public ILnb {
public: public:
Lnb(); Lnb();
Lnb(int id);
virtual Return<Result> setCallback(const sp<ILnbCallback>& callback) override; virtual Return<Result> setCallback(const sp<ILnbCallback>& callback) override;
@ -51,7 +52,10 @@ class Lnb : public ILnb {
virtual Return<Result> close() override; virtual Return<Result> close() override;
int getId();
private: private:
int mId;
virtual ~Lnb(); virtual ~Lnb();
}; };
@ -62,4 +66,4 @@ class Lnb : public ILnb {
} // namespace hardware } // namespace hardware
} // namespace android } // 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 = FrontendInfo::FrontendCapabilities();
caps.atscCaps(FrontendAtscCapabilities()); caps.atscCaps(FrontendAtscCapabilities());
mFrontendCaps[7] = caps; mFrontendCaps[7] = caps;
mLnbs.resize(2);
mLnbs[0] = new Lnb(0);
mLnbs[1] = new Lnb(1);
} }
Tuner::~Tuner() {} Tuner::~Tuner() {}
@ -194,17 +198,24 @@ Return<void> Tuner::getLnbIds(getLnbIds_cb _hidl_cb) {
ALOGV("%s", __FUNCTION__); ALOGV("%s", __FUNCTION__);
vector<LnbId> lnbIds; 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); _hidl_cb(Result::SUCCESS, lnbIds);
return Void(); 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__); 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(); return Void();
} }

View file

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