Changyeon Jo | 2400b69 | 2019-07-18 21:32:48 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 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 | |
| 17 | package android.hardware.automotive.evs@1.1; |
| 18 | |
| 19 | import @1.0::IEvsCamera; |
Changyeon Jo | 0d0228d | 2019-08-17 21:40:28 -0700 | [diff] [blame] | 20 | import @1.0::IEvsDisplay; |
Changyeon Jo | 2400b69 | 2019-07-18 21:32:48 -0700 | [diff] [blame] | 21 | import @1.0::EvsResult; |
| 22 | import IEvsCameraStream; |
| 23 | |
| 24 | /** |
| 25 | * Represents a single camera and is the primary interface for capturing images. |
| 26 | */ |
| 27 | interface IEvsCamera extends @1.0::IEvsCamera { |
| 28 | /** |
Changyeon Jo | c6fa0ab | 2019-10-12 05:25:44 -0700 | [diff] [blame] | 29 | * Returns the description of this camera. |
| 30 | * |
| 31 | * @return info The description of this camera. This must be the same value as |
| 32 | * reported by EvsEnumerator::getCameraList_1_1(). |
| 33 | */ |
| 34 | getCameraInfo_1_1() generates (CameraDesc info); |
| 35 | |
| 36 | /** |
Changyeon Jo | 2400b69 | 2019-07-18 21:32:48 -0700 | [diff] [blame] | 37 | * Requests to pause EVS camera stream events. |
| 38 | * |
| 39 | * Like stopVideoStream(), events may continue to arrive for some time |
| 40 | * after this call returns. Delivered frame buffers must be returned. |
| 41 | * |
| 42 | * @return result EvsResult::OK is returned if this call is successful. |
| 43 | */ |
| 44 | pauseVideoStream() generates (EvsResult result); |
| 45 | |
| 46 | /** |
| 47 | * Requests to resume EVS camera stream. |
| 48 | * |
| 49 | * @return result EvsResult::OK is returned if this call is successful. |
| 50 | */ |
| 51 | resumeVideoStream() generates (EvsResult result); |
| 52 | |
| 53 | /** |
| 54 | * Returns a frame that was delivered by to the IEvsCameraStream. |
| 55 | * |
| 56 | * When done consuming a frame delivered to the IEvsCameraStream |
| 57 | * interface, it must be returned to the IEvsCamera for reuse. |
| 58 | * A small, finite number of buffers are available (possibly as small |
| 59 | * as one), and if the supply is exhausted, no further frames may be |
| 60 | * delivered until a buffer is returned. |
| 61 | * |
| 62 | * @param buffer A buffer to be returned. |
| 63 | * @return result Return EvsResult::OK if this call is successful. |
| 64 | */ |
| 65 | doneWithFrame_1_1(BufferDesc buffer) generates (EvsResult result); |
Changyeon Jo | d2a8246 | 2019-07-30 11:57:17 -0700 | [diff] [blame] | 66 | |
| 67 | /** |
| 68 | * Requests to be a master client. |
| 69 | * |
| 70 | * When multiple clients subscribe to a single camera hardware and one of |
| 71 | * them adjusts a camera parameter such as the contrast, it may disturb |
| 72 | * other clients' operations. Therefore, the client must call this method |
| 73 | * to be a master client. Once it becomes a master, it will be able to |
| 74 | * change camera parameters until either it dies or explicitly gives up the |
| 75 | * role. |
| 76 | * |
| 77 | * @return result EvsResult::OK if a master role is granted. |
| 78 | * EvsResult::OWNERSHIP_LOST if there is already a |
| 79 | * master client. |
| 80 | */ |
| 81 | setMaster() generates (EvsResult result); |
| 82 | |
Changyeon Jo | 0d0228d | 2019-08-17 21:40:28 -0700 | [diff] [blame] | 83 | /** |
| 84 | * Sets to be a master client forcibly. |
| 85 | * |
| 86 | * The client, which owns the display, has a high priority and can take over |
| 87 | * a master role from other clients without the display. |
| 88 | * |
| 89 | * @param display IEvsDisplay handle. If a given display is in either |
| 90 | * NOT_VISIBLE, VISIBLE_ON_NEXT_FRAME, or VISIBLE state, the |
| 91 | * calling client is considered as the high priority client |
| 92 | * and therefore allowed to take over a master role from |
| 93 | * existing master client. |
| 94 | * |
| 95 | * @return result EvsResult::OK if a master role is granted. |
| 96 | * EvsResult::INVALID_ARG if a given display handle is null |
| 97 | * or in valid states. |
| 98 | */ |
| 99 | forceMaster(IEvsDisplay display) generates (EvsResult result); |
Changyeon Jo | d2a8246 | 2019-07-30 11:57:17 -0700 | [diff] [blame] | 100 | |
| 101 | /** |
| 102 | * Retires from a master client role. |
| 103 | * |
| 104 | * @return result EvsResult::OK if this call is successful. |
| 105 | * EvsResult::INVALID_ARG if the caller client is not a |
| 106 | * master client. |
| 107 | */ |
| 108 | unsetMaster() generates (EvsResult result); |
| 109 | |
| 110 | /** |
Changyeon Jo | c6fa0ab | 2019-10-12 05:25:44 -0700 | [diff] [blame] | 111 | * Retrieves a list of parameters this camera supports. |
| 112 | * |
| 113 | * @return params A list of CameraParam that this camera supports. |
| 114 | */ |
| 115 | getParameterList() generates (vec<CameraParam> params); |
| 116 | |
| 117 | /** |
| 118 | * Requests a valid value range of a camera parameter |
| 119 | * |
| 120 | * @param id The identifier of camera parameter, CameraParam enum. |
| 121 | * |
| 122 | * @return min The lower bound of valid parameter value range. |
| 123 | * @return max The upper bound of valid parameter value range. |
| 124 | * @return step The resolution of values in valid range. |
| 125 | */ |
| 126 | getIntParameterRange(CameraParam id) |
| 127 | generates (int32_t min, int32_t max, int32_t step); |
| 128 | |
| 129 | /** |
| 130 | * Requests to set a camera parameter. Only a request from the master |
| 131 | * client will be processed successfully. |
Changyeon Jo | d2a8246 | 2019-07-30 11:57:17 -0700 | [diff] [blame] | 132 | * |
| 133 | * @param id The identifier of camera parameter, CameraParam enum. |
| 134 | * value A desired parameter value. |
| 135 | * @return result EvsResult::OK if it succeeds to set a parameter. |
| 136 | * EvsResult::INVALID_ARG if either the request is |
| 137 | * not made by a master client, or a requested |
| 138 | * parameter is not supported. |
| 139 | * EvsResult::UNDERLYING_SERVICE_ERROR if it fails to |
| 140 | * program a value by any other reason. |
| 141 | * effectiveValue A programmed parameter value. This may differ |
| 142 | * from what the client gives if, for example, the |
| 143 | * driver does not support a target parameter. |
| 144 | */ |
Changyeon Jo | c6fa0ab | 2019-10-12 05:25:44 -0700 | [diff] [blame] | 145 | setIntParameter(CameraParam id, int32_t value) |
Changyeon Jo | d2a8246 | 2019-07-30 11:57:17 -0700 | [diff] [blame] | 146 | generates (EvsResult result, int32_t effectiveValue); |
| 147 | |
| 148 | /** |
| 149 | * Retrieves a value of given camera parameter. |
| 150 | * |
| 151 | * @param id The identifier of camera parameter, CameraParam enum. |
| 152 | * @return result EvsResult::OK if it succeeds to read a parameter. |
| 153 | * EvsResult::INVALID_ARG if either a requested parameter is |
| 154 | * not supported. |
| 155 | * value A value of requested camera parameter. |
| 156 | */ |
Changyeon Jo | c6fa0ab | 2019-10-12 05:25:44 -0700 | [diff] [blame] | 157 | getIntParameter(CameraParam id) generates(EvsResult result, int32_t value); |
Changyeon Jo | 2400b69 | 2019-07-18 21:32:48 -0700 | [diff] [blame] | 158 | }; |