xref: /aosp_15_r20/hardware/interfaces/broadcastradio/1.0/ITuner.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2015 The Android Open Source Project
3*4d7e907cSAndroid Build Coastguard Worker *
4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*4d7e907cSAndroid Build Coastguard Worker *
8*4d7e907cSAndroid Build Coastguard Worker *      http://www.apache.org/licenses/LICENSE-2.0
9*4d7e907cSAndroid Build Coastguard Worker *
10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License.
15*4d7e907cSAndroid Build Coastguard Worker */
16*4d7e907cSAndroid Build Coastguard Worker
17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected];
18*4d7e907cSAndroid Build Coastguard Worker
19*4d7e907cSAndroid Build Coastguard Workerimport ITunerCallback;
20*4d7e907cSAndroid Build Coastguard Worker
21*4d7e907cSAndroid Build Coastguard Workerinterface ITuner {
22*4d7e907cSAndroid Build Coastguard Worker
23*4d7e907cSAndroid Build Coastguard Worker    /**
24*4d7e907cSAndroid Build Coastguard Worker     * Apply current radio band configuration (band, range, channel spacing...).
25*4d7e907cSAndroid Build Coastguard Worker     * Automatically cancels pending scan, step or tune.
26*4d7e907cSAndroid Build Coastguard Worker     * ITunerCallback.configChange() method MUST be called once the
27*4d7e907cSAndroid Build Coastguard Worker     * configuration is applied or a failure occurs or after a time out.
28*4d7e907cSAndroid Build Coastguard Worker     * @param config The band configuration to apply.
29*4d7e907cSAndroid Build Coastguard Worker     * @return result OK if configuration could be applied
30*4d7e907cSAndroid Build Coastguard Worker     *                NOT_INITIALIZED in case of initialization error.
31*4d7e907cSAndroid Build Coastguard Worker     *                INVALID_ARGUMENTS if configuration requested is invalid
32*4d7e907cSAndroid Build Coastguard Worker     *
33*4d7e907cSAndroid Build Coastguard Worker     */
34*4d7e907cSAndroid Build Coastguard Worker    setConfiguration(BandConfig config) generates(Result result);
35*4d7e907cSAndroid Build Coastguard Worker
36*4d7e907cSAndroid Build Coastguard Worker    /**
37*4d7e907cSAndroid Build Coastguard Worker     * Retrieve current radio band configuration.
38*4d7e907cSAndroid Build Coastguard Worker     * @return result OK if valid configuration is returned,
39*4d7e907cSAndroid Build Coastguard Worker     *                NOT_INITIALIZED in case of initialization error.
40*4d7e907cSAndroid Build Coastguard Worker     * @param config Current band configuration
41*4d7e907cSAndroid Build Coastguard Worker     */
42*4d7e907cSAndroid Build Coastguard Worker    getConfiguration() generates(Result result, BandConfig config);
43*4d7e907cSAndroid Build Coastguard Worker
44*4d7e907cSAndroid Build Coastguard Worker    /**
45*4d7e907cSAndroid Build Coastguard Worker     * Start scanning up to next valid station.
46*4d7e907cSAndroid Build Coastguard Worker     * Shall be called only when a valid configuration has been applied.
47*4d7e907cSAndroid Build Coastguard Worker     * Automatically cancels pending scan, step or tune.
48*4d7e907cSAndroid Build Coastguard Worker     * ITunerCallback.tuneComplete() MUST be called once locked on a station
49*4d7e907cSAndroid Build Coastguard Worker     * or after a time out or full band scan if no station found.
50*4d7e907cSAndroid Build Coastguard Worker     * The status should indicate if a valid station is tuned or not.
51*4d7e907cSAndroid Build Coastguard Worker     * @param direction UP or DOWN.
52*4d7e907cSAndroid Build Coastguard Worker     * @param skipSubChannel valid for HD radio or digital radios only:
53*4d7e907cSAndroid Build Coastguard Worker     *                       ignore sub channels (e.g SPS for HD radio).
54*4d7e907cSAndroid Build Coastguard Worker     * @return result OK if scan successfully started
55*4d7e907cSAndroid Build Coastguard Worker     *                INVALID_STATE if called out of sequence
56*4d7e907cSAndroid Build Coastguard Worker     *                NOT_INITIALIZED if another error occurs
57*4d7e907cSAndroid Build Coastguard Worker     */
58*4d7e907cSAndroid Build Coastguard Worker    scan(Direction direction, bool skipSubChannel) generates(Result result);
59*4d7e907cSAndroid Build Coastguard Worker
60*4d7e907cSAndroid Build Coastguard Worker    /**
61*4d7e907cSAndroid Build Coastguard Worker     * Move one channel spacing up or down.
62*4d7e907cSAndroid Build Coastguard Worker     * Must be called when a valid configuration has been applied.
63*4d7e907cSAndroid Build Coastguard Worker     * Automatically cancels pending scan, step or tune.
64*4d7e907cSAndroid Build Coastguard Worker     * ITunerCallback.tuneComplete() MUST be called once locked on a station
65*4d7e907cSAndroid Build Coastguard Worker     * or after a time out or full band scan if no station found.
66*4d7e907cSAndroid Build Coastguard Worker     * The status should indicate if a valid station is tuned or not.
67*4d7e907cSAndroid Build Coastguard Worker     * @param direction UP or DOWN.
68*4d7e907cSAndroid Build Coastguard Worker     * @param skipSubChannel valid for HD radio or digital radios only:
69*4d7e907cSAndroid Build Coastguard Worker     *                       ignore sub channels (e.g SPS for HD radio).
70*4d7e907cSAndroid Build Coastguard Worker     * @return result OK if scan successfully started
71*4d7e907cSAndroid Build Coastguard Worker     *                INVALID_STATE if called out of sequence
72*4d7e907cSAndroid Build Coastguard Worker     *                NOT_INITIALIZED if another error occurs
73*4d7e907cSAndroid Build Coastguard Worker     */
74*4d7e907cSAndroid Build Coastguard Worker    step(Direction direction, bool skipSubChannel) generates(Result result);
75*4d7e907cSAndroid Build Coastguard Worker
76*4d7e907cSAndroid Build Coastguard Worker    /**
77*4d7e907cSAndroid Build Coastguard Worker     * Tune to specified channel.
78*4d7e907cSAndroid Build Coastguard Worker     * Must be called when a valid configuration has been applied.
79*4d7e907cSAndroid Build Coastguard Worker     * Automatically cancels pending scan, step or tune.
80*4d7e907cSAndroid Build Coastguard Worker     * ITunerCallback.tuneComplete() MUST be called once locked on a station
81*4d7e907cSAndroid Build Coastguard Worker     * or after a time out or full band scan if no station found.
82*4d7e907cSAndroid Build Coastguard Worker     * The status should indicate if a valid station is tuned or not.
83*4d7e907cSAndroid Build Coastguard Worker     * @param channel Channel to tune to. A frequency in kHz for AM/FM/HD Radio
84*4d7e907cSAndroid Build Coastguard Worker     *                bands.
85*4d7e907cSAndroid Build Coastguard Worker     * @param subChannel Valid for HD radio or digital radios only
86*4d7e907cSAndroid Build Coastguard Worker     *                   (e.g SPS number for HD radio)..
87*4d7e907cSAndroid Build Coastguard Worker     * @return result OK if scan successfully started
88*4d7e907cSAndroid Build Coastguard Worker     *                INVALID_ARGUMENTS if invalid arguments are passed
89*4d7e907cSAndroid Build Coastguard Worker     *                INVALID_STATE if called out of sequence
90*4d7e907cSAndroid Build Coastguard Worker     *                NOT_INITIALIZED if another error occurs
91*4d7e907cSAndroid Build Coastguard Worker     */
92*4d7e907cSAndroid Build Coastguard Worker    tune(uint32_t channel, uint32_t subChannel) generates(Result result);
93*4d7e907cSAndroid Build Coastguard Worker
94*4d7e907cSAndroid Build Coastguard Worker    /**
95*4d7e907cSAndroid Build Coastguard Worker     * Cancel a scan, step or tune operation.
96*4d7e907cSAndroid Build Coastguard Worker     * Shall be called only while a scan, step or tune operation is pending.
97*4d7e907cSAndroid Build Coastguard Worker     * ITunerCallback.tuneComplete() MUST NOT be sent by the HAL.
98*4d7e907cSAndroid Build Coastguard Worker     * @return result OK if scan successfully started
99*4d7e907cSAndroid Build Coastguard Worker     *                INVALID_STATE if called out of sequence
100*4d7e907cSAndroid Build Coastguard Worker     *                NOT_INITIALIZED if another error occurs
101*4d7e907cSAndroid Build Coastguard Worker     */
102*4d7e907cSAndroid Build Coastguard Worker    cancel() generates(Result result);
103*4d7e907cSAndroid Build Coastguard Worker
104*4d7e907cSAndroid Build Coastguard Worker    /**
105*4d7e907cSAndroid Build Coastguard Worker     * Retrieve current station information.
106*4d7e907cSAndroid Build Coastguard Worker     * @return result OK if scan successfully started
107*4d7e907cSAndroid Build Coastguard Worker     *                NOT_INITIALIZED if another error occurs
108*4d7e907cSAndroid Build Coastguard Worker     * @return info Current program information.
109*4d7e907cSAndroid Build Coastguard Worker     */
110*4d7e907cSAndroid Build Coastguard Worker    getProgramInformation() generates(Result result, ProgramInfo info);
111*4d7e907cSAndroid Build Coastguard Worker};
112