Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 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.gnss@1.0; |
| 18 | |
| 19 | import IGnssGeofenceCallback; |
| 20 | |
| 21 | /* Extended interface for GNSS Geofencing support */ |
| 22 | interface 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 | addGeofenceArea(int32_t geofenceId, double latitudeDegrees, double longitudeDegrees, |
| 57 | double radiusMeters, GeofenceTransition lastTransition, |
| 58 | int32_t monitorTransitions, uint32_t notificationResponsivenessMs, |
| 59 | uint32_t unknownTimerMs); |
| 60 | |
| 61 | /* |
| 62 | * Pause monitoring a particular geofence. |
| 63 | * |
| 64 | * @param geofenceId The id for the geofence. |
| 65 | */ |
| 66 | pauseGeofence(int32_t geofenceId); |
| 67 | |
| 68 | /* |
| 69 | * Resume monitoring a particular geofence. |
| 70 | * |
| 71 | * @param geofenceId - The id for the geofence. |
| 72 | * @param monitorTransitions Specifies which transitions to monitor. |
| 73 | * It can be a bitwise OR of ENTERED, EXITED and |
| 74 | * UNCERTAIN. This supersedes the value associated |
| 75 | * provided in the addGeofenceArea call. |
| 76 | */ |
| 77 | resumeGeofence(int32_t geofenceId, int32_t monitorTransitions); |
| 78 | |
| 79 | /* |
| 80 | * Remove a geofence area. After the function returns, no notifications |
| 81 | * must be sent. |
| 82 | * |
| 83 | * @param geofenceId The id of the geofence. |
| 84 | */ |
| 85 | removeGeofenceArea(int32_t geofenceId); |
| 86 | }; |