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

Commit f32eb352 authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "initial HAL definition for bradcast radio (e.g FM radio)"

parents 8389b107 402a829d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ subdirs = [
    "biometrics/fingerprint/2.1",
    "bluetooth/1.0",
    "boot/1.0",
    "broadcastradio/1.0",
    "example/extension/light/2.0",
    "gnss/1.0",
    "graphics/allocator/2.0",
+70 −0
Original line number Diff line number Diff line
// This file is autogenerated by hidl-gen. Do not edit manually.

genrule {
    name: "android.hardware.broadcastradio@1.0_genc++",
    tool: "hidl-gen",
    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.broadcastradio@1.0",
    srcs: [
        "types.hal",
        "IBroadcastRadio.hal",
        "IBroadcastRadioFactory.hal",
        "ITuner.hal",
        "ITunerCallback.hal",
    ],
    out: [
        "android/hardware/broadcastradio/1.0/types.cpp",
        "android/hardware/broadcastradio/1.0/BroadcastRadioAll.cpp",
        "android/hardware/broadcastradio/1.0/BroadcastRadioFactoryAll.cpp",
        "android/hardware/broadcastradio/1.0/TunerAll.cpp",
        "android/hardware/broadcastradio/1.0/TunerCallbackAll.cpp",
    ],
}

genrule {
    name: "android.hardware.broadcastradio@1.0_genc++_headers",
    tool: "hidl-gen",
    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.broadcastradio@1.0",
    srcs: [
        "types.hal",
        "IBroadcastRadio.hal",
        "IBroadcastRadioFactory.hal",
        "ITuner.hal",
        "ITunerCallback.hal",
    ],
    out: [
        "android/hardware/broadcastradio/1.0/types.h",
        "android/hardware/broadcastradio/1.0/IBroadcastRadio.h",
        "android/hardware/broadcastradio/1.0/IHwBroadcastRadio.h",
        "android/hardware/broadcastradio/1.0/BnBroadcastRadio.h",
        "android/hardware/broadcastradio/1.0/BpBroadcastRadio.h",
        "android/hardware/broadcastradio/1.0/BsBroadcastRadio.h",
        "android/hardware/broadcastradio/1.0/IBroadcastRadioFactory.h",
        "android/hardware/broadcastradio/1.0/IHwBroadcastRadioFactory.h",
        "android/hardware/broadcastradio/1.0/BnBroadcastRadioFactory.h",
        "android/hardware/broadcastradio/1.0/BpBroadcastRadioFactory.h",
        "android/hardware/broadcastradio/1.0/BsBroadcastRadioFactory.h",
        "android/hardware/broadcastradio/1.0/ITuner.h",
        "android/hardware/broadcastradio/1.0/IHwTuner.h",
        "android/hardware/broadcastradio/1.0/BnTuner.h",
        "android/hardware/broadcastradio/1.0/BpTuner.h",
        "android/hardware/broadcastradio/1.0/BsTuner.h",
        "android/hardware/broadcastradio/1.0/ITunerCallback.h",
        "android/hardware/broadcastradio/1.0/IHwTunerCallback.h",
        "android/hardware/broadcastradio/1.0/BnTunerCallback.h",
        "android/hardware/broadcastradio/1.0/BpTunerCallback.h",
        "android/hardware/broadcastradio/1.0/BsTunerCallback.h",
    ],
}

cc_library_shared {
    name: "android.hardware.broadcastradio@1.0",
    generated_sources: ["android.hardware.broadcastradio@1.0_genc++"],
    generated_headers: ["android.hardware.broadcastradio@1.0_genc++_headers"],
    export_generated_headers: ["android.hardware.broadcastradio@1.0_genc++_headers"],
    shared_libs: [
        "libhidl",
        "libhwbinder",
        "libutils",
        "libcutils",
    ],
}
+51 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 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.broadcastradio@1.0;

import ITunerCallback;
import ITuner;

interface IBroadcastRadio {

    /*
     * Retrieve implementation properties.
     * @return result Operation completion status: OK in case of success,
     *                NOT_INITIALIZED in case of initialization error.
     * @return properties A Properties structure containing implementation
     *                    description and capabilities.
     */
    getProperties() generates (Result result, Properties properties);

    /*
     * Open a tuner interface for the requested configuration.
     * If no other tuner is opened, this will power on the radio hardware.
     * The hardware must be powered down when all tuner interface are released.
     * @param config A BandConfig struct containing the band configuration to apply
     * @param audio True if this tuner must be used for live radio listening and
     *              should be connected to the radio audio source.
     * @param callback the callback interface
     * @return result Operation completion status: OK in case of success,
     *                INVALID_ARGUMENTS if configuration requested is invalid,
     *                INVALID_STATE if called out of sequence
     * @return tuner The interface to control the tuner
     *
     * Callback ITunerCallback.ConfigChanged MUST be called once the
     * configuration is applied or a failure occurs or after a time out.
     */
    openTuner(BandConfig config, bool audio, ITunerCallback callback)
                generates (Result result, ITuner tuner);
};
+36 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 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.broadcastradio@1.0;

import IBroadcastRadio;

interface IBroadcastRadioFactory {

    /*
     * Connects to a broadcast radio HAL module for a given class
     * (AM/FM, Satellite, DAB).
     *
     * @param classId Class of the module to connect to .
     * @return retval operation completion status. Returns INVALID_ARGUMENTS
     *         if there is no corresponding hardware module found,
     *         NOT_INITIALIZED if an error occurred while opening the hardware
     *         module.
     * @return result the interface for the created module.
     */
    connectModule(Class classId)
      generates (Result retval, IBroadcastRadio result);
};
+113 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 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.broadcastradio@1.0;

import ITunerCallback;

interface ITuner {

    /*
     * Apply current radio band configuration (band, range, channel spacing...).
     * Automatically cancels pending scan, step or tune.
     * ITunerCallback.configChange() method MUST be called once the
     * configuration is applied or a failure occurs or after a time out.
     * @param config The band configuration to apply.
     * @return result OK if configuration could be applied
     *                NOT_INITIALIZED in case of initialization error.
     *                INVALID_ARGUMENTS if configuration requested is invalid
     *
     */
    setConfiguration(BandConfig config) generates(Result result);

    /*
     * Retrieve current radio band configuration.
     * @return result OK if valid configuration is returned,
     *                NOT_INITIALIZED in case of initialization error.
     * @param config Current band configuration
     */
    getConfiguration() generates(Result result, BandConfig config);

    /*
     * Start scanning up to next valid station.
     * Shall be called only when a valid configuration has been applied.
     * Automatically cancels pending scan, step or tune.
     * ITunerCallback.tuneComplete() MUST be called once locked on a station
     * or after a time out or full band scan if no station found.
     * The status should indicate if a valid station is tuned or not.
     * @param direction UP or DOWN.
     * @param skipSubChannel valid for HD radio or digital radios only:
     *                       ignore sub channels (e.g SPS for HD radio).
     * @return result OK if scan successfully started
     *                INVALID_STATE if called out of sequence
     *                NOT_INITIALIZED if another error occurs
     */
    scan(Direction direction, bool skipSubChannel) generates(Result result);

    /*
     * Move one channel spacing up or down.
     * Must be called when a valid configuration has been applied.
     * Automatically cancels pending scan, step or tune.
     * ITunerCallback.tuneComplete() MUST be called once locked on a station
     * or after a time out or full band scan if no station found.
     * The status should indicate if a valid station is tuned or not.
     * @param direction UP or DOWN.
     * @param skipSubChannel valid for HD radio or digital radios only:
     *                       ignore sub channels (e.g SPS for HD radio).
     * @return result OK if scan successfully started
     *                INVALID_STATE if called out of sequence
     *                NOT_INITIALIZED if another error occurs
     */
    step(Direction direction, bool skipSubChannel) generates(Result result);

    /*
     * Tune to specified channel.
     * Must be called when a valid configuration has been applied.
     * Automatically cancels pending scan, step or tune.
     * ITunerCallback.tuneComplete() MUST be called once locked on a station
     * or after a time out or full band scan if no station found.
     * The status should indicate if a valid station is tuned or not.
     * @param channel Channel to tune to. A frequency in kHz for AM/FM/HD Radio
     *                bands.
     * @param subChannel Valid for HD radio or digital radios only
     *                   (e.g SPS number for HD radio)..
     * @return result OK if scan successfully started
     *                INVALID_ARGUMENTS if invalid arguments are passed
     *                INVALID_STATE if called out of sequence
     *                NOT_INITIALIZED if another error occurs
     */
    tune(uint32_t channel, uint32_t subChannel) generates(Result result);

    /*
     * Cancel a scan, step or tune operation.
     * Shall be called only while a scan, step or tune operation is pending.
     * ITunerCallback.tuneComplete() MUST NOT be sent by the HAL.
     * @return result OK if scan successfully started
     *                INVALID_STATE if called out of sequence
     *                NOT_INITIALIZED if another error occurs
     */
    cancel() generates(Result result);

    /*
     * Retrieve current station information.
     * @param withMetadata True if Metadata should be returned, false otherwise.
     * @return result OK if scan successfully started
     *                NOT_INITIALIZED if another error occurs
     * @return info Current program information.
     */
    getProgramInformation(bool withMetadata)
            generates(Result result, ProgramInfo info);
};
Loading