1 /* 2 * Copyright (C) 2016 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 17 package android.hardware.location; 18 19 // Declare any non-default types here with import statements 20 import android.hardware.location.ContextHubInfo; 21 import android.hardware.location.ContextHubMessage; 22 import android.hardware.location.NanoApp; 23 import android.hardware.location.NanoAppBinary; 24 import android.hardware.location.NanoAppFilter; 25 import android.hardware.location.NanoAppInstanceInfo; 26 import android.hardware.location.IContextHubCallback; 27 import android.hardware.location.IContextHubClient; 28 import android.hardware.location.IContextHubClientCallback; 29 import android.hardware.location.IContextHubTransactionCallback; 30 31 /** 32 * @hide 33 */ 34 interface IContextHubService { 35 36 // Registers a callback to receive messages registerCallback(in IContextHubCallback callback)37 int registerCallback(in IContextHubCallback callback); 38 39 // Gets a list of available context hub handles getContextHubHandles()40 int[] getContextHubHandles(); 41 42 // Gets the properties of a hub getContextHubInfo(int contextHubHandle)43 ContextHubInfo getContextHubInfo(int contextHubHandle); 44 45 // Loads a nanoapp at the specified hub (old API) loadNanoApp(int contextHubHandle, in NanoApp nanoApp)46 int loadNanoApp(int contextHubHandle, in NanoApp nanoApp); 47 48 // Unloads a nanoapp given its instance ID (old API) unloadNanoApp(int nanoAppHandle)49 int unloadNanoApp(int nanoAppHandle); 50 51 // Gets the NanoAppInstanceInfo of a nanoapp give its instance ID getNanoAppInstanceInfo(int nanoAppHandle)52 NanoAppInstanceInfo getNanoAppInstanceInfo(int nanoAppHandle); 53 54 // Finds all nanoApp instances matching some filter findNanoAppOnHub(int contextHubHandle, in NanoAppFilter filter)55 int[] findNanoAppOnHub(int contextHubHandle, in NanoAppFilter filter); 56 57 // Sends a message to a nanoApp sendMessage(int contextHubHandle, int nanoAppHandle, in ContextHubMessage msg)58 int sendMessage(int contextHubHandle, int nanoAppHandle, in ContextHubMessage msg); 59 60 // Creates a client to send and receive messages createClient(in IContextHubClientCallback client, int contextHubId)61 IContextHubClient createClient(in IContextHubClientCallback client, int contextHubId); 62 63 // Returns a list of ContextHub objects of available hubs getContextHubs()64 List<ContextHubInfo> getContextHubs(); 65 66 // Loads a nanoapp at the specified hub (new API) loadNanoAppOnHub( int contextHubId, in IContextHubTransactionCallback transactionCallback, in NanoAppBinary nanoAppBinary)67 void loadNanoAppOnHub( 68 int contextHubId, in IContextHubTransactionCallback transactionCallback, 69 in NanoAppBinary nanoAppBinary); 70 71 // Unloads a nanoapp on a specified context hub (new API) unloadNanoAppFromHub( int contextHubId, in IContextHubTransactionCallback transactionCallback, long nanoAppId)72 void unloadNanoAppFromHub( 73 int contextHubId, in IContextHubTransactionCallback transactionCallback, 74 long nanoAppId); 75 76 // Enables a nanoapp at the specified hub enableNanoApp( int contextHubId, in IContextHubTransactionCallback transactionCallback, long nanoAppId)77 void enableNanoApp( 78 int contextHubId, in IContextHubTransactionCallback transactionCallback, 79 long nanoAppId); 80 81 // Disables a nanoapp at the specified hub disableNanoApp( int contextHubId, in IContextHubTransactionCallback transactionCallback, long nanoAppId)82 void disableNanoApp( 83 int contextHubId, in IContextHubTransactionCallback transactionCallback, 84 long nanoAppId); 85 86 // Queries for a list of nanoapps queryNanoApps(int contextHubId, in IContextHubTransactionCallback transactionCallback)87 void queryNanoApps(int contextHubId, in IContextHubTransactionCallback transactionCallback); 88 } 89