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

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

Merge "Tuner HAL for ATV Initialize Tuner HAL review from Tuner and Frontend Interface."

parents 7263a838 bca165e6
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
// This file is autogenerated by hidl-gen -Landroidbp.

hidl_interface {
    name: "android.hardware.tv.tuner@1.0",
    root: "android.hardware",
    vndk: {
        enabled: true,
    },
    srcs: [
        "types.hal",
        "IFrontend.hal",
        "IFrontendCallback.hal",
        "ITuner.hal",
    ],
    interfaces: [
        "android.hidl.base@1.0",
    ],
    gen_java: false,
    gen_java_constants: true,
}
+82 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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.0;

import IFrontendCallback;

/**
 * A Tuner Frontend is used to tune to a frequency and lock signal. It provide
 * live data feed to Tuner Demux interface.
 */
interface IFrontend {
    /**
     * Set the callback
     *
     * It is used by the client to receive events from the Frontend.
     * Only one callback for one Frontend instance is supported. The callback
     * will be replaced if it's set again.
     *
     * @param callback Callback object to pass Frontend events to the system.
     *        The previously registered callback must be replaced with this one.
     *        It can be null.
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         INVALID_STATE if callback can't be set at current stage,
     *         UNKNOWN_ERROR if callback setting failed for other reasons.
     */
    setCallback(IFrontendCallback callback) generates (Result result);

    /**
     * Tuning Frontend
     *
     * It is used by the client to lock 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 a async call.
     * LOCKED or NO_SIGNAL eventi is sent back to caller through callback.
     *
     * @param settings Signal delivery information which frontend can use to
     * search and lock the signal.
     *
     * @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(FrontendSettings settings) generates (Result result);

    /**
     * Stop the tuning
     *
     * It is used by the client to stop a previous tuning.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successfully stop tuning.
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    stopTune() generates (Result result);

    /**
     * Release the Frontend instance
     *
     * It is used by the client to release the frontend instance. HAL clear
     * underneath resource. client mustn't access the instance any more.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         UNKNOWN_ERROR if failed for other reasons.
     */
    close() generates (Result result);
};
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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.0;

interface IFrontendCallback {
    /**
     * Notify the client that a new event happened on the frontend.
     *
     * @param frontendEventType the event type.
     */
    oneway onEvent(FrontendEventType frontendEventType);

    /**
     * The callback function that must be called by HAL implementation to notify
     * the client of new DiSEqC message.
     *
     * @param diseqcMessage a byte array of data for DiSEqC (Digital Satellite
     * Equipment Control) message which is specified by EUTELSAT Bus Functional
     * Specification Version 4.2.
     */
    oneway onDiseqcMessage(vec<uint8_t> diseqcMessage);
};
+52 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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.0;

import IFrontend;

/**
 * Top level interface to manage Frontend, Demux and Decrambler hardware
 * resouces which are needed for Android TV.
 */
interface ITuner {
    /**
     * Get Frontend IDs
     *
     * It is used by the client to get all available frontends' IDs.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         UNKNOWN_ERROR if tuning failed for other reasons.
     * @return frontendIds an array of FrontendId for the available frontends.
     */
    getFrontendIds() generates (Result result, vec<FrontendId> frontendIds);

    /**
     * Create a new instance of Frontend given a frontendId.
     *
     * It is used by the client to create a frontend instance.
     *
     * @return result Result status of the operation.
     *         SUCCESS if successful,
     *         UNKNOWN_ERROR if creation failed for other reasons.
     * @return frontend the newly created frontend interface.
     */
    openFrontendById(FrontendId frontendId)
        generates (Result result, IFrontend frontend);

};

tv/tuner/1.0/types.hal

0 → 100644
+139 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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.0;

import android.hidl.safe_union@1.0;

@export
enum Result : int32_t {
    SUCCESS,
    UNAVAILABLE,
    NOT_INITIALIZED,
    INVALID_STATE,
    INVALID_ARGUMENT,
    OUT_OF_MEMORY,
    UNKNOWN_ERROR,
};

/**
 * Frontend ID.
 */
typedef uint32_t FrontendId;

/**
 *  Frontend Types.
 */
@export
enum FrontendType : uint32_t {
    UNDEFINED = 0,
    ANALOG,
    ATSC,
    DVBC,
    DVBS,
    DVBT,
    ISDBT,
};

/**
 *  Inner Forward Error Correction type as specified in ETSI EN 300 468 V1.15.1
 *  It's a 4-bit field specifying the inner FEC scheme used according to the
 *  table 35 in the spec.
 */
@export
enum FrontendInnerFec : uint32_t {
    /* Not defined */
    FEC_UNDEFINED = 0,
    /* 1/2 conv. code rate */
    FEC_1_2 = 1 << 0,
    /* 2/3 conv. code rate */
    FEC_2_3 = 1 << 1,
    /* 3/4 conv. code rate */
    FEC_3_4 = 1 << 2,
    /* 5/6 conv. code rate */
    FEC_5_6 = 1 << 3,
    /* 7/8 conv. code rate */
    FEC_7_8 = 1 << 4,
    /* 8/9 conv. code rate */
    FEC_8_9 = 1 << 5,
    /* 3/5 conv. code rate */
    FEC_3_5 = 1 << 6,
    /* 4/5 conv. code rate */
    FEC_4_5 = 1 << 7,
    /* 9/10 conv. code rate */
    FEC_9_10 = 1 << 8,
    /* hardware is able to detect and set FEC automatically */
    FEC_AUTO = 1 << 9,
};

/**
 *  Modulation Type for ATSC.
 */
@export
enum FrontendAtscModulation : uint32_t {
    UNDEFINED = 0,
    MOD_8VSB = 1 << 0,
    MOD_16VSB = 1 << 1,
};

/**
 *  Signal Setting for ATSC Frontend.
 */
struct FrontendAtscSettings {
    /** Signal frequencey in Herhz */
    uint32_t frequency;
    FrontendAtscModulation modulation;
};

/**
 *  Signal Setting for DVBT Frontend.
 */
struct FrontendDvbtSettings {
    /** Signal frequencey in Herhz */
    uint32_t frequency;
    FrontendAtscModulation modulation;
    FrontendInnerFec fec;
};

/**
 *  Modulation Type for ATSC.
 */
safe_union FrontendSettings {
    FrontendAtscSettings atsc;
    FrontendDvbtSettings dvbt;
};

/**
 * Frontend Event Type.
 */
@export
enum FrontendEventType : uint32_t {
    /**
     * If frontend locked the signal which is specified by tune method, HAL sent
     * Locked event.
     */
    LOCKED,
    /**
     * If frontend can't locked the signal which is specified by tune method,
     * HAL sent NO_SIGNAL event.
     */
    NO_SIGNAL,
    /**
     * If frontend detect that the locked signal get lost, HAL sent LOST_LOCK
     * event.
     */
    LOST_LOCK,
};