/*
 * Copyright (C) 2019 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.neuralnetworks@1.3;

import @1.2::IExecutionCallback;
import @1.2::OutputShape;
import @1.2::Timing;

/**
 * IExecutionCallback must be used to return the error status result from an
 * execution asynchronously launched from IPreparedModel::execute*.
 */
interface IExecutionCallback extends @1.2::IExecutionCallback {

    /**
     * There are three notify methods declared for the IExecutionCallback
     * interface: notify_1_3, notify_1_2, and notify. One of the three notify
     * methods must be invoked immediately after the asynchronous task has
     * finished performing the execution. One of the notify methods must be
     * provided with the ErrorStatus from the execution. If the asynchronous
     * task is not launched, one of the notify methods must be invoked with the
     * appropriate error.
     *
     * @param status Error status returned from launching the asynchronous task
     *               (if the launch fails) or from the asynchronous task itself
     *               (if the launch succeeds). Must be:
     *               - NONE if the asynchronous execution was successful
     *               - DEVICE_UNAVAILABLE if driver is offline or busy
     *               - GENERAL_FAILURE if the asynchronous task resulted in an
     *                 unspecified error
     *               - OUTPUT_INSUFFICIENT_SIZE if at least one output
     *                 operand buffer is not large enough to store the
     *                 corresponding output
     *               - INVALID_ARGUMENT if one of the input arguments to
     *                 prepareModel is invalid
     *               - MISSED_DEADLINE_* if the execution is aborted because it
     *                 cannot be completed by the deadline
     *               - RESOURCE_EXHAUSTED_* if the task was aborted by the driver
     * @param outputShapes A list of shape information of model output operands.
     *                     The index into "outputShapes" corresponds with to index
     *                     of the output operand in the Request outputs vector.
     *                     outputShapes must be empty unless the status is either
     *                     NONE or OUTPUT_INSUFFICIENT_SIZE.
     * @param timing Duration of execution. Unless MeasureTiming::YES was passed when
     *               launching the execution and status is NONE, all times must
     *               be reported as UINT64_MAX. A driver may choose to report
     *               any time as UINT64_MAX, indicating that particular measurement is
     *               not available.
     */
  oneway notify_1_3(ErrorStatus status, vec<OutputShape> outputShapes, Timing timing);
};
