blob: 2fe454c1cd5496b2e3a6a0296b808c30ab7fa5a2 [file] [log] [blame]
Michael Butler0e2ac1b2017-09-01 10:59:38 -07001/*
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
Michael Butler0e2ac1b2017-09-01 10:59:38 -070017package android.hardware.neuralnetworks@1.0;
18
19/**
20 * The IEvent interface is a callback object passed by the
21 * Neuralnetworks runtime to the vendor service. It is used as a
22 * synchronization primitive between one or more runtime threads and a
23 * single asynchronous vendor thread. An event object is passed as an
24 * argument to a HIDL call that is expected to take a non-trivial
25 * amount of time. When the asynchronous execution thread has
26 * completed its computation, it must call "notify" on the event to
27 * indicate to the Neuralnetworks runtime whether the computation was
28 * successful or not, and that the corresponding output is ready to be
29 * consumed if the execution was successful.
Michael Butler0e2ac1b2017-09-01 10:59:38 -070030 */
31interface IEvent {
32
33 /**
Michael Butlerc7821102017-09-11 16:03:36 -070034 * IEvent::notify is called by the server thread (i.e., the thread doing
35 * the work) to mark the event as completed so that any threads requiring
36 * the corresponding output can continue executing.
Michael Butler0e2ac1b2017-09-01 10:59:38 -070037 *
Michael Butler926df1e2017-09-19 16:26:47 -070038 * @param status Error status returned from the asynchronous task, must be:
39 * - NONE if asynchronous task was successful
40 * - DEVICE_UNAVAILABLE if driver is offline or busy
41 * - GENERAL_FAILURE if the asynchronous task resulted in an
42 * unspecified error
Michael Butler0e2ac1b2017-09-01 10:59:38 -070043 */
Michael Butler61ae6ed2017-09-11 20:27:50 -070044 oneway notify(ErrorStatus status);
Michael Butler0e2ac1b2017-09-01 10:59:38 -070045};