ICameraDeviceUser.h revision cb0652e5a850b2fcd919e977247e87239efaf70e
1/*
2 * Copyright (C) 2013 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_PHOTOGRAPHY_ICAMERADEVICEUSER_H
18#define ANDROID_HARDWARE_PHOTOGRAPHY_ICAMERADEVICEUSER_H
19
20#include <binder/IInterface.h>
21#include <binder/Parcel.h>
22#include <utils/List.h>
23
24struct camera_metadata;
25
26namespace android {
27
28class ICameraDeviceUserClient;
29class IGraphicBufferProducer;
30class Surface;
31class CaptureRequest;
32class CameraMetadata;
33
34class ICameraDeviceUser : public IInterface
35{
36    /**
37     * Keep up-to-date with ICameraDeviceUser.aidl in frameworks/base
38     */
39public:
40    DECLARE_META_INTERFACE(CameraDeviceUser);
41
42    virtual void            disconnect() = 0;
43
44    /**
45     * Request Handling
46     **/
47
48    /**
49     * For streaming requests, output lastFrameNumber is the last frame number
50     * of the previous repeating request.
51     * For non-streaming requests, output lastFrameNumber is the expected last
52     * frame number of the current request.
53     */
54    virtual int             submitRequest(sp<CaptureRequest> request,
55                                          bool streaming = false,
56                                          /*out*/
57                                          int64_t* lastFrameNumber = NULL) = 0;
58
59    /**
60     * For streaming requests, output lastFrameNumber is the last frame number
61     * of the previous repeating request.
62     * For non-streaming requests, output lastFrameNumber is the expected last
63     * frame number of the current request.
64     */
65    virtual int             submitRequestList(List<sp<CaptureRequest> > requestList,
66                                              bool streaming = false,
67                                              /*out*/
68                                              int64_t* lastFrameNumber = NULL) = 0;
69
70    /**
71     * Output lastFrameNumber is the last frame number of the previous repeating request.
72     */
73    virtual status_t        cancelRequest(int requestId,
74                                          /*out*/
75                                          int64_t* lastFrameNumber = NULL) = 0;
76
77    virtual status_t        deleteStream(int streamId) = 0;
78    virtual status_t        createStream(
79            int width, int height, int format,
80            const sp<IGraphicBufferProducer>& bufferProducer) = 0;
81
82    // Create a request object from a template.
83    virtual status_t        createDefaultRequest(int templateId,
84                                                 /*out*/
85                                                 CameraMetadata* request) = 0;
86    // Get static camera metadata
87    virtual status_t        getCameraInfo(/*out*/
88                                          CameraMetadata* info) = 0;
89
90    // Wait until all the submitted requests have finished processing
91    virtual status_t        waitUntilIdle() =  0;
92
93    /**
94     * Flush all pending and in-progress work as quickly as possible.
95     * Output lastFrameNumber is the last frame number of the previous repeating request.
96     */
97    virtual status_t        flush(/*out*/
98                                  int64_t* lastFrameNumber = NULL) = 0;
99};
100
101// ----------------------------------------------------------------------------
102
103class BnCameraDeviceUser: public BnInterface<ICameraDeviceUser>
104{
105public:
106    virtual status_t    onTransact( uint32_t code,
107                                    const Parcel& data,
108                                    Parcel* reply,
109                                    uint32_t flags = 0);
110};
111
112}; // namespace android
113
114#endif
115