Michael Bestas | 3a0209e | 2023-05-04 01:15:47 +0300 | [diff] [blame] | 1 | /* 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 | |
| 29 | #ifndef LOCATION_INTERFACE_H |
| 30 | #define LOCATION_INTERFACE_H |
| 31 | |
| 32 | #include <LocationAPI.h> |
| 33 | #include <gps_extended_c.h> |
| 34 | #include <functional> |
| 35 | |
| 36 | /* Used for callback to deliver GNSS energy consumed */ |
| 37 | /** @fn |
| 38 | @brief Used by query API that retrieves energy consumed by |
| 39 | modem GNSS engine. |
| 40 | |
| 41 | @param gnssEnergyConsumedFromFirstBoot: |
| 42 | Energy consumed by the GNSS engine since the first bootup |
| 43 | in units of 0.1 milli watt seconds. |
| 44 | A value of 0xffffffffffffffff indicates an invalid reading. |
| 45 | */ |
| 46 | typedef std::function<void( |
| 47 | uint64_t gnssEnergyConsumedFromFirstBoot |
| 48 | )> GnssEnergyConsumedCallback; |
| 49 | |
| 50 | typedef void (*removeClientCompleteCallback)(LocationAPI* client); |
| 51 | |
| 52 | struct GnssInterface { |
| 53 | size_t size; |
| 54 | void (*initialize)(void); |
| 55 | void (*deinitialize)(void); |
| 56 | void (*addClient)(LocationAPI* client, const LocationCallbacks& callbacks); |
| 57 | void (*removeClient)(LocationAPI* client, removeClientCompleteCallback rmClientCb); |
| 58 | void (*requestCapabilities)(LocationAPI* client); |
| 59 | uint32_t (*startTracking)(LocationAPI* client, TrackingOptions&); |
| 60 | void (*updateTrackingOptions)(LocationAPI* client, uint32_t id, TrackingOptions&); |
| 61 | void (*stopTracking)(LocationAPI* client, uint32_t id); |
| 62 | void (*gnssNiResponse)(LocationAPI* client, uint32_t id, GnssNiResponse response); |
| 63 | void (*setControlCallbacks)(LocationControlCallbacks& controlCallbacks); |
| 64 | uint32_t (*enable)(LocationTechnologyType techType); |
| 65 | void (*disable)(uint32_t id); |
| 66 | uint32_t* (*gnssUpdateConfig)(const GnssConfig& config); |
| 67 | uint32_t* (*gnssGetConfig)(GnssConfigFlagsMask config); |
| 68 | void (*gnssUpdateSvTypeConfig)(GnssSvTypeConfig& config); |
| 69 | void (*gnssGetSvTypeConfig)(GnssSvTypeConfigCallback& callback); |
| 70 | void (*gnssResetSvTypeConfig)(); |
| 71 | uint32_t (*gnssDeleteAidingData)(GnssAidingData& data); |
| 72 | void (*gnssUpdateXtraThrottle)(const bool enabled); |
| 73 | void (*injectLocation)(double latitude, double longitude, float accuracy); |
| 74 | void (*injectTime)(int64_t time, int64_t timeReference, int32_t uncertainty); |
| 75 | void (*agpsInit)(const AgpsCbInfo& cbInfo); |
| 76 | void (*agpsDataConnOpen)(AGpsExtType agpsType, const char* apnName, int apnLen, int ipType); |
| 77 | void (*agpsDataConnClosed)(AGpsExtType agpsType); |
| 78 | void (*agpsDataConnFailed)(AGpsExtType agpsType); |
| 79 | void (*getDebugReport)(GnssDebugReport& report); |
| 80 | void (*updateConnectionStatus)(bool connected, int8_t type, bool roaming, |
| 81 | NetworkHandle networkHandle, std::string& apn); |
| 82 | void (*odcpiInit)(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority); |
| 83 | void (*odcpiInject)(const Location& location); |
| 84 | void (*blockCPI)(double latitude, double longitude, float accuracy, |
| 85 | int blockDurationMsec, double latLonDiffThreshold); |
| 86 | void (*getGnssEnergyConsumed)(GnssEnergyConsumedCallback energyConsumedCb); |
| 87 | void (*enableNfwLocationAccess)(bool enable); |
| 88 | void (*nfwInit)(const NfwCbInfo& cbInfo); |
| 89 | void (*getPowerStateChanges)(std::function<void(bool)> powerStateCb); |
| 90 | void (*injectLocationExt)(const GnssLocationInfoNotification &locationInfo); |
| 91 | void (*updateBatteryStatus)(bool charging); |
| 92 | void (*updateSystemPowerState)(PowerStateType systemPowerState); |
| 93 | uint32_t (*setConstrainedTunc) (bool enable, float tuncConstraint, uint32_t energyBudget); |
| 94 | uint32_t (*setPositionAssistedClockEstimator) (bool enable); |
| 95 | uint32_t (*gnssUpdateSvConfig)(const GnssSvTypeConfig& constellationEnablementConfig, |
| 96 | const GnssSvIdConfig& blacklistSvConfig); |
| 97 | uint32_t (*configLeverArm)(const LeverArmConfigInfo& configInfo); |
| 98 | bool (*measCorrInit)(const measCorrSetCapabilitiesCb setCapabilitiesCb); |
| 99 | bool (*measCorrSetCorrections)(const GnssMeasurementCorrections gnssMeasCorr); |
| 100 | void (*measCorrClose)(); |
| 101 | uint32_t (*antennaInfoInit)(const antennaInfoCb antennaInfoCallback); |
| 102 | void (*antennaInfoClose) (); |
| 103 | uint32_t (*configRobustLocation)(bool enable, bool enableForE911); |
| 104 | uint32_t (*configMinGpsWeek)(uint16_t minGpsWeek); |
| 105 | uint32_t (*configDeadReckoningEngineParams)(const DeadReckoningEngineConfig& dreConfig); |
| 106 | void (*updateNTRIPGGAConsent)(bool consentAccepted); |
| 107 | void (*enablePPENtripStream)(const GnssNtripConnectionParams& params, bool enableRTKEngine); |
| 108 | void (*disablePPENtripStream)(); |
| 109 | uint32_t (*gnssUpdateSecondaryBandConfig)(const GnssSvTypeConfig& secondaryBandConfig); |
| 110 | uint32_t (*gnssGetSecondaryBandConfig)(); |
| 111 | void (*resetNetworkInfo)(); |
| 112 | uint32_t (*configEngineRunState)(PositioningEngineMask engType, |
| 113 | LocEngineRunState engState); |
| 114 | }; |
| 115 | |
| 116 | struct BatchingInterface { |
| 117 | size_t size; |
| 118 | void (*initialize)(void); |
| 119 | void (*deinitialize)(void); |
| 120 | void (*addClient)(LocationAPI* client, const LocationCallbacks& callbacks); |
| 121 | void (*removeClient)(LocationAPI* client, removeClientCompleteCallback rmClientCb); |
| 122 | void (*requestCapabilities)(LocationAPI* client); |
| 123 | uint32_t (*startBatching)(LocationAPI* client, BatchingOptions&); |
| 124 | void (*stopBatching)(LocationAPI* client, uint32_t id); |
| 125 | void (*updateBatchingOptions)(LocationAPI* client, uint32_t id, BatchingOptions&); |
| 126 | void (*getBatchedLocations)(LocationAPI* client, uint32_t id, size_t count); |
| 127 | }; |
| 128 | |
| 129 | struct GeofenceInterface { |
| 130 | size_t size; |
| 131 | void (*initialize)(void); |
| 132 | void (*deinitialize)(void); |
| 133 | void (*addClient)(LocationAPI* client, const LocationCallbacks& callbacks); |
| 134 | void (*removeClient)(LocationAPI* client, removeClientCompleteCallback rmClientCb); |
| 135 | void (*requestCapabilities)(LocationAPI* client); |
| 136 | uint32_t* (*addGeofences)(LocationAPI* client, size_t count, GeofenceOption*, GeofenceInfo*); |
| 137 | void (*removeGeofences)(LocationAPI* client, size_t count, uint32_t* ids); |
| 138 | void (*modifyGeofences)(LocationAPI* client, size_t count, uint32_t* ids, |
| 139 | GeofenceOption* options); |
| 140 | void (*pauseGeofences)(LocationAPI* client, size_t count, uint32_t* ids); |
| 141 | void (*resumeGeofences)(LocationAPI* client, size_t count, uint32_t* ids); |
| 142 | }; |
| 143 | |
| 144 | #endif /* LOCATION_INTERFACE_H */ |