blob: 0e106997c485ecfe6143e8e44c62b71408250a60 [file] [log] [blame]
Mathias Agopian3cf61352010-02-09 17:46:37 -08001/*
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 Agopian3cf61352010-02-09 17:46:37 -080024namespace android {
25
Igor Murashkinc073ba52013-02-26 14:32:34 -080026class ICamera;
27class ICameraClient;
28class IProCameraUser;
29class IProCameraCallbacks;
Igor Murashkinbfc99152013-02-27 12:55:20 -080030class ICameraServiceListener;
Igor Murashkine7ee7632013-06-11 18:10:18 -070031class ICameraDeviceUser;
32class ICameraDeviceCallbacks;
Igor Murashkinc073ba52013-02-26 14:32:34 -080033
Mathias Agopian3cf61352010-02-09 17:46:37 -080034class ICameraService : public IInterface
35{
36public:
Igor Murashkinbef3f232013-05-30 17:47:38 -070037 /**
38 * Keep up-to-date with ICameraService.aidl in frameworks/base
39 */
Mathias Agopian3cf61352010-02-09 17:46:37 -080040 enum {
Chih-Chung Chang35a055b2010-05-06 16:36:58 +080041 GET_NUMBER_OF_CAMERAS = IBinder::FIRST_CALL_TRANSACTION,
Chih-Chung Changddbdb352010-06-10 13:32:16 +080042 GET_CAMERA_INFO,
Igor Murashkin634a5152013-02-20 17:15:11 -080043 CONNECT,
Igor Murashkinbfc99152013-02-27 12:55:20 -080044 CONNECT_PRO,
Igor Murashkine7ee7632013-06-11 18:10:18 -070045 CONNECT_DEVICE,
Igor Murashkinbfc99152013-02-27 12:55:20 -080046 ADD_LISTENER,
47 REMOVE_LISTENER,
Mathias Agopian3cf61352010-02-09 17:46:37 -080048 };
49
Eino-Ville Talvalaceb388d2013-02-19 10:40:14 -080050 enum {
51 USE_CALLING_UID = -1
52 };
53
Mathias Agopian3cf61352010-02-09 17:46:37 -080054public:
55 DECLARE_META_INTERFACE(CameraService);
56
Igor Murashkinbfc99152013-02-27 12:55:20 -080057 virtual int32_t getNumberOfCameras() = 0;
58 virtual status_t getCameraInfo(int cameraId,
Chih-Chung Changddbdb352010-06-10 13:32:16 +080059 struct CameraInfo* cameraInfo) = 0;
Igor Murashkinbfc99152013-02-27 12:55:20 -080060
61 // Returns 'OK' if operation succeeded
62 // - Errors: ALREADY_EXISTS if the listener was already added
63 virtual status_t addListener(const sp<ICameraServiceListener>& listener)
64 = 0;
65 // Returns 'OK' if operation succeeded
66 // - Errors: BAD_VALUE if specified listener was not in the listener list
67 virtual status_t removeListener(const sp<ICameraServiceListener>& listener)
68 = 0;
Eino-Ville Talvalaceb388d2013-02-19 10:40:14 -080069 /**
70 * clientPackageName and clientUid are used for permissions checking. if
71 * clientUid == USE_CALLING_UID, then the calling UID is used instead. Only
72 * trusted callers can set a clientUid other than USE_CALLING_UID.
73 */
Ruben Brunk0f61d8f2013-08-08 13:07:18 -070074 virtual status_t connect(const sp<ICameraClient>& cameraClient,
Eino-Ville Talvalaceb388d2013-02-19 10:40:14 -080075 int cameraId,
76 const String16& clientPackageName,
Ruben Brunk0f61d8f2013-08-08 13:07:18 -070077 int clientUid,
78 /*out*/
79 sp<ICamera>& device) = 0;
Igor Murashkin634a5152013-02-20 17:15:11 -080080
Ruben Brunk0f61d8f2013-08-08 13:07:18 -070081 virtual status_t connectPro(const sp<IProCameraCallbacks>& cameraCb,
Igor Murashkinc073ba52013-02-26 14:32:34 -080082 int cameraId,
83 const String16& clientPackageName,
Ruben Brunk0f61d8f2013-08-08 13:07:18 -070084 int clientUid,
85 /*out*/
86 sp<IProCameraUser>& device) = 0;
Igor Murashkine7ee7632013-06-11 18:10:18 -070087
Ruben Brunk0f61d8f2013-08-08 13:07:18 -070088 virtual status_t connectDevice(
Igor Murashkine7ee7632013-06-11 18:10:18 -070089 const sp<ICameraDeviceCallbacks>& cameraCb,
90 int cameraId,
91 const String16& clientPackageName,
Ruben Brunk0f61d8f2013-08-08 13:07:18 -070092 int clientUid,
93 /*out*/
94 sp<ICameraDeviceUser>& device) = 0;
Mathias Agopian3cf61352010-02-09 17:46:37 -080095};
96
97// ----------------------------------------------------------------------------
98
99class BnCameraService: public BnInterface<ICameraService>
100{
101public:
102 virtual status_t onTransact( uint32_t code,
103 const Parcel& data,
104 Parcel* reply,
105 uint32_t flags = 0);
106};
107
108}; // namespace android
109
110#endif