blob: 8bceea5dce6cc781aff7dc66b82c30cba89288de [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -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_ICAMERA_H
18#define ANDROID_HARDWARE_ICAMERA_H
19
20#include <utils/RefBase.h>
Mathias Agopian07952722009-05-19 19:08:10 -070021#include <binder/IInterface.h>
22#include <binder/Parcel.h>
Jamie Gennis85cfdd02010-08-10 16:37:53 -070023#include <surfaceflinger/Surface.h>
Mathias Agopian07952722009-05-19 19:08:10 -070024#include <binder/IMemory.h>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025#include <utils/String8.h>
Mathias Agopian000479f2010-02-09 17:46:37 -080026#include <camera/Camera.h>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027
28namespace android {
29
30class ICameraClient;
31
32class ICamera: public IInterface
33{
34public:
35 DECLARE_META_INTERFACE(Camera);
36
37 virtual void disconnect() = 0;
38
39 // connect new client with existing camera remote
40 virtual status_t connect(const sp<ICameraClient>& client) = 0;
41
42 // prevent other processes from using this ICamera interface
43 virtual status_t lock() = 0;
44
45 // allow other processes to use this ICamera interface
46 virtual status_t unlock() = 0;
47
Jamie Gennis85cfdd02010-08-10 16:37:53 -070048 // pass the buffered Surface to the camera service
49 virtual status_t setPreviewDisplay(const sp<Surface>& surface) = 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080050
51 // set the preview callback flag to affect how the received frames from
52 // preview are handled.
53 virtual void setPreviewCallbackFlag(int flag) = 0;
54
55 // start preview mode, must call setPreviewDisplay first
56 virtual status_t startPreview() = 0;
57
58 // stop preview mode
59 virtual void stopPreview() = 0;
60
61 // get preview state
62 virtual bool previewEnabled() = 0;
63
64 // start recording mode
65 virtual status_t startRecording() = 0;
66
67 // stop recording mode
68 virtual void stopRecording() = 0;
69
70 // get recording state
71 virtual bool recordingEnabled() = 0;
72
73 // release a recording frame
74 virtual void releaseRecordingFrame(const sp<IMemory>& mem) = 0;
75
76 // auto focus
77 virtual status_t autoFocus() = 0;
78
Chih-Chung Chang244f8c22009-09-15 14:51:56 +080079 // cancel auto focus
80 virtual status_t cancelAutoFocus() = 0;
81
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080082 // take a picture
83 virtual status_t takePicture() = 0;
84
85 // set preview/capture parameters - key/value pairs
86 virtual status_t setParameters(const String8& params) = 0;
87
88 // get preview/capture parameters - key/value pairs
89 virtual String8 getParameters() const = 0;
Wu-cheng Li36f68b82009-09-28 16:14:58 -070090
91 // send command to camera driver
92 virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080093};
94
95// ----------------------------------------------------------------------------
96
97class BnCamera: public BnInterface<ICamera>
98{
99public:
100 virtual status_t onTransact( uint32_t code,
101 const Parcel& data,
102 Parcel* reply,
103 uint32_t flags = 0);
104};
105
106}; // namespace android
107
108#endif