Tomasz Wasilczyk | 6e0e1ae | 2017-11-30 09:03:43 -0800 | [diff] [blame] | 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 | import ITunerCallback; |
| 19 | import ITunerSession; |
| 20 | |
| 21 | /** |
| 22 | * Represents a hardware broadcast radio module. A single module may contain |
| 23 | * multiple hardware tuners (i.e. with an additional background tuner), but the |
| 24 | * layers above the HAL see them as a single logical unit. |
| 25 | */ |
| 26 | interface IBroadcastRadio { |
| 27 | /** |
| 28 | * Returns module properties: a description of a module and its |
| 29 | * capabilities. This method must not fail. |
| 30 | * |
| 31 | * @return properties Module description. |
| 32 | */ |
| 33 | getProperties() generates (Properties properties); |
| 34 | |
| 35 | /** |
| 36 | * Opens a new tuner session. |
| 37 | * |
| 38 | * There may be only one session active at a time. If the new session was |
| 39 | * requested when the old one was active, the old must be terminated |
| 40 | * (aggressive open). |
| 41 | * |
| 42 | * @param callback The callback interface. |
| 43 | * @return result OK in case of success. |
| 44 | * @return session The session interface. |
| 45 | */ |
| 46 | openSession(ITunerCallback callback) |
| 47 | generates (Result result, ITunerSession session); |
| 48 | |
| 49 | /** |
| 50 | * Fetch image from radio module cache. |
| 51 | * |
| 52 | * This is out-of-band transport mechanism for images carried with metadata. |
| 53 | * The metadata vector only passes the identifier, so the client may cache |
| 54 | * images or even not fetch them. |
| 55 | * |
| 56 | * The identifier may be any arbitrary number (i.e. sha256 prefix) selected |
| 57 | * by the vendor. It must be stable across sessions so the application may |
| 58 | * cache it. |
| 59 | * |
| 60 | * The data must be a valid PNG, JPEG, GIF or BMP file. |
| 61 | * Image data with an invalid format must be handled gracefully in the same |
| 62 | * way as a missing image. |
| 63 | * |
| 64 | * The image identifier may become invalid after some time from passing it |
| 65 | * with metadata struct (due to resource cleanup at the HAL implementation). |
| 66 | * However, it must remain valid for a currently tuned program at least |
| 67 | * until onCurrentProgramInfoChanged is called. |
| 68 | * |
| 69 | * There is still a race condition possible between |
| 70 | * onCurrentProgramInfoChanged callback and the HAL implementation eagerly |
| 71 | * clearing the cache (because the next onCurrentProgramInfoChanged came). |
| 72 | * In such case, client application may expect the new |
| 73 | * onCurrentProgramInfoChanged callback with updated image identifier. |
| 74 | * |
| 75 | * @param id Identifier of an image (value of Constants::INVALID_IMAGE is |
| 76 | * reserved and must be treated as invalid image). |
| 77 | * @return image A binary blob with image data |
| 78 | * or a zero-length vector if identifier doesn't exist. |
| 79 | */ |
| 80 | getImage(uint32_t id) generates (vec<uint8_t> image); |
| 81 | }; |