blob: 0a0e43ad892fed0e9bb867f17775458b9fc95256 [file] [log] [blame]
Igor Murashkinbfc99152013-02-27 12:55:20 -08001/*
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_ICAMERASERVICE_LISTENER_H
18#define ANDROID_HARDWARE_ICAMERASERVICE_LISTENER_H
19
20#include <utils/RefBase.h>
21#include <binder/IInterface.h>
22#include <binder/Parcel.h>
23#include <hardware/camera_common.h>
24
25namespace android {
26
27class ICameraServiceListener : public IInterface
28{
Igor Murashkinbef3f232013-05-30 17:47:38 -070029 /**
30 * Keep up-to-date with ICameraServiceListener.aidl in frameworks/base
31 */
Igor Murashkinbfc99152013-02-27 12:55:20 -080032public:
33
Igor Murashkinb652df62013-03-18 13:36:48 -070034 /**
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
Igor Murashkincba2c162013-03-20 15:56:31 -070044 * PRESENT -> NOT_AVAILABLE
45 * NOT_AVAILABLE -> PRESENT
Igor Murashkinb652df62013-03-18 13:36:48 -070046 *
47 * A state will never immediately transition back to itself.
48 */
Igor Murashkinbfc99152013-02-27 12:55:20 -080049 enum Status {
50 // Device physically unplugged
Igor Murashkinbfc99152013-02-27 12:55:20 -080051 STATUS_NOT_PRESENT = CAMERA_DEVICE_STATUS_NOT_PRESENT,
Igor Murashkinb652df62013-03-18 13:36:48 -070052 // Device physically has been plugged in
Igor Murashkincba2c162013-03-20 15:56:31 -070053 // and the camera can be used exlusively
Igor Murashkinb652df62013-03-18 13:36:48 -070054 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,
Igor Murashkinbfc99152013-02-27 12:55:20 -080058
59 // Camera can be used exclusively
Igor Murashkincba2c162013-03-20 15:56:31 -070060 STATUS_AVAILABLE = STATUS_PRESENT, // deprecated, will be removed
61
Igor Murashkinbfc99152013-02-27 12:55:20 -080062 // Camera is in use by another app and cannot be used exclusively
Igor Murashkincba2c162013-03-20 15:56:31 -070063 STATUS_NOT_AVAILABLE = 0x80000000,
Igor Murashkinbfc99152013-02-27 12:55:20 -080064
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