blob: d32bc63940541fff40395d2127aba3bcfed5427d [file] [log] [blame]
/*
* 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 IGnssBatching;
import IGnssCallback;
import IGnssConfiguration;
import IGnssDebug;
import IGnssMeasurement;
import IGnssNavigationMessage;
import IGnssGeofencing;
import IGnssNi;
import IGnssXtra;
/** Represents the standard GNSS (Global Navigation Satellite System) interface. */
interface IGnss {
/** Requested operational mode for GNSS operation. */
@export(name="", value_prefix="GPS_POSITION_MODE_")
enum GnssPositionMode : uint8_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. */
@export(name="", value_prefix="GPS_POSITION_")
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().
*/
@export(name="", value_prefix="GPS_")
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.
*
* The framework calls this method to instruct the GPS engine to prepare for serving requests
* from the framework. The GNSS HAL implementation must respond to all GNSS requests from the
* framework upon successful return from this method until cleanup() method is called to
* close this interface.
*
* @param callback Callback interface for IGnss.
*
* @return success Returns true on success.
*/
setCallback(IGnssCallback callback) generates (bool success);
/**
* Starts a location output stream using the IGnssCallback
* gnssLocationCb(), following the settings from the most recent call to
* setPositionMode().
*
* This output must operate independently of any GNSS location batching
* operations, see the IGnssBatching.hal for details.
*
* @return success Returns true on success.
*/
start() generates (bool success);
/**
* Stops the location output stream.
*
* @return success Returns true on success.
*/
stop() generates (bool success);
/**
* Closes the interface.
*
* The cleanup() method is called by the framework to tell the GNSS HAL implementation to
* not expect any GNSS requests in the immediate future - e.g. this may be called when
* location is disabled by a user setting or low battery conditions. The GNSS HAL
* implementation must immediately stop responding to any existing requests until the
* setCallback() method is called again and the requests are re-initiated by the framework.
*
* After this method is called, the GNSS HAL implementation may choose to modify GNSS hardware
* states to save power. It is expected that when setCallback() method is called again to
* reopen this interface, to serve requests, there may be some minor delays in GNSS response
* requests as hardware readiness states are restored, not to exceed those that occur on normal
* device boot up.
*/
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);
/**
* Sets the GnssPositionMode parameter,its associated recurrence value,
* the time between fixes,requested fix accuracy and time to first fix.
*
* @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 position 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 aGnssRilIface Handle to the IAGnssRil interface.
*/
getExtensionAGnssRil() generates (IAGnssRil aGnssRilIface);
/**
* This method returns the IGnssGeofencing Interface.
*
* @return gnssGeofencingIface Handle to the IGnssGeofencing interface.
*/
getExtensionGnssGeofencing() generates(IGnssGeofencing gnssGeofencingIface);
/**
* This method returns the IAGnss Interface.
*
* @return aGnssIface Handle to the IAGnss interface.
*/
getExtensionAGnss() generates (IAGnss aGnssIface);
/**
* This method returns the IGnssNi interface.
*
* @return gnssNiIface Handle to the IGnssNi interface.
*/
getExtensionGnssNi() generates (IGnssNi gnssNiIface);
/**
* This method returns the IGnssMeasurement interface.
*
* @return gnssMeasurementIface Handle to the IGnssMeasurement interface.
*/
getExtensionGnssMeasurement() generates (IGnssMeasurement gnssMeasurementIface);
/**
* This method returns the IGnssNavigationMessage interface.
*
* @return gnssNavigationIface gnssNavigationIface to the IGnssNavigationMessage interface.
*/
getExtensionGnssNavigationMessage() generates (IGnssNavigationMessage gnssNavigationIface);
/**
* This method returns the IGnssXtra interface.
*
* @return xtraIface Handle to the IGnssXtra interface.
*/
getExtensionXtra() generates (IGnssXtra xtraIface);
/**
* This method returns the IGnssConfiguration interface.
*
* @return gnssConfigIface Handle to the IGnssConfiguration interface.
*/
getExtensionGnssConfiguration() generates (IGnssConfiguration gnssConfigIface);
/**
* This method returns the IGnssDebug interface.
*
* @return debugIface Handle to the IGnssDebug interface.
*/
getExtensionGnssDebug() generates (IGnssDebug debugIface);
/**
* This method returns the IGnssBatching interface.
*
* @return batchingIface Handle to the IGnssBatching interface.
*/
getExtensionGnssBatching() generates (IGnssBatching batchingIface);
};