blob: ef2b68576c34c16909d6b64927990db7566ad0c3 [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;
30
Mathias Agopian3cf61352010-02-09 17:46:37 -080031class ICameraService : public IInterface
32{
33public:
34 enum {
Chih-Chung Chang35a055b2010-05-06 16:36:58 +080035 GET_NUMBER_OF_CAMERAS = IBinder::FIRST_CALL_TRANSACTION,
Chih-Chung Changddbdb352010-06-10 13:32:16 +080036 GET_CAMERA_INFO,
Igor Murashkin634a5152013-02-20 17:15:11 -080037 CONNECT,
38 CONNECT_PRO
Mathias Agopian3cf61352010-02-09 17:46:37 -080039 };
40
Eino-Ville Talvalaceb388d2013-02-19 10:40:14 -080041 enum {
42 USE_CALLING_UID = -1
43 };
44
Mathias Agopian3cf61352010-02-09 17:46:37 -080045public:
46 DECLARE_META_INTERFACE(CameraService);
47
Chih-Chung Chang35a055b2010-05-06 16:36:58 +080048 virtual int32_t getNumberOfCameras() = 0;
Chih-Chung Changddbdb352010-06-10 13:32:16 +080049 virtual status_t getCameraInfo(int cameraId,
50 struct CameraInfo* cameraInfo) = 0;
Eino-Ville Talvalaceb388d2013-02-19 10:40:14 -080051 /**
52 * clientPackageName and clientUid are used for permissions checking. if
53 * clientUid == USE_CALLING_UID, then the calling UID is used instead. Only
54 * trusted callers can set a clientUid other than USE_CALLING_UID.
55 */
56 virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient,
57 int cameraId,
58 const String16& clientPackageName,
59 int clientUid) = 0;
Igor Murashkin634a5152013-02-20 17:15:11 -080060
Eino-Ville Talvalaceb388d2013-02-19 10:40:14 -080061 virtual sp<IProCameraUser> connect(const sp<IProCameraCallbacks>& cameraCb,
Igor Murashkinc073ba52013-02-26 14:32:34 -080062 int cameraId,
63 const String16& clientPackageName,
64 int clientUid) = 0;
Mathias Agopian3cf61352010-02-09 17:46:37 -080065};
66
67// ----------------------------------------------------------------------------
68
69class BnCameraService: public BnInterface<ICameraService>
70{
71public:
72 virtual status_t onTransact( uint32_t code,
73 const Parcel& data,
74 Parcel* reply,
75 uint32_t flags = 0);
76};
77
78}; // namespace android
79
80#endif