1/* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package [email protected]; 18 19import ITvInputCallback; 20 21interface ITvInput { 22 /** 23 * Sets a callback for events. 24 * 25 * Note that initially no device is available in the client side, so the 26 * implementation must notify all the currently available devices including 27 * static devices via callback once callback is set. 28 * 29 * @param callback Callback object to pass events. 30 */ 31 @entry 32 @exit 33 @callflow(next={"getStreamConfigurations"}) 34 setCallback(ITvInputCallback callback); 35 36 /** 37 * Gets stream configurations for a specific device. 38 * 39 * The configs object is valid only until the next 40 * STREAM_CONFIGURATIONS_CHANGED event. 41 * 42 * @param deviceId Device ID for the configurations. 43 * @return result OK upon success. Otherwise, 44 * INVALID_ARGUMENTS if the given device ID is not valid. 45 * @return configurations An array of available configurations. 46 */ 47 @callflow(next={"openStream", "getStreamConfigurations", "closeStream"}) 48 getStreamConfigurations(int32_t deviceId) 49 generates (Result result, vec<TvStreamConfig> configurations); 50 51 /** 52 * Opens a specific stream in a device. 53 * 54 * @param deviceId Device ID for the steam to open. 55 * @param streamId Steam ID for the steam to open. Must be one of the 56 * stream IDs returned from getStreamConfigurations(). 57 * @return result OK upon success. Otherwise, 58 * INVALID_ARGUMENTS if any of given IDs are not valid; 59 * INVALID_STATE if the stream with the given ID is already open; 60 * NO_RESOURCE if the client must close other streams to open the 61 * stream. 62 * @return sidebandStream handle for sideband stream. 63 */ 64 @callflow(next={"closeStream", "getStreamConfigurations", "openStream"}) 65 openStream(int32_t deviceId, int32_t streamId) 66 generates (Result result, handle sidebandStream); 67 68 /** 69 * Closes a specific stream in a device. 70 * 71 * @param deviceId Device ID for the steam to open. 72 * @param streamId Steam ID for the steam to open. 73 * @return result OK upon success. Otherwise, 74 * INVALID_ARGUMENTS if any of given IDs are not valid; 75 * INVALID_STATE if the stream with the given ID is not open. 76 */ 77 @callflow(next={"getStreamConfigurations", "openStream", "closeStream"}) 78 closeStream(int32_t deviceId, int32_t streamId) generates (Result result); 79}; 80