/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except compliance with the License.
 * You may obtaa copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package android.frameworks.cameraservice.device@2.0;

interface ICameraDeviceCallback {
    /**
     *  Callback called when the device encounters an error.
     *
     *  @param errorCode the error code corresponding to the error.
     *  @param resultExtras data structure containing information about the
     *         frame number, request id, etc, of the request on which the device
     *         error occured, in case the errorCode was CAMERA_BUFFER.
     */
    oneway onDeviceError(ErrorCode errorCode,
                         CaptureResultExtras resultExtras);

    /**
     *  Callback called when the device is idle.
     */
    oneway onDeviceIdle();

    /**
     *  Callback called when capture starts.
     *
     *  @param resultExtras data structure containing information about the
     *         frame number, request id, etc, of the request.
     *  @param timestamp corresponding to the start (in nanoseconds)
     */
    oneway onCaptureStarted(CaptureResultExtras resultExtras,
                            uint64_t timestamp);
    /**
     * Callback called when a capture request is completed.
     *
     * Note: The framework must call this callback serially if it opts to
     *       utilize an fmq for either the result metadata and/or any of the
     *       physicalCaptureResultInfo.physicalCameraMetadata values.
     *
     * @param result result metadata
     * @param resultExtras data structure containing information about the
     *        frame number, request id, etc of the request.
     * @param physicalCaptureResultInfos a list of physicalCaptureResultInfo,
     *        which contains the camera id and metadata related to the physical
     *        cameras involved for the particular capture request, if any.
     */
    onResultReceived(
            FmqSizeOrMetadata result,
            CaptureResultExtras resultExtras,
            vec<PhysicalCaptureResultInfo> physicalCaptureResultInfos);

    /**
     * Repeating request encountered an error and was stopped.
     *
     * @param lastFrameNumber Frame number of the last frame of the streaming
     *        request.
     * @param repeatingRequestId the ID of the repeating request
     *        being stopped
     */
    oneway onRepeatingRequestError(uint64_t lastFrameNumber,
                                   int32_t repeatingRequestId);

};