ICamera.h revision 3cf613507f1e2f7bd932d921a6e222e426fd3be4
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_ICAMERA_H
18#define ANDROID_HARDWARE_ICAMERA_H
19
20#include <utils/RefBase.h>
21#include <binder/IInterface.h>
22#include <binder/Parcel.h>
23#include <surfaceflinger/ISurface.h>
24#include <binder/IMemory.h>
25#include <utils/String8.h>
26#include <camera/Camera.h>
27
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
48    // pass the buffered ISurface to the camera service
49    virtual status_t        setPreviewDisplay(const sp<ISurface>& surface) = 0;
50
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
79    // cancel auto focus
80    virtual status_t        cancelAutoFocus() = 0;
81
82    // 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;
90
91    // send command to camera driver
92    virtual status_t        sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0;
93};
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
109