From c466b4997d9e57fea07ae8d364d18d463e05257f Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Wed, 1 Mar 2017 12:03:14 -0800 Subject: [PATCH] Add generic flags to ProgramInfo struct. Start with two for HD Radio/DAB: live and muted. And a vendor range. Test: it builds. Bug: b/32621193 Change-Id: I3761bab2abb31a29f8bcbf53683774e465cdcf5a --- broadcastradio/1.1/default/Utils.cpp | 2 +- broadcastradio/1.1/types.hal | 38 +++++++++++++++++++++------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/broadcastradio/1.1/default/Utils.cpp b/broadcastradio/1.1/default/Utils.cpp index 6d4777daaa..e21344ede2 100644 --- a/broadcastradio/1.1/default/Utils.cpp +++ b/broadcastradio/1.1/default/Utils.cpp @@ -236,7 +236,7 @@ void Utils::convertProgramInfoFromHal(ProgramInfo *info, radio_program_info_t *h info_1_0.signalStrength = halInfo->signal_strength; convertMetaDataFromHal(info_1_0.metadata, halInfo->metadata); // TODO(b/34348946): add support for HAL 1.1 fields - info_1_1.digitalStatus = DigitalStatus::INVALID; + info_1_1.flags = 0; } //static diff --git a/broadcastradio/1.1/types.hal b/broadcastradio/1.1/types.hal index 3b212ebe70..b6f72d2b3b 100644 --- a/broadcastradio/1.1/types.hal +++ b/broadcastradio/1.1/types.hal @@ -1,4 +1,4 @@ -/* +/** * Copyright 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,18 +26,38 @@ enum ProgramListResult : Result { TEMPORARILY_UNAVAILABLE, }; -enum DigitalStatus : int32_t { - INVALID = -1, - UNAVAILABLE = 1, // current program is analog-only - AVAILABLE = 2, // digital mode is available, but disabled - BUFFERING = 3, // digital mode is available and buffering has started - ACTIVE = 4, // digital mode is currently playing +/** + * Extra flags for program information. + */ +enum ProgramInfoFlags : uint32_t { + /** + * Set when the program is currently playing live stream. + * This may result in a slightly altered reception parameters, + * usually targetted at reduced latency. + */ + LIVE = 1 << 0, + + /** + * Radio stream is not playing, ie. due to bad reception conditions or + * buffering. In this state volume knob MAY be disabled to prevent user + * increasing volume too much. + */ + MUTED = 1 << 1, }; -/* Radio program information. Returned by the HAL with event RADIO_EVENT_TUNED. +/** + * Radio program information. Returned by the HAL with event RADIO_EVENT_TUNED. * Contains information on currently tuned channel. */ struct ProgramInfo { @1.0::ProgramInfo base; - DigitalStatus digitalStatus; + bitfield flags; + + /** + * Vendors are allowed to define their own set of flags and store it in this + * field. They MUST verify vendor/product name from Properties struct + * (IBroadcastRadio::getProperties) before doing any interpretation + * of such values. + */ + uint32_t vendorFlags; };