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 | |
| 30 | #include "GnssAdapter.h" |
| 31 | #include "location_interface.h" |
| 32 | |
| 33 | static GnssAdapter* gGnssAdapter = NULL; |
| 34 | |
| 35 | static void initialize(); |
| 36 | static void deinitialize(); |
| 37 | |
| 38 | static void addClient(LocationAPI* client, const LocationCallbacks& callbacks); |
| 39 | static void removeClient(LocationAPI* client, removeClientCompleteCallback rmClientCb); |
| 40 | static void requestCapabilities(LocationAPI* client); |
| 41 | |
| 42 | static uint32_t startTracking(LocationAPI* client, TrackingOptions&); |
| 43 | static void updateTrackingOptions(LocationAPI* client, uint32_t id, TrackingOptions&); |
| 44 | static void stopTracking(LocationAPI* client, uint32_t id); |
| 45 | |
| 46 | static void gnssNiResponse(LocationAPI* client, uint32_t id, GnssNiResponse response); |
| 47 | static uint32_t gnssDeleteAidingData(GnssAidingData& data); |
| 48 | static void gnssUpdateXtraThrottle(const bool enabled); |
| 49 | |
| 50 | static void setControlCallbacks(LocationControlCallbacks& controlCallbacks); |
| 51 | static uint32_t enable(LocationTechnologyType techType); |
| 52 | static void disable(uint32_t id); |
| 53 | static uint32_t* gnssUpdateConfig(const GnssConfig& config); |
| 54 | static uint32_t* gnssGetConfig(GnssConfigFlagsMask mask); |
| 55 | |
| 56 | static void gnssUpdateSvTypeConfig(GnssSvTypeConfig& config); |
| 57 | static void gnssGetSvTypeConfig(GnssSvTypeConfigCallback& callback); |
| 58 | static void gnssResetSvTypeConfig(); |
| 59 | |
| 60 | static void injectLocation(double latitude, double longitude, float accuracy); |
| 61 | static void injectLocationExt(const GnssLocationInfoNotification &locationInfo); |
| 62 | static void injectTime(int64_t time, int64_t timeReference, int32_t uncertainty); |
| 63 | |
| 64 | static void agpsInit(const AgpsCbInfo& cbInfo); |
| 65 | static void agpsDataConnOpen(AGpsExtType agpsType, const char* apnName, int apnLen, int ipType); |
| 66 | static void agpsDataConnClosed(AGpsExtType agpsType); |
| 67 | static void agpsDataConnFailed(AGpsExtType agpsType); |
| 68 | static void getDebugReport(GnssDebugReport& report); |
| 69 | static void updateConnectionStatus(bool connected, int8_t type, bool roaming, |
| 70 | NetworkHandle networkHandle, string& apn); |
| 71 | static void getGnssEnergyConsumed(GnssEnergyConsumedCallback energyConsumedCb); |
| 72 | static void enableNfwLocationAccess(bool enable); |
| 73 | static void nfwInit(const NfwCbInfo& cbInfo); |
| 74 | static void getPowerStateChanges(std::function<void(bool)> powerStateCb); |
| 75 | |
| 76 | static void odcpiInit(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority); |
| 77 | static void odcpiInject(const Location& location); |
| 78 | |
| 79 | static void blockCPI(double latitude, double longitude, float accuracy, |
| 80 | int blockDurationMsec, double latLonDiffThreshold); |
| 81 | static void updateBatteryStatus(bool charging); |
| 82 | static void updateSystemPowerState(PowerStateType systemPowerState); |
| 83 | static uint32_t setConstrainedTunc (bool enable, float tuncConstraint, |
| 84 | uint32_t energyBudget); |
| 85 | static uint32_t setPositionAssistedClockEstimator(bool enable); |
| 86 | static uint32_t gnssUpdateSvConfig(const GnssSvTypeConfig& constellationEnablementConfig, |
| 87 | const GnssSvIdConfig& blacklistSvConfig); |
| 88 | static uint32_t gnssResetSvConfig(); |
| 89 | static uint32_t configLeverArm(const LeverArmConfigInfo& configInfo); |
| 90 | static uint32_t configRobustLocation(bool enable, bool enableForE911); |
| 91 | static uint32_t configMinGpsWeek(uint16_t minGpsWeek); |
| 92 | static uint32_t configDeadReckoningEngineParams(const DeadReckoningEngineConfig& dreConfig); |
| 93 | static uint32_t gnssUpdateSecondaryBandConfig(const GnssSvTypeConfig& secondaryBandConfig); |
| 94 | static uint32_t gnssGetSecondaryBandConfig(); |
| 95 | static void resetNetworkInfo(); |
| 96 | |
| 97 | static void updateNTRIPGGAConsent(bool consentAccepted); |
| 98 | static void enablePPENtripStream(const GnssNtripConnectionParams& params, bool enableRTKEngine); |
| 99 | static void disablePPENtripStream(); |
| 100 | |
| 101 | static bool measCorrInit(const measCorrSetCapabilitiesCb setCapabilitiesCb); |
| 102 | static bool measCorrSetCorrections(const GnssMeasurementCorrections gnssMeasCorr); |
| 103 | static void measCorrClose(); |
| 104 | static uint32_t antennaInfoInit(const antennaInfoCb antennaInfoCallback); |
| 105 | static void antennaInfoClose(); |
| 106 | static uint32_t configEngineRunState(PositioningEngineMask engType, LocEngineRunState engState); |
| 107 | |
| 108 | static const GnssInterface gGnssInterface = { |
| 109 | sizeof(GnssInterface), |
| 110 | initialize, |
| 111 | deinitialize, |
| 112 | addClient, |
| 113 | removeClient, |
| 114 | requestCapabilities, |
| 115 | startTracking, |
| 116 | updateTrackingOptions, |
| 117 | stopTracking, |
| 118 | gnssNiResponse, |
| 119 | setControlCallbacks, |
| 120 | enable, |
| 121 | disable, |
| 122 | gnssUpdateConfig, |
| 123 | gnssGetConfig, |
| 124 | gnssUpdateSvTypeConfig, |
| 125 | gnssGetSvTypeConfig, |
| 126 | gnssResetSvTypeConfig, |
| 127 | gnssDeleteAidingData, |
| 128 | gnssUpdateXtraThrottle, |
| 129 | injectLocation, |
| 130 | injectTime, |
| 131 | agpsInit, |
| 132 | agpsDataConnOpen, |
| 133 | agpsDataConnClosed, |
| 134 | agpsDataConnFailed, |
| 135 | getDebugReport, |
| 136 | updateConnectionStatus, |
| 137 | odcpiInit, |
| 138 | odcpiInject, |
| 139 | blockCPI, |
| 140 | getGnssEnergyConsumed, |
| 141 | enableNfwLocationAccess, |
| 142 | nfwInit, |
| 143 | getPowerStateChanges, |
| 144 | injectLocationExt, |
| 145 | updateBatteryStatus, |
| 146 | updateSystemPowerState, |
| 147 | setConstrainedTunc, |
| 148 | setPositionAssistedClockEstimator, |
| 149 | gnssUpdateSvConfig, |
| 150 | configLeverArm, |
| 151 | measCorrInit, |
| 152 | measCorrSetCorrections, |
| 153 | measCorrClose, |
| 154 | antennaInfoInit, |
| 155 | antennaInfoClose, |
| 156 | configRobustLocation, |
| 157 | configMinGpsWeek, |
| 158 | configDeadReckoningEngineParams, |
| 159 | updateNTRIPGGAConsent, |
| 160 | enablePPENtripStream, |
| 161 | disablePPENtripStream, |
| 162 | gnssUpdateSecondaryBandConfig, |
| 163 | gnssGetSecondaryBandConfig, |
| 164 | resetNetworkInfo, |
| 165 | configEngineRunState |
| 166 | }; |
| 167 | |
| 168 | #ifndef DEBUG_X86 |
| 169 | extern "C" const GnssInterface* getGnssInterface() |
| 170 | #else |
| 171 | const GnssInterface* getGnssInterface() |
| 172 | #endif // DEBUG_X86 |
| 173 | { |
| 174 | gGnssInterface.initialize(); |
| 175 | return &gGnssInterface; |
| 176 | } |
| 177 | |
| 178 | static void initialize() |
| 179 | { |
| 180 | if (NULL == gGnssAdapter) { |
| 181 | gGnssAdapter = new GnssAdapter(); |
| 182 | } |
| 183 | } |
| 184 | |
| 185 | static void deinitialize() |
| 186 | { |
| 187 | if (NULL != gGnssAdapter) { |
| 188 | delete gGnssAdapter; |
| 189 | gGnssAdapter = NULL; |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | static void addClient(LocationAPI* client, const LocationCallbacks& callbacks) |
| 194 | { |
| 195 | if (NULL != gGnssAdapter) { |
| 196 | gGnssAdapter->addClientCommand(client, callbacks); |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | static void removeClient(LocationAPI* client, removeClientCompleteCallback rmClientCb) |
| 201 | { |
| 202 | if (NULL != gGnssAdapter) { |
| 203 | gGnssAdapter->removeClientCommand(client, rmClientCb); |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | static void requestCapabilities(LocationAPI* client) |
| 208 | { |
| 209 | if (NULL != gGnssAdapter) { |
| 210 | gGnssAdapter->requestCapabilitiesCommand(client); |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | static uint32_t startTracking( |
| 215 | LocationAPI* client, TrackingOptions& trackingOptions) |
| 216 | { |
| 217 | if (NULL != gGnssAdapter) { |
| 218 | return gGnssAdapter->startTrackingCommand(client, trackingOptions); |
| 219 | } else { |
| 220 | return 0; |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | static void updateTrackingOptions( |
| 225 | LocationAPI* client, uint32_t id, TrackingOptions& trackingOptions) |
| 226 | { |
| 227 | if (NULL != gGnssAdapter) { |
| 228 | gGnssAdapter->updateTrackingOptionsCommand( |
| 229 | client, id, trackingOptions); |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | static void stopTracking(LocationAPI* client, uint32_t id) |
| 234 | { |
| 235 | if (NULL != gGnssAdapter) { |
| 236 | gGnssAdapter->stopTrackingCommand(client, id); |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | static void gnssNiResponse(LocationAPI* client, uint32_t id, GnssNiResponse response) |
| 241 | { |
| 242 | if (NULL != gGnssAdapter) { |
| 243 | gGnssAdapter->gnssNiResponseCommand(client, id, response); |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | static void setControlCallbacks(LocationControlCallbacks& controlCallbacks) |
| 248 | { |
| 249 | if (NULL != gGnssAdapter) { |
| 250 | gGnssAdapter->setControlCallbacksCommand(controlCallbacks); |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | static uint32_t enable(LocationTechnologyType techType) |
| 255 | { |
| 256 | if (NULL != gGnssAdapter) { |
| 257 | return gGnssAdapter->enableCommand(techType); |
| 258 | } else { |
| 259 | return 0; |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | static void disable(uint32_t id) |
| 264 | { |
| 265 | if (NULL != gGnssAdapter) { |
| 266 | gGnssAdapter->disableCommand(id); |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | static uint32_t* gnssUpdateConfig(const GnssConfig& config) |
| 271 | { |
| 272 | if (NULL != gGnssAdapter) { |
| 273 | return gGnssAdapter->gnssUpdateConfigCommand(config); |
| 274 | } else { |
| 275 | return NULL; |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | static uint32_t* gnssGetConfig(GnssConfigFlagsMask mask) |
| 280 | { |
| 281 | if (NULL != gGnssAdapter) { |
| 282 | return gGnssAdapter->gnssGetConfigCommand(mask); |
| 283 | } else { |
| 284 | return NULL; |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | static void gnssUpdateSvTypeConfig(GnssSvTypeConfig& config) |
| 289 | { |
| 290 | if (NULL != gGnssAdapter) { |
| 291 | gGnssAdapter->gnssUpdateSvTypeConfigCommand(config); |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | static void gnssGetSvTypeConfig(GnssSvTypeConfigCallback& callback) |
| 296 | { |
| 297 | if (NULL != gGnssAdapter) { |
| 298 | gGnssAdapter->gnssGetSvTypeConfigCommand(callback); |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | static void gnssResetSvTypeConfig() |
| 303 | { |
| 304 | if (NULL != gGnssAdapter) { |
| 305 | gGnssAdapter->gnssResetSvTypeConfigCommand(); |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | static uint32_t gnssDeleteAidingData(GnssAidingData& data) |
| 310 | { |
| 311 | if (NULL != gGnssAdapter) { |
| 312 | return gGnssAdapter->gnssDeleteAidingDataCommand(data); |
| 313 | } else { |
| 314 | return 0; |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | static void gnssUpdateXtraThrottle(const bool enabled) |
| 319 | { |
| 320 | if (NULL != gGnssAdapter) { |
| 321 | gGnssAdapter->gnssUpdateXtraThrottleCommand(enabled); |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | static void injectLocation(double latitude, double longitude, float accuracy) |
| 326 | { |
| 327 | if (NULL != gGnssAdapter) { |
| 328 | gGnssAdapter->injectLocationCommand(latitude, longitude, accuracy); |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | static void injectTime(int64_t time, int64_t timeReference, int32_t uncertainty) |
| 333 | { |
| 334 | if (NULL != gGnssAdapter) { |
| 335 | gGnssAdapter->injectTimeCommand(time, timeReference, uncertainty); |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | static void agpsInit(const AgpsCbInfo& cbInfo) { |
| 340 | |
| 341 | if (NULL != gGnssAdapter) { |
| 342 | gGnssAdapter->initAgpsCommand(cbInfo); |
| 343 | } |
| 344 | } |
| 345 | static void agpsDataConnOpen( |
| 346 | AGpsExtType agpsType, const char* apnName, int apnLen, int ipType) { |
| 347 | |
| 348 | if (NULL != gGnssAdapter) { |
| 349 | gGnssAdapter->dataConnOpenCommand( |
| 350 | agpsType, apnName, apnLen, (AGpsBearerType)ipType); |
| 351 | } |
| 352 | } |
| 353 | static void agpsDataConnClosed(AGpsExtType agpsType) { |
| 354 | |
| 355 | if (NULL != gGnssAdapter) { |
| 356 | gGnssAdapter->dataConnClosedCommand(agpsType); |
| 357 | } |
| 358 | } |
| 359 | static void agpsDataConnFailed(AGpsExtType agpsType) { |
| 360 | |
| 361 | if (NULL != gGnssAdapter) { |
| 362 | gGnssAdapter->dataConnFailedCommand(agpsType); |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | static void getDebugReport(GnssDebugReport& report) { |
| 367 | |
| 368 | if (NULL != gGnssAdapter) { |
| 369 | gGnssAdapter->getDebugReport(report); |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | static void updateConnectionStatus(bool connected, int8_t type, |
| 374 | bool roaming, NetworkHandle networkHandle, |
| 375 | string& apn) { |
| 376 | if (NULL != gGnssAdapter) { |
| 377 | gGnssAdapter->getSystemStatus()->eventConnectionStatus( |
| 378 | connected, type, roaming, networkHandle, apn); |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | static void odcpiInit(const OdcpiRequestCallback& callback, OdcpiPrioritytype priority) |
| 383 | { |
| 384 | if (NULL != gGnssAdapter) { |
| 385 | gGnssAdapter->initOdcpiCommand(callback, priority); |
| 386 | } |
| 387 | } |
| 388 | |
| 389 | static void odcpiInject(const Location& location) |
| 390 | { |
| 391 | if (NULL != gGnssAdapter) { |
| 392 | gGnssAdapter->injectOdcpiCommand(location); |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | static void blockCPI(double latitude, double longitude, float accuracy, |
| 397 | int blockDurationMsec, double latLonDiffThreshold) { |
| 398 | if (NULL != gGnssAdapter) { |
| 399 | gGnssAdapter->blockCPICommand(latitude, longitude, accuracy, |
| 400 | blockDurationMsec, latLonDiffThreshold); |
| 401 | } |
| 402 | } |
| 403 | |
| 404 | static void getGnssEnergyConsumed(GnssEnergyConsumedCallback energyConsumedCb) { |
| 405 | if (NULL != gGnssAdapter) { |
| 406 | gGnssAdapter->getGnssEnergyConsumedCommand(energyConsumedCb); |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | static void enableNfwLocationAccess(bool enable) { |
| 411 | if (NULL != gGnssAdapter) { |
| 412 | gGnssAdapter->nfwControlCommand(enable); |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | static void nfwInit(const NfwCbInfo& cbInfo) { |
| 417 | if (NULL != gGnssAdapter) { |
| 418 | gGnssAdapter->initNfwCommand(cbInfo); |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | static void getPowerStateChanges(std::function<void(bool)> powerStateCb) |
| 423 | { |
| 424 | if (NULL != gGnssAdapter) { |
| 425 | gGnssAdapter->getPowerStateChangesCommand(powerStateCb); |
| 426 | } |
| 427 | } |
| 428 | |
| 429 | static void injectLocationExt(const GnssLocationInfoNotification &locationInfo) |
| 430 | { |
| 431 | if (NULL != gGnssAdapter) { |
| 432 | gGnssAdapter->injectLocationExtCommand(locationInfo); |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | static void updateBatteryStatus(bool charging) { |
| 437 | if (NULL != gGnssAdapter) { |
| 438 | gGnssAdapter->getSystemStatus()->updatePowerConnectState(charging); |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | static void resetNetworkInfo() { |
| 443 | if (NULL != gGnssAdapter) { |
| 444 | gGnssAdapter->getSystemStatus()->resetNetworkInfo(); |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | static void updateSystemPowerState(PowerStateType systemPowerState) { |
| 449 | if (NULL != gGnssAdapter) { |
| 450 | gGnssAdapter->updateSystemPowerStateCommand(systemPowerState); |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | static uint32_t setConstrainedTunc (bool enable, float tuncConstraint, uint32_t energyBudget) { |
| 455 | if (NULL != gGnssAdapter) { |
| 456 | return gGnssAdapter->setConstrainedTuncCommand(enable, tuncConstraint, energyBudget); |
| 457 | } else { |
| 458 | return 0; |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | static uint32_t setPositionAssistedClockEstimator(bool enable) { |
| 463 | if (NULL != gGnssAdapter) { |
| 464 | return gGnssAdapter->setPositionAssistedClockEstimatorCommand(enable); |
| 465 | } else { |
| 466 | return 0; |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | static uint32_t gnssUpdateSvConfig( |
| 471 | const GnssSvTypeConfig& constellationEnablementConfig, |
| 472 | const GnssSvIdConfig& blacklistSvConfig) { |
| 473 | if (NULL != gGnssAdapter) { |
| 474 | return gGnssAdapter->gnssUpdateSvConfigCommand( |
| 475 | constellationEnablementConfig, blacklistSvConfig); |
| 476 | } else { |
| 477 | return 0; |
| 478 | } |
| 479 | } |
| 480 | |
| 481 | static uint32_t configLeverArm(const LeverArmConfigInfo& configInfo){ |
| 482 | if (NULL != gGnssAdapter) { |
| 483 | return gGnssAdapter->configLeverArmCommand(configInfo); |
| 484 | } else { |
| 485 | return 0; |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | static bool measCorrInit(const measCorrSetCapabilitiesCb setCapabilitiesCb) { |
| 490 | if (NULL != gGnssAdapter) { |
| 491 | return gGnssAdapter->openMeasCorrCommand(setCapabilitiesCb); |
| 492 | } else { |
| 493 | return false; |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | static bool measCorrSetCorrections(const GnssMeasurementCorrections gnssMeasCorr) { |
| 498 | if (NULL != gGnssAdapter) { |
| 499 | return gGnssAdapter->measCorrSetCorrectionsCommand(gnssMeasCorr); |
| 500 | } else { |
| 501 | return false; |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | static void measCorrClose() { |
| 506 | if (NULL != gGnssAdapter) { |
| 507 | gGnssAdapter->closeMeasCorrCommand(); |
| 508 | } |
| 509 | } |
| 510 | |
| 511 | static uint32_t antennaInfoInit(const antennaInfoCb antennaInfoCallback) { |
| 512 | if (NULL != gGnssAdapter) { |
| 513 | return gGnssAdapter->antennaInfoInitCommand(antennaInfoCallback); |
| 514 | } else { |
| 515 | return ANTENNA_INFO_ERROR_GENERIC; |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | static void antennaInfoClose() { |
| 520 | if (NULL != gGnssAdapter) { |
| 521 | return gGnssAdapter->antennaInfoCloseCommand(); |
| 522 | } |
| 523 | } |
| 524 | |
| 525 | static uint32_t configRobustLocation(bool enable, bool enableForE911){ |
| 526 | if (NULL != gGnssAdapter) { |
| 527 | return gGnssAdapter->configRobustLocationCommand(enable, enableForE911); |
| 528 | } else { |
| 529 | return 0; |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | static uint32_t configMinGpsWeek(uint16_t minGpsWeek){ |
| 534 | if (NULL != gGnssAdapter) { |
| 535 | return gGnssAdapter->configMinGpsWeekCommand(minGpsWeek); |
| 536 | } else { |
| 537 | return 0; |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | static uint32_t configDeadReckoningEngineParams(const DeadReckoningEngineConfig& dreConfig){ |
| 542 | if (NULL != gGnssAdapter) { |
| 543 | return gGnssAdapter->configDeadReckoningEngineParamsCommand(dreConfig); |
| 544 | } else { |
| 545 | return 0; |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | static uint32_t gnssUpdateSecondaryBandConfig( |
| 550 | const GnssSvTypeConfig& secondaryBandConfig) { |
| 551 | if (NULL != gGnssAdapter) { |
| 552 | return gGnssAdapter->gnssUpdateSecondaryBandConfigCommand(secondaryBandConfig); |
| 553 | } else { |
| 554 | return 0; |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | static uint32_t gnssGetSecondaryBandConfig(){ |
| 559 | if (NULL != gGnssAdapter) { |
| 560 | return gGnssAdapter->gnssGetSecondaryBandConfigCommand(); |
| 561 | } else { |
| 562 | return 0; |
| 563 | } |
| 564 | } |
| 565 | |
| 566 | static void updateNTRIPGGAConsent(bool consentAccepted){ |
| 567 | if (NULL != gGnssAdapter) { |
| 568 | // Call will be enabled once GnssAdapter impl. is ready. |
| 569 | gGnssAdapter->updateNTRIPGGAConsentCommand(consentAccepted); |
| 570 | } |
| 571 | } |
| 572 | |
| 573 | static void enablePPENtripStream(const GnssNtripConnectionParams& params, bool enableRTKEngine){ |
| 574 | if (NULL != gGnssAdapter) { |
| 575 | // Call will be enabled once GnssAdapter impl. is ready. |
| 576 | gGnssAdapter->enablePPENtripStreamCommand(params, enableRTKEngine); |
| 577 | } |
| 578 | } |
| 579 | |
| 580 | static void disablePPENtripStream(){ |
| 581 | if (NULL != gGnssAdapter) { |
| 582 | // Call will be enabled once GnssAdapter impl. is ready. |
| 583 | gGnssAdapter->disablePPENtripStreamCommand(); |
| 584 | } |
| 585 | } |
| 586 | |
| 587 | static uint32_t configEngineRunState(PositioningEngineMask engType, LocEngineRunState engState) { |
| 588 | if (NULL != gGnssAdapter) { |
| 589 | return gGnssAdapter->configEngineRunStateCommand(engType, engState); |
| 590 | } else { |
| 591 | return 0; |
| 592 | } |
| 593 | } |