Michael Butler | 0e2ac1b | 2017-09-01 10:59:38 -0700 | [diff] [blame] | 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 | |
Michael Butler | 0e2ac1b | 2017-09-01 10:59:38 -0700 | [diff] [blame] | 17 | package 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 Butler | 0e2ac1b | 2017-09-01 10:59:38 -0700 | [diff] [blame] | 30 | */ |
| 31 | interface IEvent { |
| 32 | |
| 33 | /** |
Michael Butler | c782110 | 2017-09-11 16:03:36 -0700 | [diff] [blame] | 34 | * 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 Butler | 0e2ac1b | 2017-09-01 10:59:38 -0700 | [diff] [blame] | 37 | * |
Michael Butler | 926df1e | 2017-09-19 16:26:47 -0700 | [diff] [blame] | 38 | * @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 Butler | 0e2ac1b | 2017-09-01 10:59:38 -0700 | [diff] [blame] | 43 | */ |
Michael Butler | 61ae6ed | 2017-09-11 20:27:50 -0700 | [diff] [blame] | 44 | oneway notify(ErrorStatus status); |
Michael Butler | 0e2ac1b | 2017-09-01 10:59:38 -0700 | [diff] [blame] | 45 | }; |