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