blob: b70790149d06c8a81b8efc6df88a7f77d4fa2e5c [file] [log] [blame]
Michael Bestas3a0209e2023-05-04 01:15:47 +03001/* Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
2 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are
5 * met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above
9 * copyright notice, this list of conditions and the following
10 * disclaimer in the documentation and/or other materials provided
11 * with the distribution.
12 * * Neither the name of The Linux Foundation nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
Michael Bestas9f1f76e2024-05-28 23:23:20 +030029/*
30Changes from Qualcomm Innovation Center are provided under the following license:
31
32Copyright (c) 2022, 2023 Qualcomm Innovation Center, Inc. All rights reserved.
33
34Redistribution and use in source and binary forms, with or without
35modification, are permitted (subject to the limitations in the
36disclaimer below) provided that the following conditions are met:
37
38 * Redistributions of source code must retain the above copyright
39 notice, this list of conditions and the following disclaimer.
40
41 * Redistributions in binary form must reproduce the above
42 copyright notice, this list of conditions and the following
43 disclaimer in the documentation and/or other materials provided
44 with the distribution.
45
46 * Neither the name of Qualcomm Innovation Center, Inc. nor the names of its
47 contributors may be used to endorse or promote products derived
48 from this software without specific prior written permission.
49
50NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
51GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
52HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
53WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
54MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
55IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
56ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
58GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
59INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
60IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
61OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
62IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63*/
Michael Bestas3a0209e2023-05-04 01:15:47 +030064#ifndef LOCATION_INTERFACE_H
65#define LOCATION_INTERFACE_H
66
67#include <LocationAPI.h>
68#include <gps_extended_c.h>
69#include <functional>
70
71/* Used for callback to deliver GNSS energy consumed */
72/** @fn
73 @brief Used by query API that retrieves energy consumed by
74 modem GNSS engine.
75
76 @param gnssEnergyConsumedFromFirstBoot:
77 Energy consumed by the GNSS engine since the first bootup
78 in units of 0.1 milli watt seconds.
79 A value of 0xffffffffffffffff indicates an invalid reading.
80*/
81typedef std::function<void(
82 uint64_t gnssEnergyConsumedFromFirstBoot
83)> GnssEnergyConsumedCallback;
84
85typedef void (*removeClientCompleteCallback)(LocationAPI* client);
86
87struct GnssInterface {
88 size_t size;
89 void (*initialize)(void);
90 void (*deinitialize)(void);
91 void (*addClient)(LocationAPI* client, const LocationCallbacks& callbacks);
92 void (*removeClient)(LocationAPI* client, removeClientCompleteCallback rmClientCb);
93 void (*requestCapabilities)(LocationAPI* client);
94 uint32_t (*startTracking)(LocationAPI* client, TrackingOptions&);
95 void (*updateTrackingOptions)(LocationAPI* client, uint32_t id, TrackingOptions&);
96 void (*stopTracking)(LocationAPI* client, uint32_t id);
97 void (*gnssNiResponse)(LocationAPI* client, uint32_t id, GnssNiResponse response);
98 void (*setControlCallbacks)(LocationControlCallbacks& controlCallbacks);
99 uint32_t (*enable)(LocationTechnologyType techType);
100 void (*disable)(uint32_t id);
101 uint32_t* (*gnssUpdateConfig)(const GnssConfig& config);
102 uint32_t* (*gnssGetConfig)(GnssConfigFlagsMask config);
103 void (*gnssUpdateSvTypeConfig)(GnssSvTypeConfig& config);
104 void (*gnssGetSvTypeConfig)(GnssSvTypeConfigCallback& callback);
105 void (*gnssResetSvTypeConfig)();
106 uint32_t (*gnssDeleteAidingData)(GnssAidingData& data);
107 void (*gnssUpdateXtraThrottle)(const bool enabled);
108 void (*injectLocation)(double latitude, double longitude, float accuracy);
109 void (*injectTime)(int64_t time, int64_t timeReference, int32_t uncertainty);
110 void (*agpsInit)(const AgpsCbInfo& cbInfo);
111 void (*agpsDataConnOpen)(AGpsExtType agpsType, const char* apnName, int apnLen, int ipType);
112 void (*agpsDataConnClosed)(AGpsExtType agpsType);
113 void (*agpsDataConnFailed)(AGpsExtType agpsType);
114 void (*getDebugReport)(GnssDebugReport& report);
115 void (*updateConnectionStatus)(bool connected, int8_t type, bool roaming,
116 NetworkHandle networkHandle, std::string& apn);
Michael Bestas9f1f76e2024-05-28 23:23:20 +0300117 void (*odcpiInit)(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority,
118 OdcpiCallbackTypeMask typeMask);
119 void (*deRegisterOdcpi)(OdcpiPrioritytype priority, OdcpiCallbackTypeMask typeMask);
Michael Bestas3a0209e2023-05-04 01:15:47 +0300120 void (*odcpiInject)(const Location& location);
121 void (*blockCPI)(double latitude, double longitude, float accuracy,
122 int blockDurationMsec, double latLonDiffThreshold);
123 void (*getGnssEnergyConsumed)(GnssEnergyConsumedCallback energyConsumedCb);
124 void (*enableNfwLocationAccess)(bool enable);
125 void (*nfwInit)(const NfwCbInfo& cbInfo);
126 void (*getPowerStateChanges)(std::function<void(bool)> powerStateCb);
127 void (*injectLocationExt)(const GnssLocationInfoNotification &locationInfo);
128 void (*updateBatteryStatus)(bool charging);
129 void (*updateSystemPowerState)(PowerStateType systemPowerState);
130 uint32_t (*setConstrainedTunc) (bool enable, float tuncConstraint, uint32_t energyBudget);
131 uint32_t (*setPositionAssistedClockEstimator) (bool enable);
132 uint32_t (*gnssUpdateSvConfig)(const GnssSvTypeConfig& constellationEnablementConfig,
133 const GnssSvIdConfig& blacklistSvConfig);
134 uint32_t (*configLeverArm)(const LeverArmConfigInfo& configInfo);
135 bool (*measCorrInit)(const measCorrSetCapabilitiesCb setCapabilitiesCb);
136 bool (*measCorrSetCorrections)(const GnssMeasurementCorrections gnssMeasCorr);
137 void (*measCorrClose)();
138 uint32_t (*antennaInfoInit)(const antennaInfoCb antennaInfoCallback);
139 void (*antennaInfoClose) ();
140 uint32_t (*configRobustLocation)(bool enable, bool enableForE911);
141 uint32_t (*configMinGpsWeek)(uint16_t minGpsWeek);
142 uint32_t (*configDeadReckoningEngineParams)(const DeadReckoningEngineConfig& dreConfig);
143 void (*updateNTRIPGGAConsent)(bool consentAccepted);
144 void (*enablePPENtripStream)(const GnssNtripConnectionParams& params, bool enableRTKEngine);
145 void (*disablePPENtripStream)();
146 uint32_t (*gnssUpdateSecondaryBandConfig)(const GnssSvTypeConfig& secondaryBandConfig);
147 uint32_t (*gnssGetSecondaryBandConfig)();
148 void (*resetNetworkInfo)();
149 uint32_t (*configEngineRunState)(PositioningEngineMask engType,
150 LocEngineRunState engState);
151};
152
153struct BatchingInterface {
154 size_t size;
155 void (*initialize)(void);
156 void (*deinitialize)(void);
157 void (*addClient)(LocationAPI* client, const LocationCallbacks& callbacks);
158 void (*removeClient)(LocationAPI* client, removeClientCompleteCallback rmClientCb);
159 void (*requestCapabilities)(LocationAPI* client);
160 uint32_t (*startBatching)(LocationAPI* client, BatchingOptions&);
161 void (*stopBatching)(LocationAPI* client, uint32_t id);
162 void (*updateBatchingOptions)(LocationAPI* client, uint32_t id, BatchingOptions&);
163 void (*getBatchedLocations)(LocationAPI* client, uint32_t id, size_t count);
164};
165
166struct GeofenceInterface {
167 size_t size;
168 void (*initialize)(void);
169 void (*deinitialize)(void);
170 void (*addClient)(LocationAPI* client, const LocationCallbacks& callbacks);
171 void (*removeClient)(LocationAPI* client, removeClientCompleteCallback rmClientCb);
172 void (*requestCapabilities)(LocationAPI* client);
173 uint32_t* (*addGeofences)(LocationAPI* client, size_t count, GeofenceOption*, GeofenceInfo*);
174 void (*removeGeofences)(LocationAPI* client, size_t count, uint32_t* ids);
175 void (*modifyGeofences)(LocationAPI* client, size_t count, uint32_t* ids,
176 GeofenceOption* options);
177 void (*pauseGeofences)(LocationAPI* client, size_t count, uint32_t* ids);
178 void (*resumeGeofences)(LocationAPI* client, size_t count, uint32_t* ids);
179};
180
181#endif /* LOCATION_INTERFACE_H */