| 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> | 
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 23 | #include <ui/ISurface.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> | 
|  | 26 | #include <ui/Camera.h> | 
|  | 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 |  | 
|  | 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 | // take a picture | 
|  | 80 | virtual status_t        takePicture() = 0; | 
|  | 81 |  | 
|  | 82 | // set preview/capture parameters - key/value pairs | 
|  | 83 | virtual status_t        setParameters(const String8& params) = 0; | 
|  | 84 |  | 
|  | 85 | // get preview/capture parameters - key/value pairs | 
|  | 86 | virtual String8         getParameters() const = 0; | 
|  | 87 | }; | 
|  | 88 |  | 
|  | 89 | // ---------------------------------------------------------------------------- | 
|  | 90 |  | 
|  | 91 | class BnCamera: public BnInterface<ICamera> | 
|  | 92 | { | 
|  | 93 | public: | 
|  | 94 | virtual status_t    onTransact( uint32_t code, | 
|  | 95 | const Parcel& data, | 
|  | 96 | Parcel* reply, | 
|  | 97 | uint32_t flags = 0); | 
|  | 98 | }; | 
|  | 99 |  | 
|  | 100 | }; // namespace android | 
|  | 101 |  | 
|  | 102 | #endif |