1 /* Copyright (c) 2013-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 #ifndef ULP_PROXY_BASE_H
30 #define ULP_PROXY_BASE_H
31 
32 #include <gps_extended.h>
33 #include <LocationAPI.h>
34 
35 namespace loc_core {
36 
37 class LocAdapterBase;
38 
39 class UlpProxyBase {
40 public:
41     LocPosMode mPosMode;
42     bool mFixSet;
UlpProxyBase()43     inline UlpProxyBase() {
44         mPosMode.mode = LOC_POSITION_MODE_INVALID;
45         mFixSet = false;
46     }
~UlpProxyBase()47     inline virtual ~UlpProxyBase() {}
sendStartFix()48     inline virtual bool sendStartFix() { mFixSet = true; return false; }
sendStopFix()49     inline virtual bool sendStopFix() { mFixSet = false; return false; }
sendFixMode(LocPosMode & params)50     inline virtual bool sendFixMode(LocPosMode &params) {
51         mPosMode = params;
52         return false;
53     }
54 
reportPosition(const UlpLocation & location,const GpsLocationExtended & locationExtended,enum loc_sess_status status,LocPosTechMask loc_technology_mask)55     inline virtual bool reportPosition(const UlpLocation &location,
56                                        const GpsLocationExtended &locationExtended,
57                                        enum loc_sess_status status,
58                                        LocPosTechMask loc_technology_mask) {
59         (void)location;
60         (void)locationExtended;
61         (void)status;
62         (void)loc_technology_mask;
63         return false;
64     }
reportSv(const GnssSvNotification & svNotify)65     inline virtual bool reportSv(const GnssSvNotification& svNotify) {
66         (void)svNotify;
67         return false;
68     }
reportSvMeasurement(GnssSvMeasurementSet & svMeasurementSet)69     inline virtual bool reportSvMeasurement(GnssSvMeasurementSet &svMeasurementSet) {
70         (void)svMeasurementSet;
71         return false;
72     }
73 
reportSvPolynomial(GnssSvPolynomial & svPolynomial)74     inline virtual bool reportSvPolynomial(GnssSvPolynomial &svPolynomial)
75     {
76        (void)svPolynomial;
77        return false;
78     }
reportStatus(LocGpsStatusValue status)79     inline virtual bool reportStatus(LocGpsStatusValue status) {
80 
81         (void)status;
82         return false;
83     }
setAdapter(LocAdapterBase * adapter)84     inline virtual void setAdapter(LocAdapterBase* adapter) {
85 
86         (void)adapter;
87     }
setCapabilities(unsigned long capabilities)88     inline virtual void setCapabilities(unsigned long capabilities) {
89 
90         (void)capabilities;
91     }
reportBatchingSession(const LocationOptions & options,bool active)92     inline virtual bool reportBatchingSession(const LocationOptions& options, bool active)
93     {
94          (void)options;
95          (void)active;
96          return false;
97     }
reportPositions(const UlpLocation * ulpLocations,const GpsLocationExtended * extendedLocations,const uint32_t * techMasks,const size_t count)98     inline virtual bool reportPositions(const UlpLocation* ulpLocations,
99                                         const GpsLocationExtended* extendedLocations,
100                                         const uint32_t* techMasks,
101                                         const size_t count)
102     {
103         (void)ulpLocations;
104         (void)extendedLocations;
105         (void)techMasks;
106         (void)count;
107         return false;
108     }
reportDeleteAidingData(LocGpsAidingData aidingData)109     inline virtual bool reportDeleteAidingData(LocGpsAidingData aidingData)
110     {
111        (void)aidingData;
112        return false;
113     }
reportNmea(const char * nmea,int length)114     inline virtual bool reportNmea(const char* nmea, int length)
115     {
116         (void)nmea;
117         (void)length;
118         return false;
119     }
120 };
121 
122 } // namespace loc_core
123 
124 #endif // ULP_PROXY_BASE_H
125