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_NDDEBUG 0
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("   %03d: %*s  %02d    %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].gnssSvOptionsMask);
288     }
289     // loop through adapters, and deliver to all adapters.
290     TO_ALL_LOCADAPTERS(
291         mLocAdapters[i]->reportSvEvent(svNotify)
292         );
293 }
294 
reportSvMeasurement(GnssSvMeasurementSet & svMeasurementSet)295 void LocApiBase::reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet)
296 {
297     // loop through adapters, and deliver to all adapters.
298     TO_ALL_LOCADAPTERS(
299         mLocAdapters[i]->reportSvMeasurementEvent(svMeasurementSet)
300     );
301 }
302 
reportSvPolynomial(GnssSvPolynomial & svPolynomial)303 void LocApiBase::reportSvPolynomial(GnssSvPolynomial &svPolynomial)
304 {
305     // loop through adapters, and deliver to all adapters.
306     TO_ALL_LOCADAPTERS(
307         mLocAdapters[i]->reportSvPolynomialEvent(svPolynomial)
308     );
309 }
310 
reportStatus(LocGpsStatusValue status)311 void LocApiBase::reportStatus(LocGpsStatusValue status)
312 {
313     // loop through adapters, and deliver to all adapters.
314     TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportStatus(status));
315 }
316 
reportNmea(const char * nmea,int length)317 void LocApiBase::reportNmea(const char* nmea, int length)
318 {
319     // loop through adapters, and deliver to all adapters.
320     TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportNmeaEvent(nmea, length));
321 }
322 
reportXtraServer(const char * url1,const char * url2,const char * url3,const int maxlength)323 void LocApiBase::reportXtraServer(const char* url1, const char* url2,
324                                   const char* url3, const int maxlength)
325 {
326     // loop through adapters, and deliver to the first handling adapter.
327     TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportXtraServer(url1, url2, url3, maxlength));
328 
329 }
330 
requestXtraData()331 void LocApiBase::requestXtraData()
332 {
333     // loop through adapters, and deliver to the first handling adapter.
334     TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestXtraData());
335 }
336 
requestTime()337 void LocApiBase::requestTime()
338 {
339     // loop through adapters, and deliver to the first handling adapter.
340     TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestTime());
341 }
342 
requestLocation()343 void LocApiBase::requestLocation()
344 {
345     // loop through adapters, and deliver to the first handling adapter.
346     TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestLocation());
347 }
348 
requestATL(int connHandle,LocAGpsType agps_type)349 void LocApiBase::requestATL(int connHandle, LocAGpsType agps_type)
350 {
351     // loop through adapters, and deliver to the first handling adapter.
352     TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestATL(connHandle, agps_type));
353 }
354 
releaseATL(int connHandle)355 void LocApiBase::releaseATL(int connHandle)
356 {
357     // loop through adapters, and deliver to the first handling adapter.
358     TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->releaseATL(connHandle));
359 }
360 
requestSuplES(int connHandle)361 void LocApiBase::requestSuplES(int connHandle)
362 {
363     // loop through adapters, and deliver to the first handling adapter.
364     TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestSuplES(connHandle));
365 }
366 
reportDataCallOpened()367 void LocApiBase::reportDataCallOpened()
368 {
369     // loop through adapters, and deliver to the first handling adapter.
370     TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallOpened());
371 }
372 
reportDataCallClosed()373 void LocApiBase::reportDataCallClosed()
374 {
375     // loop through adapters, and deliver to the first handling adapter.
376     TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallClosed());
377 }
378 
requestNiNotify(GnssNiNotification & notify,const void * data)379 void LocApiBase::requestNiNotify(GnssNiNotification &notify, const void* data)
380 {
381     // loop through adapters, and deliver to the first handling adapter.
382     TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotifyEvent(notify, data));
383 }
384 
saveSupportedMsgList(uint64_t supportedMsgList)385 void LocApiBase::saveSupportedMsgList(uint64_t supportedMsgList)
386 {
387     mSupportedMsg = supportedMsgList;
388 }
389 
saveSupportedFeatureList(uint8_t * featureList)390 void LocApiBase::saveSupportedFeatureList(uint8_t *featureList)
391 {
392     memcpy((void *)mFeaturesSupported, (void *)featureList, sizeof(mFeaturesSupported));
393 }
394 
getSibling()395 void* LocApiBase :: getSibling()
396     DEFAULT_IMPL(NULL)
397 
398 LocApiProxyBase* LocApiBase :: getLocApiProxy()
399     DEFAULT_IMPL(NULL)
400 
401 void LocApiBase::reportGnssMeasurementData(GnssMeasurementsNotification& measurementsNotify)
402 {
403     // loop through adapters, and deliver to all adapters.
404     TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportGnssMeasurementDataEvent(measurementsNotify));
405 }
406 
407 enum loc_api_adapter_err LocApiBase::
open(LOC_API_ADAPTER_EVENT_MASK_T mask)408    open(LOC_API_ADAPTER_EVENT_MASK_T mask)
409 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
410 
411 enum loc_api_adapter_err LocApiBase::
412     close()
413 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
414 
415 enum loc_api_adapter_err LocApiBase::
416     startFix(const LocPosMode& posMode)
417 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
418 
419 enum loc_api_adapter_err LocApiBase::
420     stopFix()
421 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
422 
423 LocationError LocApiBase::
424     deleteAidingData(const GnssAidingData& data)
425 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
426 
427 enum loc_api_adapter_err LocApiBase::
428     enableData(int enable)
429 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
430 
431 enum loc_api_adapter_err LocApiBase::
432     setAPN(char* apn, int len)
433 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
434 
435 enum loc_api_adapter_err LocApiBase::
436     injectPosition(double latitude, double longitude, float accuracy)
437 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
438 
439 enum loc_api_adapter_err LocApiBase::
440     setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty)
441 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
442 
443 enum loc_api_adapter_err LocApiBase::
444     setXtraData(char* data, int length)
445 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
446 
447 enum loc_api_adapter_err LocApiBase::
448     requestXtraServer()
449 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
450 
451 enum loc_api_adapter_err LocApiBase::
452    atlOpenStatus(int handle, int is_succ, char* apn,
453                  AGpsBearerType bear, LocAGpsType agpsType)
454 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
455 
456 enum loc_api_adapter_err LocApiBase::
457     atlCloseStatus(int handle, int is_succ)
458 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
459 
460 enum loc_api_adapter_err LocApiBase::
461     setPositionMode(const LocPosMode& posMode)
462 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
463 
464 LocationError LocApiBase::
465     setServer(const char* url, int len)
466 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
467 
468 LocationError LocApiBase::
469     setServer(unsigned int ip, int port, LocServerType type)
470 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
471 
472 LocationError LocApiBase::
473     informNiResponse(GnssNiResponse userResponse, const void* passThroughData)
474 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
475 
476 LocationError LocApiBase::
477     setSUPLVersion(GnssConfigSuplVersion version)
478 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
479 
480 enum loc_api_adapter_err LocApiBase::
481     setNMEATypes (uint32_t typesMask)
482 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
483 
484 LocationError LocApiBase::
485     setLPPConfig(GnssConfigLppProfile profile)
486 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
487 
488 enum loc_api_adapter_err LocApiBase::
489     setSensorControlConfig(int sensorUsage,
490                            int sensorProvider)
491 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
492 
493 enum loc_api_adapter_err LocApiBase::
494     setSensorProperties(bool gyroBiasVarianceRandomWalk_valid,
495                         float gyroBiasVarianceRandomWalk,
496                         bool accelBiasVarianceRandomWalk_valid,
497                         float accelBiasVarianceRandomWalk,
498                         bool angleBiasVarianceRandomWalk_valid,
499                         float angleBiasVarianceRandomWalk,
500                         bool rateBiasVarianceRandomWalk_valid,
501                         float rateBiasVarianceRandomWalk,
502                         bool velocityBiasVarianceRandomWalk_valid,
503                         float velocityBiasVarianceRandomWalk)
504 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
505 
506 enum loc_api_adapter_err LocApiBase::
507     setSensorPerfControlConfig(int controlMode,
508                                int accelSamplesPerBatch,
509                                int accelBatchesPerSec,
510                                int gyroSamplesPerBatch,
511                                int gyroBatchesPerSec,
512                                int accelSamplesPerBatchHigh,
513                                int accelBatchesPerSecHigh,
514                                int gyroSamplesPerBatchHigh,
515                                int gyroBatchesPerSecHigh,
516                                int algorithmConfig)
517 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
518 
519 LocationError LocApiBase::
520     setAGLONASSProtocol(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol)
521 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
522 
523 LocationError LocApiBase::
524     setLPPeProtocolCp(GnssConfigLppeControlPlaneMask lppeCP)
525 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
526 
527 LocationError LocApiBase::
528     setLPPeProtocolUp(GnssConfigLppeUserPlaneMask lppeUP)
529 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
530 
531 enum loc_api_adapter_err LocApiBase::
532    getWwanZppFix()
533 DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
534 
535 enum loc_api_adapter_err LocApiBase::
536    getBestAvailableZppFix(LocGpsLocation& zppLoc)
537 {
538    memset(&zppLoc, 0, sizeof(zppLoc));
539    DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
540 }
541 
542 enum loc_api_adapter_err LocApiBase::
getBestAvailableZppFix(LocGpsLocation & zppLoc,LocPosTechMask & tech_mask)543    getBestAvailableZppFix(LocGpsLocation & zppLoc, LocPosTechMask & tech_mask)
544 {
545    memset(&zppLoc, 0, sizeof(zppLoc));
546    memset(&tech_mask, 0, sizeof(tech_mask));
547    DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
548 }
549 
550 int LocApiBase::
initDataServiceClient(bool isDueToSsr)551     initDataServiceClient(bool isDueToSsr)
552 DEFAULT_IMPL(-1)
553 
554 int LocApiBase::
555     openAndStartDataCall()
556 DEFAULT_IMPL(-1)
557 
558 void LocApiBase::
559     stopDataCall()
560 DEFAULT_IMPL()
561 
562 void LocApiBase::
563     closeDataCall()
564 DEFAULT_IMPL()
565 
566 void LocApiBase::
567     releaseDataServiceClient()
568 DEFAULT_IMPL()
569 
570 LocationError LocApiBase::
571     setGpsLock(GnssConfigGpsLock lock)
572 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
573 
574 void LocApiBase::
575     installAGpsCert(const LocDerEncodedCertificate* pData,
576                     size_t length,
577                     uint32_t slotBitMask)
578 DEFAULT_IMPL()
579 
580 int LocApiBase::
581     getGpsLock()
582 DEFAULT_IMPL(-1)
583 
584 LocationError LocApiBase::
585     setXtraVersionCheck(uint32_t check)
586 DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
587 
588 bool LocApiBase::
589     gnssConstellationConfig()
590 DEFAULT_IMPL(false)
591 
592 bool LocApiBase::
593     isFeatureSupported(uint8_t featureVal)
594 {
595     uint8_t arrayIndex = featureVal >> 3;
596     uint8_t bitPos = featureVal & 7;
597 
598     if (arrayIndex >= MAX_FEATURE_LENGTH) return false;
599     return ((mFeaturesSupported[arrayIndex] >> bitPos ) & 0x1);
600 }
601 
602 } // namespace loc_core
603