GPS HAL Binderization
A Debug interface as well as a configuration interface will be added in
another CL.
Bug: 31974439
Test: mma
Change-Id: I977d95fc815172bd2aae7c78f81e1fc7c9bce72a
diff --git a/gnss/1.0/Android.bp b/gnss/1.0/Android.bp
new file mode 100644
index 0000000..730087f
--- /dev/null
+++ b/gnss/1.0/Android.bp
@@ -0,0 +1,166 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+ name: "android.hardware.gnss@1.0_genc++",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.gnss@1.0",
+ srcs: [
+ "types.hal",
+ "IAGnss.hal",
+ "IAGnssCallback.hal",
+ "IAGnssRil.hal",
+ "IAGnssRilCallback.hal",
+ "IGnss.hal",
+ "IGnssCallback.hal",
+ "IGnssGeofenceCallback.hal",
+ "IGnssGeofencing.hal",
+ "IGnssMeasurement.hal",
+ "IGnssMeasurementCallback.hal",
+ "IGnssNavigationMessage.hal",
+ "IGnssNavigationMessageCallback.hal",
+ "IGnssNi.hal",
+ "IGnssNiCallback.hal",
+ "IGnssXtra.hal",
+ "IGnssXtraCallback.hal",
+ ],
+ out: [
+ "android/hardware/gnss/1.0/types.cpp",
+ "android/hardware/gnss/1.0/AGnssAll.cpp",
+ "android/hardware/gnss/1.0/AGnssCallbackAll.cpp",
+ "android/hardware/gnss/1.0/AGnssRilAll.cpp",
+ "android/hardware/gnss/1.0/AGnssRilCallbackAll.cpp",
+ "android/hardware/gnss/1.0/GnssAll.cpp",
+ "android/hardware/gnss/1.0/GnssCallbackAll.cpp",
+ "android/hardware/gnss/1.0/GnssGeofenceCallbackAll.cpp",
+ "android/hardware/gnss/1.0/GnssGeofencingAll.cpp",
+ "android/hardware/gnss/1.0/GnssMeasurementAll.cpp",
+ "android/hardware/gnss/1.0/GnssMeasurementCallbackAll.cpp",
+ "android/hardware/gnss/1.0/GnssNavigationMessageAll.cpp",
+ "android/hardware/gnss/1.0/GnssNavigationMessageCallbackAll.cpp",
+ "android/hardware/gnss/1.0/GnssNiAll.cpp",
+ "android/hardware/gnss/1.0/GnssNiCallbackAll.cpp",
+ "android/hardware/gnss/1.0/GnssXtraAll.cpp",
+ "android/hardware/gnss/1.0/GnssXtraCallbackAll.cpp",
+ ],
+}
+
+genrule {
+ name: "android.hardware.gnss@1.0_genc++_headers",
+ tool: "hidl-gen",
+ cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.gnss@1.0",
+ srcs: [
+ "types.hal",
+ "IAGnss.hal",
+ "IAGnssCallback.hal",
+ "IAGnssRil.hal",
+ "IAGnssRilCallback.hal",
+ "IGnss.hal",
+ "IGnssCallback.hal",
+ "IGnssGeofenceCallback.hal",
+ "IGnssGeofencing.hal",
+ "IGnssMeasurement.hal",
+ "IGnssMeasurementCallback.hal",
+ "IGnssNavigationMessage.hal",
+ "IGnssNavigationMessageCallback.hal",
+ "IGnssNi.hal",
+ "IGnssNiCallback.hal",
+ "IGnssXtra.hal",
+ "IGnssXtraCallback.hal",
+ ],
+ out: [
+ "android/hardware/gnss/1.0/types.h",
+ "android/hardware/gnss/1.0/IAGnss.h",
+ "android/hardware/gnss/1.0/IHwAGnss.h",
+ "android/hardware/gnss/1.0/BnAGnss.h",
+ "android/hardware/gnss/1.0/BpAGnss.h",
+ "android/hardware/gnss/1.0/BsAGnss.h",
+ "android/hardware/gnss/1.0/IAGnssCallback.h",
+ "android/hardware/gnss/1.0/IHwAGnssCallback.h",
+ "android/hardware/gnss/1.0/BnAGnssCallback.h",
+ "android/hardware/gnss/1.0/BpAGnssCallback.h",
+ "android/hardware/gnss/1.0/BsAGnssCallback.h",
+ "android/hardware/gnss/1.0/IAGnssRil.h",
+ "android/hardware/gnss/1.0/IHwAGnssRil.h",
+ "android/hardware/gnss/1.0/BnAGnssRil.h",
+ "android/hardware/gnss/1.0/BpAGnssRil.h",
+ "android/hardware/gnss/1.0/BsAGnssRil.h",
+ "android/hardware/gnss/1.0/IAGnssRilCallback.h",
+ "android/hardware/gnss/1.0/IHwAGnssRilCallback.h",
+ "android/hardware/gnss/1.0/BnAGnssRilCallback.h",
+ "android/hardware/gnss/1.0/BpAGnssRilCallback.h",
+ "android/hardware/gnss/1.0/BsAGnssRilCallback.h",
+ "android/hardware/gnss/1.0/IGnss.h",
+ "android/hardware/gnss/1.0/IHwGnss.h",
+ "android/hardware/gnss/1.0/BnGnss.h",
+ "android/hardware/gnss/1.0/BpGnss.h",
+ "android/hardware/gnss/1.0/BsGnss.h",
+ "android/hardware/gnss/1.0/IGnssCallback.h",
+ "android/hardware/gnss/1.0/IHwGnssCallback.h",
+ "android/hardware/gnss/1.0/BnGnssCallback.h",
+ "android/hardware/gnss/1.0/BpGnssCallback.h",
+ "android/hardware/gnss/1.0/BsGnssCallback.h",
+ "android/hardware/gnss/1.0/IGnssGeofenceCallback.h",
+ "android/hardware/gnss/1.0/IHwGnssGeofenceCallback.h",
+ "android/hardware/gnss/1.0/BnGnssGeofenceCallback.h",
+ "android/hardware/gnss/1.0/BpGnssGeofenceCallback.h",
+ "android/hardware/gnss/1.0/BsGnssGeofenceCallback.h",
+ "android/hardware/gnss/1.0/IGnssGeofencing.h",
+ "android/hardware/gnss/1.0/IHwGnssGeofencing.h",
+ "android/hardware/gnss/1.0/BnGnssGeofencing.h",
+ "android/hardware/gnss/1.0/BpGnssGeofencing.h",
+ "android/hardware/gnss/1.0/BsGnssGeofencing.h",
+ "android/hardware/gnss/1.0/IGnssMeasurement.h",
+ "android/hardware/gnss/1.0/IHwGnssMeasurement.h",
+ "android/hardware/gnss/1.0/BnGnssMeasurement.h",
+ "android/hardware/gnss/1.0/BpGnssMeasurement.h",
+ "android/hardware/gnss/1.0/BsGnssMeasurement.h",
+ "android/hardware/gnss/1.0/IGnssMeasurementCallback.h",
+ "android/hardware/gnss/1.0/IHwGnssMeasurementCallback.h",
+ "android/hardware/gnss/1.0/BnGnssMeasurementCallback.h",
+ "android/hardware/gnss/1.0/BpGnssMeasurementCallback.h",
+ "android/hardware/gnss/1.0/BsGnssMeasurementCallback.h",
+ "android/hardware/gnss/1.0/IGnssNavigationMessage.h",
+ "android/hardware/gnss/1.0/IHwGnssNavigationMessage.h",
+ "android/hardware/gnss/1.0/BnGnssNavigationMessage.h",
+ "android/hardware/gnss/1.0/BpGnssNavigationMessage.h",
+ "android/hardware/gnss/1.0/BsGnssNavigationMessage.h",
+ "android/hardware/gnss/1.0/IGnssNavigationMessageCallback.h",
+ "android/hardware/gnss/1.0/IHwGnssNavigationMessageCallback.h",
+ "android/hardware/gnss/1.0/BnGnssNavigationMessageCallback.h",
+ "android/hardware/gnss/1.0/BpGnssNavigationMessageCallback.h",
+ "android/hardware/gnss/1.0/BsGnssNavigationMessageCallback.h",
+ "android/hardware/gnss/1.0/IGnssNi.h",
+ "android/hardware/gnss/1.0/IHwGnssNi.h",
+ "android/hardware/gnss/1.0/BnGnssNi.h",
+ "android/hardware/gnss/1.0/BpGnssNi.h",
+ "android/hardware/gnss/1.0/BsGnssNi.h",
+ "android/hardware/gnss/1.0/IGnssNiCallback.h",
+ "android/hardware/gnss/1.0/IHwGnssNiCallback.h",
+ "android/hardware/gnss/1.0/BnGnssNiCallback.h",
+ "android/hardware/gnss/1.0/BpGnssNiCallback.h",
+ "android/hardware/gnss/1.0/BsGnssNiCallback.h",
+ "android/hardware/gnss/1.0/IGnssXtra.h",
+ "android/hardware/gnss/1.0/IHwGnssXtra.h",
+ "android/hardware/gnss/1.0/BnGnssXtra.h",
+ "android/hardware/gnss/1.0/BpGnssXtra.h",
+ "android/hardware/gnss/1.0/BsGnssXtra.h",
+ "android/hardware/gnss/1.0/IGnssXtraCallback.h",
+ "android/hardware/gnss/1.0/IHwGnssXtraCallback.h",
+ "android/hardware/gnss/1.0/BnGnssXtraCallback.h",
+ "android/hardware/gnss/1.0/BpGnssXtraCallback.h",
+ "android/hardware/gnss/1.0/BsGnssXtraCallback.h",
+ ],
+}
+
+cc_library_shared {
+ name: "android.hardware.gnss@1.0",
+ generated_sources: ["android.hardware.gnss@1.0_genc++"],
+ generated_headers: ["android.hardware.gnss@1.0_genc++_headers"],
+ export_generated_headers: ["android.hardware.gnss@1.0_genc++_headers"],
+ shared_libs: [
+ "libhidl",
+ "libhwbinder",
+ "libutils",
+ "libcutils",
+ ],
+}
diff --git a/gnss/1.0/IAGnss.hal b/gnss/1.0/IAGnss.hal
new file mode 100644
index 0000000..a3172f3
--- /dev/null
+++ b/gnss/1.0/IAGnss.hal
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@1.0;
+
+import IAGnssCallback;
+
+/*
+ * Extended interface for AGNSS support.
+ */
+interface IAGnss {
+ enum ApnIpType : uint16_t {
+ INVALID = 0,
+ IPV4 = 1,
+ IPV6 = 2,
+ IPV4V6 = 3
+ };
+
+ /*
+ * Opens the AGNSS interface and provides the callback routines to the
+ * implementation of this interface.
+ *
+ * @param callback Handle to the AGNSS status callback interface.
+ */
+ setCallback(IAGnssCallback callback);
+
+ /*
+ * Notifies that the AGNSS data connection has been closed.
+ *
+ * @return success True if the operation is successful.
+ */
+ dataConnClosed() generates (bool success);
+
+ /*
+ * Notifies that a data connection is not available for AGNSS.
+ *
+ * @return success True if the operation is successful.
+ */
+ dataConnFailed() generates (bool success);
+
+ /*
+ * Sets the hostname and port for the AGNSS server.
+ *
+ * @param type Specifies if SUPL or C2K.
+ * @param hostname Hostname of the AGNSS server.
+ * @param port Port number associated with the server.
+ *
+ * @return success True if the operation is successful.
+ */
+ setServer(AGnssType type, string hostname, int32_t port)
+ generates (bool success);
+
+ /*
+ * Notifies that a data connection is available and sets the name of the
+ * APN, and its IP type, to be used for SUPL connections.
+ *
+ * @param apn Access Point Name(follows regular APN naming convention).
+ * @param apnIpType Specifies if SUPL or C2K.
+ *
+ * @return success True if the operation is successful.
+ */
+ dataConnOpenWithApnIpType(string apn, ApnIpType apnIpType)
+ generates (bool success);
+};
diff --git a/gnss/1.0/IAGnssCallback.hal b/gnss/1.0/IAGnssCallback.hal
new file mode 100644
index 0000000..46641be
--- /dev/null
+++ b/gnss/1.0/IAGnssCallback.hal
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@1.0;
+
+/** Callback structure for the AGNSS interface. */
+interface IAGnssCallback {
+ /** AGNSS type **/
+ enum AGnssType : uint16_t {
+ TYPE_SUPL = 1,
+ TYPE_C2K = 2
+ };
+
+ enum AGnssStatusValue : uint16_t {
+ /** GNSS requests data connection for AGNSS. */
+ REQUEST_AGNSS_DATA_CONN = 1,
+ /** GNSS releases the AGNSS data connection. */
+ RELEASE_AGNSS_DATA_CONN = 2,
+ /** AGNSS data connection initiated */
+ AGNSS_DATA_CONNECTED = 3,
+ /** AGNSS data connection completed */
+ AGNSS_DATA_CONN_DONE = 4,
+ /** AGNSS data connection failed */
+ AGNSS_DATA_CONN_FAILED = 5
+ };
+
+ /*
+ * Represents the status of AGNSS augmented to support IPv4.
+ */
+ struct AGnssStatusIpV4 {
+ AGnssType type;
+ AGnssStatusValue status;
+ /*
+ * 32-bit IPv4 address.
+ */
+ uint32_t ipV4Addr;
+ };
+
+ /*
+ * Represents the status of AGNSS augmented to support IPv6.
+ */
+ struct AGnssStatusIpV6 {
+ AGnssType type;
+ AGnssStatusValue status;
+ /*
+ * 128-bit IPv6 address.
+ */
+ uint8_t[16] ipV6Addr;
+ };
+
+ /*
+ * Callback with AGNSS(IpV4) status information.
+ *
+ * @param status Will be of type AGnssStatusIpV4.
+ */
+ agnssStatusIpV4Cb(AGnssStatusIpV4 status);
+
+ /*
+ * Callback with AGNSS(IpV6) status information.
+ *
+ * @param status Will be of type AGnssStatusIpV6.
+ */
+ agnssStatusIpV6Cb(AGnssStatusIpV6 status);
+
+};
diff --git a/gnss/1.0/IAGnssRil.hal b/gnss/1.0/IAGnssRil.hal
new file mode 100644
index 0000000..fb73498
--- /dev/null
+++ b/gnss/1.0/IAGnssRil.hal
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@1.0;
+
+import IAGnssRilCallback;
+
+/*
+ * Extended interface for AGNSS RIL support. An Assisted GNSS Radio Interface
+ * Layer interface allows the GNSS chipset to request radio interface layer
+ * information from Android platform. Examples of such information are reference
+ * location, unique subscriber ID, phone number string and network availability changes.
+ */
+interface IAGnssRil {
+ enum SetIDType : uint16_t {
+ NONE = 0,
+ IMSI = 1,
+ MSISDM = 2
+ };
+
+ enum NetworkType : int32_t {
+ MOBILE = 0,
+ WIFI = 1,
+ MMS = 2,
+ SUPL = 3,
+ DUN = 4,
+ HIPRI = 5,
+ WIMAX = 6,
+ };
+
+ enum AGnssRefLocationType {
+ GSM_CELLID = 1,
+ UMTS_CELLID = 2,
+ MAC = 3,
+ LTE_CELLID = 4,
+ };
+
+ /* CellID for 2G, 3G and LTE, used in AGNSS. */
+ struct AGnssRefLocationCellID {
+ AGnssRefLocationType type;
+
+ /* Mobile Country Code. */
+ uint16_t mcc;
+
+ /* Mobile Network Code .*/
+ uint16_t mnc;
+
+ /*
+ * Location Area Code in 2G, 3G and LTE. In 3G lac is discarded. In LTE,
+ * lac is populated with tac, to ensure that we don't break old clients that
+ * might rely in the old (wrong) behavior.
+ */
+ uint16_t lac;
+
+ /* Cell id in 2G. Utran Cell id in 3G. Cell Global Id EUTRA in LTE. */
+ uint32_t cid;
+
+ /* Tracking Area Code in LTE. */
+ uint16_t tac;
+
+ /* Physical Cell id in LTE (not used in 2G and 3G) */
+ uint16_t pcid;
+ };
+
+ struct AGnssRefLocationMac {
+ uint8_t[6] mac;
+ };
+
+ /* Represents ref locations */
+ struct AGnssRefLocation {
+ AGnssRefLocationType type;
+
+ union RefLoc {
+ AGnssRefLocationCellID cellID;
+ AGnssRefLocationMac mac;
+ };
+
+ RefLoc refLocVal;
+ };
+
+ /*
+ * Opens the AGNSS interface and provides the callback routines
+ * to the implementation of this interface.
+ *
+ * @param callback Interface for AGnssRil callbacks.
+ */
+ setCallback(IAGnssRilCallback callback);
+
+ /*
+ * Sets the reference location.
+ *
+ * @param agnssReflocation AGNSS reference location CellID/MAC.
+ */
+ setRefLocation(AGnssRefLocation agnssReflocation);
+
+ /*
+ * Sets the SET ID.
+ *
+ * @param type Must be populated with either IMSI or MSISDN or NONE.
+ * @param setid If type is IMSI then setid is populated with
+ * a string representing the unique Subscriber ID, for example, the IMSI for
+ * a GMS phone. If type is MSISDN, then setid must contain
+ * the phone number string for line 1. For example, the MSISDN for a GSM phone.
+ * If the type is NONE, then the string must be empty.
+ *
+ * @return success True if all parameters were valid and operation was
+ * successful.
+ */
+ setSetId(SetIDType type, string setid) generates (bool success);
+
+ /*
+ * Notify GNSS of network status changes.
+ *
+ * @param connected Indicates whether network connectivity exists and
+ * it is possible to establish connections and pass data.
+ * @param type Indicates the kind of network, for eg. mobile, wifi etc.
+ * @param roaming Indicates whether the device is currently roaming on
+ * this network.
+ *
+ * @return success True is all parameters were valid and operation was
+ * successful.
+ */
+ updateNetworkState(bool connected, NetworkType type, bool roaming)
+ generates (bool success);
+
+ /*
+ * Notify GNSS of network status changes.
+ *
+ * @param available Indicates whether network connectivity is available.
+ * @param apn String containing the Access Point Name.
+ *
+ * @return success True if all parameters were valid and the operation was
+ * successful.
+ * TODO(b/32022567): Add VTS test to validate the format of APN.
+ */
+ updateNetworkAvailability(bool available, string apn) generates (bool success);
+
+};
diff --git a/gnss/1.0/IAGnssRilCallback.hal b/gnss/1.0/IAGnssRilCallback.hal
new file mode 100644
index 0000000..6f29820
--- /dev/null
+++ b/gnss/1.0/IAGnssRilCallback.hal
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@1.0;
+
+/*
+ * Callback for IAGnssRil interface. Used to request SET ID and
+ * Reference Location.
+ */
+interface IAGnssRilCallback {
+ /* Kinds of SET ID that can be requested */
+ enum ID : uint32_t {
+ IMSI = 1 << 0L,
+ MSISDN = 1 << 1L,
+ };
+
+ /* Kinds of reference location that can be requested. */
+ enum RefLoc : uint32_t {
+ CELLID = 1 << 0L,
+ MAC = 1 << 1L
+ };
+
+ /*
+ * The Hal uses this API to request a SET ID.
+ *
+ * @param setIdflag Specifies the kind of SET ID that is required by the HAL.
+ */
+ requestSetIdCb(ID setIdflag);
+
+ /*
+ * The Hal uses this API to request a reference location.
+ *
+ * @param refLocflag Specifies the kind of reference location that is required
+ * by the HAL.
+ */
+ requestRefLocCb(RefLoc refLocflag);
+
+};
diff --git a/gnss/1.0/IGnss.hal b/gnss/1.0/IGnss.hal
new file mode 100644
index 0000000..0f16124
--- /dev/null
+++ b/gnss/1.0/IGnss.hal
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@1.0;
+
+import IAGnss;
+import IAGnssRil;
+import IGnssMeasurement;
+import IGnssNavigationMessage;
+import IGnssCallback;
+import IGnssGeofencing;
+import IGnssNi;
+import IGnssXtra;
+
+/* Represents the standard GNSS interface. */
+interface IGnss {
+ /* Requested operational mode for GNSS operation. */
+ enum GnssPositionMode : uint32_t {
+ /** Mode for running GNSS standalone (no assistance). */
+ STANDALONE = 0,
+ /** AGNSS MS-Based mode. */
+ MS_BASED = 1,
+ /*
+ * AGNSS MS-Assisted mode. This mode is not maintained by the platform anymore.
+ * It is strongly recommended to use MS_BASED instead.
+ */
+ MS_ASSISTED = 2,
+ };
+
+ /* Requested recurrence mode for GNSS operation. */
+ enum GnssPositionRecurrence : uint32_t {
+ /** Receive GNSS fixes on a recurring basis at a specified period. */
+ RECURRENCE_PERIODIC = 0,
+ /** Request a single shot GNSS fix. */
+ RECURRENCE_SINGLE = 1
+ };
+
+ /*
+ * Flags used to specify which aiding data to delete when calling
+ * deleteAidingData().
+ */
+ enum GnssAidingData : uint16_t {
+ DELETE_EPHEMERIS = 0x0001,
+ DELETE_ALMANAC = 0x0002,
+ DELETE_POSITION = 0x0004,
+ DELETE_TIME = 0x0008,
+ DELETE_IONO = 0x0010,
+ DELETE_UTC = 0x0020,
+ DELETE_HEALTH = 0x0040,
+ DELETE_SVDIR = 0x0080,
+ DELETE_SVSTEER = 0x0100,
+ DELETE_SADATA = 0x0200,
+ DELETE_RTI = 0x0400,
+ DELETE_CELLDB_INFO = 0x8000,
+ DELETE_ALL = 0xFFFF
+ };
+
+ /*
+ * Opens the interface and provides the callback routines
+ * to the implementation of this interface.
+ *
+ * @param callback Callback interface for IGnss.
+ *
+ * @return success Returns true on success.
+ */
+ setCallback(IGnssCallback callback) generates (bool success);
+
+ /*
+ * Starts navigating.
+ *
+ * @return success Returns true on success.
+ */
+ start() generates (bool success);
+
+ /*
+ * Stops navigating.
+ *
+ * @return success Returns true on success.
+ */
+ stop() generates (bool success);
+
+ /*
+ * Closes the interface.
+ */
+ cleanup();
+
+ /*
+ * Injects the current time.
+ *
+ * @param timeMs This is the UTC time received from the NTP server, its value
+ * is given in milliseconds since January 1, 1970.
+ * @param timeReferenceMs The corresponding value of
+ * SystemClock.elapsedRealtime() from the device when the NTP response was
+ * received in milliseconds.
+ * @param uncertaintyMs Uncertainty associated with the value represented by
+ * time. Represented in milliseconds.
+ *
+ * @return success Returns true if the operation is successful.
+ *
+ injectTime(GnssUtcTime timeMs, int64_t timeReferenceMs, int32_t uncertaintyMs)
+ generates (bool success);
+
+ /*
+ * Injects current location from another location provider (typically cell
+ * ID).
+ *
+ * @param latitudeDegrees Measured in Degrees.
+ * @param longitudeDegrees Measured in Degrees.
+ * @param accuracyMeters Measured in meters.
+ *
+ * @return success Returns true if successful.
+ */
+ injectLocation(double latitudeDegrees, double longitudeDegrees, float accuracyMeters)
+ generates (bool success);
+
+ /*
+ * Specifies that the next call to start will not use the
+ * information defined in the flags. GnssAidingData value of DELETE_ALL is
+ * passed for a cold start.
+ *
+ * @param aidingDataFlags Flags specifying the aiding data to be deleted.
+ */
+ deleteAidingData(GnssAidingData aidingDataFlags);
+
+ /*
+ * @param mode Parameter must be one of MS_BASED or STANDALONE.
+ * It is allowed by the platform (and it is recommended) to fallback to
+ * MS_BASED if MS_ASSISTED is passed in, and MS_BASED is supported.
+ * @recurrence GNSS postion recurrence value, either periodic or single.
+ * @param minIntervalMs Represents the time between fixes in milliseconds.
+ * @param preferredAccuracyMeters Represents the requested fix accuracy in meters.
+ * @param preferredTimeMs Represents the requested time to first fix in milliseconds.
+
+ * @return success Returns true if successful.
+ */
+ setPositionMode(GnssPositionMode mode, GnssPositionRecurrence recurrence,
+ uint32_t minIntervalMs, uint32_t preferredAccuracyMeters,
+ uint32_t preferredTimeMs)
+ generates (bool success);
+
+ /*
+ * This method returns the IAGnssRil Interface.
+ *
+ * @return infc Handle to the IAGnssRil interface.
+ */
+ getExtensionAGnssRil() generates (IAGnssRil infc);
+
+ /*
+ * This method returns the IGnssGeofencing Interface.
+ *
+ * @return infc Handle to the IGnssGeofencing interface.
+ */
+ getExtensionGnssGeofencing() generates(IGnssGeofencing infc);
+
+ /*
+ * This method returns the IAGnss Interface.
+ *
+ * @return infc Handle to the IAGnss interface.
+ */
+ getExtensionAGnss() generates (IAGnss infc);
+
+ /*
+ * This method returns the IGnssNi interface.
+ *
+ * @return infc Handle to the IGnssNi interface.
+ */
+ getExtensionGnssNi() generates (IGnssNi infc);
+
+ /*
+ * This method returns the IGnssMeasurement interface.
+ *
+ * @return infc Handle to the IGnssMeasurement interface.
+ */
+ getExtensionGnssMeasurement() generates (IGnssMeasurement infc);
+
+ /*
+ * This method returns the IGnssNavigationMessage interface.
+ *
+ * @return infc Handle to the IGnssNavigationMessage interface.
+ */
+ getExtensionGnssNavigationMessage() generates (IGnssNavigationMessage infc);
+
+ /*
+ * This method returns the IGnssXtra interface.
+ *
+ * @return infc Handle to the IGnssXtra interface.
+ */
+ getExtensionXtra() generates (IGnssXtra infc);
+
+};
diff --git a/gnss/1.0/IGnssCallback.hal b/gnss/1.0/IGnssCallback.hal
new file mode 100644
index 0000000..5234688
--- /dev/null
+++ b/gnss/1.0/IGnssCallback.hal
@@ -0,0 +1,222 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@1.0;
+
+/*
+ * The interface is required for the HAL to communicate certain information
+ * like status and location info back to the platform, the platform implements
+ * the interfaces and passes a handle to the HAL.
+ */
+interface IGnssCallback {
+ /* Flags for the gnssSetCapabilities callback. */
+ enum Capabilities : uint32_t {
+ /*
+ * GNSS HAL schedules fixes for RECURRENCE_PERIODIC mode.
+ * If this is not set, then the framework will use 1000ms for
+ * minInterval and will call start() and stop() to schedule the GNSS.
+ */
+ SCHEDULING = 1 << 0,
+ /** GNSS supports MS-Based AGNSS mode */
+ MSB = 1 << 1,
+ /** GNSS supports MS-Assisted AGNSS mode */
+ MSA = 1 << 2,
+ /** GNSS supports single-shot fixes */
+ SINGLE_SHOT = 1 << 3,
+ /** GNSS supports on demand time injection */
+ ON_DEMAND_TIME = 1 << 4,
+ /** GNSS supports Geofencing */
+ GEOFENCING = 1 << 5,
+ /** GNSS supports Measurements. */
+ MEASUREMENTS = 1 << 6,
+ /** GNSS supports Navigation Messages */
+ NAV_MESSAGES = 1 << 7,
+ };
+
+ /* GNSS status event values. */
+ enum GnssStatusValue : uint16_t {
+ /** GNSS status unknown. */
+ STATUS_NONE = 0,
+ /** GNSS has begun navigating. */
+ SESSION_BEGIN = 1,
+ /** GNSS has stopped navigating. */
+ SESSION_END = 2,
+ /** GNSS has powered on but is not navigating. */
+ ENGINE_ON = 3,
+ /** GNSS is powered off. */
+ ENGINE_OFF = 4
+ };
+
+ /*
+ * Flags that indicate information about the satellite
+ */
+ enum GnssSvFlags : uint8_t {
+ FLAGS_NONE = 0,
+ HAS_EPHEMERIS_DATA = 1 << 0,
+ HAS_ALMANAC_DATA = 1 << 1,
+ USED_IN_FIX = 1 << 2
+ };
+
+ struct GnssSvInfo {
+ /*
+ * Pseudo-random number for the SV, or FCN/OSN number for Glonass. The
+ * distinction is made by looking at constellation field. Values must be
+ * in the range of:
+ *
+ * - GNSS: 1-32
+ * - SBAS: 120-151, 183-192
+ * - GLONASS: 1-24, the orbital slot number (OSN), if known. Or, if not:
+ * 93-106, the frequency channel number (FCN) (-7 to +6) offset by
+ * + 100
+ * i.e. report an FCN of -7 as 93, FCN of 0 as 100, and FCN of +6
+ * as 106.
+ * - QZSS: 193-200
+ * - Galileo: 1-36
+ * - Beidou: 1-37
+ */
+ int16_t svid;
+
+ /*
+ * Defines the constellation of the given SV.
+ */
+ GnssConstellationType constellation;
+
+ /*
+ * Carrier-to-noise density in dB-Hz, typically in the range [0, 63].
+ * It contains the measured C/N0 value for the signal at the antenna port.
+ *
+ * This is a mandatory value.
+ */
+ float cN0Dbhz;
+
+ /** Elevation of SV in degrees. */
+ float elevationDegrees;
+
+ /** Azimuth of SV in degrees. */
+ float azimuthDegrees;
+
+ /*
+ * Contains additional data about the given SV.
+ */
+ GnssSvFlags svFlag;
+ };
+
+ /*
+ * Represents SV status.
+ */
+ struct GnssSvStatus {
+ /*
+ * Number of GNSS SVs currently visible, refers to the SVs stored in sv_list
+ */
+ int32_t numSvs;
+
+ /*
+ * Pointer to an array of SVs information for all GNSS constellations,
+ * except GNSS, which is reported using svList
+ */
+ GnssSvInfo[ConstS32:GNSS_MAX_SVS] gnssSvList;
+
+ };
+
+ /*
+ * Called when a GNSS location is available.
+ *
+ * @param location Location information from HAL.
+ */
+ gnssLocationCb(GnssLocation location);
+
+ /*
+ * Called to communicate the status of the GNSS engine.
+ *
+ * @param status Status information from HAL.
+ */
+ gnssStatusCb(GnssStatusValue status);
+
+ /*
+ * @param svInfo SV status information from HAL.
+ */
+ gnssSvStatusCb(GnssSvStatus svInfo);
+
+ /*
+ * Called when NMEA data is available.
+ * Callback for reporting NMEA sentences.
+ *
+ * @param timestamp Marks the instance of reporting.
+ * @param nmea Follows standard NMEA 0183. Each sentence begins with a '$'
+ * and ends with a carriage return/line feed sequence and can be no longer
+ * than 80 characters of visible text (plus the line terminators). The data
+ * is contained within this single line with data items separated by commas.
+ * The data itself is just ascii text and may extend over multiple sentences
+ * in certain specialized instances but is normally fully contained in one
+ * variable length sentence. The data may vary in the amount of precision
+ * contained in the message. For example time might be indicated to decimal
+ * parts of a second or location may be shown with 3 or even 4 digits after
+ * the decimal point. Programs that read the data must only use the commas
+ * to determine the field boundaries and not depend on column positions.
+ * There is a provision for a checksum at the end of each sentence which may
+ * or may not be checked by the unit that reads the data. The checksum field
+ * consists of a '*' and two hex digits representing an 8 bit exclusive OR
+ * of all characters between, but not including, the '$' and '*'.
+ */
+ gnssNmeaCb(GnssUtcTime timestamp, string nmea);
+
+ /*
+ * Callback to inform framework of the GNSS engine's capabilities.
+ *
+ * @param capabilities Capability parameter is a bit field of
+ * the Capabilities enum.
+ */
+ gnssSetCapabilitesCb(uint32_t capabilities);
+
+ /*
+ * Callback utility for acquiring the GNSS wakelock. This can be used to prevent
+ * the CPU from suspending while handling GNSS events.
+ */
+ gnssAcquireWakelockCb();
+
+ /** Callback utility for releasing the GNSS wakelock. */
+ gnssReleaseWakelockCb();
+
+ /** Callback for requesting NTP time */
+ gnssRequestTimeCb();
+
+ /*
+ * Provides information about how new the underlying GPS/GNSS hardware and
+ * software is.
+ *
+ * This information will be available for Android Test Applications. If a GNSS
+ * HAL does not provide this information, it will be considered "2015 or
+ * earlier".
+ *
+ * If a GNSS HAL does provide this information, then newer years will need to
+ * meet newer CTS standards. E.g. if the date are 2016 or above, then N+ level
+ * GnssMeasurement support will be verified.
+ */
+ struct GnssSystemInfo{
+ /*
+ * year in which the last update was made to the underlying hardware/firmware
+ * used to capture GNSS signals, e.g. 2016
+ */
+ uint16_t yearOfHw;
+ };
+
+ /*
+ * Callback to inform framework of the engine's hardware version information.
+ *
+ * @param info GnssSystemInfo about the GPS/GNSS hardware.
+ */
+ gnssSetSystemInfoCb(GnssSystemInfo info);
+};
diff --git a/gnss/1.0/IGnssGeofenceCallback.hal b/gnss/1.0/IGnssGeofenceCallback.hal
new file mode 100644
index 0000000..06eb62a
--- /dev/null
+++ b/gnss/1.0/IGnssGeofenceCallback.hal
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@1.0;
+
+/*
+ * GNSS Geofence.
+ * There are 3 states associated with a Geofence: Inside, Outside, Unknown.
+ * There are 3 transitions: ENTERED, EXITED, UNCERTAIN.
+ *
+ * An example state diagram with confidence level: 95% and Unknown time limit
+ * set as 30 secs is shown below. (confidence level and Unknown time limit are
+ * explained latter).
+ * ____________________________
+ * | Unknown (30 secs) |
+ * """"""""""""""""""""""""""""
+ * ^ | | ^
+ * UNCERTAIN| |ENTERED EXITED| |UNCERTAIN
+ * | v v |
+ * ________ EXITED _________
+ * | Inside | -----------> | Outside |
+ * | | <----------- | |
+ * """""""" ENTERED """""""""
+ *
+ * Inside state: We are 95% confident that the user is inside the geofence.
+ * Outside state: We are 95% confident that the user is outside the geofence
+ * Unknown state: Rest of the time.
+ *
+ * The Unknown state is better explained with an example:
+ *
+ * __________
+ * | c|
+ * | ___ | _______
+ * | |a| | | b |
+ * | """ | """""""
+ * | |
+ * """"""""""
+ * In the diagram above, "a" and "b" are 2 geofences and "c" is the accuracy
+ * circle reported by the GNSS subsystem. Now with regard to "b", the system is
+ * confident that the user is outside. But with regard to "a" is not confident
+ * whether it is inside or outside the geofence. If the accuracy remains the
+ * same for a sufficient period of time, the UNCERTAIN transition must be
+ * triggered with the state set to Unknown. If the accuracy improves later, an
+ * appropriate transition must be triggered. This "sufficient period of time"
+ * is defined by the parameter in the addGeofenceArea API.
+ * In other words, Unknown state can be interpreted as a state in which the
+ * GNSS subsystem isn't confident enough that the user is either inside or
+ * outside the Geofence. It moves to Unknown state only after the expiry of the
+ * timeout.
+ *
+ * The geofence callback needs to be triggered for the ENTERED and EXITED
+ * transitions, when the GNSS system is confident that the user has entered
+ * (Inside state) or exited (Outside state) the Geofence. An implementation
+ * which uses a value of 95% as the confidence is recommended. The callback
+ * must be triggered only for the transitions requested by the
+ * addGeofenceArea method.
+ *
+ * Even though the diagram and explanation talks about states and transitions,
+ * the callee is only interested in the transistions. The states are mentioned
+ * here for illustrative purposes.
+ *
+ * Startup Scenario: When the device boots up, if an application adds geofences,
+ * and then we get an accurate GNSS location fix, it needs to trigger the
+ * appropriate (ENTERED or EXITED) transition for every Geofence it knows about.
+ * By default, all the Geofences will be in the Unknown state.
+ *
+ * When the GNSS system is unavailable, gnssGeofenceStatusCb must be
+ * called to inform the upper layers of the same. Similarly, when it becomes
+ * available the callback must be called. This is a global state while the
+ * UNKNOWN transition described above is per geofence.
+ *
+ * An important aspect to note is that users of this API (framework), will use
+ * other subsystems like wifi, sensors, cell to handle Unknown case and
+ * hopefully provide a definitive state transition to the third party
+ * application. GNSS Geofence will just be a signal indicating what the GNSS
+ * subsystem knows about the Geofence.
+ *
+ */
+
+interface IGnssGeofenceCallback {
+ enum GeofenceTransition : int32_t {
+ ENTERED = (1 << 0L),
+ EXITED = (1 << 1L),
+ UNCERTAIN = (1 << 2L),
+ };
+
+ enum GeofenceAvailability : int32_t {
+ UNAVAILABLE = (1 << 0L),
+ AVAILABLE = (1 << 1L),
+ };
+
+ enum GeofenceStatus : int32_t {
+ OPERATION_SUCCESS = 0,
+ ERROR_TOO_MANY_GEOFENCES = -100,
+ ERROR_ID_EXISTS = -101,
+ ERROR_ID_UNKNOWN = -102,
+ ERROR_INVALID_TRANSITION = -103,
+ ERROR_GENERIC = -149
+ };
+
+ /*
+ * The callback associated with the geofence transition.
+ * The callback must only be called when the caller is interested in that
+ * particular transition. For instance, if the caller is interested only in
+ * ENTERED transition, then the callback must not be called with the EXITED
+ * transition.
+ *
+ * IMPORTANT: If a transition is triggered resulting in this callback, the
+ * GNSS subsystem will wake up the application processor, if its in suspend
+ * state.
+ *
+ * @param geofenceId The id associated with the addGeofenceArea.
+ * @param location The current GNSS location.
+ * @param transition Can be one of ENTERED, EXITED or UNCERTAIN.
+ * @param timestamp Timestamp when the transition was detected.
+ *
+ */
+ gnssGeofenceTransitionCb(int32_t geofenceId, GnssLocation location,
+ GeofenceTransition transition, GnssUtcTime timestamp);
+
+ /*
+ * The callback associated with the availability of the GNSS system for
+ * geofencing monitoring. If the GNSS system determines that it cannot monitor
+ * geofences because of lack of reliability or unavailability of the GNSS
+ * signals, it will call this callback with UNAVAILABLE parameter.
+ *
+ * @param status - UNAVAILABLE or AVAILABLE.
+ * @param lastLocation - Last known location.
+ */
+ gnssGeofenceStatusCb(GeofenceAvailability status, GnssLocation lastLocation);
+
+ /*
+ * The callback associated with the addGeofence call.
+ *
+ * @param geofenceId Id of the geofence.
+ * @param status Will be OPERATION_SUCCESS if the geofence
+ * add was successful. Will be ERROR_TOO_MANY_GEOFENCES if the
+ * geofence limit has been reached.
+ * Will be ERROR_ID_EXISTS if geofence with id already exists.
+ * Will be ERROR_INVALID_TRANSITION if the monitorTransition contains an
+ * invalid transition.
+ * Will be ERROR_GENERIC for other errors.
+ */
+ gnssGeofenceAddCb(int32_t geofenceId, GeofenceStatus status);
+
+ /*
+ * The callback associated with the removeGeofence call.
+ *
+ * @param geofenceId Id of the geofence.
+ * @param status Will return OPERATION_SUCCESS if successful.
+ * Will be ERROR_ID_UNKNOWN for invalid id and
+ * ERROR_GENERIC for others.
+ */
+ gnssGeofenceRemoveCb(int32_t geofenceId, GeofenceStatus status);
+
+ /*
+ * The callback associated with the pauseGeofence call.
+ *
+ * @param geofenceId Id of the geofence.
+ * @param status Will be OPERATION_SUCCESS if success.
+ * Will be ERROR_ID_UNKNOWN for invalid id. Will be
+ * ERROR_INVALID_TRANSITION when monitorTransitions is invalid.
+ * Will be ERROR_GENERIC for other err errors.
+ */
+ gnssGeofencePauseCb(int32_t geofenceId, GeofenceStatus status);
+
+ /*
+ * The callback associated with the resumeGeofence call.
+ *
+ * @param geofenceId - Id of the geofence.
+ * @param status Will be OPERATION_SUCCESS if successful.
+ * Will be ERROR_ID_UNKNOWN for invalid id and ERROR_GENERIC for others.
+ */
+ gnssGeofenceResumeCb(int32_t geofenceId, GeofenceStatus status);
+};
diff --git a/gnss/1.0/IGnssGeofencing.hal b/gnss/1.0/IGnssGeofencing.hal
new file mode 100644
index 0000000..89301f4
--- /dev/null
+++ b/gnss/1.0/IGnssGeofencing.hal
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@1.0;
+
+import IGnssGeofenceCallback;
+
+/* Extended interface for GNSS Geofencing support */
+interface IGnssGeofencing {
+ /*
+ * Opens the geofence interface and provides the callback routines
+ * to the HAL.
+ *
+ * @param callback Handle to the IGnssGeofenceCallback interface.
+ */
+ setCallback(IGnssGeofenceCallback callback);
+
+ /*
+ * Add a geofence area. This api currently supports circular geofences.
+ *
+ * @param geofenceId The id for the geofence. If a geofence with this id
+ * already exists, an error value (ERROR_ID_EXISTS) must be returned.
+ * @param latitudeDegrees The latitude(in degrees) for the geofence lastTransition.
+ * @param longtitudeDegrees The longitude(in degrees) for the geofence lastTransition.
+ * @param radiusMeters The radius(in meters) for the geofence lastTransition.
+ * @param lastTransition The current state of the geofence. For example, if
+ * the system already knows that the user is inside the geofence, this will
+ * be set to ENTERED. In most cases, it will be UNCERTAIN.
+ * @param monitorTransitions - Which transitions to monitor. Bitwise OR of
+ * ENTERED, EXITED and UNCERTAIN.
+ * @param notificationResponsivenessMs - Defines the best-effort description
+ * of how soon must the callback be called when the transition associated
+ * with the Geofence is triggered. For instance, if set to 1000 millseconds
+ * with ENTERED, the callback must be called 1000 milliseconds within entering
+ * the geofence. This parameter is defined in milliseconds.
+ * NOTE: This is not to be confused with the rate that the GNSS is polled at.
+ * It is acceptable to dynamically vary the rate of sampling the GNSS for
+ * power-saving reasons; thus the rate of sampling may be faster or slower
+ * than this.
+ * @param unknownTimerMs - The time limit after which the UNCERTAIN transition
+ * must be triggered. This parameter is defined in milliseconds.
+ */
+ addGeofenceArea(int32_t geofenceId, double latitudeDegrees, double longitudeDegrees,
+ double radiusMeters, GeofenceTransition lastTransition,
+ int32_t monitorTransitions, uint32_t notificationResponsivenessMs,
+ uint32_t unknownTimerMs);
+
+ /*
+ * Pause monitoring a particular geofence.
+ *
+ * @param geofenceId The id for the geofence.
+ */
+ pauseGeofence(int32_t geofenceId);
+
+ /*
+ * Resume monitoring a particular geofence.
+ *
+ * @param geofenceId - The id for the geofence.
+ * @param monitorTransitions Specifies which transitions to monitor.
+ * It can be a bitwise OR of ENTERED, EXITED and
+ * UNCERTAIN. This supersedes the value associated
+ * provided in the addGeofenceArea call.
+ */
+ resumeGeofence(int32_t geofenceId, int32_t monitorTransitions);
+
+ /*
+ * Remove a geofence area. After the function returns, no notifications
+ * must be sent.
+ *
+ * @param geofenceId The id of the geofence.
+ */
+ removeGeofenceArea(int32_t geofenceId);
+};
diff --git a/gnss/1.0/IGnssMeasurement.hal b/gnss/1.0/IGnssMeasurement.hal
new file mode 100644
index 0000000..5156b32
--- /dev/null
+++ b/gnss/1.0/IGnssMeasurement.hal
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@1.0;
+
+import IGnssMeasurementCallback;
+
+/*
+ * Extended interface for GNSS Measurements support.
+ */
+interface IGnssMeasurement {
+ enum GnssMeasurementStatus : int32_t {
+ SUCCESS = 0,
+ ERROR_ALREADY_INIT = -100,
+ ERROR_GENERIC = -101
+ };
+
+ /*
+ * Initializes the interface and registers the callback routines with the HAL.
+ * After a successful call to 'setCallback' the HAL must begin to provide updates at
+ * an average output rate of 1Hz (occasional
+ * intra-measurement time offsets in the range from 0-2000msec can be
+ * tolerated.)
+ *
+ * @param callback Handle to GnssMeasurement callback interface.
+ *
+ * @return initRet Returns SUCCESS if successful.
+ * Returns ERROR_ALREADY_INIT if a callback has already been
+ * registered without a corresponding call to 'close'.
+ * Returns ERROR_GENERIC for any other error. The HAL must
+ * not generate any other updates upon returning this error code.
+ */
+ setCallback(IGnssMeasurementCallback callback) generates (int32_t initRet);
+
+ /*
+ * Stops updates from the HAL, and unregisters the callback routines.
+ * After a call to close(), the previously registered callbacks must be
+ * considered invalid by the HAL.
+ * If close() is invoked without a previous setCallback, this function must perform
+ * no work.
+ */
+ close();
+
+};
diff --git a/gnss/1.0/IGnssMeasurementCallback.hal b/gnss/1.0/IGnssMeasurementCallback.hal
new file mode 100644
index 0000000..3650892
--- /dev/null
+++ b/gnss/1.0/IGnssMeasurementCallback.hal
@@ -0,0 +1,554 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@1.0;
+
+/* The callback interface to report measurements from the HAL. */
+interface IGnssMeasurementCallback {
+ /*
+ * Flags to indicate what fields in GnssClock are valid.
+ */
+ enum GnssClockFlags : uint16_t {
+ /** A valid 'leap second' is stored in the data structure. */
+ HAS_LEAP_SECOND = 1 << 0,
+ /** A valid 'time uncertainty' is stored in the data structure. */
+ HAS_TIME_UNCERTAINTY = 1 << 1,
+ /** A valid 'full bias' is stored in the data structure. */
+ HAS_FULL_BIAS = 1 << 2,
+ /** A valid 'bias' is stored in the data structure. */
+ HAS_BIAS = 1 << 3,
+ /** A valid 'bias uncertainty' is stored in the data structure. */
+ HAS_BIAS_UNCERTAINTY = 1 << 4,
+ /** A valid 'drift' is stored in the data structure. */
+ HAS_DRIFT = 1 << 5,
+ /** A valid 'drift uncertainty' is stored in the data structure. */
+ HAS_DRIFT_UNCERTAINTY = 1 << 6
+ };
+
+ /*
+ * Flags to indicate what fields in GnssMeasurement are valid.
+ */
+ enum GnssMeasurementFlags : uint32_t {
+ /** A valid 'snr' is stored in the data structure. */
+ HAS_SNR = 1 << 0,
+ /** A valid 'carrier frequency' is stored in the data structure. */
+ HAS_CARRIER_FREQUENCY = 1 << 9,
+ /** A valid 'carrier cycles' is stored in the data structure. */
+ HAS_CARRIER_CYCLES = 1 << 10,
+ /** A valid 'carrier phase' is stored in the data structure. */
+ HAS_CARRIER_PHASE = 1 << 11,
+ /** A valid 'carrier phase uncertainty' is stored in the data structure. */
+ HAS_CARRIER_PHASE_UNCERTAINTY = 1 << 12
+ };
+
+ /*
+ * Enumeration of available values for the GNSS Measurement's multipath
+ * indicator.
+ */
+ enum GnssMultipathIndicator : uint8_t {
+ /** The indicator is not available or unknown. */
+ INDICATOR_UNKNOWN = 0,
+ /** The measurement is indicated to be affected by multipath. */
+ INDICATOR_PRESENT = 1,
+ /** The measurement is indicated to be not affected by multipath. */
+ INDICATIOR_NOT_PRESENT = 2
+ };
+
+ /*
+ * Flags indicating the GNSS measurement state.
+ *
+ * The expected behavior here is for GNSS HAL to set all the flags that applies.
+ * For example, if the state for a satellite is only C/A code locked and bit
+ * synchronized, and there is still millisecond ambiguity, the state must be
+ * set as:
+ *
+ * STATE_CODE_LOCK | STATE_BIT_SYNC | STATE_MSEC_AMBIGUOUS
+ *
+ * If GNSS is still searching for a satellite, the corresponding state must be
+ * set to STATE_UNKNOWN(0).
+ */
+ enum GnssMeasurementState : uint32_t {
+ STATE_UNKNOWN = 0,
+ STATE_CODE_LOCK = 1 << 0,
+ STATE_BIT_SYNC = 1 << 1,
+ STATE_SUBFRAME_SYNC = 1 << 2,
+ STATE_TOW_DECODED = 1 << 3,
+ STATE_MSEC_AMBIGUOUS = 1 << 4,
+ STATE_SYMBOL_SYNC = 1 << 5,
+ STATE_GLO_STRING_SYNC = 1 << 6,
+ STATE_GLO_TOD_DECODED = 1 << 7,
+ STATE_BDS_D2_BIT_SYNC = 1 << 8,
+ STATE_BDS_D2_SUBFRAME_SYNC = 1 << 9,
+ STATE_GAL_E1BC_CODE_LOCK = 1 << 10,
+ STATE_GAL_E1C_2ND_CODE_LOCK = 1 << 11,
+ STATE_GAL_E1B_PAGE_SYNC = 1 << 12,
+ STATE_SBAS_SYNC = 1 << 13
+ };
+
+ /*
+ * Flags indicating the Accumulated Delta Range's states.
+ */
+ enum GnssAccumulatedDeltaRangeState : uint16_t {
+ ADR_STATE_UNKNOWN = 0,
+ ADR_STATE_VALID = 1 << 0,
+ ADR_STATE_RESET = 1 << 1,
+ ADR_STATE_CYCLE_SLIP = 1 << 2,
+ };
+
+ /*
+ * Represents an estimate of the GNSS clock time.
+ */
+ struct GnssClock {
+ /*
+ * A set of flags indicating the validity of the fields in this data
+ * structure.
+ */
+ GnssClockFlags gnssClockFlags;
+
+ /*
+ * Leap second data.
+ * The sign of the value is defined by the following equation:
+ * utcTimeNs = timeNs - (fullBiasNs + biasNs) - leapSecond *
+ * 1,000,000,000
+ *
+ * If this data is available, gnssClockFlags must contain
+ * HAS_LEAP_SECOND.
+ */
+ int16_t leapSecond;
+
+ /*
+ * The GNSS receiver internal clock value. This is the local hardware clock
+ * value.
+ *
+ * For local hardware clock, this value is expected to be monotonically
+ * increasing while the hardware clock remains powered on. (For the case of a
+ * HW clock that is not continuously on, see the
+ * hwClockDiscontinuityCount field). The receiver's estimate of GNSS time
+ * can be derived by subtracting the sum of fullBiasNs and biasNs (when
+ * available) from this value.
+ *
+ * This GNSS time must be the best estimate of current GNSS time
+ * that GNSS receiver can achieve.
+ *
+ * Sub-nanosecond accuracy can be provided by means of the 'biasNs' field.
+ * The value contains the timeUncertaintyNs in it.
+ *
+ * This field is mandatory.
+ */
+ int64_t timeNs;
+
+ /*
+ * 1-Sigma uncertainty associated with the clock's time in nanoseconds.
+ * The uncertainty is represented as an absolute (single sided) value.
+ *
+ * If the data is available, gnssClockFlags must contain
+ * HAS_TIME_UNCERTAINTY. Ths value is ideally zero, as the time
+ * 'latched' by timeNs is defined as the reference clock vs. which all
+ * other times (and corresponding uncertainties) are measured.
+ */
+ double timeUncertaintyNs;
+
+ /*
+ * The difference between hardware clock ('time' field) inside GNSS receiver
+ * and the true GNSS time since 0000Z, January 6, 1980, in nanoseconds.
+ *
+ * The sign of the value is defined by the following equation:
+ * local estimate of GNSS time = timeNs - (fullBiasNs + biasNs)
+ *
+ * This value is mandatory if the receiver has estimated GNSS time. If the
+ * computed time is for a non-GNSS constellation, the time offset of that
+ * constellation to GNSS has to be applied to fill this value. The error
+ * estimate for the sum of this and the biasNs is the biasUncertaintyNs,
+ * and the caller is responsible for using this uncertainty (it can be very
+ * large before the GNSS time has been solved for.) If the data is available
+ * gnssClockFlags must contain HAS_FULL_BIAS.
+ */
+ int64_t fullBiasNs;
+
+ /*
+ * Sub-nanosecond bias.
+ * The error estimate for the sum of this and the fullBiasNs is the
+ * biasUncertaintyNs.
+ *
+ * If the data is available gnssClockFlags must contain HAS_BIAS. If GNSS
+ * has computed a position fix. This value is mandatory if the receiver has
+ * estimated GNSS time.
+ */
+ double biasNs;
+
+ /*
+ * 1-Sigma uncertainty associated with the local estimate of GNSS time (clock
+ * bias) in nanoseconds. The uncertainty is represented as an absolute
+ * (single sided) value.
+ *
+ * If the data is available gnssClockFlags must contain
+ * HAS_BIAS_UNCERTAINTY. This value is mandatory if the receiver
+ * has estimated GNSS time.
+ */
+ double biasUncertaintyNs;
+
+ /*
+ * The clock's drift in nanoseconds (per second).
+ *
+ * A positive value means that the frequency is higher than the nominal
+ * frequency, and that the (fullBiasNs + biasNs) is growing more positive
+ * over time.
+ *
+ * The value contains the 'drift uncertainty' in it.
+ * If the data is available gnssClockFlags must contain HAS_DRIFT.
+ *
+ * This value is mandatory if the receiver has estimated GNSS time.
+ */
+ double driftNsps;
+
+ /*
+ * 1-Sigma uncertainty associated with the clock's drift in nanoseconds (per
+ * second).
+ * The uncertainty is represented as an absolute (single sided) value.
+ *
+ * If the data is available gnssClockFlags must contain
+ * HAS_DRIFT_UNCERTAINTY. If GNSS has computed a position fix this
+ * field is mandatory and must be populated.
+ */
+ double driftUncertaintyNsps;
+
+ /*
+ * When there are any discontinuities in the HW clock, this field is
+ * mandatory.
+ *
+ * A "discontinuity" is meant to cover the case of a switch from one source
+ * of clock to another. A single free-running crystal oscillator (XO)
+ * will generally not have any discontinuities, and this can be set and
+ * left at 0.
+ *
+ * If, however, the timeNs value (HW clock) is derived from a composite of
+ * sources, that is not as smooth as a typical XO, or is otherwise stopped &
+ * restarted, then this value shall be incremented each time a discontinuity
+ * occurs. (E.g. this value can start at zero at device boot-up and
+ * increment each time there is a change in clock continuity. In the
+ * unlikely event that this value reaches full scale, rollover (not
+ * clamping) is required, such that this value continues to change, during
+ * subsequent discontinuity events.)
+ *
+ * While this number stays the same, between GnssClock reports, it can be
+ * safely assumed that the timeNs value has been running continuously, e.g.
+ * derived from a single, high quality clock (XO like, or better, that is
+ * typically used during continuous GNSS signal sampling.)
+ *
+ * It is expected, esp. during periods where there are few GNSS signals
+ * available, that the HW clock be discontinuity-free as long as possible,
+ * as this avoids the need to use (waste) a GNSS measurement to fully
+ * re-solve for the GNSS clock bias and drift, when using the accompanying
+ * measurements, from consecutive GnssData reports.
+ */
+ uint32_t hwClockDiscontinuityCount;
+
+ };
+
+ /*
+ * Represents a GNSS Measurement, it contains raw and computed information.
+ *
+ * All signal measurement information (e.g. svTime,
+ * pseudorangeRate, multipathIndicator) reported in this struct must be
+ * based on GNSS signal measurements only. You must not synthesize measurements
+ * by calculating or reporting expected measurements based on known or estimated
+ * position, velocity, or time.
+ */
+ struct GnssMeasurement{
+ /*
+ * A set of flags indicating the validity of the fields in this data
+ * structure.
+ */
+ GnssMeasurementFlags flags;
+
+ /*
+ * Satellite vehicle ID number, as defined in GnssSvInfo::svid
+ * This is a mandatory value.
+ */
+ int16_t svid;
+
+ /*
+ * Defines the constellation of the given SV.
+ */
+ GnssConstellationType constellation;
+
+ /*
+ * Time offset at which the measurement was taken in nanoseconds.
+ * The reference receiver's time is specified by GnssData::clock::timeNs.
+ *
+ * The sign of timeOffsetNs is given by the following equation:
+ * measurement time = GnssClock::timeNs + timeOffsetNs
+ *
+ * It provides an individual time-stamp for the measurement, and allows
+ * sub-nanosecond accuracy.
+ * This is a mandatory value.
+ */
+ double timeOffsetNs;
+
+ /*
+ * Per satellite sync state. It represents the current sync state for the
+ * associated satellite.
+ * Based on the sync state, the 'received GNSS tow' field must be interpreted
+ * accordingly.
+ *
+ * This is a mandatory value.
+ */
+ GnssMeasurementState state;
+
+ /*
+ * The received GNSS Time-of-Week at the measurement time, in nanoseconds.
+ * For GNSS & QZSS, this is the received GNSS Time-of-Week at the
+ * measurement time, in nanoseconds. The value is relative to the
+ * beginning of the current GNSS week.
+ *
+ * Given the highest sync state that can be achieved, per each satellite,
+ * valid range for this field can be:
+ * Searching : [ 0 ] : STATE_UNKNOWN
+ * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK set
+ * Bit sync : [ 0 20ms ] : STATE_BIT_SYNC set
+ * Subframe sync : [ 0 6s ] : STATE_SUBFRAME_SYNC set
+ * TOW decoded : [ 0 1week ] : STATE_TOW_DECODED set
+ *
+ * Note: If there is any ambiguity in integer millisecond,
+ * GNSS_MEASUREMENT_STATE_MSEC_AMBIGUOUS must be set accordingly, in the
+ * 'state' field.
+ *
+ * This value must be populated if 'state' != STATE_UNKNOWN.
+ *
+ * For Glonass, this is the received Glonass time of day, at the
+ * measurement time in nanoseconds.
+ *
+ * Given the highest sync state that can be achieved, per each satellite,
+ * valid range for this field can be:
+ * Searching : [ 0 ] : STATE_UNKNOWN set
+ * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK set
+ * Symbol sync : [ 0 10ms ] : STATE_SYMBOL_SYNC set
+ * Bit sync : [ 0 20ms ] : STATE_BIT_SYNC set
+ * String sync : [ 0 2s ] : STATE_GLO_STRING_SYNC set
+ * Time of day : [ 0 1day ] : STATE_GLO_TOW_DECODED set
+ *
+ * For Beidou, this is the received Beidou time of week,
+ * at the measurement time in nanoseconds.
+ *
+ * Given the highest sync state that can be achieved, per each satellite,
+ * valid range for this field can be:
+ * Searching : [ 0 ] : STATE_UNKNOWN set.
+ * C/A code lock: [ 0 1ms ] : STATE_CODE_LOCK set.
+ * Bit sync (D2): [ 0 2ms ] : STATE_BDS_D2_BIT_SYNC set.
+ * Bit sync (D1): [ 0 20ms ] : STATE_BIT_SYNC set.
+ * Subframe (D2): [ 0 0.6s ] : STATE_BDS_D2_SUBFRAME_SYNC set.
+ * Subframe (D1): [ 0 6s ] : STATE_SUBFRAME_SYNC set.
+ * Time of week : [ 0 1week ] : STATE_TOW_DECODED set.
+ *
+ * For Galileo, this is the received Galileo time of week,
+ * at the measurement time in nanoseconds.
+ *
+ * E1BC code lock : [ 0 4ms ] : STATE_GAL_E1BC_CODE_LOCK set.
+ * E1C 2nd code lock: [ 0 100ms] : STATE_GAL_E1C_2ND_CODE_LOCK set.
+ * E1B page : [ 0 2s ] : STATE_GAL_E1B_PAGE_SYNC set.
+ * Time of week : [ 0 1week] : STATE_TOW_DECODED is set.
+ *
+ * For SBAS, this is received SBAS time, at the measurement time in
+ * nanoseconds.
+ *
+ * Given the highest sync state that can be achieved, per each satellite,
+ * valid range for this field can be:
+ * Searching : [ 0 ] : STATE_UNKNOWN
+ * C/A code lock: [ 0 1ms ] : STATE_CODE_LOCK is set
+ * Symbol sync : [ 0 2ms ] : STATE_SYMBOL_SYNC is set
+ * Message : [ 0 1s ] : STATE_SBAS_SYNC is set
+ */
+ int64_t receivedSvTimeInNs;
+
+ /*
+ * 1-Sigma uncertainty of the Received GNSS Time-of-Week in nanoseconds.
+ *
+ * This value must be populated if 'state' != STATE_UNKNOWN.
+ */
+ int64_t receivedSvTimeUncertaintyInNs;
+
+ /*
+ * Carrier-to-noise density in dB-Hz, typically in the range [0, 63].
+ * It contains the measured C/N0 value for the signal at the antenna port.
+ *
+ * This is a mandatory value.
+ */
+ double cN0DbHz;
+
+ /*
+ * Pseudorange rate at the timestamp in m/s. The correction of a given
+ * Pseudorange Rate value includes corrections for receiver and satellite
+ * clock frequency errors. Ensure that this field is independent (see
+ * comment at top of GnssMeasurement struct.)
+ *
+ * It is mandatory to provide the 'uncorrected' 'pseudorange rate', and
+ * provide GnssClock's 'drift' field as well. When providing the
+ * uncorrected pseudorange rate, do not apply the corrections described above.)
+ *
+ * The value includes the 'pseudorange rate uncertainty' in it.
+ * A positive 'uncorrected' value indicates that the SV is moving away from
+ * the receiver.
+ *
+ * The sign of the 'uncorrected' 'pseudorange rate' and its relation to the
+ * sign of 'doppler shift' is given by the equation:
+ * pseudorange rate = -k * doppler shift (where k is a constant)
+ *
+ * This must be the most accurate pseudorange rate available, based on
+ * fresh signal measurements from this channel.
+ *
+ * It is mandatory that this value be provided at typical carrier phase PRR
+ * quality (few cm/sec per second of uncertainty, or better) - when signals
+ * are sufficiently strong & stable, e.g. signals from a GNSS simulator at >=
+ * 35 dB-Hz.
+ */
+ double pseudorangeRateMps;
+
+ /*
+ * 1-Sigma uncertainty of the pseudorangeRateMps.
+ * The uncertainty is represented as an absolute (single sided) value.
+ *
+ * This is a mandatory value.
+ */
+ double pseudorangeRateUncertaintyMps;
+
+ /*
+ * Accumulated delta range's state. It indicates whether ADR is reset or
+ * there is a cycle slip(indicating loss of lock).
+ *
+ * This is a mandatory value.
+ */
+ GnssAccumulatedDeltaRangeState accumulatedDeltaRangeState;
+
+ /*
+ * Accumulated delta range since the last channel reset in meters.
+ * A positive value indicates that the SV is moving away from the receiver.
+ *
+ * The sign of the 'accumulated delta range' and its relation to the sign of
+ * 'carrier phase' is given by the equation:
+ * accumulated delta range = -k * carrier phase (where k is a constant)
+ *
+ * This value must be populated if 'accumulated delta range state' !=
+ * ADR_STATE_UNKNOWN.
+ * However, it is expected that the data is only accurate when:
+ * 'accumulated delta range state' == ADR_STATE_VALID.
+ */
+ double accumulatedDeltaRangeM;
+
+ /*
+ * 1-Sigma uncertainty of the accumulated delta range in meters.
+ * This value must be populated if 'accumulated delta range state' !=
+ * ADR_STATE_UNKNOWN.
+ */
+ double accumulatedDeltaRangeUncertaintyM;
+
+ /*
+ * Carrier frequency at which codes and messages are modulated, it can
+ * be L1 or L2. If the field is not set, the carrier frequency is
+ * assumed to be L1.
+ *
+ * If the data is available, gnssClockFlags must contain
+ * HAS_CARRIER_FREQUENCY.
+ */
+ float carrierFrequencyHz;
+
+ /*
+ * The number of full carrier cycles between the satellite and the
+ * receiver. The reference frequency is given by the field
+ * 'carrierFrequencyHz'. Indications of possible cycle slips and
+ * resets in the accumulation of this value can be inferred from the
+ * accumulatedDeltaRangeState flags.
+ *
+ * If the data is available, gnssClockFlags must contain
+ * HAS_CARRIER_CYCLES.
+ */
+ int64_t carrierCycles;
+
+ /*
+ * The RF phase detected by the receiver, in the range [0.0, 1.0].
+ * This is usually the fractional part of the complete carrier phase
+ * measurement.
+ *
+ * The reference frequency is given by the field 'carrierFrequencyHz'.
+ * The value contains the 'carrier-phase uncertainty' in it.
+ *
+ * If the data is available, gnssClockFlags must contain
+ * HAS_CARRIER_PHASE.
+ */
+ double carrierPhase;
+
+ /*
+ * 1-Sigma uncertainty of the carrier-phase.
+ * If the data is available, gnssClockFlags must contain
+ * HAS_CARRIER_PHASE_UNCERTAINTY.
+ */
+ double carrierPhaseUncertainty;
+
+ /*
+ * An enumeration that indicates the 'multipath' state of the event.
+ *
+ * The multipath Indicator is intended to report the presence of overlapping
+ * signals that manifest as distorted correlation peaks.
+ *
+ * - if there is a distorted correlation peak shape, report that multipath
+ * is MULTIPATH_INDICATOR_PRESENT.
+ * - if there is no distorted correlation peak shape, report
+ * MULTIPATH_INDICATOR_NOT_PRESENT
+ * - if signals are too weak to discern this information, report
+ * MULTIPATH_INDICATOR_UNKNOWN
+ *
+ * Example: when doing the standardized overlapping Multipath Performance
+ * test (3GPP TS 34.171) the Multipath indicator must report
+ * MULTIPATH_INDICATOR_PRESENT for those signals that are tracked, and
+ * contain multipath, and MULTIPATH_INDICATOR_NOT_PRESENT for those
+ * signals that are tracked and do not contain multipath.
+ */
+ GnssMultipathIndicator multipathIndicator;
+
+ /*
+ * Signal-to-noise ratio at correlator output in dB.
+ * If the data is available, gnssClockFlags must contain MEASUREMENT_HAS_SNR.
+ * This is the power ratio of the "correlation peak height above the
+ * observed noise floor" to "the noise RMS".
+ */
+ double snrDb;
+ };
+
+ /*
+ * Represents a reading of GNSS measurements. For devices where GnssSystemInfo's
+ * yearOfHw is set to 2016+, it is mandatory that these be provided, on
+ * request, when the GNSS receiver is searching/tracking signals.
+ *
+ * - Reporting of GNSS constellation measurements is mandatory.
+ * - Reporting of all tracked constellations are encouraged.
+ */
+ struct GnssData {
+ /* Number of GnssMeasurement elements. */
+ uint32_t measurementCount;
+
+ /* The array of measurements. */
+ GnssMeasurement[ConstS32:GNSS_MAX_MEASUREMENT] measurements;
+
+ /** The GNSS clock time reading. */
+ GnssClock clock;
+ };
+
+ /*
+ * Callback for the hal to pass a GnssData structure back to the client.
+ *
+ * @param data Contains a reading of GNSS measurements.
+ */
+ GnssMeasurementCb(GnssData data);
+};
diff --git a/gnss/1.0/IGnssNavigationMessage.hal b/gnss/1.0/IGnssNavigationMessage.hal
new file mode 100644
index 0000000..d59b538
--- /dev/null
+++ b/gnss/1.0/IGnssNavigationMessage.hal
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@1.0;
+
+import IGnssNavigationMessageCallback;
+
+/*
+ * Extended interface for GNSS navigation message reporting support.
+ */
+interface IGnssNavigationMessage {
+ enum GnssNavigationMessageStatus : int32_t {
+ SUCCESS = 0,
+ ERROR_ALREADY_INIT = -100,
+ ERROR_GENERIC = -101
+ };
+
+ /*
+ * Initializes the interface and registers the callback routines with the HAL.
+ * After a successful call to 'setCallback' the HAL must begin to provide updates as
+ * they become available.
+ * @param callback handle to IGnssNavigationMessageCallack interface.
+ *
+ * @return initRet Returns SUCCESS if the operation
+ * is successful.
+ * Returns ERROR_ALREADY_INIT if a callback has
+ * already been registered without a corresponding call to close().
+ * Returns ERROR_GENERIC if any other error occurred. It is
+ * expected that the HAL will not generate any updates upon returning
+ * this error code.
+ */
+ setCallback(IGnssNavigationMessageCallback callback) generates (int32_t initRet);
+
+ /*
+ * Stops updates from the HAL, and unregisters the callback routines.
+ * After a call to close(), the previously registered callbacks must be
+ * considered invalid by the HAL.
+ * If close() is invoked without a previous setCallback, this function must perform
+ * no work.
+ */
+ close();
+};
diff --git a/gnss/1.0/IGnssNavigationMessageCallback.hal b/gnss/1.0/IGnssNavigationMessageCallback.hal
new file mode 100644
index 0000000..a714fd7
--- /dev/null
+++ b/gnss/1.0/IGnssNavigationMessageCallback.hal
@@ -0,0 +1,166 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@1.0;
+
+/** Represents a GNSS navigation message (or a fragment of it). */
+interface IGnssNavigationMessageCallback {
+ /*
+ * Enumeration of available values to indicate the GNSS Navigation message
+ * types.
+ *
+ * For convenience, first byte is the GnssConstellationType on which that signal
+ * is typically transmitted.
+ */
+ enum GnssNavigationMessageType : int16_t {
+ TYPE_UNKNOWN = 0,
+ /** GNSS L1 C/A message contained in the structure. */
+ GNSS_L1CA = 0x0101,
+ /** GNSS L2-CNAV message contained in the structure. */
+ GNSS_L2CNAV = 0x0102,
+ /** GNSS L5-CNAV message contained in the structure. */
+ GNSS_L5CNAV = 0x0103,
+ /** GNSS CNAV-2 message contained in the structure. */
+ GNSS_CNAV2 = 0x0104,
+ /** Glonass L1 CA message contained in the structure. */
+ GLO_L1CA = 0x0301,
+ /** Beidou D1 message contained in the structure. */
+ BDS_D1 = 0x0501,
+ /** Beidou D2 message contained in the structure. */
+ BDS_D2 = 0x0502,
+ /** Galileo I/NAV message contained in the structure. */
+ GAL_I = 0x0601,
+ /** Galileo F/NAV message contained in the structure. */
+ GAL_F = 0x0602
+ };
+
+ /*
+ * Status of Navigation Message
+ * When a message is received properly without any parity error in its
+ * navigation words, the status must be set to PARITY_PASSED. But if a message is
+ * received with words that failed parity check, but GNSS is able to correct
+ * those words, the status must be set to PARITY_REBUILT.
+ * No need to send any navigation message that contains words with parity error
+ * and cannot be corrected.
+ */
+ enum NavigationMessageStatus : uint16_t {
+ PARITY_PASSED = (1 << 0),
+ PARITY_REBUILT = (1 << 1),
+ STATUS_UNKOWN = 0
+ };
+
+ struct GnssNavigationMessage {
+ /*
+ * Satellite vehicle ID number, as defined in GnssSvInfo::svid
+ * This is a mandatory value.
+ */
+ int16_t svid;
+
+ /*
+ * The type of message contained in the structure.
+ * This is a mandatory value.
+ */
+ GnssNavigationMessageType type;
+
+ /*
+ * The status of the received navigation message.
+ * No need to send any navigation message that contains words with parity
+ * error and cannot be corrected.
+ */
+ NavigationMessageStatus status;
+
+ /*
+ * Message identifier. It provides an index so the complete Navigation
+ * Message can be assembled.
+ *
+ * - For GNSS L1 C/A subframe 4 and 5, this value corresponds to the 'frame
+ * id' of the navigation message, in the range of 1-25 (Subframe 1, 2, 3
+ * does not contain a 'frame id' and this value can be set to -1.)
+ *
+ * - For Glonass L1 C/A, this refers to the frame ID, in the range of 1-5.
+ *
+ * - For BeiDou D1, this refers to the frame number in the range of 1-24
+ *
+ * - For Beidou D2, this refers to the frame number, in the range of 1-120
+ *
+ * - For Galileo F/NAV nominal frame structure, this refers to the subframe
+ * number, in the range of 1-12
+ *
+ * - For Galileo I/NAV nominal frame structure, this refers to the subframe
+ * number in the range of 1-24
+ */
+ int16_t messageId;
+
+ /*
+ * Sub-message identifier. If required by the message 'type', this value
+ * contains a sub-index within the current message (or frame) that is being
+ * transmitted.
+ *
+ * - For GNSS L1 C/A, BeiDou D1 & BeiDou D2, the submessage id corresponds to
+ * the subframe number of the navigation message, in the range of 1-5.
+ *
+ * - For Glonass L1 C/A, this refers to the String number, in the range from
+ * 1-15
+ *
+ * - For Galileo F/NAV, this refers to the page type in the range 1-6
+ *
+ * - For Galileo I/NAV, this refers to the word type in the range 1-10+
+ */
+ int16_t submessageId;
+
+ /*
+ * The data of the reported GNSS message. The bytes (or words) are specified
+ * using big endian format (MSB first). The data is stored and decoded
+ * in a server for research purposes.
+ *
+ * - For GNSS L1 C/A, Beidou D1 & Beidou D2, each subframe contains 10 30-bit
+ * words. Each word (30 bits) must fit into the last 30 bits in a
+ * 4-byte word (skip B31 and B32), with MSB first, for a total of 40
+ * bytes, covering a time period of 6, 6, and 0.6 seconds, respectively.
+ * The standard followed is 1995 SPS Signal specification.
+ *
+ * - For Glonass L1 C/A, each string contains 85 data bits, including the
+ * checksum. These bits must fit into 11 bytes, with MSB first (skip
+ * B86-B88), covering a time period of 2 seconds.
+ * The standard followed is Glonass Interface Control Document Edition 5.1.
+ *
+ * - For Galileo F/NAV, each word consists of 238-bit (sync & tail symbols
+ * excluded). Each word must fit into 30-bytes, with MSB first (skip
+ * B239, B240), covering a time period of 10 seconds. The standard
+ * followed is European GNSS(Galileo) Signal in Space Interface
+ * Control Document Issue 1.2.
+ *
+ * - For Galileo I/NAV, each page contains 2 page parts, even and odd, with
+ * a total of 2x114 = 228 bits, (sync & tail excluded) that must fit
+ * into 29 bytes, with MSB first (skip B229-B232). The standard followed
+ * is same as above.
+ *
+ * TODO(b/32022567): Describe this relationship with data to the VTS
+ * via custom annotations and plug in a VTS test to verify that the data
+ * correctly follows the standard.
+ *
+ */
+ vec<uint8_t> data;
+ };
+
+ /*
+ * The callback to report an available fragment of a GNSS navigation messages
+ * from the HAL.
+ *
+ * @param message - The GNSS navigation submessage/subframe representation.
+ */
+ gnssNavigationMessageCb(GnssNavigationMessage message);
+};
diff --git a/gnss/1.0/IGnssNi.hal b/gnss/1.0/IGnssNi.hal
new file mode 100644
index 0000000..c823bf0
--- /dev/null
+++ b/gnss/1.0/IGnssNi.hal
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@1.0;
+import IGnssNiCallback;
+
+/*
+ * Extended interface for Network-initiated (NI) support. This interface is used
+ * to respond to NI notifications originating from the HAL.
+ */
+interface IGnssNi {
+ /*
+ * Registers the callbacks for HAL to use.
+ *
+ * @param callback handle to IGnssNiCallback interface.
+ */
+ setCallback(IGnssNiCallback callback);
+
+ /*
+ * Sends a response to HAL.
+ *
+ * @param notifId An ID generated by HAL to associate NI notifications and
+ * framework responses.
+ * @param userResponse A GNSS Ni response indicating if the notification was
+ * accepted, denied or not responded to.
+ */
+ respond(int32_t notifId, GnssUserResponseType userResponse);
+};
diff --git a/gnss/1.0/IGnssNiCallback.hal b/gnss/1.0/IGnssNiCallback.hal
new file mode 100644
index 0000000..c696a92
--- /dev/null
+++ b/gnss/1.0/IGnssNiCallback.hal
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@1.0;
+
+/* GNSS Network Initiated callback interface. */
+interface IGnssNiCallback {
+ /*
+ * GnssNiType constants
+ */
+ enum GnssNiType : uint32_t {
+ VOICE = 1,
+ UMTS_SUPL = 2,
+ UMTS_CTRL_PLANE = 3
+ };
+
+ /*
+ * GnssNiNotifyFlags constants
+ */
+ enum GnssNiNotifyFlags : uint32_t {
+ /** NI requires notification */
+ NEED_NOTIFY = 0x0001,
+ /** NI requires verification */
+ NEED_VERIFY = 0x0002,
+ /** NI requires privacy override, no notification/minimal trace */
+ PRIVACY_OVERRIDE = 0x0004,
+ };
+
+ /*
+ * GNSS NI responses, used to define the response in
+ * NI structures
+ */
+ enum GnssUserResponseType : int32_t {
+ RESPONSE_ACCEPT = 1,
+ RESPONSE_DENY = 2,
+ RESPONSE_NORESP = 3,
+ };
+
+ /*
+ * NI data encoding scheme
+ */
+ enum GnssNiEncodingType : int32_t {
+ ENC_NONE = 0,
+ ENC_SUPL_GSM_DEFAULT = 1,
+ ENC_SUPL_UTF8 = 2,
+ ENC_SUPL_UCS2 = 3,
+ ENC_UNKNOWN = -1,
+ };
+
+ /** Represents an NI request */
+ struct GnssNiNotification{
+ /*
+ * An ID generated by HAL to associate NI notifications and UI
+ * responses.
+ */
+ int32_t notificationId;
+
+ /*
+ * A type used to distinguish different categories of NI
+ * events, such as VOICE, UMTS_SUPL etc.
+ */
+ GnssNiType niType;
+
+ /*
+ * Notification/verification options, combinations of GnssNiNotifyFlags
+ * constants.
+ */
+ GnssNiNotifyFlags notifyFlags;
+
+ /*
+ * Timeout period to wait for user response.
+ * Set to 0 for no timeout limit. Specified in seconds.
+ */
+ uint32_t timeoutSec;
+
+ /*
+ * Default response when timeout.
+ */
+ GnssUserResponseType defaultResponse;
+
+ /*
+ * String representing the requester of the network inititated location
+ * request.
+ */
+ string requestorId;
+
+ /*
+ * Notification message. String representing the service(for eg. SUPL-service)
+ * who sent the network initiated location request.
+ */
+ string notificationMessage;
+
+ /*
+ * requestorId decoding scheme.
+ */
+ GnssNiEncodingType requestorIdEncoding;
+
+ /*
+ * notificationId decoding scheme
+ */
+ GnssNiEncodingType notificationIdEncoding;
+ };
+
+ /*
+ * Callback with a network initiated request.
+ *
+ * @param notification network initiated request.
+ */
+ niNotifyCb(GnssNiNotification notification);
+};
diff --git a/gnss/1.0/IGnssXtra.hal b/gnss/1.0/IGnssXtra.hal
new file mode 100644
index 0000000..5222fde
--- /dev/null
+++ b/gnss/1.0/IGnssXtra.hal
@@ -0,0 +1,27 @@
+package android.hardware.gnss@1.0;
+import IGnssXtraCallback;
+
+/*
+ * This interface is used by the GNSS HAL to request the framework
+ * to download XTRA data.
+ */
+interface IGnssXtra {
+ /*
+ * Opens the XTRA interface and provides the callback routines
+ * to the implementation of this interface.
+ *
+ * @param callback Handle to the IGnssXtraCallback interface.
+ *
+ * @return success True if the operation is successful.
+ */
+ setCallback(IGnssXtraCallback callback) generates (bool success);
+
+ /*
+ * Inject the downloaded XTRA data into the GNSS receiver.
+ *
+ * @param xtraData GNSS XTRA data.
+ *
+ * @return success True if the operation is successful.
+ */
+ injectXtraData(string xtraData) generates (bool success);
+};
diff --git a/gnss/1.0/IGnssXtraCallback.hal b/gnss/1.0/IGnssXtraCallback.hal
new file mode 100644
index 0000000..42df082
--- /dev/null
+++ b/gnss/1.0/IGnssXtraCallback.hal
@@ -0,0 +1,12 @@
+package android.hardware.gnss@1.0;
+
+/*
+ * This interface is used by the GNSS HAL to request download of XTRA data.
+ */
+interface IGnssXtraCallback {
+ /*
+ * Callback to request the client to download XTRA data. The client should
+ * download XTRA data and inject it by calling injectXtraData().
+ */
+ downloadRequestCb();
+};
diff --git a/gnss/1.0/types.hal b/gnss/1.0/types.hal
new file mode 100644
index 0000000..3120648
--- /dev/null
+++ b/gnss/1.0/types.hal
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@1.0;
+
+enum ConstS32 : int32_t {
+/** Maximum number of SVs for gnssSvStatusCb(). */
+ GNSS_MAX_SVS = 64,
+
+/* Maximum number of Measurements in gnssMeasurementCb(). */
+ GNSS_MAX_MEASUREMENT = 64,
+};
+
+/* Milliseconds since January 1, 1970 */
+typedef int64_t GnssUtcTime;
+
+/*
+ * Constellation type of GnssSvInfo
+ */
+enum GnssConstellationType : uint8_t {
+ UNKNOWN = 0,
+ GNSS = 1,
+ SBAS = 2,
+ GLONASS = 3,
+ QZSS = 4,
+ BEIDOU = 5,
+ GALILEO = 6,
+};
+
+/* Represents a location. */
+struct GnssLocation {
+ /* Contains GnssLocationFlags bits. */
+ uint16_t gnssLocationFlags;
+
+ /* Represents latitude in degrees. */
+ double latitude;
+
+ /* Represents longitude in degrees. */
+ double longitude;
+
+ /*
+ * Represents altitude in meters above the WGS 84 reference ellipsoid.
+ */
+ double altitude;
+
+ /* Represents speed in meters per second. */
+ float speedMetersperSec;
+
+ /* Represents heading in degrees. */
+ float bearingDegrees;
+
+ /* Represents expected accuracy in meters. */
+ float accuracyMeters;
+
+ /* Timestamp for the location fix. */
+ GnssUtcTime timestamp;
+
+};