Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83505727 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add Lnbs for CTS" into rvc-dev

parents d78626d9 fd882510
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -27,6 +27,9 @@ namespace V1_0 {
namespace implementation {

Lnb::Lnb() {}
Lnb::Lnb(int id) {
    mId = id;
}

Lnb::~Lnb() {}

@@ -66,6 +69,10 @@ Return<Result> Lnb::close() {
    return Result::SUCCESS;
}

int Lnb::getId() {
    return mId;
}

}  // namespace implementation
}  // namespace V1_0
}  // namespace tuner
+5 −1
Original line number Diff line number Diff line
@@ -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();
};

+14 −3
Original line number Diff line number Diff line
@@ -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();
}

+2 −0
Original line number Diff line number Diff line
@@ -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