blob: 3e2c9cca7d4affb3d7dee2aacc73348d83072c3f [file] [log] [blame]
Weilin Xua8cebd52022-05-02 17:48:13 +00001/*
2 * Copyright (C) 2022 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.broadcastradio;
18
19import android.hardware.broadcastradio.Metadata;
20import android.hardware.broadcastradio.ProgramIdentifier;
21import android.hardware.broadcastradio.ProgramSelector;
22import android.hardware.broadcastradio.VendorKeyValue;
23
24/**
25 * Program (channel, station) information.
26 *
27 * Carries both user-visible information (like station name) and technical
28 * details (tuning selector).
29 */
30@VintfStability
31@JavaDerive(equals=true, toString=true)
32parcelable ProgramInfo {
33 /**
34 * Set when the program is currently playing live stream.
35 * This may result in a slightly altered reception parameters,
36 * usually targeted at reduced latency.
37 */
38 const int FLAG_LIVE = 1 << 0;
39
40 /**
41 * Radio stream is not playing, ie. due to bad reception conditions or
42 * buffering. In this state volume knob MAY be disabled to prevent user
43 * increasing volume too much.
44 */
45 const int FLAG_MUTED = 1 << 1;
46
47 /**
48 * Station broadcasts traffic information regularly,
49 * but not necessarily right now.
50 */
51 const int FLAG_TRAFFIC_PROGRAM = 1 << 2;
52
53 /**
54 * Station is broadcasting traffic information at the very moment.
55 */
56 const int FLAG_TRAFFIC_ANNOUNCEMENT = 1 << 3;
57
58 /**
59 * Station can be tuned to (not playing static).
60 *
61 * It's the same condition that would stop a seek operation
62 * (i.e. {@link IBroadcastRadio#seek}).
63 *
64 * By definition, this flag must be set for all items on the program list.
65 */
66 const int FLAG_TUNABLE = 1 << 4;
67
68 /**
69 * Audio stream is MONO if this bit is not set.
70 */
71 const int FLAG_STEREO = 1 << 5;
72
73 /**
74 * An identifier used to point at the program (primarily to tune to it).
75 *
76 * This field is required - its type field must not be set to
77 * {@link IdentifierType#INVALID}.
78 */
79 ProgramSelector selector;
80
81 /**
82 * Identifier currently used for program selection.
83 *
84 * It allows to determine which technology is currently used for reception.
85 *
86 * Some program selectors contain tuning information for different radio
87 * technologies (i.e. FM RDS and DAB). For example, user may tune using
88 * a ProgramSelector with RDS_PI primary identifier, but the tuner hardware
89 * may choose to use DAB technology to make actual tuning. This identifier
90 * must reflect that.
91 *
92 * This field is required for currently tuned program only.
93 * For all other items on the program list, its type field must be
94 * initialized to {@link IdentifierType#INVALID}.
95 *
96 * Only primary identifiers for a given radio technology are valid:
97 * - AMFM_FREQUENCY_KHZ for analog AM/FM;
98 * - RDS_PI for FM RDS;
99 * - HD_STATION_ID_EXT;
100 * - DAB_SID_EXT;
101 * - DRMO_SERVICE_ID;
102 * - SXM_SERVICE_ID;
103 * - VENDOR_*;
104 * - more might come in next minor versions of this HAL.
105 */
106 ProgramIdentifier logicallyTunedTo;
107
108 /**
109 * Identifier currently used by hardware to physically tune to a channel.
110 *
111 * Some radio technologies broadcast the same program on multiple channels,
112 * i.e. with RDS AF the same program may be broadcasted on multiple
113 * alternative frequencies; the same DAB program may be broadcast on
114 * multiple ensembles. This identifier points to the channel to which the
115 * radio hardware is physically tuned to.
116 *
117 * This field is required for currently tuned program only.
118 * For all other items on the program list, its type field must be
119 * initialized to {@link IdentifierType#INVALID}.
120 *
121 * Only physical identifiers are valid:
122 * - AMFM_FREQUENCY_KHZ;
123 * - DAB_ENSEMBLE;
124 * - DRMO_FREQUENCY_KHZ;
125 * - SXM_CHANNEL;
126 * - VENDOR_*;
127 * - more might come in next minor versions of this HAL.
128 */
129 ProgramIdentifier physicallyTunedTo;
130
131 /**
132 * Primary identifiers of related contents.
133 *
134 * Some radio technologies provide pointers to other programs that carry
135 * related content (i.e. DAB soft-links). This field is a list of pointers
136 * to other programs on the program list.
137 *
138 * This is not a list of programs that carry the same content (i.e.
139 * DAB hard-links, RDS AF). Switching to programs from this list usually
140 * require user action.
141 *
142 * Please note, that these identifiers do not have to exist on the program
143 * list - i.e. DAB tuner may provide information on FM RDS alternatives
144 * despite not supporting FM RDS. If the system has multiple tuners, another
145 * one may have it on its list.
146 *
147 * This field is optional.
148 */
149 @nullable ProgramIdentifier[] relatedContent;
150
151 /**
152 * Program flags.
153 */
154 int infoFlags;
155
156 /**
157 * Signal quality measured in 0% to 100% range to be shown in the UI.
158 */
159 int signalQuality;
160
161 /**
162 * Program metadata (station name, PTY, song title).
163 */
164 Metadata[] metadata;
165
166 /**
167 * Vendor-specific information.
168 *
169 * It may be used for extra features, not supported by the platform,
170 * for example: paid-service=true; bitrate=320kbps.
171 */
172 VendorKeyValue[] vendorInfo;
173}