ICameraService.h revision 65d14b9825311f9d1847cf282bd0419e71bac666
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 24namespace android { 25 26class ICamera; 27class ICameraClient; 28class IProCameraUser; 29class IProCameraCallbacks; 30class ICameraServiceListener; 31class ICameraDeviceUser; 32class ICameraDeviceCallbacks; 33class CameraMetadata; 34class VendorTagDescriptor; 35class String16; 36 37class ICameraService : public IInterface 38{ 39public: 40 /** 41 * Keep up-to-date with ICameraService.aidl in frameworks/base 42 */ 43 enum { 44 GET_NUMBER_OF_CAMERAS = IBinder::FIRST_CALL_TRANSACTION, 45 GET_CAMERA_INFO, 46 CONNECT, 47 CONNECT_PRO, 48 CONNECT_DEVICE, 49 ADD_LISTENER, 50 REMOVE_LISTENER, 51 GET_CAMERA_CHARACTERISTICS, 52 GET_CAMERA_VENDOR_TAG_DESCRIPTOR, 53 GET_LEGACY_PARAMETERS, 54 SUPPORTS_CAMERA_API, 55 }; 56 57 enum { 58 USE_CALLING_UID = -1 59 }; 60 61 enum { 62 API_VERSION_1 = 1, 63 API_VERSION_2 = 2, 64 }; 65 66public: 67 DECLARE_META_INTERFACE(CameraService); 68 69 virtual int32_t getNumberOfCameras() = 0; 70 virtual status_t getCameraInfo(int cameraId, 71 /*out*/ 72 struct CameraInfo* cameraInfo) = 0; 73 74 virtual status_t getCameraCharacteristics(int cameraId, 75 /*out*/ 76 CameraMetadata* cameraInfo) = 0; 77 78 virtual status_t getCameraVendorTagDescriptor( 79 /*out*/ 80 sp<VendorTagDescriptor>& desc) = 0; 81 82 // Returns 'OK' if operation succeeded 83 // - Errors: ALREADY_EXISTS if the listener was already added 84 virtual status_t addListener(const sp<ICameraServiceListener>& listener) 85 = 0; 86 // Returns 'OK' if operation succeeded 87 // - Errors: BAD_VALUE if specified listener was not in the listener list 88 virtual status_t removeListener(const sp<ICameraServiceListener>& listener) 89 = 0; 90 /** 91 * clientPackageName and clientUid are used for permissions checking. if 92 * clientUid == USE_CALLING_UID, then the calling UID is used instead. Only 93 * trusted callers can set a clientUid other than USE_CALLING_UID. 94 */ 95 virtual status_t connect(const sp<ICameraClient>& cameraClient, 96 int cameraId, 97 const String16& clientPackageName, 98 int clientUid, 99 /*out*/ 100 sp<ICamera>& device) = 0; 101 102 virtual status_t connectPro(const sp<IProCameraCallbacks>& cameraCb, 103 int cameraId, 104 const String16& clientPackageName, 105 int clientUid, 106 /*out*/ 107 sp<IProCameraUser>& device) = 0; 108 109 virtual status_t connectDevice( 110 const sp<ICameraDeviceCallbacks>& cameraCb, 111 int cameraId, 112 const String16& clientPackageName, 113 int clientUid, 114 /*out*/ 115 sp<ICameraDeviceUser>& device) = 0; 116 117 virtual status_t getLegacyParameters( 118 int cameraId, 119 /*out*/ 120 String16* parameters) = 0; 121 122 /** 123 * Returns OK if device supports camera2 api, 124 * returns -EOPNOTSUPP if it doesn't. 125 */ 126 virtual status_t supportsCameraApi( 127 int cameraId, int apiVersion) = 0; 128}; 129 130// ---------------------------------------------------------------------------- 131 132class BnCameraService: public BnInterface<ICameraService> 133{ 134public: 135 virtual status_t onTransact( uint32_t code, 136 const Parcel& data, 137 Parcel* reply, 138 uint32_t flags = 0); 139}; 140 141}; // namespace android 142 143#endif 144