2016-09-22 23:07:22 +02:00
|
|
|
/*
|
|
|
|
* 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;
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* 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 {
|
2017-03-29 01:19:16 +02:00
|
|
|
/** Flags for the gnssSetCapabilities callback. */
|
2016-11-22 17:17:23 +01:00
|
|
|
@export(name="", value_prefix="GPS_CAPABILITY_")
|
2016-09-22 23:07:22 +02:00
|
|
|
enum Capabilities : uint32_t {
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* 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.
|
|
|
|
*/
|
2017-01-11 23:04:21 +01:00
|
|
|
SCHEDULING = 1 << 0,
|
2016-09-22 23:07:22 +02:00
|
|
|
/** GNSS supports MS-Based AGNSS mode */
|
2017-01-11 23:04:21 +01:00
|
|
|
MSB = 1 << 1,
|
2016-09-22 23:07:22 +02:00
|
|
|
/** GNSS supports MS-Assisted AGNSS mode */
|
2017-01-11 23:04:21 +01:00
|
|
|
MSA = 1 << 2,
|
2016-09-22 23:07:22 +02:00
|
|
|
/** GNSS supports single-shot fixes */
|
2017-01-11 23:04:21 +01:00
|
|
|
SINGLE_SHOT = 1 << 3,
|
2023-01-19 14:52:00 +01:00
|
|
|
/**
|
|
|
|
* The platform periodically injects time to GNSS in addition to
|
|
|
|
* on-demand and occasional time updates.
|
|
|
|
*
|
|
|
|
* Note: The naming of "on demand" should be "periodic" instead. This
|
|
|
|
* is the result of a historic implementation bug, b/73893222.
|
|
|
|
*/
|
2017-01-11 23:04:21 +01:00
|
|
|
ON_DEMAND_TIME = 1 << 4,
|
2016-09-22 23:07:22 +02:00
|
|
|
/** GNSS supports Geofencing */
|
2017-01-11 23:04:21 +01:00
|
|
|
GEOFENCING = 1 << 5,
|
|
|
|
/** GNSS supports Measurements for at least GPS. */
|
|
|
|
MEASUREMENTS = 1 << 6,
|
2016-09-22 23:07:22 +02:00
|
|
|
/** GNSS supports Navigation Messages */
|
2017-01-11 23:04:21 +01:00
|
|
|
NAV_MESSAGES = 1 << 7
|
2016-09-22 23:07:22 +02:00
|
|
|
};
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/** GNSS status event values. */
|
2016-11-22 17:17:23 +01:00
|
|
|
@export(name="", value_prefix="GPS_STATUS_")
|
2016-11-02 18:20:07 +01:00
|
|
|
enum GnssStatusValue : uint8_t {
|
2016-09-22 23:07:22 +02:00
|
|
|
/** GNSS status unknown. */
|
2016-11-02 18:20:07 +01:00
|
|
|
NONE = 0,
|
2016-09-22 23:07:22 +02:00
|
|
|
/** 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
|
|
|
|
};
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* Flags that indicate information about the satellite
|
|
|
|
*/
|
2016-11-22 17:17:23 +01:00
|
|
|
@export(name="", value_prefix="GNSS_SV_FLAGS_")
|
2016-09-22 23:07:22 +02:00
|
|
|
enum GnssSvFlags : uint8_t {
|
2017-01-11 23:04:21 +01:00
|
|
|
NONE = 0,
|
|
|
|
HAS_EPHEMERIS_DATA = 1 << 0,
|
|
|
|
HAS_ALMANAC_DATA = 1 << 1,
|
|
|
|
USED_IN_FIX = 1 << 2,
|
|
|
|
HAS_CARRIER_FREQUENCY = 1 << 3
|
2016-09-22 23:07:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct GnssSvInfo {
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2017-10-19 19:59:24 +02:00
|
|
|
* Pseudo-random or satellite ID number for the satellite, a.k.a. Space Vehicle (SV), or
|
|
|
|
* FCN/OSN number for Glonass. The distinction is made by looking at constellation field.
|
|
|
|
* Values must be in the range of:
|
2016-09-22 23:07:22 +02:00
|
|
|
*
|
|
|
|
* - 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
|
2020-01-14 20:04:48 +01:00
|
|
|
* - IRNSS: 1-14
|
2016-09-22 23:07:22 +02:00
|
|
|
*/
|
|
|
|
int16_t svid;
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* Defines the constellation of the given SV.
|
|
|
|
*/
|
|
|
|
GnssConstellationType constellation;
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* 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;
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2017-01-11 23:04:21 +01:00
|
|
|
* Carrier frequency of the signal tracked, for example it can be the
|
2017-01-20 09:00:42 +01:00
|
|
|
* GPS central frequency for L1 = 1575.45 MHz, or L2 = 1227.60 MHz, L5 =
|
2018-11-06 20:20:59 +01:00
|
|
|
* 1176.45 MHz, varying GLO channels, etc. If the field is zero, it is
|
|
|
|
* the primary common use central frequency, e.g. L1 = 1575.45 MHz for
|
|
|
|
* GPS.
|
2017-01-20 09:00:42 +01:00
|
|
|
*
|
|
|
|
* For an L1, L5 receiver tracking a satellite on L1 and L5 at the same
|
|
|
|
* time, two GnssSvInfo structs must be reported for this same
|
|
|
|
* satellite, in one of the structs, all the values related
|
|
|
|
* to L1 must be filled, and in the other all of the values related to
|
|
|
|
* L5 must be filled.
|
2017-01-11 23:04:21 +01:00
|
|
|
*
|
2018-11-06 20:20:59 +01:00
|
|
|
* If the data is available, svFlag must contain HAS_CARRIER_FREQUENCY.
|
2017-01-11 23:04:21 +01:00
|
|
|
*/
|
|
|
|
float carrierFrequencyHz;
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* Contains additional data about the given SV.
|
|
|
|
*/
|
2016-12-05 21:35:05 +01:00
|
|
|
bitfield<GnssSvFlags> svFlag;
|
2016-09-22 23:07:22 +02:00
|
|
|
};
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* Represents SV status.
|
|
|
|
*/
|
|
|
|
struct GnssSvStatus {
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* Number of GNSS SVs currently visible, refers to the SVs stored in sv_list
|
|
|
|
*/
|
2016-11-02 18:20:07 +01:00
|
|
|
uint32_t numSvs;
|
2016-09-22 23:07:22 +02:00
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* Pointer to an array of SVs information for all GNSS constellations,
|
|
|
|
* except GNSS, which is reported using svList
|
|
|
|
*/
|
2016-11-02 18:20:07 +01:00
|
|
|
GnssSvInfo[GnssMax:SVS_COUNT] gnssSvList;
|
2016-09-22 23:07:22 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* Called when a GNSS location is available.
|
|
|
|
*
|
|
|
|
* @param location Location information from HAL.
|
|
|
|
*/
|
|
|
|
gnssLocationCb(GnssLocation location);
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* Called to communicate the status of the GNSS engine.
|
|
|
|
*
|
|
|
|
* @param status Status information from HAL.
|
|
|
|
*/
|
|
|
|
gnssStatusCb(GnssStatusValue status);
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* @param svInfo SV status information from HAL.
|
|
|
|
*/
|
|
|
|
gnssSvStatusCb(GnssSvStatus svInfo);
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* 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);
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* Callback to inform framework of the GNSS engine's capabilities.
|
|
|
|
*
|
|
|
|
* @param capabilities Capability parameter is a bit field of
|
|
|
|
* the Capabilities enum.
|
|
|
|
*/
|
2016-12-06 02:16:09 +01:00
|
|
|
gnssSetCapabilitesCb(bitfield<Capabilities> capabilities);
|
2016-09-22 23:07:22 +02:00
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* 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();
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* 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{
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* year in which the last update was made to the underlying hardware/firmware
|
|
|
|
* used to capture GNSS signals, e.g. 2016
|
|
|
|
*/
|
|
|
|
uint16_t yearOfHw;
|
|
|
|
};
|
|
|
|
|
2017-03-29 01:19:16 +02:00
|
|
|
/**
|
2016-09-22 23:07:22 +02:00
|
|
|
* Callback to inform framework of the engine's hardware version information.
|
|
|
|
*
|
|
|
|
* @param info GnssSystemInfo about the GPS/GNSS hardware.
|
|
|
|
*/
|
|
|
|
gnssSetSystemInfoCb(GnssSystemInfo info);
|
|
|
|
};
|