1*4d7e907cSAndroid Build Coastguard Worker/* 2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2016 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 Workerinterface IContexthubCallback { 20*4d7e907cSAndroid Build Coastguard Worker /** 21*4d7e907cSAndroid Build Coastguard Worker * This callback is passed by the Contexthub service to the HAL 22*4d7e907cSAndroid Build Coastguard Worker * implementation to allow the HAL to send asynchronous messages back 23*4d7e907cSAndroid Build Coastguard Worker * to the service and registered clients of the ContextHub service. 24*4d7e907cSAndroid Build Coastguard Worker * 25*4d7e907cSAndroid Build Coastguard Worker * @param msg message being sent from the contexthub 26*4d7e907cSAndroid Build Coastguard Worker * 27*4d7e907cSAndroid Build Coastguard Worker */ 28*4d7e907cSAndroid Build Coastguard Worker handleClientMsg(ContextHubMsg msg); 29*4d7e907cSAndroid Build Coastguard Worker 30*4d7e907cSAndroid Build Coastguard Worker /** 31*4d7e907cSAndroid Build Coastguard Worker * This callback is passed by the Contexthub service to the HAL 32*4d7e907cSAndroid Build Coastguard Worker * implementation to allow the HAL to send the response for a 33*4d7e907cSAndroid Build Coastguard Worker * transaction. 34*4d7e907cSAndroid Build Coastguard Worker * 35*4d7e907cSAndroid Build Coastguard Worker * @param txnId transaction id whose result is being sent 36*4d7e907cSAndroid Build Coastguard Worker * passed in by the service at start of transacation. 37*4d7e907cSAndroid Build Coastguard Worker * @param result result of transaction. 38*4d7e907cSAndroid Build Coastguard Worker * 39*4d7e907cSAndroid Build Coastguard Worker */ 40*4d7e907cSAndroid Build Coastguard Worker handleTxnResult(uint32_t txnId, TransactionResult result); 41*4d7e907cSAndroid Build Coastguard Worker 42*4d7e907cSAndroid Build Coastguard Worker /** 43*4d7e907cSAndroid Build Coastguard Worker * This callback is passed by the Contexthub service to the HAL 44*4d7e907cSAndroid Build Coastguard Worker * implementation to allow the HAL to send an asynchronous event 45*4d7e907cSAndroid Build Coastguard Worker * to the ContextHub service. 46*4d7e907cSAndroid Build Coastguard Worker * 47*4d7e907cSAndroid Build Coastguard Worker * @param evt event being sent from the contexthub 48*4d7e907cSAndroid Build Coastguard Worker * 49*4d7e907cSAndroid Build Coastguard Worker */ 50*4d7e907cSAndroid Build Coastguard Worker handleHubEvent(AsyncEventType evt); 51*4d7e907cSAndroid Build Coastguard Worker 52*4d7e907cSAndroid Build Coastguard Worker /** 53*4d7e907cSAndroid Build Coastguard Worker * This callback is passed by the Contexthub service to the HAL 54*4d7e907cSAndroid Build Coastguard Worker * implementation to allow the HAL to send a notification to the service 55*4d7e907cSAndroid Build Coastguard Worker * that a nanp-app has aborted. 56*4d7e907cSAndroid Build Coastguard Worker * This method must be called when a nanoapp invokes chreAbort(...)). 57*4d7e907cSAndroid Build Coastguard Worker * 58*4d7e907cSAndroid Build Coastguard Worker * @param appId app identifier 59*4d7e907cSAndroid Build Coastguard Worker * @param abortCode code passed by the nanoApp. 60*4d7e907cSAndroid Build Coastguard Worker * 61*4d7e907cSAndroid Build Coastguard Worker * Also see chreAbort(...) 62*4d7e907cSAndroid Build Coastguard Worker * 63*4d7e907cSAndroid Build Coastguard Worker */ 64*4d7e907cSAndroid Build Coastguard Worker handleAppAbort(uint64_t appId, uint32_t abortCode); 65*4d7e907cSAndroid Build Coastguard Worker 66*4d7e907cSAndroid Build Coastguard Worker /** 67*4d7e907cSAndroid Build Coastguard Worker * This callback is passed by the Contexthub service to the HAL 68*4d7e907cSAndroid Build Coastguard Worker * implementation to allow the HAL to send information about the 69*4d7e907cSAndroid Build Coastguard Worker * currently loaded and active nanoapps on the hub. 70*4d7e907cSAndroid Build Coastguard Worker * 71*4d7e907cSAndroid Build Coastguard Worker * @param appInfo vector of HubAppinfo structure for each nanoApp on the 72*4d7e907cSAndroid Build Coastguard Worker * hub that can be enabled, disabled and unloaded by the 73*4d7e907cSAndroid Build Coastguard Worker * service. Any nanoApps that cannot be controlled by the 74*4d7e907cSAndroid Build Coastguard Worker * service must not be reported. All nanoApps that can be 75*4d7e907cSAndroid Build Coastguard Worker * controlled by the service must be reported. 76*4d7e907cSAndroid Build Coastguard Worker */ 77*4d7e907cSAndroid Build Coastguard Worker handleAppsInfo(vec<HubAppInfo> appInfo); 78*4d7e907cSAndroid Build Coastguard Worker}; 79