/*
 * 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 ISurroundViewSession;

/**
 * Interface representing a surround view 2d session.
 *
 * Surround view 2d provides a top/bird's eye view of the car and its surroundings.
 */
interface ISurroundView2dSession extends ISurroundViewSession {

    /**
     * Gets mapping information for 2d surround view.
     *
     * Mapping information maps the output frame of 2d surround view to actual dimensions
     * covered on the ground. Mapping information is fixed for a car and is based upon its camera
     * coverage. Mapping information can be used for doing overlays of objects in 3d space
     * onto the surround view 2d output frame.
     *
     * @param sv2dConfig Configuration to set.
     * @return sv2dMappingInfo mapping information of the 2d surround view.
     */
    get2dMappingInfo() generates (Sv2dMappingInfo sv2dMappingInfo);

    /**
     * Sets the configuration of 2d surround view.
     *
     * Configuration is used for supported different target use-cases of the surround view eg.
     * fullscreen or preview. Default configuration is FULLSCREEN.
     * A set config call can be performed at any time (before or after startStream) of the session.
     * Once config change is complete, a CONFIG_CHANGED event is sent, after which
     * all frames received will be of the updated config.
     *
     * @param sv2dConfig Configuration to set.
     * @return svResult  Returns OK if successful, appropriate error result otherwise.
     */
    set2dConfig(Sv2dConfig sv2dConfig) generates (SvResult svResult);

    /**
     * Gets the current configuration of the 2d surround view.
     *
     * Configuration is used for supported different target use-cases of the surround view eg.
     * fullscreen view or preview. Use setConfig call to set a configuration.
     *
     * @return sv2dConfig the active current configuration of the 2d session.
     */
    get2dConfig() generates (Sv2dConfig sv2dConfig);

    /**
     * Projects points on camera image to surround view 2d image.
     *
     * Useful for mapping points detected on individual camera frames onto the surround view 2d
     * output frame.
     *
     * @param cameraPoints  List of camera pixel points to be projected in range including (0, 0)
     *                      and (width - 1, height -1) of camera frame. If point is outside camera
                            frame INVALID_ARG error is returned.
     * @param cameraId      Id of the EvsCamera to use for projecting points. Id must be one of the
     *                      cameras as returned by getCameraIds() else INVALID_ARG error is returned
     * @return points2d     Returns a list of 2d pixel points projecting into surround view 2d
     *                      frame in the same order as cameraPoints. Point projected maybe outside
     *                      surround view frame i.e. outside (0, 0) and
     *                      (sv_width - 1, sv_height - 1). Points that do not project to ground
     *                      plane are set with inValid true.
     */
    projectCameraPoints(vec<Point2dInt> cameraPoints, string cameraId) generates (
            vec<Point2dFloat> points2d);
};