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

Commit 8966d51c authored by Amy Zhang's avatar Amy Zhang Committed by Android (Google) Code Review
Browse files

Merge "Add FrontendSettingsExt struct in Tuner 1.1"

parents a240379a 3ea25a64
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ hidl_interface {
    srcs: [
        "IDemux.hal",
        "IFilter.hal",
        "IFrontend.hal",
        "IFilterCallback.hal",
        "ITuner.hal",
        "types.hal",
+70 −0
Original line number Diff line number Diff line
/*
 * Copyright 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.tv.tuner@1.1;

import @1.0::FrontendScanType;
import @1.0::FrontendSettings;
import @1.0::IFrontend;
import @1.0::Result;

/**
 * A Tuner Frontend is used to tune to a frequency and lock signal.
 *
 * IFrontend provides a bit stream to the Tuner Demux interface.
 */
interface IFrontend extends @1.0::IFrontend {
    /**
     * Tunes the frontend to using the settings given.
     *
     * This locks the frontend to a frequency by providing signal
     * delivery information. If previous tuning isn't completed, this call MUST
     * stop previous tuning, and start a new tuning.
     * Tune is an async call, with LOCKED or NO_SIGNAL events sent via callback.
     *
     * @param settings Signal delivery information the frontend uses to
     * search and lock the signal.
     * @param settingsExt Extended information that would be used in the 1.1 Frontend to
     * search and lock the signal in a better way.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if tuning can't be applied at current stage,
     *         UNKNOWN_ERROR if tuning failed for other reasons.
     */
    tune_1_1(FrontendSettings settings, FrontendSettingsExt settingsExt) generates (Result result);

    /**
     * Scan the frontend to use the settings given.
     *
     * This uses the frontend to start a scan from signal delivery information.
     * If previous scan isn't completed, this call MUST stop previous scan,
     * and start a new scan.
     * Scan is an async call, with FrontendScanMessage sent via callback.
     *
     * @param settings Signal delivery information which the frontend uses to
     * scan the signal.
     * @param type the type which the frontend uses to scan the signal.
     * @param settingsExt Extended information that would be used in the 1.1 Frontend to
     * search and lock the signal in a better way.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if tuning can't be applied at current stage,
     *         UNKNOWN_ERROR if tuning failed for other reasons.
     */
    scan_1_1(FrontendSettings settings, FrontendScanType type, FrontendSettingsExt settingsExt)
            generates (Result result);
};
+12 −0
Original line number Diff line number Diff line
@@ -71,6 +71,12 @@ Return<Result> Frontend::tune(const FrontendSettings& /* settings */) {
    return Result::SUCCESS;
}

Return<Result> Frontend::tune_1_1(const FrontendSettings& settings,
                                  const V1_1::FrontendSettingsExt& settingsExt) {
    ALOGV("%s", __FUNCTION__);
    return tune(settings);
}

Return<Result> Frontend::stopTune() {
    ALOGV("%s", __FUNCTION__);

@@ -115,6 +121,12 @@ Return<Result> Frontend::scan(const FrontendSettings& settings, FrontendScanType
    return Result::SUCCESS;
}

Return<Result> Frontend::scan_1_1(const FrontendSettings& settings, FrontendScanType type,
                                  const V1_1::FrontendSettingsExt& /*settingsExt*/) {
    ALOGV("%s", __FUNCTION__);
    return scan(settings, type);
}

Return<Result> Frontend::stopScan() {
    ALOGV("%s", __FUNCTION__);

+8 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#ifndef ANDROID_HARDWARE_TV_TUNER_V1_1_FRONTEND_H_
#define ANDROID_HARDWARE_TV_TUNER_V1_1_FRONTEND_H_

#include <android/hardware/tv/tuner/1.1/IFrontend.h>
#include <fstream>
#include <iostream>
#include "Tuner.h"
@@ -32,7 +33,7 @@ namespace implementation {

class Tuner;

class Frontend : public IFrontend {
class Frontend : public V1_1::IFrontend {
  public:
    Frontend(FrontendType type, FrontendId id, sp<Tuner> tuner);

@@ -42,10 +43,16 @@ class Frontend : public IFrontend {

    virtual Return<Result> tune(const FrontendSettings& settings) override;

    virtual Return<Result> tune_1_1(const FrontendSettings& settings,
                                    const V1_1::FrontendSettingsExt& settingsExt) override;

    virtual Return<Result> stopTune() override;

    virtual Return<Result> scan(const FrontendSettings& settings, FrontendScanType type) override;

    virtual Return<Result> scan_1_1(const FrontendSettings& settings, FrontendScanType type,
                                    const V1_1::FrontendSettingsExt& settingsExt) override;

    virtual Return<Result> stopScan() override;

    virtual Return<void> getStatus(const hidl_vec<FrontendStatusType>& statusTypes,
+94 −0
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ package android.hardware.tv.tuner@1.1;
import @1.0::Constant;
import @1.0::DemuxFilterMmtpRecordEvent;
import @1.0::DemuxFilterTsRecordEvent;
import @1.0::FrontendDvbcSpectralInversion;
import @1.0::FrontendDvbtTransmissionMode;
import android.hidl.safe_union@1.0;
import android.hidl.safe_union@1.0::Monostate;

@@ -28,6 +30,10 @@ enum Constant : @1.0::Constant {
     * An invalid mpuSequenceNumber in DemuxFilterMmtpRecordEvent.
     */
    INVALID_MMTP_RECORD_EVENT_MPT_SEQUENCE_NUM = 0xFFFFFFFF,
    /**
     * An invalid frenquency that can be used as the default value of the frontend setting.
     */
    INVALID_FRONTEND_SETTING_FREQUENCY = 0xFFFFFFFF,
};

@export
@@ -84,3 +90,91 @@ struct DemuxFilterEventExt {
     */
    vec<Event> events;
};

typedef FrontendDvbcSpectralInversion FrontendSpectralInversion;

/**
 *  Scan type for a DVBS Frontend.
 */
@export
enum FrontendDvbsScanType : uint32_t {
    UNDEFINED = 0,
    DIRECT,
    DISEQC,
    UNICABLE,
    JESS,
};

/**
 *  Rotation status for a DVBT Frontend.
 */
@export
enum FrontendDvbtRotation : uint32_t {
    UNDEFINED,
    NOT_ROTATED,
    ROTATED,
};

/**
 * AFT flag for an Analog Frontend.
 */
@export
enum FrontendAnalogAftFlag : uint32_t {
    UNDEFINED,
    AFT_TRUE,
    AFT_FALSE,
};

/**
 *  Extended Transmission Mode for DVBT.
 */
@export
enum FrontendDvbtTransmissionMode : @1.0::FrontendDvbtTransmissionMode {
    MODE_8K_E = 1 << 7,

    MODE_16K_E = 1 << 8,

    MODE_32K_E = 1 << 9,
};

/**
 *  Extended Signal Settings for a DVBS Frontend.
 */
struct FrontendDvbsSettingsExt {
    FrontendDvbsScanType scanType;
};

/**
 *  Extended Signal Settings for a DVBT Frontend.
 */
struct FrontendDvbtSettingsExt {
    FrontendDvbtRotation rotation;

    FrontendDvbtTransmissionMode transmissionMode;
};

/**
 *  Extended Signal Settings for an Analog Frontend.
 */
struct FrontendAnalogSettingsExt {
    FrontendAnalogAftFlag aftFlag;
};

/**
 *  Extended Signal Settings for Frontend.
 */
struct FrontendSettingsExt {
    uint32_t endFrequency;

    FrontendSpectralInversion inversion;

    safe_union SettingsExt {
        Monostate noinit;

        FrontendAnalogSettingsExt analog;

        FrontendDvbsSettingsExt dvbs;

        FrontendDvbtSettingsExt dvbt;
    } settingExt;
};
Loading