Home | History | Annotate | Download | only in 2.0
      1 /* Copyright (C) 2017 The Android Open Source Project
      2  *
      3  * Licensed under the Apache License, Version 2.0 (the "License");
      4  * you may not use this file except in compliance with the License.
      5  * You may obtain a copy of the License at
      6  *
      7  *      http://www.apache.org/licenses/LICENSE-2.0
      8  *
      9  * Unless required by applicable law or agreed to in writing, software
     10  * distributed under the License is distributed on an "AS IS" BASIS,
     11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12  * See the License for the specific language governing permissions and
     13  * limitations under the License.
     14  */
     15 
     16 package android.hardware.broadcastradio@2.0;
     17 
     18 /** Constants used by broadcast radio HAL. */
     19 enum Constants : int32_t {
     20     /** Invalid identifier for IBroadcastRadio::getImage. */
     21     INVALID_IMAGE = 0,
     22 
     23     /**
     24      * If the antenna is disconnected from the beginning, the
     25      * onAntennaStateChange callback must be called within this time.
     26      */
     27     ANTENNA_DISCONNECTED_TIMEOUT_MS = 100,
     28 
     29     LIST_COMPLETE_TIMEOUT_MS = 300000,
     30 };
     31 
     32 enum Result : int32_t {
     33     OK,
     34     UNKNOWN_ERROR,
     35     INTERNAL_ERROR,
     36     INVALID_ARGUMENTS,
     37     INVALID_STATE,
     38     NOT_SUPPORTED,
     39     TIMEOUT,
     40 };
     41 
     42 /**
     43  * Configuration flags to be used with isConfigFlagSet and setConfigFlag methods
     44  * of ITunerSession.
     45  */
     46 enum ConfigFlag : uint32_t {
     47     /**
     48      * Forces mono audio stream reception.
     49      *
     50      * Analog broadcasts can recover poor reception conditions by jointing
     51      * stereo channels into one. Mainly for, but not limited to AM/FM.
     52      */
     53     FORCE_MONO = 1,
     54 
     55     /**
     56      * Forces the analog playback for the supporting radio technology.
     57      *
     58      * User may disable digital playback for FM HD Radio or hybrid FM/DAB with
     59      * this option. This is purely user choice, ie. does not reflect digital-
     60      * analog handover state managed from the HAL implementation side.
     61      *
     62      * Some radio technologies may not support this, ie. DAB.
     63      */
     64     FORCE_ANALOG,
     65 
     66     /**
     67      * Forces the digital playback for the supporting radio technology.
     68      *
     69      * User may disable digital-analog handover that happens with poor
     70      * reception conditions. With digital forced, the radio will remain silent
     71      * instead of switching to analog channel if it's available. This is purely
     72      * user choice, it does not reflect the actual state of handover.
     73      */
     74     FORCE_DIGITAL,
     75 
     76     /**
     77      * RDS Alternative Frequencies.
     78      *
     79      * If set and the currently tuned RDS station broadcasts on multiple
     80      * channels, radio tuner automatically switches to the best available
     81      * alternative.
     82      */
     83     RDS_AF,
     84 
     85     /**
     86      * RDS region-specific program lock-down.
     87      *
     88      * Allows user to lock to the current region as they move into the
     89      * other region.
     90      */
     91     RDS_REG,
     92 
     93     /** Enables DAB-DAB hard- and implicit-linking (the same content). */
     94     DAB_DAB_LINKING,
     95 
     96     /** Enables DAB-FM hard- and implicit-linking (the same content). */
     97     DAB_FM_LINKING,
     98 
     99     /** Enables DAB-DAB soft-linking (related content). */
    100     DAB_DAB_SOFT_LINKING,
    101 
    102     /** Enables DAB-FM soft-linking (related content). */
    103     DAB_FM_SOFT_LINKING,
    104 };
    105 
    106 /**
    107  * A key-value pair for vendor-specific information to be passed as-is through
    108  * Android framework to the front-end application.
    109  */
    110 struct VendorKeyValue {
    111     /**
    112      * Key must start with unique vendor Java-style namespace,
    113      * eg. 'com.somecompany.parameter1'.
    114      */
    115     string key;
    116 
    117     /**
    118      * Value must be passed through the framework without any changes.
    119      * Format of this string can vary across vendors.
    120      */
    121     string value;
    122 };
    123 
    124 /**
    125  * A supported or configured RDS variant.
    126  *
    127  * Both might be set for hardware capabilities check (with full=true when
    128  * calling getAmFmRegionConfig), but only one (or none) for specific
    129  * region settings.
    130  */
    131 enum Rds : uint8_t {
    132     /** Standard variant, used everywhere except North America. */
    133     RDS = 1 << 0,
    134 
    135     /** Variant used in North America. */
    136     RBDS = 1 << 1,
    137 };
    138 
    139 /**
    140  * FM de-emphasis filter supported or configured.
    141  *
    142  * Both might be set for hardware capabilities check (with full=true when
    143  * calling getAmFmRegionConfig), but exactly one for specific region settings.
    144  */
    145 enum Deemphasis : uint8_t {
    146     D50 = 1 << 0,
    147     D75 = 1 << 1,
    148 };
    149 
    150 /**
    151  * Regional configuration for AM/FM.
    152  *
    153  * For hardware capabilities check (with full=true when calling
    154  * getAmFmRegionConfig), HAL implementation fills entire supported range of
    155  * frequencies and features.
    156  *
    157  * When checking current configuration, at most one bit in each bitfield
    158  * can be set.
    159  */
    160 struct AmFmRegionConfig {
    161     /**
    162      * All supported or configured AM/FM bands.
    163      *
    164      * AM/FM bands are identified by frequency value
    165      * (see IdentifierType::AMFM_FREQUENCY).
    166      *
    167      * With typical configuration, it's expected to have two frequency ranges
    168      * for capabilities check (AM and FM) and four ranges for specific region
    169      * configuration (AM LW, AM MW, AM SW, FM).
    170      */
    171     vec<AmFmBandRange> ranges;
    172 
    173     /** De-emphasis filter supported/configured. */
    174     bitfield<Deemphasis> fmDeemphasis;
    175 
    176     /** RDS/RBDS variant supported/configured. */
    177     bitfield<Rds> fmRds;
    178 };
    179 
    180 /**
    181  * AM/FM band range for region configuration.
    182  *
    183  * Defines channel grid: each possible channel is set at
    184  * lowerBound + channelNumber * spacing, up to upperBound.
    185  */
    186 struct AmFmBandRange {
    187     /** The frequency (in kHz) of the first channel within the range. */
    188     uint32_t lowerBound;
    189 
    190     /** The frequency (in kHz) of the last channel within the range. */
    191     uint32_t upperBound;
    192 
    193     /** Channel grid resolution (in kHz), how far apart are the channels. */
    194     uint32_t spacing;
    195 
    196     /**
    197      * Channel spacing (in kHz) used to speed up seeking to the next station
    198      * via the ITunerSession::scan() operation.
    199      *
    200      * It must be a multiple of channel grid resolution.
    201      *
    202      * Tuner may first quickly check every n-th channel and if it detects echo
    203      * from a station, it fine-tunes to find the exact frequency.
    204      *
    205      * It's ignored for capabilities check (with full=true when calling
    206      * getAmFmRegionConfig).
    207      */
    208     uint32_t scanSpacing;
    209 };
    210 
    211 /**
    212  * An entry in regional configuration for DAB.
    213  *
    214  * Defines a frequency table row for ensembles.
    215  */
    216 struct DabTableEntry {
    217     /**
    218      * Channel name, i.e. 5A, 7B.
    219      *
    220      * It must match the following regular expression:
    221      * /^[A-Z0-9][A-Z0-9 ]{0,5}[A-Z0-9]$/ (2-7 uppercase alphanumeric characters
    222      * without spaces allowed at the beginning nor end).
    223      */
    224     string label;
    225 
    226     /** Frequency, in kHz. */
    227     uint32_t frequency;
    228 };
    229 
    230 /**
    231  * Properties of a given broadcast radio module.
    232  */
    233 struct Properties {
    234     /**
    235      * A company name who made the radio module. Must be a valid, registered
    236      * name of the company itself.
    237      *
    238      * It must be opaque to the Android framework.
    239      */
    240     string maker;
    241 
    242     /**
    243      * A product name. Must be unique within the company.
    244      *
    245      * It must be opaque to the Android framework.
    246      */
    247     string product;
    248 
    249     /**
    250      * Version of the hardware module.
    251      *
    252      * It must be opaque to the Android framework.
    253      */
    254     string version;
    255 
    256     /**
    257      * Hardware serial number (for subscription services).
    258      *
    259      * It must be opaque to the Android framework.
    260      */
    261     string serial;
    262 
    263     /**
    264      * A list of supported IdentifierType values.
    265      *
    266      * If an identifier is supported by radio module, it means it can use it for
    267      * tuning to ProgramSelector with either primary or secondary Identifier of
    268      * a given type.
    269      *
    270      * Support for VENDOR identifier type does not guarantee compatibility, as
    271      * other module properties (implementor, product, version) must be checked.
    272      */
    273     vec<uint32_t> supportedIdentifierTypes;
    274 
    275     /**
    276      * Vendor-specific information.
    277      *
    278      * It may be used for extra features, not supported by the platform,
    279      * for example: com.me.preset-slots=6; com.me.ultra-hd-capable=false.
    280      */
    281     vec<VendorKeyValue> vendorInfo;
    282 };
    283 
    284 /**
    285  * Program (channel, station) information.
    286  *
    287  * Carries both user-visible information (like station name) and technical
    288  * details (tuning selector).
    289  */
    290 struct ProgramInfo {
    291     /**
    292      * An identifier used to point at the program (primarily to tune to it).
    293      *
    294      * This field is required - its type field must not be set to
    295      * IdentifierType::INVALID.
    296      */
    297     ProgramSelector selector;
    298 
    299     /**
    300      * Identifier currently used for program selection.
    301      *
    302      * It allows to determine which technology is currently used for reception.
    303      *
    304      * Some program selectors contain tuning information for different radio
    305      * technologies (i.e. FM RDS and DAB). For example, user may tune using
    306      * a ProgramSelector with RDS_PI primary identifier, but the tuner hardware
    307      * may choose to use DAB technology to make actual tuning. This identifier
    308      * must reflect that.
    309      *
    310      * This field is required for currently tuned program only.
    311      * For all other items on the program list, its type field must be
    312      * initialized to IdentifierType::INVALID.
    313      *
    314      * Only primary identifiers for a given radio technology are valid:
    315      *  - AMFM_FREQUENCY for analog AM/FM;
    316      *  - RDS_PI for FM RDS;
    317      *  - HD_STATION_ID_EXT;
    318      *  - DAB_SID_EXT;
    319      *  - DRMO_SERVICE_ID;
    320      *  - SXM_SERVICE_ID;
    321      *  - VENDOR_*;
    322      *  - more might come in next minor versions of this HAL.
    323      */
    324     ProgramIdentifier logicallyTunedTo;
    325 
    326     /**
    327      * Identifier currently used by hardware to physically tune to a channel.
    328      *
    329      * Some radio technologies broadcast the same program on multiple channels,
    330      * i.e. with RDS AF the same program may be broadcasted on multiple
    331      * alternative frequencies; the same DAB program may be broadcast on
    332      * multiple ensembles. This identifier points to the channel to which the
    333      * radio hardware is physically tuned to.
    334      *
    335      * This field is required for currently tuned program only.
    336      * For all other items on the program list, its type field must be
    337      * initialized to IdentifierType::INVALID.
    338      *
    339      * Only physical identifiers are valid:
    340      *  - AMFM_FREQUENCY;
    341      *  - DAB_ENSEMBLE;
    342      *  - DRMO_FREQUENCY;
    343      *  - SXM_CHANNEL;
    344      *  - VENDOR_*;
    345      *  - more might come in next minor versions of this HAL.
    346      */
    347     ProgramIdentifier physicallyTunedTo;
    348 
    349     /**
    350      * Primary identifiers of related contents.
    351      *
    352      * Some radio technologies provide pointers to other programs that carry
    353      * related content (i.e. DAB soft-links). This field is a list of pointers
    354      * to other programs on the program list.
    355      *
    356      * This is not a list of programs that carry the same content (i.e.
    357      * DAB hard-links, RDS AF). Switching to programs from this list usually
    358      * require user action.
    359      *
    360      * Please note, that these identifiers do not have to exist on the program
    361      * list - i.e. DAB tuner may provide information on FM RDS alternatives
    362      * despite not supporting FM RDS. If the system has multiple tuners, another
    363      * one may have it on its list.
    364      *
    365      * This field is optional (can be empty).
    366      */
    367     vec<ProgramIdentifier> relatedContent;
    368 
    369     bitfield<ProgramInfoFlags> infoFlags;
    370 
    371     /**
    372      * Signal quality measured in 0% to 100% range to be shown in the UI.
    373      *
    374      * The purpose of this field is primarily informative, must not be used to
    375      * determine to which frequency should it tune to.
    376      */
    377     uint32_t signalQuality;
    378 
    379     /**
    380      * Program metadata (station name, PTY, song title).
    381      */
    382     vec<Metadata> metadata;
    383 
    384     /**
    385      * Vendor-specific information.
    386      *
    387      * It may be used for extra features, not supported by the platform,
    388      * for example: paid-service=true; bitrate=320kbps.
    389      */
    390     vec<VendorKeyValue> vendorInfo;
    391 };
    392 
    393 enum ProgramInfoFlags : uint32_t {
    394     /**
    395      * Set when the program is currently playing live stream.
    396      * This may result in a slightly altered reception parameters,
    397      * usually targetted at reduced latency.
    398      */
    399     LIVE = 1 << 0,
    400 
    401     /**
    402      * Radio stream is not playing, ie. due to bad reception conditions or
    403      * buffering. In this state volume knob MAY be disabled to prevent user
    404      * increasing volume too much.
    405      */
    406     MUTED = 1 << 1,
    407 
    408     /**
    409      * Station broadcasts traffic information regularly,
    410      * but not necessarily right now.
    411      */
    412     TRAFFIC_PROGRAM = 1 << 2,
    413 
    414     /**
    415      * Station is broadcasting traffic information at the very moment.
    416      */
    417     TRAFFIC_ANNOUNCEMENT = 1 << 3,
    418 
    419     /**
    420      * Tuned to a program (not playing static).
    421      *
    422      * It's the same condition that would stop a seek operation
    423      * (ie: ITunerSession::scan()).
    424      *
    425      * By definition, this flag must be set for all items on the program list.
    426      */
    427     TUNED = 1 << 4,
    428 
    429     /**
    430      * Audio stream is MONO if this bit is not set.
    431      */
    432     STEREO = 1 << 5,
    433 };
    434 
    435 /**
    436  * Type of program identifier component.
    437  *
    438  * Each identifier type corresponds to exactly one radio technology,
    439  * i.e. DAB_ENSEMBLE is specifically for DAB.
    440  *
    441  * VENDOR identifier types must be opaque to the framework.
    442  *
    443  * The value format for each (but VENDOR_*) identifier is strictly defined
    444  * to maintain interoperability between devices made by different vendors.
    445  *
    446  * All other values are reserved for future use.
    447  * Values not matching any enumerated constant must be ignored.
    448  */
    449 enum IdentifierType : uint32_t {
    450     /**
    451      * Primary/secondary identifier for vendor-specific radio technology.
    452      * The value format is determined by a vendor.
    453      *
    454      * The vendor identifiers have limited serialization capabilities - see
    455      * ProgramSelector description.
    456      */
    457     VENDOR_START = 1000,
    458 
    459     /** See VENDOR_START */
    460     VENDOR_END = 1999,
    461 
    462     INVALID = 0,
    463 
    464     /**
    465      * Primary identifier for analogue (without RDS) AM/FM stations:
    466      * frequency in kHz.
    467      *
    468      * This identifier also contains band information:
    469      *  - <500kHz: AM LW;
    470      *  - 500kHz - 1705kHz: AM MW;
    471      *  - 1.71MHz - 30MHz: AM SW;
    472      *  - >60MHz: FM.
    473      */
    474     AMFM_FREQUENCY,
    475 
    476     /**
    477      * 16bit primary identifier for FM RDS station.
    478      */
    479     RDS_PI,
    480 
    481     /**
    482      * 64bit compound primary identifier for HD Radio.
    483      *
    484      * Consists of (from the LSB):
    485      * - 32bit: Station ID number;
    486      * - 4bit: HD Radio subchannel;
    487      * - 18bit: AMFM_FREQUENCY.
    488      *
    489      * While station ID number should be unique globally, it sometimes get
    490      * abused by broadcasters (i.e. not being set at all). To ensure local
    491      * uniqueness, AMFM_FREQUENCY was added here. Global uniqueness is
    492      * a best-effort - see HD_STATION_NAME.
    493      *
    494      * HD Radio subchannel is a value in range 0-7.
    495      * This index is 0-based (where 0 is MPS and 1..7 are SPS),
    496      * as opposed to HD Radio standard (where it's 1-based).
    497      *
    498      * The remaining bits should be set to zeros when writing on the chip side
    499      * and ignored when read.
    500      */
    501     HD_STATION_ID_EXT,
    502 
    503     /**
    504      * 64bit additional identifier for HD Radio.
    505      *
    506      * Due to Station ID abuse, some HD_STATION_ID_EXT identifiers may be not
    507      * globally unique. To provide a best-effort solution, a short version of
    508      * station name may be carried as additional identifier and may be used
    509      * by the tuner hardware to double-check tuning.
    510      *
    511      * The name is limited to the first 8 A-Z0-9 characters (lowercase letters
    512      * must be converted to uppercase). Encoded in little-endian ASCII:
    513      * the first character of the name is the LSB.
    514      *
    515      * For example: "Abc" is encoded as 0x434241.
    516      */
    517     HD_STATION_NAME,
    518 
    519     /**
    520      * 28bit compound primary identifier for Digital Audio Broadcasting.
    521      *
    522      * Consists of (from the LSB):
    523      * - 16bit: SId;
    524      * - 8bit: ECC code;
    525      * - 4bit: SCIdS.
    526      *
    527      * SCIdS (Service Component Identifier within the Service) value
    528      * of 0 represents the main service, while 1 and above represents
    529      * secondary services.
    530      *
    531      * The remaining bits should be set to zeros when writing on the chip side
    532      * and ignored when read.
    533      */
    534     DAB_SID_EXT,
    535 
    536     /** 16bit */
    537     DAB_ENSEMBLE,
    538 
    539     /** 12bit */
    540     DAB_SCID,
    541 
    542     /** kHz (see AMFM_FREQUENCY) */
    543     DAB_FREQUENCY,
    544 
    545     /**
    546      * 24bit primary identifier for Digital Radio Mondiale.
    547      */
    548     DRMO_SERVICE_ID,
    549 
    550     /** kHz (see AMFM_FREQUENCY) */
    551     DRMO_FREQUENCY,
    552 
    553     /**
    554      * 32bit primary identifier for SiriusXM Satellite Radio.
    555      */
    556     SXM_SERVICE_ID = DRMO_FREQUENCY + 2,
    557 
    558     /** 0-999 range */
    559     SXM_CHANNEL,
    560 };
    561 
    562 /**
    563  * A single program identifier component, i.e. frequency or channel ID.
    564  */
    565 struct ProgramIdentifier {
    566     /**
    567      * Maps to IdentifierType enum. The enum may be extended in future versions
    568      * of the HAL. Values out of the enum range must not be used when writing
    569      * and ignored when reading.
    570      */
    571     uint32_t type;
    572 
    573     /**
    574      * The uint64_t value field holds the value in format described in comments
    575      * for IdentifierType enum.
    576      */
    577     uint64_t value;
    578 };
    579 
    580 /**
    581  * A set of identifiers necessary to tune to a given station.
    582  *
    583  * This can hold a combination of various identifiers, like:
    584  * - AM/FM frequency,
    585  * - HD Radio subchannel,
    586  * - DAB service ID.
    587  *
    588  * The type of radio technology is determined by the primary identifier - if the
    589  * primary identifier is for DAB, the program is DAB. However, a program of a
    590  * specific radio technology may have additional secondary identifiers for other
    591  * technologies, i.e. a satellite program may have FM fallback frequency,
    592  * if a station broadcasts both via satellite and FM.
    593  *
    594  * The identifiers from VENDOR_START..VENDOR_END range have limited
    595  * serialization capabilities: they are serialized locally, but ignored by the
    596  * cloud services. If a program has primary id from vendor range, it's not
    597  * synchronized with other devices at all.
    598  */
    599 struct ProgramSelector {
    600     /**
    601      * Primary program identifier.
    602      *
    603      * This identifier uniquely identifies a station and can be used for
    604      * equality check.
    605      *
    606      * It can hold only a subset of identifier types, one per each
    607      * radio technology:
    608      *  - analogue AM/FM: AMFM_FREQUENCY;
    609      *  - FM RDS: RDS_PI;
    610      *  - HD Radio: HD_STATION_ID_EXT;
    611      *  - DAB: DAB_SID_EXT;
    612      *  - Digital Radio Mondiale: DRMO_SERVICE_ID;
    613      *  - SiriusXM: SXM_SERVICE_ID;
    614      *  - vendor-specific: VENDOR_START..VENDOR_END.
    615      *
    616      * The list may change in future versions, so the implementation must obey,
    617      * but not rely on it.
    618      */
    619     ProgramIdentifier primaryId;
    620 
    621     /**
    622      * Secondary program identifiers.
    623      *
    624      * These identifiers are supplementary and can speed up tuning process,
    625      * but the primary ID must be sufficient (i.e. RDS PI is enough to select
    626      * a station from the list after a full band scan).
    627      *
    628      * Two selectors with different secondary IDs, but the same primary ID are
    629      * considered equal. In particular, secondary IDs vector may get updated for
    630      * an entry on the program list (ie. when a better frequency for a given
    631      * station is found).
    632      */
    633     vec<ProgramIdentifier> secondaryIds;
    634 };
    635 
    636 enum MetadataKey : int32_t {
    637     /** RDS PS (string) */
    638     RDS_PS = 1,
    639 
    640     /** RDS PTY (uint8_t) */
    641     RDS_PTY,
    642 
    643     /** RBDS PTY (uint8_t) */
    644     RBDS_PTY,
    645 
    646     /** RDS RT (string) */
    647     RDS_RT,
    648 
    649     /** Song title (string) */
    650     SONG_TITLE,
    651 
    652     /** Artist name (string) */
    653     SONG_ARTIST,
    654 
    655     /** Album name (string) */
    656     SONG_ALBUM,
    657 
    658     /** Station icon (uint32_t, see IBroadcastRadio::getImage) */
    659     STATION_ICON,
    660 
    661     /** Album art (uint32_t, see IBroadcastRadio::getImage) */
    662     ALBUM_ART,
    663 
    664     /**
    665      * Station name.
    666      *
    667      * This is a generic field to cover any radio technology.
    668      *
    669      * If the PROGRAM_NAME has the same content as DAB_*_NAME or RDS_PS,
    670      * it may not be present, to preserve space - framework must repopulate
    671      * it on the client side.
    672      */
    673     PROGRAM_NAME,
    674 
    675     /** DAB ensemble name (string) */
    676     DAB_ENSEMBLE_NAME,
    677 
    678     /**
    679      * DAB ensemble name abbreviated (string).
    680      *
    681      * The string must be up to 8 characters long.
    682      *
    683      * If the short variant is present, the long (DAB_ENSEMBLE_NAME) one must be
    684      * present as well.
    685      */
    686     DAB_ENSEMBLE_NAME_SHORT,
    687 
    688     /** DAB service name (string) */
    689     DAB_SERVICE_NAME,
    690 
    691     /** DAB service name abbreviated (see DAB_ENSEMBLE_NAME_SHORT) (string) */
    692     DAB_SERVICE_NAME_SHORT,
    693 
    694     /** DAB component name (string) */
    695     DAB_COMPONENT_NAME,
    696 
    697     /** DAB component name abbreviated (see DAB_ENSEMBLE_NAME_SHORT) (string) */
    698     DAB_COMPONENT_NAME_SHORT,
    699 };
    700 
    701 /**
    702  * An element of metadata vector.
    703  *
    704  * Contains one of the entries explained in MetadataKey.
    705  *
    706  * Depending on a type described in the comment for a specific key, either the
    707  * intValue or stringValue field must be populated.
    708  */
    709 struct Metadata {
    710     /**
    711      * Maps to MetadataKey enum. The enum may be extended in future versions
    712      * of the HAL. Values out of the enum range must not be used when writing
    713      * and ignored when reading.
    714      */
    715     uint32_t key;
    716 
    717     int64_t intValue;
    718     string stringValue;
    719 };
    720 
    721 /**
    722  * An update packet of the program list.
    723  *
    724  * The order of entries in the vectors is unspecified.
    725  */
    726 struct ProgramListChunk {
    727     /**
    728      * Treats all previously added entries as removed.
    729      *
    730      * This is meant to save binder transaction bandwidth on 'removed' vector
    731      * and provide a clear empty state.
    732      *
    733      * If set, 'removed' vector must be empty.
    734      *
    735      * The client may wait with taking action on this until it received the
    736      * chunk with complete flag set (to avoid part of stations temporarily
    737      * disappearing from the list).
    738      */
    739     bool purge;
    740 
    741     /**
    742      * If false, it means there are still programs not transmitted,
    743      * due for transmission in following updates.
    744      *
    745      * Used by UIs that wait for complete list instead of displaying
    746      * programs while scanning.
    747      *
    748      * After the whole channel range was scanned and all discovered programs
    749      * were transmitted, the last chunk must have set this flag to true.
    750      * This must happen within Constants::LIST_COMPLETE_TIMEOUT_MS from the
    751      * startProgramListUpdates call. If it doesn't, client may assume the tuner
    752      * came into a bad state and display error message.
    753      */
    754     bool complete;
    755 
    756     /**
    757      * Added or modified program list entries.
    758      *
    759      * Two entries with the same primaryId (ProgramSelector member)
    760      * are considered the same.
    761      */
    762     vec<ProgramInfo> modified;
    763 
    764     /**
    765      * Removed program list entries.
    766      *
    767      * Contains primaryId (ProgramSelector member) of a program to remove.
    768      */
    769     vec<ProgramIdentifier> removed;
    770 };
    771 
    772 /**
    773  * Large-grain filter to the program list.
    774  *
    775  * This is meant to reduce binder transaction bandwidth, not for fine-grained
    776  * filtering user might expect.
    777  *
    778  * The filter is designed as conjunctive normal form: the entry that passes the
    779  * filter must satisfy all the clauses (members of this struct). Vector clauses
    780  * are disjunctions of literals. In other words, there is AND between each
    781  * high-level group and OR inside it.
    782  */
    783 struct ProgramFilter {
    784     /**
    785      * List of identifier types that satisfy the filter.
    786      *
    787      * If the program list entry contains at least one identifier of the type
    788      * listed, it satisfies this condition.
    789      *
    790      * Empty list means no filtering on identifier type.
    791      */
    792     vec<uint32_t> identifierTypes;
    793 
    794     /**
    795      * List of identifiers that satisfy the filter.
    796      *
    797      * If the program list entry contains at least one listed identifier,
    798      * it satisfies this condition.
    799      *
    800      * Empty list means no filtering on identifier.
    801      */
    802     vec<ProgramIdentifier> identifiers;
    803 
    804     /**
    805      * Includes non-tunable entries that define tree structure on the
    806      * program list (i.e. DAB ensembles).
    807      */
    808     bool includeCategories;
    809 
    810     /**
    811      * Disable updates on entry modifications.
    812      *
    813      * If true, 'modified' vector of ProgramListChunk must contain list
    814      * additions only. Once the program is added to the list, it's not
    815      * updated anymore.
    816      */
    817     bool excludeModifications;
    818 };
    819 
    820 /**
    821  * Type of an announcement.
    822  *
    823  * It maps to different announcement types per each radio technology.
    824  */
    825 enum AnnouncementType : uint8_t {
    826     /** DAB alarm, RDS emergency program type (PTY 31). */
    827     EMERGENCY = 1,
    828 
    829     /** DAB warning. */
    830     WARNING,
    831 
    832     /** DAB road traffic, RDS TA, HD Radio transportation. */
    833     TRAFFIC,
    834 
    835     /** Weather. */
    836     WEATHER,
    837 
    838     /** News. */
    839     NEWS,
    840 
    841     /** DAB event, special event. */
    842     EVENT,
    843 
    844     /** DAB sport report, RDS sports. */
    845     SPORT,
    846 
    847     /** All others. */
    848     MISC,
    849 };
    850 
    851 /**
    852  * A pointer to a station broadcasting active announcement.
    853  */
    854 struct Announcement {
    855     /**
    856      * Program selector to tune to the announcement.
    857      */
    858     ProgramSelector selector;
    859 
    860     /** Announcement type. */
    861     AnnouncementType type;
    862 
    863     /**
    864      * Vendor-specific information.
    865      *
    866      * It may be used for extra features, not supported by the platform,
    867      * for example: com.me.hdradio.urgency=100; com.me.hdradio.certainity=50.
    868      */
    869     vec<VendorKeyValue> vendorInfo;
    870 };
    871