1/*
2 * Copyright (C) 2018 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
17package android.frameworks.cameraservice.service@2.0;
18
19import android.frameworks.cameraservice.device@2.0::CameraMetadata;
20import android.frameworks.cameraservice.device@2.0::ICameraDeviceUser;
21import android.frameworks.cameraservice.device@2.0::ICameraDeviceCallback;
22import android.frameworks.cameraservice.common@2.0::Status;
23import android.frameworks.cameraservice.common@2.0::ProviderIdAndVendorTagSections;
24import ICameraServiceListener;
25
26interface ICameraService {
27    /**
28     * connectDevice
29     *
30     * Return an ICameraDeviceUser interface for the requested cameraId.
31     *
32     * Note: The client must have camera permissions to call this method
33     *       successfully.
34     *
35     * @param callback the ICameraDeviceCallback interface which will get called
36     *        the cameraserver when capture is started, results are received
37     *        etc.
38     * @param cameraId the cameraId of the camera device to connect to.
39     *
40     * @return status Status code of the operation.
41     * @return device ICameraDeviceUser interface to the camera device requested.
42     */
43    connectDevice(ICameraDeviceCallback callback, string cameraId)
44        generates (Status status, ICameraDeviceUser device);
45
46    /**
47     * Add listener for changes to camera device status.
48     *
49     * Also returns the set of currently-known camera IDs and state of each
50     * device. Adding multiple listeners must result in the callbacks defined by
51     * ICameraServiceListener being called on all of them, on change of device
52     * status.
53     *
54     * @param listener the listener interface to be added. The cameraserver will
55     *        call callbacks on this interface when a camera device's status
56     *        changes.
57     * @return status Status code of the operation
58     * @return statuses a list of CameraStatusAndIds which store the deviceIds
59     *         and their corresponding statuses.
60     */
61    addListener(ICameraServiceListener listener)
62        generates (Status status, vec<CameraStatusAndId> statuses);
63
64    /**
65     * Remove listener for changes to camera device status.
66     *
67     * @param listener the listener to be removed from receiving callbacks on
68     *        changes to device state.
69     * @return status Status code of the operation.
70     */
71    removeListener(ICameraServiceListener listener) generates (Status status);
72
73    /**
74     * Read the static camera metadata for a camera device.
75     * @param cameraId the camera id of the camera device, whose metadata is
76     *        being requested.
77     * @return status the status code of the operation
78     * @return metadata the static metadata of the camera device requested.
79     */
80    getCameraCharacteristics(string cameraId)
81        generates (Status status, CameraMetadata metadata);
82
83    /**
84     * Read in the provider ids and corresponding vendor tag sections from the camera server.
85     * Intended to be used by the native code of CameraMetadata to correctly
86     * interpret camera metadata with vendor tags.
87     *
88     * Note: VendorTag caches may be created in process, by clients. A HIDL api
89     *       is not provided for this.
90     *
91     * @return status the status code of the operation.
92     * @return providerIdAndVendorTagSections the list of provider ids and corresponding
93     *         vendor tag sections.
94     */
95    getCameraVendorTagSections()
96        generates (Status status,
97                   vec<ProviderIdAndVendorTagSections> providerIdAndVendorTagSections);
98};
99