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 17package android.hardware.gnss@1.0; 18 19import IGnssGeofenceCallback; 20 21/** Extended interface for GNSS Geofencing support */ 22interface IGnssGeofencing { 23 /** 24 * Opens the geofence interface and provides the callback routines 25 * to the HAL. 26 * 27 * @param callback Handle to the IGnssGeofenceCallback interface. 28 */ 29 setCallback(IGnssGeofenceCallback callback); 30 31 /** 32 * Add a geofence area. This api currently supports circular geofences. 33 * 34 * @param geofenceId The id for the geofence. If a geofence with this id 35 * already exists, an error value (ERROR_ID_EXISTS) must be returned. 36 * @param latitudeDegrees The latitude(in degrees) for the geofence lastTransition. 37 * @param longtitudeDegrees The longitude(in degrees) for the geofence lastTransition. 38 * @param radiusMeters The radius(in meters) for the geofence lastTransition. 39 * @param lastTransition The current state of the geofence. For example, if 40 * the system already knows that the user is inside the geofence, this will 41 * be set to ENTERED. In most cases, it will be UNCERTAIN. 42 * @param monitorTransitions - Which transitions to monitor. Bitwise OR of 43 * ENTERED, EXITED and UNCERTAIN. 44 * @param notificationResponsivenessMs - Defines the best-effort description 45 * of how soon must the callback be called when the transition associated 46 * with the Geofence is triggered. For instance, if set to 1000 millseconds 47 * with ENTERED, the callback must be called 1000 milliseconds within entering 48 * the geofence. This parameter is defined in milliseconds. 49 * NOTE: This is not to be confused with the rate that the GNSS is polled at. 50 * It is acceptable to dynamically vary the rate of sampling the GNSS for 51 * power-saving reasons; thus the rate of sampling may be faster or slower 52 * than this. 53 * @param unknownTimerMs - The time limit after which the UNCERTAIN transition 54 * must be triggered. This parameter is defined in milliseconds. 55 */ 56 addGeofence(int32_t geofenceId, double latitudeDegrees, double longitudeDegrees, 57 double radiusMeters, GeofenceTransition lastTransition, 58 bitfield<IGnssGeofenceCallback.GeofenceTransition> monitorTransitions, 59 uint32_t notificationResponsivenessMs, 60 uint32_t unknownTimerMs); 61 62 /** 63 * Pause monitoring a particular geofence. 64 * 65 * @param geofenceId The id for the geofence. 66 */ 67 pauseGeofence(int32_t geofenceId); 68 69 /** 70 * Resume monitoring a particular geofence. 71 * 72 * @param geofenceId - The id for the geofence. 73 * @param monitorTransitions Specifies which transitions to monitor. 74 * It can be a bitwise OR of ENTERED, EXITED and 75 * UNCERTAIN. This supersedes the value associated 76 * provided in the addGeofenceArea call. 77 */ 78 resumeGeofence(int32_t geofenceId, 79 bitfield<IGnssGeofenceCallback.GeofenceTransition> monitorTransitions); 80 81 /** 82 * Remove a geofence area. After the function returns, no notifications 83 * must be sent. 84 * 85 * @param geofenceId The id of the geofence. 86 */ 87 removeGeofence(int32_t geofenceId); 88}; 89