Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 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_ICAMERASERVICE_H |
| 18 | #define ANDROID_HARDWARE_ICAMERASERVICE_H |
| 19 | |
| 20 | #include <utils/RefBase.h> |
| 21 | #include <binder/IInterface.h> |
| 22 | #include <binder/Parcel.h> |
| 23 | |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 24 | namespace android { |
| 25 | |
Igor Murashkin | c073ba5 | 2013-02-26 14:32:34 -0800 | [diff] [blame] | 26 | class ICamera; |
| 27 | class ICameraClient; |
| 28 | class IProCameraUser; |
| 29 | class IProCameraCallbacks; |
Igor Murashkin | bfc9915 | 2013-02-27 12:55:20 -0800 | [diff] [blame] | 30 | class ICameraServiceListener; |
Igor Murashkin | c073ba5 | 2013-02-26 14:32:34 -0800 | [diff] [blame] | 31 | |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 32 | class ICameraService : public IInterface |
| 33 | { |
| 34 | public: |
Igor Murashkin | bef3f23 | 2013-05-30 17:47:38 -0700 | [diff] [blame^] | 35 | /** |
| 36 | * Keep up-to-date with ICameraService.aidl in frameworks/base |
| 37 | */ |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 38 | enum { |
Chih-Chung Chang | 35a055b | 2010-05-06 16:36:58 +0800 | [diff] [blame] | 39 | GET_NUMBER_OF_CAMERAS = IBinder::FIRST_CALL_TRANSACTION, |
Chih-Chung Chang | ddbdb35 | 2010-06-10 13:32:16 +0800 | [diff] [blame] | 40 | GET_CAMERA_INFO, |
Igor Murashkin | 634a515 | 2013-02-20 17:15:11 -0800 | [diff] [blame] | 41 | CONNECT, |
Igor Murashkin | bfc9915 | 2013-02-27 12:55:20 -0800 | [diff] [blame] | 42 | CONNECT_PRO, |
| 43 | ADD_LISTENER, |
| 44 | REMOVE_LISTENER, |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 45 | }; |
| 46 | |
Eino-Ville Talvala | ceb388d | 2013-02-19 10:40:14 -0800 | [diff] [blame] | 47 | enum { |
| 48 | USE_CALLING_UID = -1 |
| 49 | }; |
| 50 | |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 51 | public: |
| 52 | DECLARE_META_INTERFACE(CameraService); |
| 53 | |
Igor Murashkin | bfc9915 | 2013-02-27 12:55:20 -0800 | [diff] [blame] | 54 | virtual int32_t getNumberOfCameras() = 0; |
| 55 | virtual status_t getCameraInfo(int cameraId, |
Chih-Chung Chang | ddbdb35 | 2010-06-10 13:32:16 +0800 | [diff] [blame] | 56 | struct CameraInfo* cameraInfo) = 0; |
Igor Murashkin | bfc9915 | 2013-02-27 12:55:20 -0800 | [diff] [blame] | 57 | |
| 58 | // Returns 'OK' if operation succeeded |
| 59 | // - Errors: ALREADY_EXISTS if the listener was already added |
| 60 | virtual status_t addListener(const sp<ICameraServiceListener>& listener) |
| 61 | = 0; |
| 62 | // Returns 'OK' if operation succeeded |
| 63 | // - Errors: BAD_VALUE if specified listener was not in the listener list |
| 64 | virtual status_t removeListener(const sp<ICameraServiceListener>& listener) |
| 65 | = 0; |
Eino-Ville Talvala | ceb388d | 2013-02-19 10:40:14 -0800 | [diff] [blame] | 66 | /** |
| 67 | * clientPackageName and clientUid are used for permissions checking. if |
| 68 | * clientUid == USE_CALLING_UID, then the calling UID is used instead. Only |
| 69 | * trusted callers can set a clientUid other than USE_CALLING_UID. |
| 70 | */ |
| 71 | virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient, |
| 72 | int cameraId, |
| 73 | const String16& clientPackageName, |
| 74 | int clientUid) = 0; |
Igor Murashkin | 634a515 | 2013-02-20 17:15:11 -0800 | [diff] [blame] | 75 | |
Eino-Ville Talvala | ceb388d | 2013-02-19 10:40:14 -0800 | [diff] [blame] | 76 | virtual sp<IProCameraUser> connect(const sp<IProCameraCallbacks>& cameraCb, |
Igor Murashkin | c073ba5 | 2013-02-26 14:32:34 -0800 | [diff] [blame] | 77 | int cameraId, |
| 78 | const String16& clientPackageName, |
| 79 | int clientUid) = 0; |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | // ---------------------------------------------------------------------------- |
| 83 | |
| 84 | class BnCameraService: public BnInterface<ICameraService> |
| 85 | { |
| 86 | public: |
| 87 | virtual status_t onTransact( uint32_t code, |
| 88 | const Parcel& data, |
| 89 | Parcel* reply, |
| 90 | uint32_t flags = 0); |
| 91 | }; |
| 92 | |
| 93 | }; // namespace android |
| 94 | |
| 95 | #endif |