1 /* Copyright (c) 2011-2014, 2016-2017 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 #define LOG_NDEBUG 0 //Define to enable LOGV
30 #define LOG_TAG "LocSvc_LocApiBase"
31
32 #include <dlfcn.h>
33 #include <LocApiBase.h>
34 #include <LocAdapterBase.h>
35 #include <platform_lib_log_util.h>
36 #include <LocDualContext.h>
37
38 namespace loc_core {
39
40 #define TO_ALL_LOCADAPTERS(call) TO_ALL_ADAPTERS(mLocAdapters, (call))
41 #define TO_1ST_HANDLING_LOCADAPTERS(call) TO_1ST_HANDLING_ADAPTER(mLocAdapters, (call))
42
hexcode(char * hexstring,int string_size,const char * data,int data_size)43 int hexcode(char *hexstring, int string_size,
44 const char *data, int data_size)
45 {
46 int i;
47 for (i = 0; i < data_size; i++)
48 {
49 char ch = data[i];
50 if (i*2 + 3 <= string_size)
51 {
52 snprintf(&hexstring[i*2], 3, "%02X", ch);
53 }
54 else {
55 break;
56 }
57 }
58 return i;
59 }
60
decodeAddress(char * addr_string,int string_size,const char * data,int data_size)61 int decodeAddress(char *addr_string, int string_size,
62 const char *data, int data_size)
63 {
64 const char addr_prefix = 0x91;
65 int i, idxOutput = 0;
66
67 if (!data || !addr_string) { return 0; }
68
69 if (data[0] != addr_prefix)
70 {
71 LOC_LOGW("decodeAddress: address prefix is not 0x%x but 0x%x", addr_prefix, data[0]);
72 addr_string[0] = '\0';
73 return 0; // prefix not correct
74 }
75
76 for (i = 1; i < data_size; i++)
77 {
78 unsigned char ch = data[i], low = ch & 0x0F, hi = ch >> 4;
79 if (low <= 9 && idxOutput < string_size - 1) { addr_string[idxOutput++] = low + '0'; }
80 if (hi <= 9 && idxOutput < string_size - 1) { addr_string[idxOutput++] = hi + '0'; }
81 }
82
83 addr_string[idxOutput] = '\0'; // Terminates the string
84
85 return idxOutput;
86 }
87
88 struct LocSsrMsg : public LocMsg {
89 LocApiBase* mLocApi;
LocSsrMsgloc_core::LocSsrMsg90 inline LocSsrMsg(LocApiBase* locApi) :
91 LocMsg(), mLocApi(locApi)
92 {
93 locallog();
94 }
procloc_core::LocSsrMsg95 inline virtual void proc() const {
96 mLocApi->close();
97 mLocApi->open(mLocApi->getEvtMask());
98 }
locallogloc_core::LocSsrMsg99 inline void locallog() {
100 LOC_LOGV("LocSsrMsg");
101 }
logloc_core::LocSsrMsg102 inline virtual void log() {
103 locallog();
104 }
105 };
106
107 struct LocOpenMsg : public LocMsg {
108 LocApiBase* mLocApi;
109 LOC_API_ADAPTER_EVENT_MASK_T mMask;
LocOpenMsgloc_core::LocOpenMsg110 inline LocOpenMsg(LocApiBase* locApi,
111 LOC_API_ADAPTER_EVENT_MASK_T mask) :
112 LocMsg(), mLocApi(locApi), mMask(mask)
113 {
114 locallog();
115 }
procloc_core::LocOpenMsg116 inline virtual void proc() const {
117 mLocApi->open(mMask);
118 }
locallogloc_core::LocOpenMsg119 inline void locallog() {
120 LOC_LOGV("%s:%d]: LocOpen Mask: %x\n",
121 __func__, __LINE__, mMask);
122 }
logloc_core::LocOpenMsg123 inline virtual void log() {
124 locallog();
125 }
126 };
127
LocApiBase(const MsgTask * msgTask,LOC_API_ADAPTER_EVENT_MASK_T excludedMask,ContextBase * context)128 LocApiBase::LocApiBase(const MsgTask* msgTask,
129 LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
130 ContextBase* context) :
131 mExcludedMask(excludedMask), mMsgTask(msgTask),
132 mMask(0), mSupportedMsg(0), mContext(context)
133 {
134 memset(mLocAdapters, 0, sizeof(mLocAdapters));
135 memset(mFeaturesSupported, 0, sizeof(mFeaturesSupported));
136 }
137
getEvtMask()138 LOC_API_ADAPTER_EVENT_MASK_T LocApiBase::getEvtMask()
139 {
140 LOC_API_ADAPTER_EVENT_MASK_T mask = 0;
141
142 TO_ALL_LOCADAPTERS(mask |= mLocAdapters[i]->getEvtMask());
143
144 return mask & ~mExcludedMask;
145 }
146
isInSession()147 bool LocApiBase::isInSession()
148 {
149 bool inSession = false;
150
151 for (int i = 0;
152 !inSession && i < MAX_ADAPTERS && NULL != mLocAdapters[i];
153 i++) {
154 inSession = mLocAdapters[i]->isInSession();
155 }
156
157 return inSession;
158 }
159
needReport(const UlpLocation & ulpLocation,enum loc_sess_status status,LocPosTechMask techMask)160 bool LocApiBase::needReport(const UlpLocation& ulpLocation,
161 enum loc_sess_status status,
162 LocPosTechMask techMask)
163 {
164 bool reported = false;
165
166 if (LOC_SESS_SUCCESS == status) {
167 // this is a final fix
168 LocPosTechMask mask =
169 LOC_POS_TECH_MASK_SATELLITE | LOC_POS_TECH_MASK_SENSORS | LOC_POS_TECH_MASK_HYBRID;
170 // it is a Satellite fix or a sensor fix
171 reported = (mask & techMask);
172 }
173 else if (LOC_SESS_INTERMEDIATE == status &&
174 LOC_SESS_INTERMEDIATE == ContextBase::mGps_conf.INTERMEDIATE_POS) {
175 // this is a intermediate fix and we accept intermediate
176
177 // it is NOT the case that
178 // there is inaccuracy; and
179 // we care about inaccuracy; and
180 // the inaccuracy exceeds our tolerance
181 reported = !((ulpLocation.gpsLocation.flags & LOC_GPS_LOCATION_HAS_ACCURACY) &&
182 (ContextBase::mGps_conf.ACCURACY_THRES != 0) &&
183 (ulpLocation.gpsLocation.accuracy > ContextBase::mGps_conf.ACCURACY_THRES));
184 }
185
186 return reported;
187 }
188
addAdapter(LocAdapterBase * adapter)189 void LocApiBase::addAdapter(LocAdapterBase* adapter)
190 {
191 for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) {
192 if (mLocAdapters[i] == NULL) {
193 mLocAdapters[i] = adapter;
194 mMsgTask->sendMsg(new LocOpenMsg(this,
195 (adapter->getEvtMask())));
196 break;
197 }
198 }
199 }
200
removeAdapter(LocAdapterBase * adapter)201 void LocApiBase::removeAdapter(LocAdapterBase* adapter)
202 {
203 for (int i = 0;
204 i < MAX_ADAPTERS && NULL != mLocAdapters[i];
205 i++) {
206 if (mLocAdapters[i] == adapter) {
207 mLocAdapters[i] = NULL;
208
209 // shift the rest of the adapters up so that the pointers
210 // in the array do not have holes. This should be more
211 // performant, because the array maintenance is much much
212 // less frequent than event handlings, which need to linear
213 // search all the adapters
214 int j = i;
215 while (++i < MAX_ADAPTERS && mLocAdapters[i] != NULL);
216
217 // i would be MAX_ADAPTERS or point to a NULL
218 i--;
219 // i now should point to a none NULL adapter within valid
220 // range although i could be equal to j, but it won't hurt.
221 // No need to check it, as it gains nothing.
222 mLocAdapters[j] = mLocAdapters[i];
223 // this makes sure that we exit the for loop
224 mLocAdapters[i] = NULL;
225
226 // if we have an empty list of adapters
227 if (0 == i) {
228 close();
229 } else {
230 // else we need to remove the bit
231 mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
232 }
233 }
234 }
235 }
236
updateEvtMask()237 void LocApiBase::updateEvtMask()
238 {
239 mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
240 }
241
handleEngineUpEvent()242 void LocApiBase::handleEngineUpEvent()
243 {
244 // This will take care of renegotiating the loc handle
245 mMsgTask->sendMsg(new LocSsrMsg(this));
246
247 LocDualContext::injectFeatureConfig(mContext);
248
249 // loop through adapters, and deliver to all adapters.
250 TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineUpEvent());
251 }
252
handleEngineDownEvent()253 void LocApiBase::handleEngineDownEvent()
254 {
255 // loop through adapters, and deliver to all adapters.
256 TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineDownEvent());
257 }
258
reportPosition(UlpLocation & location,GpsLocationExtended & locationExtended,enum loc_sess_status status,LocPosTechMask loc_technology_mask)259 void LocApiBase::reportPosition(UlpLocation& location,
260 GpsLocationExtended& locationExtended,
261 enum loc_sess_status status,
262 LocPosTechMask loc_technology_mask)
263 {
264 // print the location info before delivering
265 LOC_LOGD("flags: %d\n source: %d\n latitude: %f\n longitude: %f\n "
266 "altitude: %f\n speed: %f\n bearing: %f\n accuracy: %f\n "
267 "timestamp: %lld\n rawDataSize: %d\n rawData: %p\n "
268 "Session status: %d\n Technology mask: %u\n "
269 "SV used in fix (gps/glo/bds/gal) : (%x/%x/%x/%x)",
270 location.gpsLocation.flags, location.position_source,
271 location.gpsLocation.latitude, location.gpsLocation.longitude,
272 location.gpsLocation.altitude, location.gpsLocation.speed,
273 location.gpsLocation.bearing, location.gpsLocation.accuracy,
274 location.gpsLocation.timestamp, location.rawDataSize,
275 location.rawData, status, loc_technology_mask,
276 locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask,
277 locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask,
278 locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask,
279 locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask);
280 // loop through adapters, and deliver to all adapters.
281 TO_ALL_LOCADAPTERS(
282 mLocAdapters[i]->reportPositionEvent(location, locationExtended,
283 status, loc_technology_mask)
284 );
285 }
286
reportWwanZppFix(LocGpsLocation & zppLoc)287 void LocApiBase::reportWwanZppFix(LocGpsLocation &zppLoc)
288 {
289 // loop through adapters, and deliver to the first handling adapter.
290 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportWwanZppFix(zppLoc));
291 }
292
reportSv(GnssSvNotification & svNotify)293 void LocApiBase::reportSv(GnssSvNotification& svNotify)
294 {
295 const char* constellationString[] = { "Unknown", "GPS", "SBAS", "GLONASS",
296 "QZSS", "BEIDOU", "GALILEO" };
297
298 // print the SV info before delivering
299 LOC_LOGV("num sv: %d\n"
300 " sv: constellation svid cN0"
301 " elevation azimuth flags",
302 svNotify.count);
303 for (int i = 0; i < svNotify.count && i < LOC_GNSS_MAX_SVS; i++) {
304 if (svNotify.gnssSvs[i].type >
305 sizeof(constellationString) / sizeof(constellationString[0]) - 1) {
306 svNotify.gnssSvs[i].type = GNSS_SV_TYPE_UNKNOWN;
307 }
308 LOC_LOGV(" %03zu: %*s %02d %f %f %f %f 0x%02X",
309 i,
310 13,
311 constellationString[svNotify.gnssSvs[i].type],
312 svNotify.gnssSvs[i].svId,
313 svNotify.gnssSvs[i].cN0Dbhz,
314 svNotify.gnssSvs[i].elevation,
315 svNotify.gnssSvs[i].azimuth,
316 svNotify.gnssSvs[i].carrierFrequencyHz,
317 svNotify.gnssSvs[i].gnssSvOptionsMask);
318 }
319 // loop through adapters, and deliver to all adapters.
320 TO_ALL_LOCADAPTERS(
321 mLocAdapters[i]->reportSvEvent(svNotify)
322 );
323 }
324
reportSvMeasurement(GnssSvMeasurementSet & svMeasurementSet)325 void LocApiBase::reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet)
326 {
327 // loop through adapters, and deliver to all adapters.
328 TO_ALL_LOCADAPTERS(
329 mLocAdapters[i]->reportSvMeasurementEvent(svMeasurementSet)
330 );
331 }
332
reportSvPolynomial(GnssSvPolynomial & svPolynomial)333 void LocApiBase::reportSvPolynomial(GnssSvPolynomial &svPolynomial)
334 {
335 // loop through adapters, and deliver to all adapters.
336 TO_ALL_LOCADAPTERS(
337 mLocAdapters[i]->reportSvPolynomialEvent(svPolynomial)
338 );
339 }
340
reportStatus(LocGpsStatusValue status)341 void LocApiBase::reportStatus(LocGpsStatusValue status)
342 {
343 // loop through adapters, and deliver to all adapters.
344 TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportStatus(status));
345 }
346
reportNmea(const char * nmea,int length)347 void LocApiBase::reportNmea(const char* nmea, int length)
348 {
349 // loop through adapters, and deliver to all adapters.
350 TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportNmeaEvent(nmea, length));
351 }
352
reportXtraServer(const char * url1,const char * url2,const char * url3,const int maxlength)353 void LocApiBase::reportXtraServer(const char* url1, const char* url2,
354 const char* url3, const int maxlength)
355 {
356 // loop through adapters, and deliver to the first handling adapter.
357 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportXtraServer(url1, url2, url3, maxlength));
358
359 }
360
requestXtraData()361 void LocApiBase::requestXtraData()
362 {
363 // loop through adapters, and deliver to the first handling adapter.
364 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestXtraData());
365 }
366
requestTime()367 void LocApiBase::requestTime()
368 {
369 // loop through adapters, and deliver to the first handling adapter.
370 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestTime());
371 }
372
requestLocation()373 void LocApiBase::requestLocation()
374 {
375 // loop through adapters, and deliver to the first handling adapter.
376 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestLocation());
377 }
378
requestATL(int connHandle,LocAGpsType agps_type)379 void LocApiBase::requestATL(int connHandle, LocAGpsType agps_type)
380 {
381 // loop through adapters, and deliver to the first handling adapter.
382 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestATL(connHandle, agps_type));
383 }
384
releaseATL(int connHandle)385 void LocApiBase::releaseATL(int connHandle)
386 {
387 // loop through adapters, and deliver to the first handling adapter.
388 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->releaseATL(connHandle));
389 }
390
requestSuplES(int connHandle)391 void LocApiBase::requestSuplES(int connHandle)
392 {
393 // loop through adapters, and deliver to the first handling adapter.
394 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestSuplES(connHandle));
395 }
396
reportDataCallOpened()397 void LocApiBase::reportDataCallOpened()
398 {
399 // loop through adapters, and deliver to the first handling adapter.
400 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallOpened());
401 }
402
reportDataCallClosed()403 void LocApiBase::reportDataCallClosed()
404 {
405 // loop through adapters, and deliver to the first handling adapter.
406 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallClosed());
407 }
408
requestNiNotify(GnssNiNotification & notify,const void * data)409 void LocApiBase::requestNiNotify(GnssNiNotification ¬ify, const void* data)
410 {
411 // loop through adapters, and deliver to the first handling adapter.
412 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotifyEvent(notify, data));
413 }
414
saveSupportedMsgList(uint64_t supportedMsgList)415 void LocApiBase::saveSupportedMsgList(uint64_t supportedMsgList)
416 {
417 mSupportedMsg = supportedMsgList;
418 }
419
saveSupportedFeatureList(uint8_t * featureList)420 void LocApiBase::saveSupportedFeatureList(uint8_t *featureList)
421 {
422 memcpy((void *)mFeaturesSupported, (void *)featureList, sizeof(mFeaturesSupported));
423 }
424
getSibling()425 void* LocApiBase :: getSibling()
426 DEFAULT_IMPL(NULL)
427
428 LocApiProxyBase* LocApiBase :: getLocApiProxy()
429 DEFAULT_IMPL(NULL)
430
431 void LocApiBase::reportGnssMeasurementData(GnssMeasurementsNotification& measurementsNotify)
432 {
433 // loop through adapters, and deliver to all adapters.
434 TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssMeasurementDataEvent(measurementsNotify));
435 }
436
437 enum loc_api_adapter_err LocApiBase::
open(LOC_API_ADAPTER_EVENT_MASK_T mask)438 open(LOC_API_ADAPTER_EVENT_MASK_T mask)
439 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
440
441 enum loc_api_adapter_err LocApiBase::
442 close()
443 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
444
445 enum loc_api_adapter_err LocApiBase::
446 startFix(const LocPosMode& posMode)
447 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
448
449 enum loc_api_adapter_err LocApiBase::
450 stopFix()
451 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
452
453 LocationError LocApiBase::
454 deleteAidingData(const GnssAidingData& data)
455 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
456
457 enum loc_api_adapter_err LocApiBase::
458 enableData(int enable)
459 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
460
461 enum loc_api_adapter_err LocApiBase::
462 setAPN(char* apn, int len)
463 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
464
465 enum loc_api_adapter_err LocApiBase::
466 injectPosition(double latitude, double longitude, float accuracy)
467 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
468
469 enum loc_api_adapter_err LocApiBase::
470 setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty)
471 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
472
473 enum loc_api_adapter_err LocApiBase::
474 setXtraData(char* data, int length)
475 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
476
477 enum loc_api_adapter_err LocApiBase::
478 requestXtraServer()
479 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
480
481 enum loc_api_adapter_err LocApiBase::
482 atlOpenStatus(int handle, int is_succ, char* apn,
483 AGpsBearerType bear, LocAGpsType agpsType)
484 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
485
486 enum loc_api_adapter_err LocApiBase::
487 atlCloseStatus(int handle, int is_succ)
488 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
489
490 enum loc_api_adapter_err LocApiBase::
491 setPositionMode(const LocPosMode& posMode)
492 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
493
494 LocationError LocApiBase::
495 setServer(const char* url, int len)
496 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
497
498 LocationError LocApiBase::
499 setServer(unsigned int ip, int port, LocServerType type)
500 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
501
502 LocationError LocApiBase::
503 informNiResponse(GnssNiResponse userResponse, const void* passThroughData)
504 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
505
506 LocationError LocApiBase::
507 setSUPLVersion(GnssConfigSuplVersion version)
508 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
509
510 enum loc_api_adapter_err LocApiBase::
511 setNMEATypes (uint32_t typesMask)
512 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
513
514 LocationError LocApiBase::
515 setLPPConfig(GnssConfigLppProfile profile)
516 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
517
518 enum loc_api_adapter_err LocApiBase::
519 setSensorControlConfig(int sensorUsage,
520 int sensorProvider)
521 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
522
523 enum loc_api_adapter_err LocApiBase::
524 setSensorProperties(bool gyroBiasVarianceRandomWalk_valid,
525 float gyroBiasVarianceRandomWalk,
526 bool accelBiasVarianceRandomWalk_valid,
527 float accelBiasVarianceRandomWalk,
528 bool angleBiasVarianceRandomWalk_valid,
529 float angleBiasVarianceRandomWalk,
530 bool rateBiasVarianceRandomWalk_valid,
531 float rateBiasVarianceRandomWalk,
532 bool velocityBiasVarianceRandomWalk_valid,
533 float velocityBiasVarianceRandomWalk)
534 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
535
536 enum loc_api_adapter_err LocApiBase::
537 setSensorPerfControlConfig(int controlMode,
538 int accelSamplesPerBatch,
539 int accelBatchesPerSec,
540 int gyroSamplesPerBatch,
541 int gyroBatchesPerSec,
542 int accelSamplesPerBatchHigh,
543 int accelBatchesPerSecHigh,
544 int gyroSamplesPerBatchHigh,
545 int gyroBatchesPerSecHigh,
546 int algorithmConfig)
547 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
548
549 LocationError LocApiBase::
550 setAGLONASSProtocol(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol)
551 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
552
553 LocationError LocApiBase::
554 setLPPeProtocolCp(GnssConfigLppeControlPlaneMask lppeCP)
555 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
556
557 LocationError LocApiBase::
558 setLPPeProtocolUp(GnssConfigLppeUserPlaneMask lppeUP)
559 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
560
561 enum loc_api_adapter_err LocApiBase::
562 getWwanZppFix()
563 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
564
565 enum loc_api_adapter_err LocApiBase::
566 getBestAvailableZppFix(LocGpsLocation& zppLoc)
567 {
568 memset(&zppLoc, 0, sizeof(zppLoc));
569 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
570 }
571
572 enum loc_api_adapter_err LocApiBase::
getBestAvailableZppFix(LocGpsLocation & zppLoc,LocPosTechMask & tech_mask)573 getBestAvailableZppFix(LocGpsLocation & zppLoc, LocPosTechMask & tech_mask)
574 {
575 memset(&zppLoc, 0, sizeof(zppLoc));
576 memset(&tech_mask, 0, sizeof(tech_mask));
577 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
578 }
579
580 int LocApiBase::
initDataServiceClient(bool isDueToSsr)581 initDataServiceClient(bool isDueToSsr)
582 DEFAULT_IMPL(-1)
583
584 int LocApiBase::
585 openAndStartDataCall()
586 DEFAULT_IMPL(-1)
587
588 void LocApiBase::
589 stopDataCall()
590 DEFAULT_IMPL()
591
592 void LocApiBase::
593 closeDataCall()
594 DEFAULT_IMPL()
595
596 void LocApiBase::
597 releaseDataServiceClient()
598 DEFAULT_IMPL()
599
600 LocationError LocApiBase::
601 setGpsLock(GnssConfigGpsLock lock)
602 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
603
604 void LocApiBase::
605 installAGpsCert(const LocDerEncodedCertificate* pData,
606 size_t length,
607 uint32_t slotBitMask)
608 DEFAULT_IMPL()
609
610 int LocApiBase::
611 getGpsLock()
612 DEFAULT_IMPL(-1)
613
614 LocationError LocApiBase::
615 setXtraVersionCheck(uint32_t check)
616 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
617
618 bool LocApiBase::
619 gnssConstellationConfig()
620 DEFAULT_IMPL(false)
621
622 bool LocApiBase::
623 isFeatureSupported(uint8_t featureVal)
624 {
625 uint8_t arrayIndex = featureVal >> 3;
626 uint8_t bitPos = featureVal & 7;
627
628 if (arrayIndex >= MAX_FEATURE_LENGTH) return false;
629 return ((mFeaturesSupported[arrayIndex] >> bitPos ) & 0x1);
630 }
631
632 } // namespace loc_core
633