1/**
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.radio;
18
19import android.graphics.Bitmap;
20import android.hardware.radio.ProgramList;
21import android.hardware.radio.ProgramSelector;
22import android.hardware.radio.RadioManager;
23
24/** {@hide} */
25interface ITuner {
26    void close();
27
28    boolean isClosed();
29
30    /**
31     * @throws IllegalArgumentException if config is not valid or null
32     */
33    void setConfiguration(in RadioManager.BandConfig config);
34
35    RadioManager.BandConfig getConfiguration();
36
37    /**
38     * @throws IllegalStateException if tuner was opened without audio
39     */
40    void setMuted(boolean mute);
41
42    boolean isMuted();
43
44    /**
45     * @throws IllegalStateException if called out of sequence
46     */
47    void step(boolean directionDown, boolean skipSubChannel);
48
49    /**
50     * @throws IllegalStateException if called out of sequence
51     */
52    void scan(boolean directionDown, boolean skipSubChannel);
53
54    /**
55     * @throws IllegalArgumentException if invalid arguments are passed
56     * @throws IllegalStateException if called out of sequence
57     */
58    void tune(in ProgramSelector selector);
59
60    /**
61     * @throws IllegalStateException if called out of sequence
62     */
63    void cancel();
64
65    void cancelAnnouncement();
66
67    Bitmap getImage(int id);
68
69    /**
70     * @return {@code true} if the scan was properly scheduled,
71     *          {@code false} if the scan feature is unavailable
72     */
73    boolean startBackgroundScan();
74
75    void startProgramListUpdates(in ProgramList.Filter filter);
76    void stopProgramListUpdates();
77
78    boolean isConfigFlagSupported(int flag);
79    boolean isConfigFlagSet(int flag);
80    void setConfigFlag(int flag, boolean value);
81
82    /**
83     * @param parameters Vendor-specific key-value pairs, must be Map<String, String>
84     * @return Vendor-specific key-value pairs, must be Map<String, String>
85     */
86    Map setParameters(in Map parameters);
87
88    /**
89     * @param keys Parameter keys to fetch
90     * @return Vendor-specific key-value pairs, must be Map<String, String>
91     */
92    Map getParameters(in List<String> keys);
93}
94