/*
 * Copyright 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in 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.hardware.automotive.sv@1.0;

import ISurroundView2dSession;
import ISurroundView3dSession;

/**
 * Interface representing entry point for surround view.
 *
 * Surround view service has two types of sessions 2d and 3d. Refer to their respective interface
 * for more details.
 */
interface ISurroundViewService {

    /**
     * Gets a list of camera ids that are used for generating surround view.
     * For 4 camera configuration, the cameras ids are ordered in clockwise direction
     * when viewed from top of the car starting with the front camera. i.e. FRONT, RIGHT, REAR and
     * LEFT. All other configurations must follow clockwise order.
     *
     * @result cameraIds List of camera ids that matching the Id of EVS Cameras used by service.
     */
    getCameraIds() generates (vec<string> cameraIds);

    /**
     * Starts a surround view 2d session.
     *
     * @result sv2dSession Returns a new 2d session that was created.
     *         result      Returns OK if successful, appropriate error result otherwise.
     */
    start2dSession() generates (ISurroundView2dSession sv2dSession, SvResult result);

    /**
     * Stops a surround view 2d session.
     *
     * @param sv2dSession Valid 2d session to be stopped.
     * @return svResult   Returns OK if successful, appropriate error result otherwise.
     */
    stop2dSession(ISurroundView2dSession sv2dSession) generates (SvResult result);

    /**
     * Starts a surround view 3d session.
     *
     * @result sv3dSession Returns a new 3d session that was created.
     *         result      Returns OK if successful, appropriate error result otherwise.
     */
    start3dSession() generates (ISurroundView3dSession sv3dSession, SvResult result);

    /**
     * Stops a surround view 2d session.
     *
     * @param sv2dSession Valid 2d session to be stopped.
     * @return svResult  Returns OK if successful, appropriate error result otherwise.
     */
    stop3dSession(ISurroundView3dSession sv3dSession) generates (SvResult result);
};
