Zhijun He | 8486e41 | 2016-09-12 15:30:51 -0700 | [diff] [blame] | 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 | |
| 17 | package android.hardware.camera.device@1.0; |
| 18 | |
| 19 | interface ICameraDeviceCallback { |
| 20 | |
| 21 | /** |
| 22 | * Notify the camera service of a particular event occurring |
| 23 | * The meaning of each parameter is defined by the value of msgType, and |
| 24 | * documented in the definition of NotifyCallbackMsg. |
| 25 | * |
| 26 | * @param msgType The type of the event. |
| 27 | * @param ext1 The first parameter for the event, if needed. |
| 28 | * @param ext2 The second parameter for the event, if needed. |
| 29 | */ |
| 30 | notifyCallback(NotifyCallbackMsg msgType, int32_t ext1, int32_t ext2); |
| 31 | |
| 32 | /** |
| 33 | * Define a memory buffer from the provided handle and size, and return a |
| 34 | * unique identifier for the HAL to use to reference it with. |
| 35 | * |
| 36 | * TODO(b/33269977): Ensure this aligns with design and performance goals. |
| 37 | * |
| 38 | * @param descriptor A native handle that must have exactly one file |
| 39 | * descriptor in it; the file descriptor must be memory mappable to |
| 40 | * bufferSize * bufferCount bytes. |
| 41 | * @param bufferSize The number of bytes a single buffer consists of. |
| 42 | * @param bufferCount The number of contiguous buffers that the descriptor |
| 43 | * contains. |
| 44 | * |
| 45 | * @return memId A integer identifier for this memory buffer, for use with |
| 46 | * data callbacks and unregistering memory. |
| 47 | */ |
| 48 | registerMemory(handle descriptor, uint32_t bufferSize, uint32_t bufferCount) |
| 49 | generates (MemoryId memId); |
| 50 | |
| 51 | /** |
| 52 | * Unregister a previously registered memory buffer |
| 53 | */ |
| 54 | unregisterMemory(MemoryId memId); |
| 55 | |
| 56 | /** |
| 57 | * Send a buffer of image data to the camera service |
| 58 | * |
| 59 | * @param msgType The kind of image buffer data this call represents. |
| 60 | * @param data A memory handle to the buffer containing the data. |
| 61 | * @param bufferIndex The offset into the memory handle where the buffer |
| 62 | * starts. |
| 63 | * |
| 64 | */ |
| 65 | dataCallback(DataCallbackMsg msgType, MemoryId data, uint32_t bufferIndex); |
| 66 | |
| 67 | /** |
| 68 | * Send a buffer of image data to the camera service, with a timestamp |
| 69 | * |
| 70 | * @param msgType The kind of image buffer data this call represents. |
| 71 | * @param data A memory handle to the buffer containing the data. |
| 72 | * @param bufferIndex The offset into the memory handle where the buffer |
| 73 | * starts. |
| 74 | * @param timestamp The time this buffer was captured by the camera, in |
| 75 | * nanoseconds. |
| 76 | * |
| 77 | */ |
| 78 | dataCallbackTimestamp(DataCallbackMsg msgType, MemoryId data, uint32_t bufferIndex, |
| 79 | int64_t timestamp); |
| 80 | |
| 81 | }; |