summaryrefslogtreecommitdiff
path: root/location
diff options
context:
space:
mode:
authorWei Chen <weic@codeaurora.org>2018-09-19 10:59:28 -0700
committerWei Chen <weic@codeaurora.org>2018-10-08 12:26:06 -0700
commit21b9c4e47ed5811f53d764c38943e3b971bde5e8 (patch)
tree7050d4d2124d0ff0abd72605cd4a58598892d6a6 /location
parent5b53be1d9e037a197cdc56b65c73543c63051df1 (diff)
downloadgps-21b9c4e47ed5811f53d764c38943e3b971bde5e8.tar.gz
FR48381: Support leap second change event
Support leap second change event (1) Info will be available in location api and location client api (2) Engine hub aggregator will use the info to calculate UTC timestamp Change-Id: Ie79c1a38301fa094134a4a31af424487758343f6 CRs-fixed: 2289457
Diffstat (limited to 'location')
-rw-r--r--location/LocationAPIClientBase.h2
-rw-r--r--location/LocationDataTypes.h60
2 files changed, 62 insertions, 0 deletions
diff --git a/location/LocationAPIClientBase.h b/location/LocationAPIClientBase.h
index c61e4a8..da87535 100644
--- a/location/LocationAPIClientBase.h
+++ b/location/LocationAPIClientBase.h
@@ -281,6 +281,8 @@ public:
inline virtual void onGnssNiCb(uint32_t /*id*/, GnssNiNotification /*gnssNiNotification*/) {}
inline virtual void onGnssNiResponseCb(LocationError /*error*/) {}
+ inline virtual void onLocationSystemInfoCb(LocationSystemInfo /*locationSystemInfo*/) {}
+
private:
// private inner classes
typedef struct {
diff --git a/location/LocationDataTypes.h b/location/LocationDataTypes.h
index aae6dcf..f35b220 100644
--- a/location/LocationDataTypes.h
+++ b/location/LocationDataTypes.h
@@ -1113,6 +1113,58 @@ typedef struct {
std::vector<GnssDebugSatelliteInfo> mSatelliteInfo;
} GnssDebugReport;
+typedef uint32_t LeapSecondSysInfoMask;
+typedef enum {
+ // current leap second info is available. This info will only
+ // be available if the leap second change info is not available.
+ //
+ // If leap second change info is avaiable, to figure out
+ // the current leap second info, compare current gps time with
+ // the gps timestamp of leap second change to know whether to choose
+ // leapSecondBefore or leapSecondAfter as current leap second.
+ LEAP_SECOND_SYS_INFO_CURRENT_LEAP_SECONDS_BIT = (1ULL << 0),
+ // the last known leap change event is available.
+ // The info can be available on two scenario:
+ // 1: this leap second change event has been scheduled and yet to happen
+ // 2: this leap second change event has already happened and next
+ // leap second change event has not yet been scheduled.
+ LEAP_SECOND_SYS_INFO_LEAP_SECOND_CHANGE_BIT = (1ULL << 1),
+} LeapSecondSysInfoDataBits;
+
+struct LeapSecondChangeInfo {
+ // GPS timestamp that corrresponds to the last known
+ // leap second change event.
+ //
+ // The info can be available on two scenario:
+ // 1: this leap second change event has been scheduled and yet to happen
+ // 2: this leap second change event has already happened and next
+ // leap second change event has not yet been scheduled.
+ GnssSystemTimeStructType gpsTimestampLsChange;
+ // Number of leap seconds prior to the leap second change event
+ // that corresponds to the timestamp at gpsTimestampLsChange.
+ uint8_t leapSecondsBeforeChange;
+ // Number of leap seconds after the leap second change event
+ // that corresponds to the timestamp at gpsTimestampLsChange.
+ uint8_t leapSecondsAfterChange;
+};
+
+struct LeapSecondSystemInfo {
+ LeapSecondSysInfoMask leapSecondInfoMask;
+ uint8_t leapSecondCurrent;
+ LeapSecondChangeInfo leapSecondChangeInfo;
+};
+
+typedef uint32_t LocationSystemInfoMask;
+typedef enum {
+ // contains current leap second or leap second change info
+ LOCATION_SYS_INFO_LEAP_SECOND = (1ULL << 0),
+} LocationSystemInfoDataBits;
+
+struct LocationSystemInfo {
+ LocationSystemInfoMask systemInfoMask;
+ LeapSecondSystemInfo leapSecondSysInfo;
+};
+
/* Provides the capabilities of the system
capabilities callback is called once soon after createInstance is called */
typedef std::function<void(
@@ -1215,6 +1267,13 @@ typedef std::function<void(
GnssConfig& config
)> gnssConfigCallback;
+/* LocationSystemInfoCb is for receiving rare occuring location
+ system information update. optional, can be NULL.
+*/
+typedef std::function<void(
+ LocationSystemInfo locationSystemInfo
+)> locationSystemInfoCallback;
+
typedef struct {
size_t size; // set to sizeof(LocationCallbacks)
capabilitiesCallback capabilitiesCb; // mandatory
@@ -1231,6 +1290,7 @@ typedef struct {
gnssDataCallback gnssDataCb; // optional
gnssMeasurementsCallback gnssMeasurementsCb; // optional
batchingStatusCallback batchingStatusCb; // optional
+ locationSystemInfoCallback locationSystemInfoCb; // optional
} LocationCallbacks;
#endif /* LOCATIONDATATYPES_H */