Igor Murashkin | e7ee763 | 2013-06-11 18:10:18 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 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 | #ifndef ANDROID_HARDWARE_PHOTOGRAPHY_CALLBACKS_H |
| 18 | #define ANDROID_HARDWARE_PHOTOGRAPHY_CALLBACKS_H |
| 19 | |
| 20 | #include <utils/RefBase.h> |
| 21 | #include <binder/IInterface.h> |
| 22 | #include <binder/Parcel.h> |
| 23 | #include <binder/IMemory.h> |
| 24 | #include <utils/Timers.h> |
| 25 | #include <system/camera.h> |
| 26 | |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 27 | #include <camera/CaptureResult.h> |
| 28 | |
Igor Murashkin | e7ee763 | 2013-06-11 18:10:18 -0700 | [diff] [blame] | 29 | namespace android { |
| 30 | class CameraMetadata; |
| 31 | |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 32 | |
Igor Murashkin | e7ee763 | 2013-06-11 18:10:18 -0700 | [diff] [blame] | 33 | class ICameraDeviceCallbacks : public IInterface |
| 34 | { |
| 35 | /** |
| 36 | * Keep up-to-date with ICameraDeviceCallbacks.aidl in frameworks/base |
| 37 | */ |
| 38 | public: |
| 39 | DECLARE_META_INTERFACE(CameraDeviceCallbacks); |
| 40 | |
Eino-Ville Talvala | f1e98d8 | 2013-09-06 09:32:43 -0700 | [diff] [blame] | 41 | /** |
| 42 | * Error codes for CAMERA_MSG_ERROR |
| 43 | */ |
| 44 | enum CameraErrorCode { |
Eino-Ville Talvala | 1754351 | 2014-08-06 14:32:02 -0700 | [diff] [blame] | 45 | ERROR_CAMERA_INVALID_ERROR = -1, // To indicate all invalid error codes |
Eino-Ville Talvala | f1e98d8 | 2013-09-06 09:32:43 -0700 | [diff] [blame] | 46 | ERROR_CAMERA_DISCONNECTED = 0, |
| 47 | ERROR_CAMERA_DEVICE = 1, |
Eino-Ville Talvala | 1754351 | 2014-08-06 14:32:02 -0700 | [diff] [blame] | 48 | ERROR_CAMERA_SERVICE = 2, |
| 49 | ERROR_CAMERA_REQUEST = 3, |
| 50 | ERROR_CAMERA_RESULT = 4, |
| 51 | ERROR_CAMERA_BUFFER = 5, |
Eino-Ville Talvala | f1e98d8 | 2013-09-06 09:32:43 -0700 | [diff] [blame] | 52 | }; |
Igor Murashkin | e7ee763 | 2013-06-11 18:10:18 -0700 | [diff] [blame] | 53 | |
| 54 | // One way |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 55 | virtual void onDeviceError(CameraErrorCode errorCode, |
| 56 | const CaptureResultExtras& resultExtras) = 0; |
Eino-Ville Talvala | f1e98d8 | 2013-09-06 09:32:43 -0700 | [diff] [blame] | 57 | |
| 58 | // One way |
| 59 | virtual void onDeviceIdle() = 0; |
| 60 | |
| 61 | // One way |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 62 | virtual void onCaptureStarted(const CaptureResultExtras& resultExtras, |
Eino-Ville Talvala | f1e98d8 | 2013-09-06 09:32:43 -0700 | [diff] [blame] | 63 | int64_t timestamp) = 0; |
| 64 | |
| 65 | // One way |
Jianing Wei | cb0652e | 2014-03-12 18:29:36 -0700 | [diff] [blame] | 66 | virtual void onResultReceived(const CameraMetadata& metadata, |
| 67 | const CaptureResultExtras& resultExtras) = 0; |
Eino-Ville Talvala | 4d44cad | 2015-04-11 13:15:45 -0700 | [diff] [blame] | 68 | |
| 69 | // One way |
| 70 | virtual void onPrepared(int streamId) = 0; |
Igor Murashkin | e7ee763 | 2013-06-11 18:10:18 -0700 | [diff] [blame] | 71 | }; |
| 72 | |
| 73 | // ---------------------------------------------------------------------------- |
| 74 | |
| 75 | class BnCameraDeviceCallbacks : public BnInterface<ICameraDeviceCallbacks> |
| 76 | { |
| 77 | public: |
| 78 | virtual status_t onTransact( uint32_t code, |
| 79 | const Parcel& data, |
| 80 | Parcel* reply, |
| 81 | uint32_t flags = 0); |
| 82 | }; |
| 83 | |
| 84 | }; // namespace android |
| 85 | |
| 86 | #endif |