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
addAdapter(LocAdapterBase * adapter)160 void LocApiBase::addAdapter(LocAdapterBase* adapter)
161 {
162 for (int i = 0; i < MAX_ADAPTERS && mLocAdapters[i] != adapter; i++) {
163 if (mLocAdapters[i] == NULL) {
164 mLocAdapters[i] = adapter;
165 mMsgTask->sendMsg(new LocOpenMsg(this,
166 (adapter->getEvtMask())));
167 break;
168 }
169 }
170 }
171
removeAdapter(LocAdapterBase * adapter)172 void LocApiBase::removeAdapter(LocAdapterBase* adapter)
173 {
174 for (int i = 0;
175 i < MAX_ADAPTERS && NULL != mLocAdapters[i];
176 i++) {
177 if (mLocAdapters[i] == adapter) {
178 mLocAdapters[i] = NULL;
179
180 // shift the rest of the adapters up so that the pointers
181 // in the array do not have holes. This should be more
182 // performant, because the array maintenance is much much
183 // less frequent than event handlings, which need to linear
184 // search all the adapters
185 int j = i;
186 while (++i < MAX_ADAPTERS && mLocAdapters[i] != NULL);
187
188 // i would be MAX_ADAPTERS or point to a NULL
189 i--;
190 // i now should point to a none NULL adapter within valid
191 // range although i could be equal to j, but it won't hurt.
192 // No need to check it, as it gains nothing.
193 mLocAdapters[j] = mLocAdapters[i];
194 // this makes sure that we exit the for loop
195 mLocAdapters[i] = NULL;
196
197 // if we have an empty list of adapters
198 if (0 == i) {
199 close();
200 } else {
201 // else we need to remove the bit
202 mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
203 }
204 }
205 }
206 }
207
updateEvtMask()208 void LocApiBase::updateEvtMask()
209 {
210 mMsgTask->sendMsg(new LocOpenMsg(this, getEvtMask()));
211 }
212
handleEngineUpEvent()213 void LocApiBase::handleEngineUpEvent()
214 {
215 // This will take care of renegotiating the loc handle
216 mMsgTask->sendMsg(new LocSsrMsg(this));
217
218 LocDualContext::injectFeatureConfig(mContext);
219
220 // loop through adapters, and deliver to all adapters.
221 TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineUpEvent());
222 }
223
handleEngineDownEvent()224 void LocApiBase::handleEngineDownEvent()
225 {
226 // loop through adapters, and deliver to all adapters.
227 TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineDownEvent());
228 }
229
reportPosition(UlpLocation & location,GpsLocationExtended & locationExtended,enum loc_sess_status status,LocPosTechMask loc_technology_mask)230 void LocApiBase::reportPosition(UlpLocation& location,
231 GpsLocationExtended& locationExtended,
232 enum loc_sess_status status,
233 LocPosTechMask loc_technology_mask)
234 {
235 // print the location info before delivering
236 LOC_LOGD("flags: %d\n source: %d\n latitude: %f\n longitude: %f\n "
237 "altitude: %f\n speed: %f\n bearing: %f\n accuracy: %f\n "
238 "timestamp: %lld\n rawDataSize: %d\n rawData: %p\n "
239 "Session status: %d\n Technology mask: %u\n "
240 "SV used in fix (gps/glo/bds/gal) : (%x/%x/%x/%x)",
241 location.gpsLocation.flags, location.position_source,
242 location.gpsLocation.latitude, location.gpsLocation.longitude,
243 location.gpsLocation.altitude, location.gpsLocation.speed,
244 location.gpsLocation.bearing, location.gpsLocation.accuracy,
245 location.gpsLocation.timestamp, location.rawDataSize,
246 location.rawData, status, loc_technology_mask,
247 locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask,
248 locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask,
249 locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask,
250 locationExtended.gnss_sv_used_ids.gal_sv_used_ids_mask);
251 // loop through adapters, and deliver to all adapters.
252 TO_ALL_LOCADAPTERS(
253 mLocAdapters[i]->reportPositionEvent(location, locationExtended,
254 status, loc_technology_mask)
255 );
256 }
257
reportWwanZppFix(LocGpsLocation & zppLoc)258 void LocApiBase::reportWwanZppFix(LocGpsLocation &zppLoc)
259 {
260 // loop through adapters, and deliver to the first handling adapter.
261 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportWwanZppFix(zppLoc));
262 }
263
reportSv(GnssSvNotification & svNotify)264 void LocApiBase::reportSv(GnssSvNotification& svNotify)
265 {
266 const char* constellationString[] = { "Unknown", "GPS", "SBAS", "GLONASS",
267 "QZSS", "BEIDOU", "GALILEO" };
268
269 // print the SV info before delivering
270 LOC_LOGV("num sv: %d\n"
271 " sv: constellation svid cN0"
272 " elevation azimuth flags",
273 svNotify.count);
274 for (int i = 0; i < svNotify.count && i < LOC_GNSS_MAX_SVS; i++) {
275 if (svNotify.gnssSvs[i].type >
276 sizeof(constellationString) / sizeof(constellationString[0]) - 1) {
277 svNotify.gnssSvs[i].type = GNSS_SV_TYPE_UNKNOWN;
278 }
279 LOC_LOGV(" %03zu: %*s %02d %f %f %f %f 0x%02X",
280 i,
281 13,
282 constellationString[svNotify.gnssSvs[i].type],
283 svNotify.gnssSvs[i].svId,
284 svNotify.gnssSvs[i].cN0Dbhz,
285 svNotify.gnssSvs[i].elevation,
286 svNotify.gnssSvs[i].azimuth,
287 svNotify.gnssSvs[i].carrierFrequencyHz,
288 svNotify.gnssSvs[i].gnssSvOptionsMask);
289 }
290 // loop through adapters, and deliver to all adapters.
291 TO_ALL_LOCADAPTERS(
292 mLocAdapters[i]->reportSvEvent(svNotify)
293 );
294 }
295
reportSvMeasurement(GnssSvMeasurementSet & svMeasurementSet)296 void LocApiBase::reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet)
297 {
298 // loop through adapters, and deliver to all adapters.
299 TO_ALL_LOCADAPTERS(
300 mLocAdapters[i]->reportSvMeasurementEvent(svMeasurementSet)
301 );
302 }
303
reportSvPolynomial(GnssSvPolynomial & svPolynomial)304 void LocApiBase::reportSvPolynomial(GnssSvPolynomial &svPolynomial)
305 {
306 // loop through adapters, and deliver to all adapters.
307 TO_ALL_LOCADAPTERS(
308 mLocAdapters[i]->reportSvPolynomialEvent(svPolynomial)
309 );
310 }
311
reportStatus(LocGpsStatusValue status)312 void LocApiBase::reportStatus(LocGpsStatusValue status)
313 {
314 // loop through adapters, and deliver to all adapters.
315 TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportStatus(status));
316 }
317
reportNmea(const char * nmea,int length)318 void LocApiBase::reportNmea(const char* nmea, int length)
319 {
320 // loop through adapters, and deliver to all adapters.
321 TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportNmeaEvent(nmea, length));
322 }
323
reportXtraServer(const char * url1,const char * url2,const char * url3,const int maxlength)324 void LocApiBase::reportXtraServer(const char* url1, const char* url2,
325 const char* url3, const int maxlength)
326 {
327 // loop through adapters, and deliver to the first handling adapter.
328 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportXtraServer(url1, url2, url3, maxlength));
329
330 }
331
requestXtraData()332 void LocApiBase::requestXtraData()
333 {
334 // loop through adapters, and deliver to the first handling adapter.
335 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestXtraData());
336 }
337
requestTime()338 void LocApiBase::requestTime()
339 {
340 // loop through adapters, and deliver to the first handling adapter.
341 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestTime());
342 }
343
requestLocation()344 void LocApiBase::requestLocation()
345 {
346 // loop through adapters, and deliver to the first handling adapter.
347 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestLocation());
348 }
349
requestATL(int connHandle,LocAGpsType agps_type)350 void LocApiBase::requestATL(int connHandle, LocAGpsType agps_type)
351 {
352 // loop through adapters, and deliver to the first handling adapter.
353 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestATL(connHandle, agps_type));
354 }
355
releaseATL(int connHandle)356 void LocApiBase::releaseATL(int connHandle)
357 {
358 // loop through adapters, and deliver to the first handling adapter.
359 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->releaseATL(connHandle));
360 }
361
requestSuplES(int connHandle)362 void LocApiBase::requestSuplES(int connHandle)
363 {
364 // loop through adapters, and deliver to the first handling adapter.
365 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestSuplES(connHandle));
366 }
367
reportDataCallOpened()368 void LocApiBase::reportDataCallOpened()
369 {
370 // loop through adapters, and deliver to the first handling adapter.
371 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallOpened());
372 }
373
reportDataCallClosed()374 void LocApiBase::reportDataCallClosed()
375 {
376 // loop through adapters, and deliver to the first handling adapter.
377 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallClosed());
378 }
379
requestNiNotify(GnssNiNotification & notify,const void * data)380 void LocApiBase::requestNiNotify(GnssNiNotification ¬ify, const void* data)
381 {
382 // loop through adapters, and deliver to the first handling adapter.
383 TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotifyEvent(notify, data));
384 }
385
saveSupportedMsgList(uint64_t supportedMsgList)386 void LocApiBase::saveSupportedMsgList(uint64_t supportedMsgList)
387 {
388 mSupportedMsg = supportedMsgList;
389 }
390
saveSupportedFeatureList(uint8_t * featureList)391 void LocApiBase::saveSupportedFeatureList(uint8_t *featureList)
392 {
393 memcpy((void *)mFeaturesSupported, (void *)featureList, sizeof(mFeaturesSupported));
394 }
395
getSibling()396 void* LocApiBase :: getSibling()
397 DEFAULT_IMPL(NULL)
398
399 LocApiProxyBase* LocApiBase :: getLocApiProxy()
400 DEFAULT_IMPL(NULL)
401
402 void LocApiBase::reportGnssMeasurementData(GnssMeasurementsNotification& measurementsNotify)
403 {
404 // loop through adapters, and deliver to all adapters.
405 TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssMeasurementDataEvent(measurementsNotify));
406 }
407
408 enum loc_api_adapter_err LocApiBase::
open(LOC_API_ADAPTER_EVENT_MASK_T mask)409 open(LOC_API_ADAPTER_EVENT_MASK_T mask)
410 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
411
412 enum loc_api_adapter_err LocApiBase::
413 close()
414 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
415
416 enum loc_api_adapter_err LocApiBase::
417 startFix(const LocPosMode& posMode)
418 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
419
420 enum loc_api_adapter_err LocApiBase::
421 stopFix()
422 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
423
424 LocationError LocApiBase::
425 deleteAidingData(const GnssAidingData& data)
426 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
427
428 enum loc_api_adapter_err LocApiBase::
429 enableData(int enable)
430 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
431
432 enum loc_api_adapter_err LocApiBase::
433 setAPN(char* apn, int len)
434 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
435
436 enum loc_api_adapter_err LocApiBase::
437 injectPosition(double latitude, double longitude, float accuracy)
438 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
439
440 enum loc_api_adapter_err LocApiBase::
441 setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty)
442 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
443
444 enum loc_api_adapter_err LocApiBase::
445 setXtraData(char* data, int length)
446 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
447
448 enum loc_api_adapter_err LocApiBase::
449 requestXtraServer()
450 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
451
452 enum loc_api_adapter_err LocApiBase::
453 atlOpenStatus(int handle, int is_succ, char* apn,
454 AGpsBearerType bear, LocAGpsType agpsType)
455 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
456
457 enum loc_api_adapter_err LocApiBase::
458 atlCloseStatus(int handle, int is_succ)
459 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
460
461 enum loc_api_adapter_err LocApiBase::
462 setPositionMode(const LocPosMode& posMode)
463 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
464
465 LocationError LocApiBase::
466 setServer(const char* url, int len)
467 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
468
469 LocationError LocApiBase::
470 setServer(unsigned int ip, int port, LocServerType type)
471 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
472
473 LocationError LocApiBase::
474 informNiResponse(GnssNiResponse userResponse, const void* passThroughData)
475 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
476
477 LocationError LocApiBase::
478 setSUPLVersion(GnssConfigSuplVersion version)
479 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
480
481 enum loc_api_adapter_err LocApiBase::
482 setNMEATypes (uint32_t typesMask)
483 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
484
485 LocationError LocApiBase::
486 setLPPConfig(GnssConfigLppProfile profile)
487 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
488
489 enum loc_api_adapter_err LocApiBase::
490 setSensorControlConfig(int sensorUsage,
491 int sensorProvider)
492 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
493
494 enum loc_api_adapter_err LocApiBase::
495 setSensorProperties(bool gyroBiasVarianceRandomWalk_valid,
496 float gyroBiasVarianceRandomWalk,
497 bool accelBiasVarianceRandomWalk_valid,
498 float accelBiasVarianceRandomWalk,
499 bool angleBiasVarianceRandomWalk_valid,
500 float angleBiasVarianceRandomWalk,
501 bool rateBiasVarianceRandomWalk_valid,
502 float rateBiasVarianceRandomWalk,
503 bool velocityBiasVarianceRandomWalk_valid,
504 float velocityBiasVarianceRandomWalk)
505 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
506
507 enum loc_api_adapter_err LocApiBase::
508 setSensorPerfControlConfig(int controlMode,
509 int accelSamplesPerBatch,
510 int accelBatchesPerSec,
511 int gyroSamplesPerBatch,
512 int gyroBatchesPerSec,
513 int accelSamplesPerBatchHigh,
514 int accelBatchesPerSecHigh,
515 int gyroSamplesPerBatchHigh,
516 int gyroBatchesPerSecHigh,
517 int algorithmConfig)
518 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
519
520 LocationError LocApiBase::
521 setAGLONASSProtocol(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol)
522 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
523
524 LocationError LocApiBase::
525 setLPPeProtocolCp(GnssConfigLppeControlPlaneMask lppeCP)
526 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
527
528 LocationError LocApiBase::
529 setLPPeProtocolUp(GnssConfigLppeUserPlaneMask lppeUP)
530 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
531
532 enum loc_api_adapter_err LocApiBase::
533 getWwanZppFix()
534 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
535
536 enum loc_api_adapter_err LocApiBase::
537 getBestAvailableZppFix(LocGpsLocation& zppLoc)
538 {
539 memset(&zppLoc, 0, sizeof(zppLoc));
540 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
541 }
542
543 enum loc_api_adapter_err LocApiBase::
getBestAvailableZppFix(LocGpsLocation & zppLoc,LocPosTechMask & tech_mask)544 getBestAvailableZppFix(LocGpsLocation & zppLoc, LocPosTechMask & tech_mask)
545 {
546 memset(&zppLoc, 0, sizeof(zppLoc));
547 memset(&tech_mask, 0, sizeof(tech_mask));
548 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
549 }
550
551 int LocApiBase::
initDataServiceClient(bool isDueToSsr)552 initDataServiceClient(bool isDueToSsr)
553 DEFAULT_IMPL(-1)
554
555 int LocApiBase::
556 openAndStartDataCall()
557 DEFAULT_IMPL(-1)
558
559 void LocApiBase::
560 stopDataCall()
561 DEFAULT_IMPL()
562
563 void LocApiBase::
564 closeDataCall()
565 DEFAULT_IMPL()
566
567 void LocApiBase::
568 releaseDataServiceClient()
569 DEFAULT_IMPL()
570
571 LocationError LocApiBase::
572 setGpsLock(GnssConfigGpsLock lock)
573 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
574
575 void LocApiBase::
576 installAGpsCert(const LocDerEncodedCertificate* pData,
577 size_t length,
578 uint32_t slotBitMask)
579 DEFAULT_IMPL()
580
581 int LocApiBase::
582 getGpsLock()
583 DEFAULT_IMPL(-1)
584
585 LocationError LocApiBase::
586 setXtraVersionCheck(uint32_t check)
587 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
588
589 bool LocApiBase::
590 gnssConstellationConfig()
591 DEFAULT_IMPL(false)
592
593 bool LocApiBase::
594 isFeatureSupported(uint8_t featureVal)
595 {
596 uint8_t arrayIndex = featureVal >> 3;
597 uint8_t bitPos = featureVal & 7;
598
599 if (arrayIndex >= MAX_FEATURE_LENGTH) return false;
600 return ((mFeaturesSupported[arrayIndex] >> bitPos ) & 0x1);
601 }
602
603 } // namespace loc_core
604