1 /* Copyright (c) 2018, 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 ENGINE_HUB_PROXY_BASE_H
30 #define ENGINE_HUB_PROXY_BASE_H
31 
32 namespace loc_core {
33 
34 class EngineHubProxyBase {
35 public:
EngineHubProxyBase()36     inline EngineHubProxyBase() {
37     }
~EngineHubProxyBase()38     inline virtual ~EngineHubProxyBase() {}
39 
40     // gnss session related functions
gnssStartFix()41     inline virtual bool gnssStartFix() {
42         return false;
43     }
44 
gnssStopFix()45     inline virtual bool gnssStopFix() {
46         return false;
47     }
48 
gnssSetFixMode(const LocPosMode & params)49     inline virtual bool gnssSetFixMode(const LocPosMode &params) {
50         (void) params;
51         return false;
52     }
53 
gnssDeleteAidingData(const GnssAidingData & aidingData)54     inline virtual bool gnssDeleteAidingData(const GnssAidingData &aidingData) {
55         (void) aidingData;
56         return false;
57     }
58 
59     // GNSS reports
gnssReportPosition(const UlpLocation & location,const GpsLocationExtended & locationExtended,enum loc_sess_status status)60     inline virtual bool gnssReportPosition(const UlpLocation &location,
61                                            const GpsLocationExtended &locationExtended,
62                                            enum loc_sess_status status) {
63         (void) location;
64         (void) locationExtended;
65         (void) status;
66         return false;
67     }
68 
gnssReportSv(const GnssSvNotification & svNotify)69     inline virtual bool gnssReportSv(const GnssSvNotification& svNotify) {
70         (void) svNotify;
71         return false;
72     }
73 
gnssReportSvMeasurement(const GnssSvMeasurementSet & svMeasurementSet)74     inline virtual bool gnssReportSvMeasurement(const GnssSvMeasurementSet& svMeasurementSet) {
75         (void) svMeasurementSet;
76         return false;
77     }
78 
gnssReportSvPolynomial(const GnssSvPolynomial & svPolynomial)79     inline virtual bool gnssReportSvPolynomial(const GnssSvPolynomial& svPolynomial) {
80         (void) svPolynomial;
81         return false;
82     }
83 
gnssReportSvEphemeris(const GnssSvEphemerisReport & svEphemeris)84     inline virtual bool gnssReportSvEphemeris(const GnssSvEphemerisReport& svEphemeris) {
85         (void) svEphemeris;
86         return false;
87     }
88 
gnssReportSystemInfo(const LocationSystemInfo & systemInfo)89     inline virtual bool gnssReportSystemInfo(const LocationSystemInfo& systemInfo) {
90         (void) systemInfo;
91         return false;
92     }
93 
gnssReportKlobucharIonoModel(const GnssKlobucharIonoModel & ionoModel)94     inline virtual bool gnssReportKlobucharIonoModel(const GnssKlobucharIonoModel& ionoModel) {
95         (void) ionoModel;
96         return false;
97     }
98 
gnssReportAdditionalSystemInfo(const GnssAdditionalSystemInfo & additionalSystemInfo)99     inline virtual bool gnssReportAdditionalSystemInfo(
100             const GnssAdditionalSystemInfo& additionalSystemInfo) {
101         (void) additionalSystemInfo;
102         return false;
103     }
104 };
105 
106 typedef std::function<void(int count, EngineLocationInfo* locationArr)>
107         GnssAdapterReportEnginePositionsEventCb;
108 
109 typedef std::function<void(const GnssSvNotification& svNotify,
110                            bool fromEngineHub)>
111         GnssAdapterReportSvEventCb;
112 
113 typedef std::function<void(const GnssAidingDataSvMask& svDataMask)>
114         GnssAdapterReqAidingDataCb;
115 
116 // potential parameters: message queue: MsgTask * msgTask;
117 // callback function to report back dr and ppe position and sv report
118 typedef EngineHubProxyBase* (getEngHubProxyFn)(
119         const MsgTask * msgTask,
120         IOsObserver* osObserver,
121         GnssAdapterReportEnginePositionsEventCb positionEventCb,
122         GnssAdapterReportSvEventCb svEventCb,
123         GnssAdapterReqAidingDataCb reqAidingDataCb);
124 
125 } // namespace loc_core
126 
127 #endif // ENGINE_HUB_PROXY_BASE_H
128