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