1 /* Copyright (c) 2018-2020 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 #ifdef NO_UNORDERED_SET_OR_MAP 32 #include <map> 33 #else 34 #include <unordered_map> 35 #endif 36 37 namespace loc_core { 38 39 using namespace loc_util; 40 41 class EngineHubProxyBase { 42 public: EngineHubProxyBase()43 inline EngineHubProxyBase() { 44 } ~EngineHubProxyBase()45 inline virtual ~EngineHubProxyBase() {} 46 47 // gnss session related functions gnssStartFix()48 inline virtual bool gnssStartFix() { 49 return false; 50 } 51 gnssStopFix()52 inline virtual bool gnssStopFix() { 53 return false; 54 } 55 gnssSetFixMode(const LocPosMode & params)56 inline virtual bool gnssSetFixMode(const LocPosMode ¶ms) { 57 (void) params; 58 return false; 59 } 60 gnssDeleteAidingData(const GnssAidingData & aidingData)61 inline virtual bool gnssDeleteAidingData(const GnssAidingData &aidingData) { 62 (void) aidingData; 63 return false; 64 } 65 66 // GNSS reports gnssReportPosition(const UlpLocation & location,const GpsLocationExtended & locationExtended,enum loc_sess_status status)67 inline virtual bool gnssReportPosition(const UlpLocation &location, 68 const GpsLocationExtended &locationExtended, 69 enum loc_sess_status status) { 70 (void) location; 71 (void) locationExtended; 72 (void) status; 73 return false; 74 } 75 gnssReportSv(const GnssSvNotification & svNotify)76 inline virtual bool gnssReportSv(const GnssSvNotification& svNotify) { 77 (void) svNotify; 78 return false; 79 } 80 gnssReportSvMeasurement(const GnssSvMeasurementSet & svMeasurementSet)81 inline virtual bool gnssReportSvMeasurement(const GnssSvMeasurementSet& svMeasurementSet) { 82 (void) svMeasurementSet; 83 return false; 84 } 85 gnssReportSvPolynomial(const GnssSvPolynomial & svPolynomial)86 inline virtual bool gnssReportSvPolynomial(const GnssSvPolynomial& svPolynomial) { 87 (void) svPolynomial; 88 return false; 89 } 90 gnssReportSvEphemeris(const GnssSvEphemerisReport & svEphemeris)91 inline virtual bool gnssReportSvEphemeris(const GnssSvEphemerisReport& svEphemeris) { 92 (void) svEphemeris; 93 return false; 94 } 95 gnssReportSystemInfo(const LocationSystemInfo & systemInfo)96 inline virtual bool gnssReportSystemInfo(const LocationSystemInfo& systemInfo) { 97 (void) systemInfo; 98 return false; 99 } 100 gnssReportKlobucharIonoModel(const GnssKlobucharIonoModel & ionoModel)101 inline virtual bool gnssReportKlobucharIonoModel(const GnssKlobucharIonoModel& ionoModel) { 102 (void) ionoModel; 103 return false; 104 } 105 gnssReportAdditionalSystemInfo(const GnssAdditionalSystemInfo & additionalSystemInfo)106 inline virtual bool gnssReportAdditionalSystemInfo( 107 const GnssAdditionalSystemInfo& additionalSystemInfo) { 108 (void) additionalSystemInfo; 109 return false; 110 } 111 configLeverArm(const LeverArmConfigInfo & configInfo)112 inline virtual bool configLeverArm(const LeverArmConfigInfo& configInfo) { 113 (void) configInfo; 114 return false; 115 } 116 configDeadReckoningEngineParams(const DeadReckoningEngineConfig & dreConfig)117 inline virtual bool configDeadReckoningEngineParams( 118 const DeadReckoningEngineConfig& dreConfig) { 119 (void) dreConfig; 120 return false; 121 } 122 configEngineRunState(PositioningEngineMask engType,LocEngineRunState engState)123 inline virtual bool configEngineRunState( 124 PositioningEngineMask engType, LocEngineRunState engState) { 125 (void) engType; 126 (void) engState; 127 return false; 128 } 129 }; 130 131 typedef std::function<void(int count, EngineLocationInfo* locationArr)> 132 GnssAdapterReportEnginePositionsEventCb; 133 134 typedef std::function<void(const GnssSvNotification& svNotify, 135 bool fromEngineHub)> 136 GnssAdapterReportSvEventCb; 137 138 typedef std::function<void(const GnssAidingDataSvMask& svDataMask)> 139 GnssAdapterReqAidingDataCb; 140 141 typedef std::function<void(bool nHzNeeded, bool nHzMeasNeeded)> 142 GnssAdapterUpdateNHzRequirementCb; 143 144 typedef std::function<void(const std::unordered_map<LocationQwesFeatureType, bool> &featureMap)> 145 GnssAdapterUpdateQwesFeatureStatusCb; 146 147 // potential parameters: message queue: MsgTask * msgTask; 148 // callback function to report back dr and ppe position and sv report 149 typedef EngineHubProxyBase* (getEngHubProxyFn)( 150 const MsgTask * msgTask, 151 IOsObserver* osObserver, 152 GnssAdapterReportEnginePositionsEventCb positionEventCb, 153 GnssAdapterReportSvEventCb svEventCb, 154 GnssAdapterReqAidingDataCb reqAidingDataCb, 155 GnssAdapterUpdateNHzRequirementCb updateNHzRequirementCb, 156 GnssAdapterUpdateQwesFeatureStatusCb updateQwesFeatureStatusCb); 157 158 } // namespace loc_core 159 160 #endif // ENGINE_HUB_PROXY_BASE_H 161