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, in String attributionTag, in String packageName)62 IContextHubClient createClient( 63 int contextHubId, in IContextHubClientCallback client, in String attributionTag, 64 in String packageName); 65 66 // Creates a PendingIntent-based client to send and receive messages createPendingIntentClient( int contextHubId, in PendingIntent pendingIntent, long nanoAppId, in String attributionTag)67 IContextHubClient createPendingIntentClient( 68 int contextHubId, in PendingIntent pendingIntent, long nanoAppId, 69 in String attributionTag); 70 71 // Returns a list of ContextHub objects of available hubs getContextHubs()72 List<ContextHubInfo> getContextHubs(); 73 74 // Loads a nanoapp at the specified hub (new API) loadNanoAppOnHub( int contextHubId, in IContextHubTransactionCallback transactionCallback, in NanoAppBinary nanoAppBinary)75 void loadNanoAppOnHub( 76 int contextHubId, in IContextHubTransactionCallback transactionCallback, 77 in NanoAppBinary nanoAppBinary); 78 79 // Unloads a nanoapp on a specified context hub (new API) unloadNanoAppFromHub( int contextHubId, in IContextHubTransactionCallback transactionCallback, long nanoAppId)80 void unloadNanoAppFromHub( 81 int contextHubId, in IContextHubTransactionCallback transactionCallback, 82 long nanoAppId); 83 84 // Enables a nanoapp at the specified hub enableNanoApp( int contextHubId, in IContextHubTransactionCallback transactionCallback, long nanoAppId)85 void enableNanoApp( 86 int contextHubId, in IContextHubTransactionCallback transactionCallback, 87 long nanoAppId); 88 89 // Disables a nanoapp at the specified hub disableNanoApp( int contextHubId, in IContextHubTransactionCallback transactionCallback, long nanoAppId)90 void disableNanoApp( 91 int contextHubId, in IContextHubTransactionCallback transactionCallback, 92 long nanoAppId); 93 94 // Queries for a list of nanoapps queryNanoApps(int contextHubId, in IContextHubTransactionCallback transactionCallback)95 void queryNanoApps(int contextHubId, in IContextHubTransactionCallback transactionCallback); 96 } 97