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 | interface ITunerSession { |
| 19 | /** |
| 20 | * Tune to a specified program. |
| 21 | * |
| 22 | * Automatically cancels pending scan, step or tune. |
| 23 | * If the method returns OK, tuneFailed or currentProgramInfoChanged |
| 24 | * callback must be called. |
| 25 | * |
| 26 | * @param program Program to tune to. |
| 27 | * @return result OK if successfully started tuning. |
| 28 | * NOT_SUPPORTED if the program selector doesn't contain any |
| 29 | * supported identifier. |
| 30 | * INVALID_ARGUMENTS if the program selector contains |
| 31 | * identifiers in invalid format (i.e. out of range). |
| 32 | */ |
| 33 | tune(ProgramSelector program) generates (Result result); |
| 34 | |
| 35 | /** |
| 36 | * Tune to the next valid program. |
| 37 | * |
| 38 | * Automatically cancels pending scan, step or tune. |
| 39 | * If the method returns OK, tuneFailed or currentProgramInfoChanged |
| 40 | * callback must be called. |
| 41 | * |
| 42 | * The skipSubChannel parameter is used to skip digital radio subchannels: |
| 43 | * - HD Radio SPS; |
| 44 | * - DAB secondary service. |
| 45 | * |
| 46 | * As an implementation detail, the HAL has the option to perform an actual |
| 47 | * scan or select the next program from the list retrieved in the |
| 48 | * background, if one is not stale. |
| 49 | * |
| 50 | * @param directionUp True to change towards higher numeric values |
| 51 | * (frequency, channel number), false towards lower. |
| 52 | * @param skipSubChannel Don't tune to subchannels. |
| 53 | * @return result OK if the scan has successfully started. |
| 54 | */ |
| 55 | scan(bool directionUp, bool skipSubChannel) generates (Result result); |
| 56 | |
| 57 | /** |
| 58 | * Tune to the adjacent channel, which may not be occupied by any program. |
| 59 | * |
| 60 | * Automatically cancels pending scan, step or tune. |
| 61 | * If the method returns OK, tuneFailed or currentProgramInfoChanged |
| 62 | * callback must be called. |
| 63 | * |
| 64 | * @param directionUp True to change towards higher numeric values |
| 65 | * (frequency, channel number), false towards lower. |
| 66 | * @return result OK successfully started tuning. |
| 67 | * NOT_SUPPORTED if tuning to an unoccupied channel is not |
| 68 | * supported (i.e. for satellite radio). |
| 69 | */ |
| 70 | step(bool directionUp) generates (Result result); |
| 71 | |
| 72 | /** |
| 73 | * Cancel a scan, step or tune operation. |
| 74 | * |
| 75 | * If there is no such operation running, the call must be ignored. |
| 76 | */ |
| 77 | cancel(); |
| 78 | |
| 79 | /** |
| 80 | * Generic method for setting vendor-specific parameter values. |
| 81 | * The framework does not interpret the parameters, they are passed |
| 82 | * in an opaque manner between a vendor application and HAL. |
| 83 | * |
| 84 | * Framework does not make any assumptions on the keys or values, other than |
| 85 | * ones stated in VendorKeyValue documentation (a requirement of key |
| 86 | * prefixes). |
| 87 | * |
| 88 | * For each pair in the result vector, the key must be one of the keys |
| 89 | * contained in the input (possibly with wildcards expanded), and the value |
| 90 | * must be a vendor-specific result status (i.e. the string "OK" or an error |
| 91 | * code). The implementation may choose to return an empty vector, or only |
| 92 | * return a status for a subset of the provided inputs, at its discretion. |
| 93 | * |
| 94 | * Application and HAL must not use keys with unknown prefix. In particular, |
| 95 | * it must not place a key-value pair in results vector for unknown key from |
| 96 | * parameters vector - instead, an unknown key should simply be ignored. |
| 97 | * In other words, results vector may contain a subset of parameter keys |
| 98 | * (however, the framework doesn't enforce a strict subset - the only |
| 99 | * formal requirement is vendor domain prefix for keys). |
| 100 | * |
| 101 | * @param parameters Vendor-specific key-value pairs. |
| 102 | * @return results Operation completion status for parameters being set. |
| 103 | */ |
| 104 | setParameters(vec<VendorKeyValue> parameters) |
| 105 | generates (vec<VendorKeyValue> results); |
| 106 | |
| 107 | /** |
| 108 | * Generic method for retrieving vendor-specific parameter values. |
| 109 | * The framework does not interpret the parameters, they are passed |
| 110 | * in an opaque manner between a vendor application and HAL. |
| 111 | * |
| 112 | * Framework does not cache set/get requests, so it's allowed for |
| 113 | * getParameter to return a different value than previous setParameter call. |
| 114 | * |
| 115 | * The syntax and semantics of keys are up to the vendor (as long as prefix |
| 116 | * rules are obeyed). For instance, vendors may include some form of |
| 117 | * wildcard support. In such case, result vector may be of different size |
| 118 | * than requested keys vector. However, wildcards are not recognized by |
| 119 | * framework and they are passed as-is to the HAL implementation. |
| 120 | * |
| 121 | * Unknown keys must be ignored and not placed into results vector. |
| 122 | * |
| 123 | * @param keys Parameter keys to fetch. |
| 124 | * @return parameters Vendor-specific key-value pairs. |
| 125 | */ |
| 126 | getParameters(vec<string> keys) generates (vec<VendorKeyValue> parameters); |
| 127 | |
| 128 | /** |
| 129 | * Closes the session. |
| 130 | * |
| 131 | * The call must not fail and must only be issued once. |
| 132 | * |
| 133 | * After the close call is executed, no other calls to this interface |
| 134 | * are allowed. |
| 135 | */ |
| 136 | close(); |
| 137 | }; |