| /* |
| * Copyright (C) 2016 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.contexthub@1.0; |
| |
| import IContexthubCallback; |
| |
| interface IContexthub { |
| /* |
| * Enumerate all available context hubs on the system. |
| * |
| * @return hubs list of hubs on this system. |
| */ |
| getHubs() generates (vec<ContextHub> hubs); |
| |
| /* |
| * Register a callback for the HAL implementation to send asynchronous |
| * messages to the service from a context hub. There can be a maximum of |
| * one callback registered with the HAL. A call to this function when a |
| * callback has already been registered must override the previous |
| * registration. |
| * |
| * @param hubId identifier for the hub |
| * callback an implementation of the IContextHubCallbacks |
| * |
| * @return result OK on success |
| * BAD_VALUE if parameters are not sane |
| * |
| */ |
| registerCallback(uint32_t hubId, IContexthubCallback cb) generates (Result result); |
| |
| /** |
| * Send a message to a hub |
| * |
| * @param hubId identifier for hub to send message to |
| * msg message to be sent |
| * |
| * @return result OK if successful, error code otherwise |
| * BAD_VALUE if parameters are not sane |
| * TRANSACTION_FAILED if message send failed |
| */ |
| sendMessageToHub(uint32_t hubId, ContextHubMsg msg) |
| generates (Result result); |
| |
| /** |
| * Loads a nanoApp. After loading, the nanoApp's init method must be called. |
| * After the init method for nanoApp returns success, this must be indicated |
| * to the service by an asynchronous call to handleTxnResult. |
| * |
| * Loading a nanoapp must not take more than 30 seconds. |
| * |
| * @param hubId identifer of the contextHub |
| * appBinary serialized NanoApppBinary for the nanoApp |
| * transactionId transactionId for this call |
| * |
| * @return result OK if transation started |
| * BAD_VALUE if parameters are not sane |
| * TRANSACTION_PENDING if hub is busy with another |
| * load/unload transaction |
| * TRANSACTION_FAILED if load failed synchronously |
| * |
| */ |
| loadNanoApp(uint32_t hubId, |
| vec<uint8_t> appBinary, |
| uint32_t transactionId) |
| generates (Result result); |
| |
| /** |
| * Unloads a nanoApp. Before the unload, the apps deinit method is called. |
| * After this, success must be indicated to the service through an |
| * asynchronous call to handleTxnResult. |
| * |
| * Unloading a nanoapp must not take more than 5 seconds. |
| * |
| * @param hubId identifer of the contextHub |
| * appId appIdentifier returned by the HAL |
| * msg message to be sent |
| * |
| * @return result OK if transation started |
| * BAD_VALUE if parameters are not sane |
| * TRANSACTION_PENDING if hub is busy with another |
| * load/unload transaction |
| * TRANSACTION_FAILED if unload failed synchronously |
| * |
| */ |
| unloadNanoApp(uint32_t hubId, uint64_t appId, uint32_t transactionId) |
| generates (Result result); |
| |
| /** |
| * Enables a nanoApp. The app's init method is called. |
| * After this, success must be indicated to the service through an |
| * asynchronous message. |
| * |
| * Enabling a nanoapp must not take more than 5 seconds. |
| * |
| * @param hubId identifer of the contextHub |
| * appId appIdentifier returned by the HAL |
| * msg message to be sent |
| * |
| * @return result OK if transation started |
| * BAD_VALUE if parameters are not sane |
| * TRANSACTION_PENDING if hub is busy with another |
| * load/unload transaction |
| * FAILED_TRANSACTION if load fails immediately |
| * |
| */ |
| enableNanoApp(uint32_t hubId, uint64_t appId, uint32_t transactionId) |
| generates (Result result); |
| |
| /** |
| * Disables a nanoApp. The app's deinit method is called. |
| * After this, success must be indicated to the service through an |
| * asynchronous message. |
| * |
| * Disabling a nanoapp must not take more than 5 seconds. |
| * |
| * @param hubId identifer of the contextHub |
| * appId appIdentifier returned by the HAL |
| * msg message to be sent |
| * |
| * @return result OK if transation started |
| * BAD_VALUE if parameters are not sane |
| * TRANSACTION_PENDING if hub is busy with another |
| * load/unload transaction |
| * FAILED_TRANSACTION if load fails immediately |
| * |
| */ |
| disableNanoApp(uint32_t hubId, uint64_t appId, uint32_t transactionId) |
| generates (Result result); |
| |
| /** |
| * Queries for Loaded apps on the hub |
| * |
| * @param hubId identifer of the contextHub |
| * |
| * @return apps all nanoApps on the hub. |
| * All nanoApps that can be modified by the service must |
| * be returned. A non-modifiable nanoapps must not be |
| * returned. A modifiable nanoApp is one that can be |
| * unloaded/disabled/enabled by the service. |
| * |
| */ |
| queryApps(uint32_t hubId) generates (Result result); |
| |
| /** |
| * Reboots context hub OS, restarts all the nanoApps. |
| * No reboot notification is sent to nanoApps; reboot happens immediately |
| * and unconditionally; all volatile contexthub state and any data is lost |
| * as a result. |
| * |
| * @param hubId identifer of the contextHub |
| * |
| * @return result OK on success |
| * BAD_VALUE if parameters are not sane |
| * |
| */ |
| reboot(uint32_t hubId) generates (Result result); |
| }; |