Debian Codegraph @

core/java/android/hardware/location/GeofenceHardwareMonitorEvent.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2014 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 import android.annotation.NonNull;
20 import android.annotation.SystemApi;
21 import android.location.Location;
22 import android.os.Parcel;
23 import android.os.Parcelable;
24
25 /**
26 * A class that represents an event for each change in the state of a monitoring system.
27 *
28 * @hide
29 */
30 @SystemApi
31 public class GeofenceHardwareMonitorEvent implements Parcelable {
32 private final int mMonitoringType;
33 private final int mMonitoringStatus;
34 private final int mSourceTechnologies;
35 private final Location mLocation;
36
37 public GeofenceHardwareMonitorEvent(
38 int monitoringType,
39 int monitoringStatus,
40 int sourceTechnologies,
41 Location location) {
42 mMonitoringType = monitoringType;
43 mMonitoringStatus = monitoringStatus;
44 mSourceTechnologies = sourceTechnologies;
45 mLocation = location;
46 }
47
48 /**
49 * Returns the type of the monitoring system that has a change on its state.
50 */
51 public int getMonitoringType() {
52 return mMonitoringType;
53 }
54
55 /**
56 * Returns the new status associated with the monitoring system.
57 */
58 public int getMonitoringStatus() {
59 return mMonitoringStatus;
60 }
61
62 /**
63 * Returns the source technologies that the status is associated to.
64 */
65 public int getSourceTechnologies() {
66 return mSourceTechnologies;
67 }
68
69 /**
70 * Returns the last known location according to the monitoring system.
71 */
72 public Location getLocation() {
73 return mLocation;
74 }
75
76 public static final @NonNull Creator<GeofenceHardwareMonitorEvent> CREATOR =
77 new Creator<GeofenceHardwareMonitorEvent>() {
78 @Override
79 public GeofenceHardwareMonitorEvent createFromParcel(Parcel source) {
80 ClassLoader classLoader = GeofenceHardwareMonitorEvent.class.getClassLoader();
81 int monitoringType = source.readInt();
82 int monitoringStatus = source.readInt();
83 int sourceTechnologies = source.readInt();
84 Location location = source.readParcelable(classLoader, android.location.Location.class);
85
86 return new GeofenceHardwareMonitorEvent(
87 monitoringType,
88 monitoringStatus,
89 sourceTechnologies,
90 location);
91 }
92
93 @Override
94 public GeofenceHardwareMonitorEvent[] newArray(int size) {
95 return new GeofenceHardwareMonitorEvent[size];
96 }
97 };
98
99 @Override
100 public int describeContents() {
101 return 0;
102 }
103
104 @Override
105 public void writeToParcel(Parcel parcel, int flags) {
106 parcel.writeInt(mMonitoringType);
107 parcel.writeInt(mMonitoringStatus);
108 parcel.writeInt(mSourceTechnologies);
109 parcel.writeParcelable(mLocation, flags);
110 }
111
112 @NonNull
113 @Override
114 public String toString() {
115 return String.format(
116 "GeofenceHardwareMonitorEvent: type=%d, status=%d, sources=%d, location=%s",
117 mMonitoringType,
118 mMonitoringStatus,
119 mSourceTechnologies,
120 mLocation);
121 }
122 }