1/* Copyright (c) 2011-2014, 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_LocAdapterBase"
31
32#include <dlfcn.h>
33#include <LocAdapterBase.h>
34#include <loc_target.h>
35#include <log_util.h>
36#include <LocAdapterProxyBase.h>
37
38namespace loc_core {
39
40// This is the top level class, so the constructor will
41// always gets called. Here we prepare for the default.
42// But if getLocApi(targetEnumType target) is overriden,
43// the right locApi should get created.
44LocAdapterBase::LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
45                               ContextBase* context, LocAdapterProxyBase *adapterProxyBase) :
46    mEvtMask(mask), mContext(context),
47    mLocApi(context->getLocApi()), mLocAdapterProxyBase(adapterProxyBase),
48    mMsgTask(context->getMsgTask())
49{
50    mLocApi->addAdapter(this);
51}
52
53void LocAdapterBase::handleEngineUpEvent()
54{
55    if (mLocAdapterProxyBase) {
56        mLocAdapterProxyBase->handleEngineUpEvent();
57    }
58}
59
60void LocAdapterBase::handleEngineDownEvent()
61{
62    if (mLocAdapterProxyBase) {
63        mLocAdapterProxyBase->handleEngineDownEvent();
64    }
65}
66
67void LocAdapterBase::
68    reportPosition(UlpLocation &location,
69                   GpsLocationExtended &locationExtended,
70                   void* locationExt,
71                   enum loc_sess_status status,
72                   LocPosTechMask loc_technology_mask)
73DEFAULT_IMPL()
74
75void LocAdapterBase::
76    reportSv(GpsSvStatus &svStatus,
77             GpsLocationExtended &locationExtended,
78             void* svExt)
79DEFAULT_IMPL()
80
81
82void LocAdapterBase::
83    reportStatus(GpsStatusValue status)
84DEFAULT_IMPL()
85
86
87void LocAdapterBase::
88    reportNmea(const char* nmea, int length)
89DEFAULT_IMPL()
90
91bool LocAdapterBase::
92    reportXtraServer(const char* url1, const char* url2,
93                     const char* url3, const int maxlength)
94DEFAULT_IMPL(false)
95
96bool LocAdapterBase::
97    requestXtraData()
98DEFAULT_IMPL(false)
99
100bool LocAdapterBase::
101    requestTime()
102DEFAULT_IMPL(false)
103
104bool LocAdapterBase::
105    requestLocation()
106DEFAULT_IMPL(false)
107
108bool LocAdapterBase::
109    requestATL(int connHandle, AGpsType agps_type)
110DEFAULT_IMPL(false)
111
112bool LocAdapterBase::
113    releaseATL(int connHandle)
114DEFAULT_IMPL(false)
115
116bool LocAdapterBase::
117    requestSuplES(int connHandle)
118DEFAULT_IMPL(false)
119
120bool LocAdapterBase::
121    reportDataCallOpened()
122DEFAULT_IMPL(false)
123
124bool LocAdapterBase::
125    reportDataCallClosed()
126DEFAULT_IMPL(false)
127
128bool LocAdapterBase::
129    requestNiNotify(GpsNiNotification &notify, const void* data)
130DEFAULT_IMPL(false)
131
132void LocAdapterBase::
133    shutdown()
134DEFAULT_IMPL()
135
136void LocAdapterBase::
137    reportGpsMeasurementData(GpsData &gpsMeasurementData)
138DEFAULT_IMPL()
139} // namespace loc_core
140