Home | History | Annotate | Download | only in camera
      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_IPROCAMERAUSER_H
     18 #define ANDROID_HARDWARE_IPROCAMERAUSER_H
     19 
     20 #include <utils/RefBase.h>
     21 #include <binder/IInterface.h>
     22 #include <binder/Parcel.h>
     23 #include <binder/IMemory.h>
     24 #include <utils/String8.h>
     25 #include <camera/IProCameraCallbacks.h>
     26 
     27 struct camera_metadata;
     28 
     29 namespace android {
     30 
     31 class IProCameraUserClient;
     32 class IGraphicBufferProducer;
     33 class Surface;
     34 
     35 class IProCameraUser: public IInterface
     36 {
     37     /**
     38      * Keep up-to-date with IProCameraUser.aidl in frameworks/base
     39      */
     40 public:
     41     DECLARE_META_INTERFACE(ProCameraUser);
     42 
     43     virtual void            disconnect() = 0;
     44 
     45     // connect to the service, given a callbacks listener
     46     virtual status_t        connect(const sp<IProCameraCallbacks>& callbacks)
     47                                                                             = 0;
     48 
     49     /**
     50      * Locking
     51      **/
     52     virtual status_t        exclusiveTryLock() = 0;
     53     virtual status_t        exclusiveLock() = 0;
     54     virtual status_t        exclusiveUnlock() = 0;
     55 
     56     virtual bool            hasExclusiveLock() = 0;
     57 
     58     /**
     59      * Request Handling
     60      **/
     61 
     62     // Note that the callee gets a copy of the metadata.
     63     virtual int             submitRequest(struct camera_metadata* metadata,
     64                                           bool streaming = false) = 0;
     65     virtual status_t        cancelRequest(int requestId) = 0;
     66 
     67     virtual status_t        deleteStream(int streamId) = 0;
     68     virtual status_t        createStream(
     69                                       int width, int height, int format,
     70                                       const sp<IGraphicBufferProducer>& bufferProducer,
     71                                       /*out*/
     72                                       int* streamId) = 0;
     73 
     74     // Create a request object from a template.
     75     virtual status_t        createDefaultRequest(int templateId,
     76                                                  /*out*/
     77                                                  camera_metadata** request)
     78                                                                            = 0;
     79 
     80     // Get static camera metadata
     81     virtual status_t        getCameraInfo(int cameraId,
     82                                           /*out*/
     83                                           camera_metadata** info) = 0;
     84 
     85 };
     86 
     87 // ----------------------------------------------------------------------------
     88 
     89 class BnProCameraUser: public BnInterface<IProCameraUser>
     90 {
     91 public:
     92     virtual status_t    onTransact( uint32_t code,
     93                                     const Parcel& data,
     94                                     Parcel* reply,
     95                                     uint32_t flags = 0);
     96 };
     97 
     98 }; // namespace android
     99 
    100 #endif
    101