blob: 562355afe3ef7de9f6207ccc4d3d4197d4d0e728 [file] [log] [blame]
Hridya Valsarajue596a712016-09-22 14:07:22 -07001/*
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
Andreas Huber40d3a9b2017-03-28 16:19:16 -070021/** Extended interface for GNSS Geofencing support */
Hridya Valsarajue596a712016-09-22 14:07:22 -070022interface IGnssGeofencing {
Andreas Huber40d3a9b2017-03-28 16:19:16 -070023 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -070024 * 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
Andreas Huber40d3a9b2017-03-28 16:19:16 -070031 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -070032 * 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 */
Hridya Valsaraju97ecaa02016-11-02 10:20:07 -070056 addGeofence(int32_t geofenceId, double latitudeDegrees, double longitudeDegrees,
Yifan Hong7037fdb2016-12-05 17:16:09 -080057 double radiusMeters, GeofenceTransition lastTransition,
58 bitfield<IGnssGeofenceCallback.GeofenceTransition> monitorTransitions,
59 uint32_t notificationResponsivenessMs,
60 uint32_t unknownTimerMs);
Hridya Valsarajue596a712016-09-22 14:07:22 -070061
Andreas Huber40d3a9b2017-03-28 16:19:16 -070062 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -070063 * Pause monitoring a particular geofence.
64 *
65 * @param geofenceId The id for the geofence.
66 */
67 pauseGeofence(int32_t geofenceId);
68
Andreas Huber40d3a9b2017-03-28 16:19:16 -070069 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -070070 * 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 */
Yifan Hong7037fdb2016-12-05 17:16:09 -080078 resumeGeofence(int32_t geofenceId,
79 bitfield<IGnssGeofenceCallback.GeofenceTransition> monitorTransitions);
Hridya Valsarajue596a712016-09-22 14:07:22 -070080
Andreas Huber40d3a9b2017-03-28 16:19:16 -070081 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -070082 * Remove a geofence area. After the function returns, no notifications
83 * must be sent.
84 *
85 * @param geofenceId The id of the geofence.
86 */
Hridya Valsaraju97ecaa02016-11-02 10:20:07 -070087 removeGeofence(int32_t geofenceId);
Hridya Valsarajue596a712016-09-22 14:07:22 -070088};