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 android.hardware.automotive.evs@1.0; 18 19import IEvsCameraStream; 20 21 22/** 23 * Represents a single camera and is the primary interface for capturing images. 24 */ 25interface IEvsCamera { 26 27 /** 28 * Returns the ID of this camera. 29 * 30 * @return info The description of this camera. This must be the same value as 31 * reported by EvsEnumerator::getCameraList(). 32 */ 33 getCameraInfo() generates (CameraDesc info); 34 35 /** 36 * Specifies the depth of the buffer chain the camera is asked to support. 37 * 38 * Up to this many frames may be held concurrently by the client of IEvsCamera. 39 * If this many frames have been delivered to the receiver without being returned 40 * by doneWithFrame, the stream must skip frames until a buffer is returned for reuse. 41 * It is legal for this call to come at any time, even while streams are already running, 42 * in which case buffers should be added or removed from the chain as appropriate. 43 * If no call is made to this entry point, the IEvsCamera must support at least one 44 * frame by default. More is acceptable. 45 * 46 * @param bufferCount Number of buffers the client of IEvsCamera may hold concurrently. 47 * @return result EvsResult::OK is returned if this call is successful. 48 */ 49 setMaxFramesInFlight(uint32_t bufferCount) generates (EvsResult result); 50 51 /** 52 * Request to start EVS camera stream from this camera. 53 * 54 * The IEvsCameraStream must begin receiving calls with various events 55 * including new image frame ready until stopVideoStream() is called. 56 * 57 * @param receiver IEvsCameraStream implementation. 58 * @return result EvsResult::OK is returned if this call is successful. 59 */ 60 startVideoStream(IEvsCameraStream receiver) generates (EvsResult result); 61 62 /** 63 * Return a frame that was delivered by to the IEvsCameraStream. 64 * 65 * When done consuming a frame delivered to the IEvsCameraStream 66 * interface, it must be returned to the IEvsCamera for reuse. 67 * A small, finite number of buffers are available (possibly as small 68 * as one), and if the supply is exhausted, no further frames may be 69 * delivered until a buffer is returned. 70 * 71 * @param buffer A buffer to be returned. 72 */ 73 oneway doneWithFrame(BufferDesc buffer); 74 75 /** 76 * Stop the delivery of EVS camera frames. 77 * 78 * Because delivery is asynchronous, frames may continue to arrive for 79 * some time after this call returns. Each must be returned until the 80 * closure of the stream is signaled to the IEvsCameraStream. 81 * This function cannot fail and is simply ignored if the stream isn't running. 82 */ 83 stopVideoStream(); 84 85 /** 86 * Request driver specific information from the HAL implementation. 87 * 88 * The values allowed for opaqueIdentifier are driver specific, 89 * but no value passed in may crash the driver. The driver should 90 * return 0 for any unrecognized opaqueIdentifier. 91 * 92 * @param opaqueIdentifier An unique identifier of the information to 93 * request. 94 * @return value Requested information. Zero is returned if the 95 * driver does not recognize a given identifier. 96 */ 97 getExtendedInfo(uint32_t opaqueIdentifier) generates (int32_t value); 98 99 /** 100 * Send a driver specific value to the HAL implementation. 101 * 102 * This extension is provided to facilitate car specific 103 * extensions, but no HAL implementation may require this call 104 * in order to function in a default state. 105 * INVALID_ARG is returned if the opaqueValue is not meaningful to 106 * the driver implementation. 107 * 108 * @param opaqueIdentifier An unique identifier of the information to 109 * program. 110 * opaqueValue A value to program. 111 * @return result EvsResult::OK is returned if this call is successful. 112 */ 113 setExtendedInfo(uint32_t opaqueIdentifier, int32_t opaqueValue) generates (EvsResult result); 114}; 115