1*4d7e907cSAndroid Build Coastguard Worker/* 2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2018 The Android Open Source Project 3*4d7e907cSAndroid Build Coastguard Worker * 4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*4d7e907cSAndroid Build Coastguard Worker * 8*4d7e907cSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*4d7e907cSAndroid Build Coastguard Worker * 10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License. 15*4d7e907cSAndroid Build Coastguard Worker */ 16*4d7e907cSAndroid Build Coastguard Worker 17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected]; 18*4d7e907cSAndroid Build Coastguard Worker 19*4d7e907cSAndroid Build Coastguard Worker/** 20*4d7e907cSAndroid Build Coastguard Worker * Generic configuration interface presented by all configurable Codec2 objects. 21*4d7e907cSAndroid Build Coastguard Worker * 22*4d7e907cSAndroid Build Coastguard Worker * This interface must be supported in all states of the owning object, and must 23*4d7e907cSAndroid Build Coastguard Worker * not change the state of the owning object. 24*4d7e907cSAndroid Build Coastguard Worker */ 25*4d7e907cSAndroid Build Coastguard Workerinterface IConfigurable { 26*4d7e907cSAndroid Build Coastguard Worker /** 27*4d7e907cSAndroid Build Coastguard Worker * Returns the id of the object. This must be unique among all objects of 28*4d7e907cSAndroid Build Coastguard Worker * the same type hosted by the same store. 29*4d7e907cSAndroid Build Coastguard Worker * 30*4d7e907cSAndroid Build Coastguard Worker * @return id Id of the object. 31*4d7e907cSAndroid Build Coastguard Worker */ 32*4d7e907cSAndroid Build Coastguard Worker getId() generates (uint32_t id); 33*4d7e907cSAndroid Build Coastguard Worker 34*4d7e907cSAndroid Build Coastguard Worker /** 35*4d7e907cSAndroid Build Coastguard Worker * Returns the name of the object. 36*4d7e907cSAndroid Build Coastguard Worker * 37*4d7e907cSAndroid Build Coastguard Worker * This must match the name that was supplied during the creation of the 38*4d7e907cSAndroid Build Coastguard Worker * object. 39*4d7e907cSAndroid Build Coastguard Worker * 40*4d7e907cSAndroid Build Coastguard Worker * @return name Name of the object. 41*4d7e907cSAndroid Build Coastguard Worker */ 42*4d7e907cSAndroid Build Coastguard Worker getName() generates (string name); 43*4d7e907cSAndroid Build Coastguard Worker 44*4d7e907cSAndroid Build Coastguard Worker /** 45*4d7e907cSAndroid Build Coastguard Worker * Queries a set of parameters from the object. 46*4d7e907cSAndroid Build Coastguard Worker * 47*4d7e907cSAndroid Build Coastguard Worker * Querying is performed at best effort: the object must query all supported 48*4d7e907cSAndroid Build Coastguard Worker * parameters and skip unsupported ones (which may include parameters that 49*4d7e907cSAndroid Build Coastguard Worker * could not be allocated). Any errors are communicated in the return value. 50*4d7e907cSAndroid Build Coastguard Worker * 51*4d7e907cSAndroid Build Coastguard Worker * If @p mayBlock is false, this method must not block. All parameter 52*4d7e907cSAndroid Build Coastguard Worker * queries that require blocking must be skipped. 53*4d7e907cSAndroid Build Coastguard Worker * 54*4d7e907cSAndroid Build Coastguard Worker * If @p mayBlock is true, a query may block, but the whole method call 55*4d7e907cSAndroid Build Coastguard Worker * has to complete in a timely manner, or `status = TIMED_OUT` is returned. 56*4d7e907cSAndroid Build Coastguard Worker * 57*4d7e907cSAndroid Build Coastguard Worker * If @p mayBlock is false, this method must not block. Otherwise, this 58*4d7e907cSAndroid Build Coastguard Worker * method is allowed to block for a certain period of time before completing 59*4d7e907cSAndroid Build Coastguard Worker * the operation. If the operation is not completed in a timely manner, 60*4d7e907cSAndroid Build Coastguard Worker * `status = TIMED_OUT` is returned. 61*4d7e907cSAndroid Build Coastguard Worker * 62*4d7e907cSAndroid Build Coastguard Worker * @note The order of C2Param objects in @p param does not depend on the 63*4d7e907cSAndroid Build Coastguard Worker * order of C2Param structure indices in @p indices. 64*4d7e907cSAndroid Build Coastguard Worker * 65*4d7e907cSAndroid Build Coastguard Worker * \par For IComponent 66*4d7e907cSAndroid Build Coastguard Worker * 67*4d7e907cSAndroid Build Coastguard Worker * When the object type is @ref IComponent, this method must be supported in 68*4d7e907cSAndroid Build Coastguard Worker * any state except released. This call must not change the state nor the 69*4d7e907cSAndroid Build Coastguard Worker * internal configuration of the component. 70*4d7e907cSAndroid Build Coastguard Worker * 71*4d7e907cSAndroid Build Coastguard Worker * The blocking behavior of this method differs among states: 72*4d7e907cSAndroid Build Coastguard Worker * - In the stopped state, this must be non-blocking. @p mayBlock is 73*4d7e907cSAndroid Build Coastguard Worker * ignored. (The method operates as if @p mayBlock was false.) 74*4d7e907cSAndroid Build Coastguard Worker * - In any of the running states, this method may block momentarily if 75*4d7e907cSAndroid Build Coastguard Worker * @p mayBlock is true. However, if the call cannot be completed in a 76*4d7e907cSAndroid Build Coastguard Worker * timely manner, `status = TIMED_OUT` is returned. 77*4d7e907cSAndroid Build Coastguard Worker * 78*4d7e907cSAndroid Build Coastguard Worker * @param indices List of C2Param structure indices to query. 79*4d7e907cSAndroid Build Coastguard Worker * @param mayBlock Whether this call may block or not. 80*4d7e907cSAndroid Build Coastguard Worker * @return status Status of the call, which may be 81*4d7e907cSAndroid Build Coastguard Worker * - `OK` - All parameters could be queried. 82*4d7e907cSAndroid Build Coastguard Worker * - `BAD_INDEX` - All supported parameters could be queried, but some 83*4d7e907cSAndroid Build Coastguard Worker * parameters were not supported. 84*4d7e907cSAndroid Build Coastguard Worker * - `NO_MEMORY` - Could not allocate memory for a supported parameter. 85*4d7e907cSAndroid Build Coastguard Worker * - `BLOCKING` - Querying some parameters requires blocking, but 86*4d7e907cSAndroid Build Coastguard Worker * @p mayBlock is false. 87*4d7e907cSAndroid Build Coastguard Worker * - `TIMED_OUT` - The operation cannot be finished in a timely manner. 88*4d7e907cSAndroid Build Coastguard Worker * - `CORRUPTED` - Some unknown error occurred. 89*4d7e907cSAndroid Build Coastguard Worker * @return params Flattened representation of C2Param objects. 90*4d7e907cSAndroid Build Coastguard Worker * 91*4d7e907cSAndroid Build Coastguard Worker * @sa Params. 92*4d7e907cSAndroid Build Coastguard Worker */ 93*4d7e907cSAndroid Build Coastguard Worker query( 94*4d7e907cSAndroid Build Coastguard Worker vec<ParamIndex> indices, 95*4d7e907cSAndroid Build Coastguard Worker bool mayBlock 96*4d7e907cSAndroid Build Coastguard Worker ) generates ( 97*4d7e907cSAndroid Build Coastguard Worker Status status, 98*4d7e907cSAndroid Build Coastguard Worker Params params 99*4d7e907cSAndroid Build Coastguard Worker ); 100*4d7e907cSAndroid Build Coastguard Worker 101*4d7e907cSAndroid Build Coastguard Worker /** 102*4d7e907cSAndroid Build Coastguard Worker * Sets a set of parameters for the object. 103*4d7e907cSAndroid Build Coastguard Worker * 104*4d7e907cSAndroid Build Coastguard Worker * Tuning is performed at best effort: the object must update all supported 105*4d7e907cSAndroid Build Coastguard Worker * configurations at best effort and skip unsupported parameters. Any errors 106*4d7e907cSAndroid Build Coastguard Worker * are communicated in the return value and in @p failures. 107*4d7e907cSAndroid Build Coastguard Worker * 108*4d7e907cSAndroid Build Coastguard Worker * A non-strict parameter update with an unsupported value shall cause an 109*4d7e907cSAndroid Build Coastguard Worker * update to the closest supported value. A strict parameter update with an 110*4d7e907cSAndroid Build Coastguard Worker * unsupported value shall be skipped and a failure shall be returned. 111*4d7e907cSAndroid Build Coastguard Worker * 112*4d7e907cSAndroid Build Coastguard Worker * If @p mayBlock is false, this method must not block. An update that 113*4d7e907cSAndroid Build Coastguard Worker * requires blocking shall be skipped and a failure shall be returned. 114*4d7e907cSAndroid Build Coastguard Worker * 115*4d7e907cSAndroid Build Coastguard Worker * If @p mayBlock is true, an update may block, but the whole method call 116*4d7e907cSAndroid Build Coastguard Worker * has to complete in a timely manner, or `status = TIMED_OUT` is returned. 117*4d7e907cSAndroid Build Coastguard Worker * 118*4d7e907cSAndroid Build Coastguard Worker * The final values for all parameters set are propagated back to the caller 119*4d7e907cSAndroid Build Coastguard Worker * in @p params. 120*4d7e907cSAndroid Build Coastguard Worker * 121*4d7e907cSAndroid Build Coastguard Worker * \par For IComponent 122*4d7e907cSAndroid Build Coastguard Worker * 123*4d7e907cSAndroid Build Coastguard Worker * When the object type is @ref IComponent, this method must be supported in 124*4d7e907cSAndroid Build Coastguard Worker * any state except released. 125*4d7e907cSAndroid Build Coastguard Worker * 126*4d7e907cSAndroid Build Coastguard Worker * The blocking behavior of this method differs among states: 127*4d7e907cSAndroid Build Coastguard Worker * - In the stopped state, this must be non-blocking. @p mayBlock is 128*4d7e907cSAndroid Build Coastguard Worker * ignored. (The method operates as if @p mayBlock was false.) 129*4d7e907cSAndroid Build Coastguard Worker * - In any of the running states, this method may block momentarily if 130*4d7e907cSAndroid Build Coastguard Worker * @p mayBlock is true. However, if the call cannot be completed in a 131*4d7e907cSAndroid Build Coastguard Worker * timely manner, `status = TIMED_OUT` is returned. 132*4d7e907cSAndroid Build Coastguard Worker * 133*4d7e907cSAndroid Build Coastguard Worker * @note Parameter tuning @e does depend on the order of the tuning 134*4d7e907cSAndroid Build Coastguard Worker * parameters, e.g., some parameter update may enable some subsequent 135*4d7e907cSAndroid Build Coastguard Worker * parameter update. 136*4d7e907cSAndroid Build Coastguard Worker * 137*4d7e907cSAndroid Build Coastguard Worker * @param inParams Requested parameter updates. 138*4d7e907cSAndroid Build Coastguard Worker * @param mayBlock Whether this call may block or not. 139*4d7e907cSAndroid Build Coastguard Worker * @return status Status of the call, which may be 140*4d7e907cSAndroid Build Coastguard Worker * - `OK` - All parameters could be updated successfully. 141*4d7e907cSAndroid Build Coastguard Worker * - `BAD_INDEX` - All supported parameters could be updated successfully, 142*4d7e907cSAndroid Build Coastguard Worker * but some parameters were not supported. 143*4d7e907cSAndroid Build Coastguard Worker * - `NO_MEMORY` - Some supported parameters could not be updated 144*4d7e907cSAndroid Build Coastguard Worker * successfully because they contained unsupported values. 145*4d7e907cSAndroid Build Coastguard Worker * These are returned in @p failures. 146*4d7e907cSAndroid Build Coastguard Worker * - `BLOCKING` - Setting some parameters requires blocking, but 147*4d7e907cSAndroid Build Coastguard Worker * @p mayBlock is false. 148*4d7e907cSAndroid Build Coastguard Worker * - `TIMED_OUT` - The operation cannot be finished in a timely manner. 149*4d7e907cSAndroid Build Coastguard Worker * - `CORRUPTED` - Some unknown error occurred. 150*4d7e907cSAndroid Build Coastguard Worker * @return failures List of update failures. 151*4d7e907cSAndroid Build Coastguard Worker * @return outParams Flattened representation of configured parameters. The 152*4d7e907cSAndroid Build Coastguard Worker * order of parameters in @p outParams is based on the order of 153*4d7e907cSAndroid Build Coastguard Worker * requested updates in @p inParams. 154*4d7e907cSAndroid Build Coastguard Worker * 155*4d7e907cSAndroid Build Coastguard Worker * @sa SettingResult. 156*4d7e907cSAndroid Build Coastguard Worker */ 157*4d7e907cSAndroid Build Coastguard Worker config( 158*4d7e907cSAndroid Build Coastguard Worker Params inParams, 159*4d7e907cSAndroid Build Coastguard Worker bool mayBlock 160*4d7e907cSAndroid Build Coastguard Worker ) generates ( 161*4d7e907cSAndroid Build Coastguard Worker Status status, 162*4d7e907cSAndroid Build Coastguard Worker vec<SettingResult> failures, 163*4d7e907cSAndroid Build Coastguard Worker Params outParams 164*4d7e907cSAndroid Build Coastguard Worker ); 165*4d7e907cSAndroid Build Coastguard Worker 166*4d7e907cSAndroid Build Coastguard Worker // REFLECTION MECHANISM 167*4d7e907cSAndroid Build Coastguard Worker // ========================================================================= 168*4d7e907cSAndroid Build Coastguard Worker 169*4d7e907cSAndroid Build Coastguard Worker /** 170*4d7e907cSAndroid Build Coastguard Worker * Returns a list of supported parameters within a selected range of C2Param 171*4d7e907cSAndroid Build Coastguard Worker * structure indices. 172*4d7e907cSAndroid Build Coastguard Worker * 173*4d7e907cSAndroid Build Coastguard Worker * @param start The first index of the selected range. 174*4d7e907cSAndroid Build Coastguard Worker * @param count The length of the selected range. 175*4d7e907cSAndroid Build Coastguard Worker * @return status Status of the call, which may be 176*4d7e907cSAndroid Build Coastguard Worker * - `OK` - The operation completed successfully. 177*4d7e907cSAndroid Build Coastguard Worker * - `NO_MEMORY` - Not enough memory to complete this method. 178*4d7e907cSAndroid Build Coastguard Worker * @return params List of supported parameters in the selected range. This 179*4d7e907cSAndroid Build Coastguard Worker * list may have fewer than @p count elements if some indices in the 180*4d7e907cSAndroid Build Coastguard Worker * range are not supported. 181*4d7e907cSAndroid Build Coastguard Worker * 182*4d7e907cSAndroid Build Coastguard Worker * @sa ParamDescriptor. 183*4d7e907cSAndroid Build Coastguard Worker */ 184*4d7e907cSAndroid Build Coastguard Worker querySupportedParams( 185*4d7e907cSAndroid Build Coastguard Worker uint32_t start, 186*4d7e907cSAndroid Build Coastguard Worker uint32_t count 187*4d7e907cSAndroid Build Coastguard Worker ) generates ( 188*4d7e907cSAndroid Build Coastguard Worker Status status, 189*4d7e907cSAndroid Build Coastguard Worker vec<ParamDescriptor> params 190*4d7e907cSAndroid Build Coastguard Worker ); 191*4d7e907cSAndroid Build Coastguard Worker 192*4d7e907cSAndroid Build Coastguard Worker /** 193*4d7e907cSAndroid Build Coastguard Worker * Retrieves the supported values for the queried fields. 194*4d7e907cSAndroid Build Coastguard Worker * 195*4d7e907cSAndroid Build Coastguard Worker * The object must process all fields queried even if some queries fail. 196*4d7e907cSAndroid Build Coastguard Worker * 197*4d7e907cSAndroid Build Coastguard Worker * If @p mayBlock is false, this method must not block. Otherwise, this 198*4d7e907cSAndroid Build Coastguard Worker * method is allowed to block for a certain period of time before completing 199*4d7e907cSAndroid Build Coastguard Worker * the operation. If the operation cannot be completed in a timely manner, 200*4d7e907cSAndroid Build Coastguard Worker * `status = TIMED_OUT` is returned. 201*4d7e907cSAndroid Build Coastguard Worker * 202*4d7e907cSAndroid Build Coastguard Worker * \par For IComponent 203*4d7e907cSAndroid Build Coastguard Worker * 204*4d7e907cSAndroid Build Coastguard Worker * When the object type is @ref IComponent, this method must be supported in 205*4d7e907cSAndroid Build Coastguard Worker * any state except released. 206*4d7e907cSAndroid Build Coastguard Worker * 207*4d7e907cSAndroid Build Coastguard Worker * The blocking behavior of this method differs among states: 208*4d7e907cSAndroid Build Coastguard Worker * - In the stopped state, this must be non-blocking. @p mayBlock is 209*4d7e907cSAndroid Build Coastguard Worker * ignored. (The method operates as if @p mayBlock was false.) 210*4d7e907cSAndroid Build Coastguard Worker * - In any of the running states, this method may block momentarily if 211*4d7e907cSAndroid Build Coastguard Worker * @p mayBlock is true. However, if the call cannot be completed in a 212*4d7e907cSAndroid Build Coastguard Worker * timely manner, `status = TIMED_OUT` is returned. 213*4d7e907cSAndroid Build Coastguard Worker * 214*4d7e907cSAndroid Build Coastguard Worker * @param inFields List of field queries. 215*4d7e907cSAndroid Build Coastguard Worker * @param mayBlock Whether this call may block or not. 216*4d7e907cSAndroid Build Coastguard Worker * @return status Status of the call, which may be 217*4d7e907cSAndroid Build Coastguard Worker * - `OK` - The operation completed successfully. 218*4d7e907cSAndroid Build Coastguard Worker * - `BLOCKING` - Querying some parameters requires blocking, but 219*4d7e907cSAndroid Build Coastguard Worker * @p mayBlock is false. 220*4d7e907cSAndroid Build Coastguard Worker * - `NO_MEMORY` - Not enough memory to complete this method. 221*4d7e907cSAndroid Build Coastguard Worker * - `BAD_INDEX` - At least one field was not recognized as a component 222*4d7e907cSAndroid Build Coastguard Worker * field. 223*4d7e907cSAndroid Build Coastguard Worker * - `BLOCKING` - Querying some fields requires blocking, but @p mayblock 224*4d7e907cSAndroid Build Coastguard Worker * is false. 225*4d7e907cSAndroid Build Coastguard Worker * - `TIMED_OUT` - The operation cannot be finished in a timely manner. 226*4d7e907cSAndroid Build Coastguard Worker * - `CORRUPTED` - Some unknown error occurred. 227*4d7e907cSAndroid Build Coastguard Worker * @return outFields List of supported values and results for the 228*4d7e907cSAndroid Build Coastguard Worker * supplied queries. 229*4d7e907cSAndroid Build Coastguard Worker * 230*4d7e907cSAndroid Build Coastguard Worker * @sa FieldSupportedValuesQuery, FieldSupportedValuesQueryResult. 231*4d7e907cSAndroid Build Coastguard Worker */ 232*4d7e907cSAndroid Build Coastguard Worker querySupportedValues( 233*4d7e907cSAndroid Build Coastguard Worker vec<FieldSupportedValuesQuery> inFields, 234*4d7e907cSAndroid Build Coastguard Worker bool mayBlock 235*4d7e907cSAndroid Build Coastguard Worker ) generates ( 236*4d7e907cSAndroid Build Coastguard Worker Status status, 237*4d7e907cSAndroid Build Coastguard Worker vec<FieldSupportedValuesQueryResult> outFields 238*4d7e907cSAndroid Build Coastguard Worker ); 239*4d7e907cSAndroid Build Coastguard Worker 240*4d7e907cSAndroid Build Coastguard Worker}; 241*4d7e907cSAndroid Build Coastguard Worker 242