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 public:
     38     DECLARE_META_INTERFACE(ProCameraUser);
     39 
     40     virtual void            disconnect() = 0;
     41 
     42     // connect to the service, given a callbacks listener
     43     virtual status_t        connect(const sp<IProCameraCallbacks>& callbacks)
     44                                                                             = 0;
     45 
     46     /**
     47      * Locking
     48      **/
     49     virtual status_t        exclusiveTryLock() = 0;
     50     virtual status_t        exclusiveLock() = 0;
     51     virtual status_t        exclusiveUnlock() = 0;
     52 
     53     virtual bool            hasExclusiveLock() = 0;
     54 
     55     /**
     56      * Request Handling
     57      **/
     58 
     59     // Note that the callee gets a copy of the metadata.
     60     virtual int             submitRequest(struct camera_metadata* metadata,
     61                                           bool streaming = false) = 0;
     62     virtual status_t        cancelRequest(int requestId) = 0;
     63 
     64     virtual status_t        deleteStream(int streamId) = 0;
     65     virtual status_t        createStream(
     66                                       int width, int height, int format,
     67                                       const sp<IGraphicBufferProducer>& bufferProducer,
     68                                       /*out*/
     69                                       int* streamId) = 0;
     70 
     71     // Create a request object from a template.
     72     virtual status_t        createDefaultRequest(int templateId,
     73                                                  /*out*/
     74                                                  camera_metadata** request)
     75                                                                            = 0;
     76 
     77     // Get static camera metadata
     78     virtual status_t        getCameraInfo(int cameraId,
     79                                           /*out*/
     80                                           camera_metadata** info) = 0;
     81 
     82 };
     83 
     84 // ----------------------------------------------------------------------------
     85 
     86 class BnProCameraUser: public BnInterface<IProCameraUser>
     87 {
     88 public:
     89     virtual status_t    onTransact( uint32_t code,
     90                                     const Parcel& data,
     91                                     Parcel* reply,
     92                                     uint32_t flags = 0);
     93 };
     94 
     95 }; // namespace android
     96 
     97 #endif
     98