The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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> |
Mathias Agopian | 0795272 | 2009-05-19 19:08:10 -0700 | [diff] [blame] | 21 | #include <binder/IInterface.h> |
| 22 | #include <binder/Parcel.h> |
Jamie Gennis | 85cfdd0 | 2010-08-10 16:37:53 -0700 | [diff] [blame] | 23 | #include <surfaceflinger/Surface.h> |
Mathias Agopian | 0795272 | 2009-05-19 19:08:10 -0700 | [diff] [blame] | 24 | #include <binder/IMemory.h> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 25 | #include <utils/String8.h> |
Mathias Agopian | 000479f | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 26 | #include <camera/Camera.h> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 27 | |
| 28 | namespace android { |
| 29 | |
| 30 | class ICameraClient; |
| 31 | |
| 32 | class ICamera: public IInterface |
| 33 | { |
| 34 | public: |
| 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 Gennis | 85cfdd0 | 2010-08-10 16:37:53 -0700 | [diff] [blame] | 48 | // pass the buffered Surface to the camera service |
| 49 | virtual status_t setPreviewDisplay(const sp<Surface>& surface) = 0; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 | |
Chih-Chung Chang | 244f8c2 | 2009-09-15 14:51:56 +0800 | [diff] [blame] | 79 | // cancel auto focus |
| 80 | virtual status_t cancelAutoFocus() = 0; |
| 81 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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; |
Wu-cheng Li | 36f68b8 | 2009-09-28 16:14:58 -0700 | [diff] [blame] | 90 | |
| 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 93 | }; |
| 94 | |
| 95 | // ---------------------------------------------------------------------------- |
| 96 | |
| 97 | class BnCamera: public BnInterface<ICamera> |
| 98 | { |
| 99 | public: |
| 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 |