• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2017 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.hardware.neuralnetworks@1.0;
18
19import IPreparedModel;
20
21/**
22 * IPreparedModelCallback must be used to return a prepared model produced by an
23 * asynchronous task launched from IDevice::prepareModel.
24 */
25interface IPreparedModelCallback {
26
27    /**
28     * notify must be invoked immediately after the asynchronous task holding
29     * this callback has finished preparing the model. If the model was
30     * successfully prepared, notify must be invoked with ErrorStatus::NONE and
31     * the prepared model. If the model was not able to be successfully
32     * prepared, notify must be invoked with the appropriate ErrorStatus and
33     * nullptr as the IPreparedModel. If the asynchronous task holding this
34     * callback fails to launch or if the model provided to
35     * IDevice::prepareModel is invalid, notify must be invoked with the
36     * appropriate error as well as nullptr for the IPreparedModel.
37     *
38     * @param status Error status returned from the asynchronous model
39     *               preparation task; must be:
40     *               - NONE if the asynchronous task successfully prepared the
41     *                 model
42     *               - DEVICE_UNAVAILABLE if driver is offline or busy
43     *               - GENERAL_FAILURE if the asynchronous task resulted in an
44     *                 unspecified error
45     *               - INVALID_ARGUMENT if one of the input arguments to
46     *                 prepareModel is invalid
47     * @param preparedModel A model that has been asynchronously prepared for
48     *                      execution. If the model was unable to be prepared
49     *                      due to an error, nullptr must be passed in place of
50     *                      the IPreparedModel object.
51     */
52    oneway notify(ErrorStatus status, IPreparedModel preparedModel);
53};
54