ICameraServiceListener.h revision bef3f23f16f2fc575b3f425febcfcc436a7db70f
1c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)/* 2c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * Copyright (C) 2013 The Android Open Source Project 3c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * 4c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * Licensed under the Apache License, Version 2.0 (the "License"); 558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) * you may not use this file except in compliance with the License. 658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) * You may obtain a copy of the License at 7c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * 8c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * http://www.apache.org/licenses/LICENSE-2.0 9c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * 10a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * Unless required by applicable law or agreed to in writing, software 11a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) * distributed under the License is distributed on an "AS IS" BASIS, 12c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * See the License for the specific language governing permissions and 14c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * limitations under the License. 15c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) */ 16c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 17c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#ifndef ANDROID_HARDWARE_ICAMERASERVICE_LISTENER_H 18a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)#define ANDROID_HARDWARE_ICAMERASERVICE_LISTENER_H 19a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) 20c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include <utils/RefBase.h> 2158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#include <binder/IInterface.h> 22#include <binder/Parcel.h> 23#include <hardware/camera_common.h> 24 25namespace android { 26 27class ICameraServiceListener : public IInterface 28{ 29 /** 30 * Keep up-to-date with ICameraServiceListener.aidl in frameworks/base 31 */ 32public: 33 34 /** 35 * Initial status will be transmitted with onStatusChange immediately 36 * after this listener is added to the service listener list. 37 * 38 * Allowed transitions: 39 * 40 * (Any) -> NOT_PRESENT 41 * NOT_PRESENT -> PRESENT 42 * NOT_PRESENT -> ENUMERATING 43 * ENUMERATING -> PRESENT 44 * PRESENT -> NOT_AVAILABLE 45 * NOT_AVAILABLE -> PRESENT 46 * 47 * A state will never immediately transition back to itself. 48 */ 49 enum Status { 50 // Device physically unplugged 51 STATUS_NOT_PRESENT = CAMERA_DEVICE_STATUS_NOT_PRESENT, 52 // Device physically has been plugged in 53 // and the camera can be used exlusively 54 STATUS_PRESENT = CAMERA_DEVICE_STATUS_PRESENT, 55 // Device physically has been plugged in 56 // but it will not be connect-able until enumeration is complete 57 STATUS_ENUMERATING = CAMERA_DEVICE_STATUS_ENUMERATING, 58 59 // Camera can be used exclusively 60 STATUS_AVAILABLE = STATUS_PRESENT, // deprecated, will be removed 61 62 // Camera is in use by another app and cannot be used exclusively 63 STATUS_NOT_AVAILABLE = 0x80000000, 64 65 // Use to initialize variables only 66 STATUS_UNKNOWN = 0xFFFFFFFF, 67 }; 68 69 DECLARE_META_INTERFACE(CameraServiceListener); 70 71 virtual void onStatusChanged(Status status, int32_t cameraId) = 0; 72}; 73 74// ---------------------------------------------------------------------------- 75 76class BnCameraServiceListener : public BnInterface<ICameraServiceListener> 77{ 78public: 79 virtual status_t onTransact( uint32_t code, 80 const Parcel& data, 81 Parcel* reply, 82 uint32_t flags = 0); 83}; 84 85}; // namespace android 86 87#endif 88