xref: /aosp_15_r20/hardware/interfaces/neuralnetworks/1.0/IPreparedModelCallback.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2017 The Android Open Source Project
3*4d7e907cSAndroid Build Coastguard Worker *
4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*4d7e907cSAndroid Build Coastguard Worker *
8*4d7e907cSAndroid Build Coastguard Worker *      http://www.apache.org/licenses/LICENSE-2.0
9*4d7e907cSAndroid Build Coastguard Worker *
10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License.
15*4d7e907cSAndroid Build Coastguard Worker */
16*4d7e907cSAndroid Build Coastguard Worker
17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected];
18*4d7e907cSAndroid Build Coastguard Worker
19*4d7e907cSAndroid Build Coastguard Workerimport IPreparedModel;
20*4d7e907cSAndroid Build Coastguard Worker
21*4d7e907cSAndroid Build Coastguard Worker/**
22*4d7e907cSAndroid Build Coastguard Worker * IPreparedModelCallback must be used to return a prepared model produced by an
23*4d7e907cSAndroid Build Coastguard Worker * asynchronous task launched from IDevice::prepareModel.
24*4d7e907cSAndroid Build Coastguard Worker */
25*4d7e907cSAndroid Build Coastguard Workerinterface IPreparedModelCallback {
26*4d7e907cSAndroid Build Coastguard Worker
27*4d7e907cSAndroid Build Coastguard Worker    /**
28*4d7e907cSAndroid Build Coastguard Worker     * notify must be invoked immediately after the asynchronous task holding
29*4d7e907cSAndroid Build Coastguard Worker     * this callback has finished preparing the model. If the model was
30*4d7e907cSAndroid Build Coastguard Worker     * successfully prepared, notify must be invoked with ErrorStatus::NONE and
31*4d7e907cSAndroid Build Coastguard Worker     * the prepared model. If the model was not able to be successfully
32*4d7e907cSAndroid Build Coastguard Worker     * prepared, notify must be invoked with the appropriate ErrorStatus and
33*4d7e907cSAndroid Build Coastguard Worker     * nullptr as the IPreparedModel. If the asynchronous task holding this
34*4d7e907cSAndroid Build Coastguard Worker     * callback fails to launch or if the model provided to
35*4d7e907cSAndroid Build Coastguard Worker     * IDevice::prepareModel is invalid, notify must be invoked with the
36*4d7e907cSAndroid Build Coastguard Worker     * appropriate error as well as nullptr for the IPreparedModel.
37*4d7e907cSAndroid Build Coastguard Worker     *
38*4d7e907cSAndroid Build Coastguard Worker     * @param status Error status returned from the asynchronous model
39*4d7e907cSAndroid Build Coastguard Worker     *               preparation task; must be:
40*4d7e907cSAndroid Build Coastguard Worker     *               - NONE if the asynchronous task successfully prepared the
41*4d7e907cSAndroid Build Coastguard Worker     *                 model
42*4d7e907cSAndroid Build Coastguard Worker     *               - DEVICE_UNAVAILABLE if driver is offline or busy
43*4d7e907cSAndroid Build Coastguard Worker     *               - GENERAL_FAILURE if the asynchronous task resulted in an
44*4d7e907cSAndroid Build Coastguard Worker     *                 unspecified error
45*4d7e907cSAndroid Build Coastguard Worker     *               - INVALID_ARGUMENT if one of the input arguments to
46*4d7e907cSAndroid Build Coastguard Worker     *                 prepareModel is invalid
47*4d7e907cSAndroid Build Coastguard Worker     * @param preparedModel A model that has been asynchronously prepared for
48*4d7e907cSAndroid Build Coastguard Worker     *                      execution. If the model was unable to be prepared
49*4d7e907cSAndroid Build Coastguard Worker     *                      due to an error, nullptr must be passed in place of
50*4d7e907cSAndroid Build Coastguard Worker     *                      the IPreparedModel object.
51*4d7e907cSAndroid Build Coastguard Worker     */
52*4d7e907cSAndroid Build Coastguard Worker    oneway notify(ErrorStatus status, IPreparedModel preparedModel);
53*4d7e907cSAndroid Build Coastguard Worker};
54