sm8250-common: import location from LA.UM.9.12.r1-13500.01-SMxx50.QSSI12.0

Change-Id: If93ba9b50dc3bb07a4ba81694187e99f58dd172c
This commit is contained in:
SGCMarkus 2022-03-23 21:42:45 +01:00
parent 72410cf795
commit 64ab05b033
103 changed files with 92521 additions and 0 deletions

View file

@ -0,0 +1,2 @@
LOCAL_PATH := $(call my-dir)
include $(call all-subdir-makefiles)

View file

@ -0,0 +1,7 @@
cc_library_headers {
name: "libloc_api_v02_headers",
export_include_dirs: ["."],
vendor: true,
}

View file

@ -0,0 +1,46 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := libloc_api_v02
# activate the following line for debug purposes only, comment out for production
#LOCAL_SANITIZE_DIAG += $(GNSS_SANITIZE_DIAG)
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := \
libutils \
libcutils \
libqmi_cci \
libqmi_common_so \
libloc_core \
libgps.utils \
libdl \
liblog
LOCAL_SRC_FILES = \
LocApiV02.cpp \
loc_api_v02_log.cpp \
loc_api_v02_client.cpp \
loc_api_sync_req.cpp \
location_service_v02.c
LOCAL_CFLAGS += \
-fno-short-enums \
-D_ANDROID_
## Includes
LOCAL_C_INCLUDES := \
$(TARGET_OUT_HEADERS)/qmi-framework/inc \
$(TARGET_OUT_HEADERS)/qmi/inc
LOCAL_HEADER_LIBRARIES := \
libloc_core_headers \
libgps.utils_headers \
libloc_pla_headers \
liblocation_api_headers \
libqmi_common_headers \
libqmi_cci_headers
LOCAL_CFLAGS += $(GNSS_CFLAGS)
include $(BUILD_SHARED_LIBRARY)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,550 @@
/* Copyright (c) 2011-2020, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LOC_API_V_0_2_H
#define LOC_API_V_0_2_H
#include <stdint.h>
#include <stdbool.h>
#include <LocApiBase.h>
#include <loc_api_v02_client.h>
#include <vector>
#include <functional>
#include <unordered_map>
#define LOC_SEND_SYNC_REQ(NAME, ID, REQ) \
int rv = true; \
locClientStatusEnumType st; \
locClientReqUnionType reqUnion; \
qmiLoc##NAME##IndMsgT_v02 ind; \
\
memset(&ind, 0, sizeof(ind)); \
reqUnion.p##NAME##Req = &REQ; \
\
st = locSyncSendReq(QMI_LOC_##ID##_REQ_V02, \
reqUnion, \
LOC_ENGINE_SYNC_REQUEST_TIMEOUT, \
QMI_LOC_##ID##_IND_V02, \
&ind); \
\
if (st != eLOC_CLIENT_SUCCESS || \
eQMI_LOC_SUCCESS_V02 != ind.status) { \
LOC_LOGE ("%s:%d]: Error : st = %d, ind.status = %d", \
__func__, __LINE__, st, ind.status); \
rv = false; \
}
using Resender = std::function<void()>;
using namespace loc_core;
typedef struct
{
uint32_t counter;
qmiLocSvSystemEnumT_v02 system;
qmiLocGnssSignalTypeMaskT_v02 gnssSignalType;
uint16_t gnssSvId;
qmiLocMeasFieldsValidMaskT_v02 validMask;
uint8_t cycleSlipCount;
} adrData;
typedef uint64_t GpsSvMeasHeaderFlags;
#define BIAS_GPSL1_VALID 0x00000001
#define BIAS_GPSL1_UNC_VALID 0x00000002
#define BIAS_GPSL1_GPSL5_VALID 0x00000004
#define BIAS_GPSL1_GPSL5_UNC_VALID 0x00000008
#define BIAS_GPSL1_GLOG1_VALID 0x00000010
#define BIAS_GPSL1_GLOG1_UNC_VALID 0x00000020
#define BIAS_GPSL1_GALE1_VALID 0x00000040
#define BIAS_GPSL1_GALE1_UNC_VALID 0x00000080
#define BIAS_GPSL1_BDSB1_VALID 0x00000100
#define BIAS_GPSL1_BDSB1_UNC_VALID 0x00000200
#define BIAS_GPSL1_NAVIC_VALID 0x00000400
#define BIAS_GPSL1_NAVIC_UNC_VALID 0x00000800
#define BIAS_GALE1_VALID 0x00001000
#define BIAS_GALE1_UNC_VALID 0x00002000
#define BIAS_GALE1_GALE5A_VALID 0x00004000
#define BIAS_GALE1_GALE5A_UNC_VALID 0x00008000
#define BIAS_BDSB1_VALID 0x00010000
#define BIAS_BDSB1_UNC_VALID 0x00020000
#define BIAS_BDSB1_BDSB1C_VALID 0x00040000
#define BIAS_BDSB1_BDSB1C_UNC_VALID 0x00080000
#define BIAS_BDSB1_BDSB2A_VALID 0x00100000
#define BIAS_BDSB1_BDSB2A_UNC_VALID 0x00200000
typedef struct {
uint64_t flags;
/* used directly */
float gpsL1;
float gpsL1Unc;
float gpsL1_gpsL5;
float gpsL1_gpsL5Unc;
float gpsL1_gloG1;
float gpsL1_gloG1Unc;
float gpsL1_galE1;
float gpsL1_galE1Unc;
float gpsL1_bdsB1;
float gpsL1_bdsB1Unc;
float gpsL1_navic;
float gpsL1_navicUnc;
/* used for intermediate computations */
float galE1;
float galE1Unc;
float galE1_galE5a;
float galE1_galE5aUnc;
float bdsB1;
float bdsB1Unc;
float bdsB1_bdsB1c;
float bdsB1_bdsB1cUnc;
float bdsB1_bdsB2a;
float bdsB1_bdsB2aUnc;
} timeBiases;
/* This class derives from the LocApiBase class.
The members of this class are responsible for converting
the Loc API V02 data structures into Loc Adapter data structures.
This class also implements some of the virtual functions that
handle the requests from loc engine. */
class LocApiV02 : public LocApiBase {
protected:
/* loc api v02 handle*/
locClientHandleType clientHandle;
private:
locClientEventMaskType mQmiMask;
bool mInSession;
GnssPowerMode mPowerMode;
bool mEngineOn;
bool mMeasurementsStarted;
std::vector<Resender> mResenders;
bool mMasterRegisterNotSupported;
uint32_t mCounter;
uint32_t mMinInterval;
std::vector<adrData> mADRdata;
GnssMeasurements* mGnssMeasurements;
bool mGPSreceived;
int mMsInWeek;
bool mAgcIsPresent;
timeBiases mTimeBiases;
size_t mBatchSize, mDesiredBatchSize;
size_t mTripBatchSize, mDesiredTripBatchSize;
bool mIsFirstFinalFixReported;
bool mIsFirstStartFixReq;
uint64_t mHlosQtimer1, mHlosQtimer2;
uint32_t mRefFCount;
// Below two member variables are for elapsedRealTime calculation
ElapsedRealtimeEstimator mMeasElapsedRealTimeCal;
ElapsedRealtimeEstimator mPositionElapsedRealTimeCal;
/* Convert event mask from loc eng to loc_api_v02 format */
static locClientEventMaskType convertMask(LOC_API_ADAPTER_EVENT_MASK_T mask);
/* Convert GPS LOCK from LocationAPI format to QMI format */
static qmiLocLockEnumT_v02 convertGpsLockFromAPItoQMI(GnssConfigGpsLock lock);
/* Convert GPS LOCK from QMI format to LocationAPI format */
static GnssConfigGpsLock convertGpsLockFromQMItoAPI(qmiLocLockEnumT_v02 lock);
/* Convert error from loc_api_v02 to loc eng format*/
static enum loc_api_adapter_err convertErr(locClientStatusEnumType status);
/* convert Ni Encoding type from QMI_LOC to loc eng format */
static GnssNiEncodingType convertNiEncoding(
qmiLocNiDataCodingSchemeEnumT_v02 loc_encoding);
/*convert NI notify verify type from QMI LOC to loc eng format*/
static bool convertNiNotifyVerifyType (GnssNiNotification *notif,
qmiLocNiNotifyVerifyEnumT_v02 notif_priv);
/*convert signal type to carrier frequency*/
static float convertSignalTypeToCarrierFrequency(
qmiLocGnssSignalTypeMaskT_v02 signalType,
uint8_t gloFrequency);
/*convert GnssMeasurement type from QMI LOC to loc eng format*/
bool convertGnssMeasurements (
const qmiLocEventGnssSvMeasInfoIndMsgT_v02& gnss_measurement_report_ptr,
int index, bool isExt, bool validDgnssSvMeas);
/* Convert APN Type mask */
static qmiLocApnTypeMaskT_v02 convertLocApnTypeMask(LocApnTypeMask mask);
static LocApnTypeMask convertQmiLocApnTypeMask(qmiLocApnTypeMaskT_v02 mask);
/* Convert Get Constellation QMI Ind info to GnssSvTypeConfig */
static void convertToGnssSvTypeConfig(
const qmiLocGetConstellationConfigIndMsgT_v02& ind,
GnssSvTypeConfig& config);
/* Convert GnssPowerMode to QMI Loc Power Mode Enum */
static qmiLocPowerModeEnumT_v02 convertPowerMode(GnssPowerMode powerMode);
void convertGnssMeasurementsHeader(const Gnss_LocSvSystemEnumType locSvSystemType,
const qmiLocEventGnssSvMeasInfoIndMsgT_v02& gnss_measurement_info);
/*convert LocGnssClock type from QMI LOC to loc eng format*/
int convertGnssClock (GnssMeasurementsClock& clock,
const qmiLocEventGnssSvMeasInfoIndMsgT_v02& gnss_measurement_info);
/* convert dgnss constellation mask from QMI loc to loc eng format */
static void convertGnssConestellationMask (
qmiLocGNSSConstellEnumT_v02 qmiConstellationEnum,
GnssConstellationTypeMask& constellationMask);
/* If Confidence value is less than 68%, then scale the accuracy value to 68%
confidence.*/
void scaleAccuracyTo68PercentConfidence(const uint8_t confidenceValue,
LocGpsLocation &gpsLocation,
const bool isCircularUnc);
/* convert position report to loc eng format and send the converted
position to loc eng */
void reportPosition
(const qmiLocEventPositionReportIndMsgT_v02 *location_report_ptr,
bool unpropagatedPosition = false);
/* convert satellite report to loc eng format and send the converted
report to loc eng */
void reportSv (const qmiLocEventGnssSvInfoIndMsgT_v02 *gnss_report_ptr);
void reportSvPolynomial (
const qmiLocEventGnssSvPolyIndMsgT_v02 *gnss_sv_poly_ptr);
void reportSvEphemeris (
uint32_t eventId, const locClientEventIndUnionType &eventPayload);
void populateGpsEphemeris(const qmiLocGpsEphemerisReportIndMsgT_v02 *,
GnssSvEphemerisReport &);
void populateGlonassEphemeris(const qmiLocGloEphemerisReportIndMsgT_v02 *,
GnssSvEphemerisReport &);
void populateBdsEphemeris(const qmiLocBdsEphemerisReportIndMsgT_v02 *,
GnssSvEphemerisReport &);
void populateGalEphemeris(const qmiLocGalEphemerisReportIndMsgT_v02 *,
GnssSvEphemerisReport &);
void populateQzssEphemeris(const qmiLocQzssEphemerisReportIndMsgT_v02 *,
GnssSvEphemerisReport &);
void populateCommonEphemeris(const qmiLocEphGnssDataStructT_v02 &, GnssEphCommon &);
void populateGpsTimeOfReport(const qmiLocGnssTimeStructT_v02 &, GnssSystemTimeStructType &);
void populateFeatureStatusReport(const qmiLocFeaturesStatusMaskT_v02 &featureStatusReport,
std::unordered_map<LocationQwesFeatureType, bool> &featureMap);
void reportLocEvent(const qmiLocEventReportIndMsgT_v02 *event_report_ptr);
/* convert system info to location api format and dispatch to
the registered adapter */
void reportSystemInfo(const qmiLocSystemInfoIndMsgT_v02* system_info_ptr);
void reportLocationRequestNotification(
const qmiLocLocationRequestNotificationIndMsgT_v02* loc_req_notif);
/* convert engine state report to loc eng format and send the converted
report to loc eng */
void reportEngineState (
const qmiLocEventEngineStateIndMsgT_v02 *engine_state_ptr);
/* convert fix session report to loc eng format and send the converted
report to loc eng */
void reportFixSessionState (
const qmiLocEventFixSessionStateIndMsgT_v02 *fix_session_state_ptr);
/* convert NMEA report to loc eng format and send the converted
report to loc eng */
void reportNmea (const qmiLocEventNmeaIndMsgT_v02 *nmea_report_ptr);
/* convert and report an ATL request to loc engine */
void reportAtlRequest(
const qmiLocEventLocationServerConnectionReqIndMsgT_v02
*server_request_ptr);
/* convert and report NI request to loc eng */
void reportNiRequest(
const qmiLocEventNiNotifyVerifyReqIndMsgT_v02 *ni_req_ptr);
/* report the xtra server info */
void reportXtraServerUrl(
const qmiLocEventInjectPredictedOrbitsReqIndMsgT_v02* server_request_ptr);
/* convert and report GNSS measurement data to loc eng */
void reportGnssMeasurementData(
const qmiLocEventGnssSvMeasInfoIndMsgT_v02& gnss_measurement_report_ptr);
void reportSvMeasurementInternal();
inline void resetSvMeasurementReport(){
memset(mGnssMeasurements, 0, sizeof(GnssMeasurements));
mGnssMeasurements->size = sizeof(GnssMeasurements);
mGnssMeasurements->gnssSvMeasurementSet.size = sizeof(GnssSvMeasurementSet);
mGnssMeasurements->gnssSvMeasurementSet.isNhz = false;
mGnssMeasurements->gnssSvMeasurementSet.svMeasSetHeader.size =
sizeof(GnssSvMeasurementHeader);
memset(&mTimeBiases, 0, sizeof(mTimeBiases));
mGPSreceived = false;
mMsInWeek = -1;
mAgcIsPresent = false;
}
void setGnssBiases();
/* convert and report ODCPI request */
void requestOdcpi(
const qmiLocEventWifiReqIndMsgT_v02& odcpiReq);
void registerEventMask(LOC_API_ADAPTER_EVENT_MASK_T adapterMask);
bool sendRequestForAidingData(locClientEventMaskType qmiMask);
locClientEventMaskType adjustMaskIfNoSessionOrEngineOff(locClientEventMaskType qmiMask);
bool cacheGnssMeasurementSupport();
void registerMasterClient();
int getGpsLock(uint8_t subType);
void getRobustLocationConfig(uint32_t sessionId, LocApiResponse* adapterResponse);
void getMinGpsWeek(uint32_t sessionId, LocApiResponse* adapterResponse);
/* Convert get blacklist sv info to GnssSvIdConfig */
void reportGnssSvIdConfig
(const qmiLocGetBlacklistSvIndMsgT_v02& getBlacklistSvIndMsg);
/* Convert get constellation info to GnssSvTypeConfig */
void reportGnssSvTypeConfig
(const qmiLocGetConstellationConfigIndMsgT_v02& getConstellationConfigIndMsg);
/* Inform ODCPI availability to Modem */
void wifiStatusInformSync();
void sendNfwNotification(GnssNfwNotification& notification);
LocationError queryBatchBuffer(size_t desiredSize,
size_t &allocatedSize, BatchingMode batchMode);
LocationError releaseBatchBuffer(BatchingMode batchMode);
void readModemLocations(Location* pLocationPiece, size_t count,
BatchingMode batchingMode, size_t& numbOfEntries);
void setOperationMode(GnssSuplMode mode);
bool needsNewTripBatchRestart(uint32_t newTripDistance, uint32_t newTripTBFInterval,
uint32_t &accumulatedDistance, uint32_t &numOfBatchedPositions);
void batchFullEvent(const qmiLocEventBatchFullIndMsgT_v02* batchFullInfo);
void batchStatusEvent(const qmiLocEventBatchingStatusIndMsgT_v02* batchStatusInfo);
void onDbtPosReportEvent(const qmiLocEventDbtPositionReportIndMsgT_v02* pDbtPosReport);
void geofenceBreachEvent(const qmiLocEventGeofenceBreachIndMsgT_v02* breachInfo);
void geofenceBreachEvent(const qmiLocEventGeofenceBatchedBreachIndMsgT_v02* batchedBreachInfo);
void geofenceStatusEvent(const qmiLocEventGeofenceGenAlertIndMsgT_v02* alertInfo);
void geofenceDwellEvent(const qmiLocEventGeofenceBatchedDwellIndMsgT_v02 *dwellEvent);
void reportLatencyInfo(const qmiLocLatencyInformationIndMsgT_v02* pLocLatencyInfo);
protected:
virtual enum loc_api_adapter_err
open(LOC_API_ADAPTER_EVENT_MASK_T mask);
virtual enum loc_api_adapter_err
close();
LocApiV02(LOC_API_ADAPTER_EVENT_MASK_T exMask,
ContextBase *context = NULL);
virtual ~LocApiV02();
public:
static LocApiBase* createLocApiV02(LOC_API_ADAPTER_EVENT_MASK_T exMask,
ContextBase* context);
/* event callback registered with the loc_api v02 interface */
virtual void eventCb(locClientHandleType client_handle,
uint32_t loc_event_id,
locClientEventIndUnionType loc_event_payload);
/* error callback, this function handles the service unavailable
error */
void errorCb(locClientHandleType handle,
locClientErrorEnumType errorId);
// Tracking
virtual void startFix(const LocPosMode& posMode, LocApiResponse *adapterResponse);
virtual void stopFix(LocApiResponse *adapterResponse);
void startTimeBasedTracking(const TrackingOptions& options, LocApiResponse* adapterResponse);
void stopTimeBasedTracking(LocApiResponse* adapterResponse);
void startDistanceBasedTracking(uint32_t sessionId, const LocationOptions& options,
LocApiResponse* adapterResponse);
void stopDistanceBasedTracking(uint32_t sessionId, LocApiResponse* adapterResponse);
// Batching
void startBatching(uint32_t sessionId, const LocationOptions& options, uint32_t accuracy,
uint32_t timeout, LocApiResponse* adapterResponse);
void stopBatching(uint32_t sessionId, LocApiResponse* adapterResponse);
LocationError startOutdoorTripBatchingSync(uint32_t tripDistance, uint32_t tripTbf,
uint32_t timeout);
void startOutdoorTripBatching(uint32_t tripDistance, uint32_t tripTbf, uint32_t timeout,
LocApiResponse* adapterResponse);
void reStartOutdoorTripBatching(uint32_t ongoingTripDistance, uint32_t ongoingTripInterval,
uint32_t batchingTimeout, LocApiResponse* adapterResponse);
LocationError stopOutdoorTripBatchingSync(bool deallocBatchBuffer = true);
void stopOutdoorTripBatching(bool deallocBatchBuffer = true,
LocApiResponse* adapterResponse = nullptr);
LocationError getBatchedLocationsSync(size_t count);
void getBatchedLocations(size_t count, LocApiResponse* adapterResponse);
LocationError getBatchedTripLocationsSync(size_t count, uint32_t accumulatedDistance);
void getBatchedTripLocations(size_t count, uint32_t accumulatedDistance,
LocApiResponse* adapterResponse);
virtual void setBatchSize(size_t size);
virtual void setTripBatchSize(size_t size);
LocationError queryAccumulatedTripDistanceSync(uint32_t &accumulatedTripDistance,
uint32_t &numOfBatchedPositions);
void queryAccumulatedTripDistance(
LocApiResponseData<LocApiBatchData>* adapterResponseData);
// Geofence
virtual void addGeofence(uint32_t clientId, const GeofenceOption& options,
const GeofenceInfo& info, LocApiResponseData<LocApiGeofenceData>* adapterResponseData);
virtual void removeGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse);
virtual void pauseGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse);
virtual void resumeGeofence(uint32_t hwId, uint32_t clientId, LocApiResponse* adapterResponse);
virtual void modifyGeofence(uint32_t hwId, uint32_t clientId,
const GeofenceOption& options, LocApiResponse* adapterResponse);
virtual void addToCallQueue(LocApiResponse* adapterResponse);
virtual void
setTime(LocGpsUtcTime time, int64_t timeReference, int uncertainty);
virtual void
injectPosition(double latitude, double longitude, float accuracy, bool onDemandCpi);
virtual void
injectPosition(const Location& location, bool onDemandCpi);
virtual void
injectPosition(const GnssLocationInfoNotification &locationInfo, bool onDemandCpi);
virtual void
deleteAidingData(const GnssAidingData& data, LocApiResponse *adapterResponse);
virtual void
informNiResponse(GnssNiResponse userResponse, const void* passThroughData);
virtual LocationError
setServerSync(const char* url, int len, LocServerType type);
virtual LocationError
setServerSync(unsigned int ip, int port, LocServerType type);
virtual void
atlOpenStatus(int handle, int is_succ, char* apn, uint32_t apnLen, AGpsBearerType bear,
LocAGpsType agpsType, LocApnTypeMask mask);
virtual void atlCloseStatus(int handle, int is_succ);
virtual LocationError setSUPLVersionSync(GnssConfigSuplVersion version);
virtual enum loc_api_adapter_err setNMEATypesSync(uint32_t typesMask);
virtual LocationError setLPPConfigSync(GnssConfigLppProfileMask profileMask);
virtual enum loc_api_adapter_err
setSensorPropertiesSync(bool gyroBiasVarianceRandomWalk_valid, float gyroBiasVarianceRandomWalk,
bool accelBiasVarianceRandomWalk_valid, float accelBiasVarianceRandomWalk,
bool angleBiasVarianceRandomWalk_valid, float angleBiasVarianceRandomWalk,
bool rateBiasVarianceRandomWalk_valid, float rateBiasVarianceRandomWalk,
bool velocityBiasVarianceRandomWalk_valid, float velocityBiasVarianceRandomWalk);
virtual enum loc_api_adapter_err
setSensorPerfControlConfigSync(int controlMode, int accelSamplesPerBatch,
int accelBatchesPerSec, int gyroSamplesPerBatch, int gyroBatchesPerSec,
int accelSamplesPerBatchHigh, int accelBatchesPerSecHigh,
int gyroSamplesPerBatchHigh, int gyroBatchesPerSecHigh, int algorithmConfig);
virtual LocationError
setAGLONASSProtocolSync(GnssConfigAGlonassPositionProtocolMask aGlonassProtocol);
virtual LocationError setLPPeProtocolCpSync(GnssConfigLppeControlPlaneMask lppeCP);
virtual LocationError setLPPeProtocolUpSync(GnssConfigLppeUserPlaneMask lppeUP);
virtual void getWwanZppFix();
virtual void
handleWwanZppFixIndication(const qmiLocGetAvailWwanPositionIndMsgT_v02 &zpp_ind);
virtual void
handleZppBestAvailableFixIndication(const qmiLocGetBestAvailablePositionIndMsgT_v02 &zpp_ind);
virtual void getBestAvailableZppFix();
virtual LocationError setGpsLockSync(GnssConfigGpsLock lock);
virtual void setConstrainedTuncMode(bool enabled, float tuncConstraint, uint32_t powerBudget,
LocApiResponse *adapterResponse=nullptr);
virtual void setPositionAssistedClockEstimatorMode(bool enabled,
LocApiResponse *adapterResponse=nullptr);
virtual void getGnssEnergyConsumed();
virtual void updateSystemPowerState(PowerStateType powerState);
virtual void requestForAidingData(GnssAidingDataSvMask svDataMask);
virtual void configRobustLocation(bool enable, bool enableForE911,
LocApiResponse *adapterResponse=nullptr);
virtual void configMinGpsWeek(uint16_t minGpsWeek,
LocApiResponse *adapterResponse=nullptr);
virtual LocationError setParameterSync(const GnssConfig & gnssConfig);
virtual void getParameter(uint32_t sessionId, GnssConfigFlagsMask flags,
LocApiResponse* adapterResponse=nullptr);
/*
Returns
Current value of GPS Lock on success
-1 on failure
*/
virtual int setSvMeasurementConstellation(const locClientEventMaskType mask);
virtual LocationError setXtraVersionCheckSync(uint32_t check);
virtual LocPosTechMask convertPosTechMask(qmiLocPosTechMaskT_v02 mask);
virtual LocNavSolutionMask convertNavSolutionMask(qmiLocNavSolutionMaskT_v02 mask);
virtual GnssConfigSuplVersion convertSuplVersion(const uint32_t suplVersion);
virtual GnssConfigLppeControlPlaneMask convertLppeCp(const uint32_t lppeControlPlaneMask);
virtual GnssConfigLppeUserPlaneMask convertLppeUp(const uint32_t lppeUserPlaneMask);
virtual LocationError setEmergencyExtensionWindowSync(const uint32_t emergencyExtensionSeconds);
virtual void setMeasurementCorrections(
const GnssMeasurementCorrections& gnssMeasurementCorrections);
virtual GnssSignalTypeMask convertQmiGnssSignalType(
qmiLocGnssSignalTypeMaskT_v02 qmiGnssSignalType);
void convertQmiBlacklistedSvConfigToGnssConfig(
const qmiLocGetBlacklistSvIndMsgT_v02& qmiBlacklistConfig,
GnssSvIdConfig& gnssBlacklistConfig);
virtual void convertQmiSecondaryConfigToGnssConfig(
qmiLocGNSSConstellEnumT_v02 qmiSecondaryBandConfig,
GnssSvTypeConfig& secondaryBandConfig);
/* Requests for SV/Constellation Control */
virtual LocationError setBlacklistSvSync(const GnssSvIdConfig& config);
virtual void setBlacklistSv(const GnssSvIdConfig& config,
LocApiResponse* adapterResponse=nullptr);
virtual void getBlacklistSv();
virtual void setConstellationControl(const GnssSvTypeConfig& config,
LocApiResponse *adapterResponse=nullptr);
virtual void getConstellationControl();
virtual void resetConstellationControl(LocApiResponse *adapterResponse=nullptr);
virtual void configConstellationMultiBand(const GnssSvTypeConfig& secondaryBandConfig,
LocApiResponse* adapterResponse=nullptr);
virtual void getConstellationMultiBandConfig(uint32_t sessionId,
LocApiResponse* adapterResponse=nullptr);
locClientStatusEnumType locSyncSendReq(uint32_t req_id, locClientReqUnionType req_payload,
uint32_t timeout_msec, uint32_t ind_id, void* ind_payload_ptr);
inline locClientStatusEnumType locClientSendReq(uint32_t req_id,
locClientReqUnionType req_payload) {
return ::locClientSendReq(clientHandle, req_id, req_payload);
}
};
extern "C" LocApiBase* getLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask,
ContextBase *context);
#endif //LOC_API_V_0_2_H

View file

@ -0,0 +1,47 @@
AM_CFLAGS = \
-I. \
$(LOCPLA_CFLAGS) \
$(GPSUTILS_CFLAGS) \
$(LOCCORE_CFLAGS) \
$(QMIFW_CFLAGS) \
-fno-short-enums \
-D__func__=__PRETTY_FUNCTION__ \
-DTARGET_USES_QCOM_BSP
libloc_api_v02_la_SOURCES = \
LocApiV02.cpp \
loc_api_v02_log.cpp \
loc_api_v02_client.cpp \
loc_api_sync_req.cpp \
location_service_v02.c
if USE_GLIB
libloc_api_v02_la_CFLAGS = -DUSE_GLIB $(AM_CFLAGS) @GLIB_CFLAGS@
libloc_api_v02_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -lcutils @GLIB_LIBS@ -shared -version-info 1:0:0
libloc_api_v02_la_CPPFLAGS = -DUSE_GLIB $(AM_CFLAGS) $(AM_CPPFLAGS) @GLIB_CFLAGS@
else
libloc_api_v02_la_CFLAGS = $(AM_CFLAGS)
libloc_api_v02_la_LDFLAGS = -lstdc++ -Wl,-z,defs -lpthread -lcutils -shared -version-info 1:0:0
libloc_api_v02_la_CPPFLAGS = $(AM_CFLAGS) $(AM_CPPFLAGS)
endif
libloc_api_v02_la_CXXFLAGS = -std=c++0x
libloc_api_v02_la_LIBADD = -lstdc++ -ldl -lutils $(QMIFW_LIBS) $(GPSUTILS_LIBS) $(LOCCORE_LIBS)
library_include_HEADERS = \
location_service_v02.h \
loc_api_v02_log.h \
loc_api_v02_client.h \
loc_api_sync_req.h \
LocApiV02.h \
loc_util_log.h
library_includedir = $(pkgincludedir)/loc_api_v02
#Create and Install libraries
lib_LTLIBRARIES = libloc_api_v02.la
library_includedir = $(pkgincludedir)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = loc-api-v02.pc
EXTRA_DIST = $(pkgconfig_DATA)

View file

@ -0,0 +1,90 @@
# configure.ac -- Autoconf script for gps loc-api-v02
#
# Process this file with autoconf to produce a configure script
# Requires autoconf tool later than 2.61
AC_PREREQ(2.61)
# Initialize the gps loc-api-v02 package version 1.0.0
AC_INIT([loc-api-v02],1.0.0)
# Does not strictly follow GNU Coding standards
AM_INIT_AUTOMAKE([foreign subdir-objects])
# Disables auto rebuilding of configure, Makefile.ins
AM_MAINTAINER_MODE
# Verifies the --srcdir is correct by checking for the path
AC_CONFIG_SRCDIR([Makefile.am])
# defines some macros variable to be included by source
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
# Checks for programs.
AC_PROG_LIBTOOL
AC_PROG_CXX
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_AWK
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG
# Checks for libraries.
PKG_CHECK_MODULES([GPSUTILS], [gps-utils])
AC_SUBST([GPSUTILS_CFLAGS])
AC_SUBST([GPSUTILS_LIBS])
PKG_CHECK_MODULES([LOCCORE], [loc-core])
AC_SUBST([LOCCORE_CFLAGS])
AC_SUBST([LOCCORE_LIBS])
PKG_CHECK_MODULES([QMIFW], [qmi-framework])
AC_SUBST([QMIFW_CFLAGS])
AC_SUBST([QMIFW_LIBS])
AC_ARG_WITH([core_includes],
AC_HELP_STRING([--with-core-includes=@<:@dir@:>@],
[Specify the location of the core headers]),
[core_incdir=$withval],
with_core_includes=no)
if test "x${with_core_includes}" != "xno"; then
CPPFLAGS="${CPPFLAGS} -I${core_incdir}"
fi
AC_ARG_WITH([locpla_includes],
AC_HELP_STRING([--with-locpla-includes=@<:@dir@:>@],
[Specify the path to locpla-includes in loc-pla_git.bb]),
[locpla_incdir=$withval],
with_locpla_includes=no)
if test "x${with_locpla_includes}" != "xno"; then
AC_SUBST(LOCPLA_CFLAGS, "-I${locpla_incdir}")
fi
AC_SUBST([CPPFLAGS])
AC_ARG_WITH([glib],
AC_HELP_STRING([--with-glib],
[enable glib, building HLOS systems which use glib]))
if (test "x${with_glib}" = "xyes"); then
AC_DEFINE(ENABLE_USEGLIB, 1, [Define if HLOS systems uses glib])
PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
AC_MSG_ERROR(GThread >= 2.16 is required))
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes,
AC_MSG_ERROR(GLib >= 2.16 is required))
GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
fi
AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes")
AC_CONFIG_FILES([ \
Makefile \
loc-api-v02.pc
])
AC_OUTPUT

View file

@ -0,0 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: loc-api-v02
Description: Loc Api V02
Version: @VERSION
Libs: -L${libdir} -lloc_api_v02
Cflags: -I${includedir} -I${includedir}/loc-api-v02

View file

@ -0,0 +1,546 @@
/* Copyright (c) 2011-2012, 2015-2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <assert.h>
#include <errno.h>
#include <sys/time.h>
#include <string.h>
#include <pthread.h>
#include <stdbool.h>
#include <stdint.h>
#include <loc_cfg.h>
#include "loc_api_v02_client.h"
#include "loc_api_sync_req.h"
#include "loc_api_v02_log.h"
#include <loc_pla.h>
/* Logging */
// Uncomment to log verbose logs
#define LOG_NDEBUG 1
// log debug logs
#define LOG_NDDEBUG 1
#define LOG_TAG "LocSvc_api_v02"
#include "loc_util_log.h"
#define LOC_SYNC_REQ_BUFFER_SIZE 8
pthread_mutex_t loc_sync_call_mutex = PTHREAD_MUTEX_INITIALIZER;
static bool loc_sync_call_initialized = false;
typedef struct {
pthread_mutex_t sync_req_lock;
/* Client ID */
locClientHandleType client_handle;
/* waiting conditional variable */
pthread_cond_t ind_arrived_cond;
/* Callback waiting data block, protected by loc_cb_data_mutex */
bool ind_is_selected; /* is cb selected? */
bool ind_is_waiting; /* is waiting? */
bool ind_has_arrived; /* callback has arrived */
uint32_t req_id; /* sync request */
void *recv_ind_payload_ptr; /* received payload */
uint32_t recv_ind_id; /* received ind */
} loc_sync_req_data_s_type;
typedef struct {
bool in_use; /* at least one sync call is active */
bool slot_in_use[LOC_SYNC_REQ_BUFFER_SIZE];
loc_sync_req_data_s_type slots[LOC_SYNC_REQ_BUFFER_SIZE];
} loc_sync_req_array_s_type;
/***************************************************************************
* DATA FOR ASYNCHRONOUS RPC PROCESSING
**************************************************************************/
loc_sync_req_array_s_type loc_sync_array;
/*===========================================================================
FUNCTION loc_sync_req_init
DESCRIPTION
Initialize this module
DEPENDENCIES
N/A
RETURN VALUE
none
SIDE EFFECTS
N/A
===========================================================================*/
void loc_sync_req_init()
{
LOC_LOGV(" %s:%d]:\n", __func__, __LINE__);
UTIL_READ_CONF_DEFAULT(LOC_PATH_GPS_CONF);
pthread_mutex_lock(&loc_sync_call_mutex);
if(true == loc_sync_call_initialized)
{
LOC_LOGD("%s:%d]:already initialized\n", __func__, __LINE__);
pthread_mutex_unlock(&loc_sync_call_mutex);
return;
}
loc_sync_array.in_use = false;
memset(loc_sync_array.slot_in_use, 0, sizeof(loc_sync_array.slot_in_use));
int i;
for (i = 0; i < LOC_SYNC_REQ_BUFFER_SIZE; i++)
{
loc_sync_req_data_s_type *slot = &loc_sync_array.slots[i];
pthread_mutex_init(&slot->sync_req_lock, NULL);
pthread_condattr_t condAttr;
pthread_condattr_init(&condAttr);
pthread_condattr_setclock(&condAttr, CLOCK_MONOTONIC);
pthread_cond_init(&slot->ind_arrived_cond, &condAttr);
pthread_condattr_destroy(&condAttr);
slot->client_handle = LOC_CLIENT_INVALID_HANDLE_VALUE;
slot->ind_is_selected = false; /* is ind selected? */
slot->ind_is_waiting = false; /* is waiting? */
slot->ind_has_arrived = false; /* callback has arrived */
slot->recv_ind_id = 0; /* ind to wait for */
slot->recv_ind_payload_ptr = NULL;
slot->req_id = 0; /* req id */
}
loc_sync_call_initialized = true;
pthread_mutex_unlock(&loc_sync_call_mutex);
}
/*===========================================================================
FUNCTION loc_sync_process_ind
DESCRIPTION
Wakes up blocked API calls to check if the needed callback has arrived
DEPENDENCIES
N/A
RETURN VALUE
none
SIDE EFFECTS
N/A
===========================================================================*/
void loc_sync_process_ind(
locClientHandleType client_handle, /* handle of the client */
uint32_t ind_id , /* ind id */
void *ind_payload_ptr, /* payload */
uint32_t ind_payload_size /* payload size */
)
{
LOC_LOGV("%s:%d]: received indication, handle = %p ind_id = %u \n",
__func__,__LINE__, client_handle, ind_id);
pthread_mutex_lock(&loc_sync_call_mutex);
if (!loc_sync_array.in_use)
{
LOC_LOGD("%s:%d]: loc_sync_array not in use \n",
__func__, __LINE__);
pthread_mutex_unlock(&loc_sync_call_mutex);
return;
}
bool in_use = false, consumed = false;
int i;
for (i = 0; i < LOC_SYNC_REQ_BUFFER_SIZE && !consumed; i++)
{
loc_sync_req_data_s_type *slot = &loc_sync_array.slots[i];
in_use |= loc_sync_array.slot_in_use[i];
pthread_mutex_lock(&slot->sync_req_lock);
if ( (loc_sync_array.slot_in_use[i]) && (slot->client_handle == client_handle)
&& (ind_id == slot->recv_ind_id) && (!slot->ind_has_arrived))
{
LOC_LOGV("%s:%d]: found slot %d selected for ind %u \n",
__func__, __LINE__, i, ind_id);
if( NULL != slot->recv_ind_payload_ptr &&
NULL != ind_payload_ptr && ind_payload_size > 0 )
{
LOC_LOGV("%s:%d]: copying ind payload size = %u \n",
__func__, __LINE__, ind_payload_size);
memcpy(slot->recv_ind_payload_ptr, ind_payload_ptr, ind_payload_size);
consumed = true;
}
/* Received a callback while waiting, wake up thread to check it */
if (slot->ind_is_waiting)
{
slot->recv_ind_id = ind_id;
pthread_cond_signal(&slot->ind_arrived_cond);
}
else
{
/* If callback arrives before wait, remember it */
LOC_LOGV("%s:%d]: ind %u arrived before wait was called \n",
__func__, __LINE__, ind_id);
slot->ind_has_arrived = true;
}
}
pthread_mutex_unlock(&slot->sync_req_lock);
}
if (!in_use) {
loc_sync_array.in_use = false;
}
pthread_mutex_unlock(&loc_sync_call_mutex);
}
/*===========================================================================
FUNCTION loc_alloc_slot
DESCRIPTION
Allocates a buffer slot for the synchronous API call
DEPENDENCIES
N/A
RETURN VALUE
Select ID (>=0) : successful
-1 : buffer full
SIDE EFFECTS
N/A
===========================================================================*/
static int loc_alloc_slot()
{
int i, select_id = -1; /* no free buffer */
pthread_mutex_lock(&loc_sync_call_mutex);
for (i = 0; i < LOC_SYNC_REQ_BUFFER_SIZE; i++)
{
if (!loc_sync_array.slot_in_use[i])
{
select_id = i;
loc_sync_array.slot_in_use[i] = 1;
loc_sync_array.in_use = true;
break;
}
}
pthread_mutex_unlock(&loc_sync_call_mutex);
LOC_LOGV("%s:%d]: returning slot %d\n",
__func__, __LINE__, select_id);
return select_id;
}
/*===========================================================================
FUNCTION loc_free_slot
DESCRIPTION
Frees a buffer slot after the synchronous API call
DEPENDENCIES
N/A
RETURN VALUE
None
SIDE EFFECTS
N/A
===========================================================================*/
static void loc_free_slot(int select_id)
{
int i;
loc_sync_req_data_s_type *slot;
pthread_mutex_lock(&loc_sync_call_mutex);
LOC_LOGD("%s:%d]: freeing slot %d\n", __func__, __LINE__, select_id);
loc_sync_array.slot_in_use[select_id] = 0;
slot = &loc_sync_array.slots[select_id];
slot->client_handle = LOC_CLIENT_INVALID_HANDLE_VALUE;
slot->ind_is_selected = false; /* is ind selected? */
slot->ind_is_waiting = false; /* is waiting? */
slot->ind_has_arrived = false; /* callback has arrived */
slot->recv_ind_id = 0; /* ind to wait for */
slot->recv_ind_payload_ptr = NULL;
slot->req_id = 0;
// check if all slots are now free
for (i = 0; i < LOC_SYNC_REQ_BUFFER_SIZE; i++)
{
if (loc_sync_array.slot_in_use[i]) break;
}
if (i >= LOC_SYNC_REQ_BUFFER_SIZE)
{
loc_sync_array.in_use = false;
}
pthread_mutex_unlock(&loc_sync_call_mutex);
}
/*===========================================================================
FUNCTION loc_sync_select_ind
DESCRIPTION
Selects which indication to wait for.
DEPENDENCIES
N/A
RETURN VALUE
Select ID (>=0) : successful
-ENOMEM : out of buffer
SIDE EFFECTS
N/A
===========================================================================*/
static int loc_sync_select_ind(
locClientHandleType client_handle, /* Client handle */
uint32_t ind_id, /* ind Id wait for */
uint32_t req_id, /* req id */
void * ind_payload_ptr /* ptr where payload should be copied to*/
)
{
int select_id = loc_alloc_slot();
LOC_LOGV("%s:%d]: client handle %p, ind_id %u, req_id %u \n",
__func__, __LINE__, client_handle, ind_id, req_id);
if (select_id < 0)
{
LOC_LOGE("%s:%d]: buffer full for this synchronous req %s \n",
__func__, __LINE__, loc_get_v02_event_name(req_id));
return -ENOMEM;
}
loc_sync_req_data_s_type *slot = &loc_sync_array.slots[select_id];
pthread_mutex_lock(&slot->sync_req_lock);
slot->client_handle = client_handle;
slot->ind_is_selected = true;
slot->ind_is_waiting = false;
slot->ind_has_arrived = false;
slot->recv_ind_id = ind_id;
slot->req_id = req_id;
slot->recv_ind_payload_ptr = ind_payload_ptr; //store the payload ptr
pthread_mutex_unlock(&slot->sync_req_lock);
return select_id;
}
/*===========================================================================
FUNCTION loc_sync_wait_for_ind
DESCRIPTION
Waits for a selected indication. The wait expires in timeout_seconds seconds.
If the function is called before an existing wait has finished, it will
immediately return error.
DEPENDENCIES
N/A
RETURN VALUE
0 on SUCCESS, -ve value on failure
SIDE EFFECTS
N/A
===========================================================================*/
static int loc_sync_wait_for_ind(
int select_id, /* ID from loc_sync_select_ind() */
int timeout_seconds, /* Timeout in this number of seconds */
uint32_t ind_id
)
{
if (select_id < 0 || select_id >= LOC_SYNC_REQ_BUFFER_SIZE || !loc_sync_array.slot_in_use[select_id])
{
LOC_LOGE("%s:%d]: invalid select_id: %d \n",
__func__, __LINE__, select_id);
return (-EINVAL);
}
loc_sync_req_data_s_type *slot = &loc_sync_array.slots[select_id];
int ret_val = 0; /* the return value of this function: 0 = no error */
int rc; /* return code from pthread calls */
struct timespec expire_time;
pthread_mutex_lock(&slot->sync_req_lock);
do
{
if (slot->ind_has_arrived)
{
ret_val = 0; /* success */
break;
}
if (slot->ind_is_waiting)
{
LOC_LOGW("%s:%d]: already waiting in this slot %d\n", __func__,
__LINE__, select_id);
ret_val = -EBUSY; // busy
break;
}
/* Calculate absolute expire time */
clock_gettime(CLOCK_MONOTONIC, &expire_time);
expire_time.tv_sec += timeout_seconds;
/* Take new wait request */
slot->ind_is_waiting = true;
/* Waiting */
rc = pthread_cond_timedwait(&slot->ind_arrived_cond,
&slot->sync_req_lock, &expire_time);
slot->ind_is_waiting = false;
if(rc == ETIMEDOUT)
{
LOC_LOGE("%s:%d]: slot %d, timed out for ind_id %s\n",
__func__, __LINE__, select_id, loc_get_v02_event_name(ind_id));
ret_val = -ETIMEDOUT; //time out
}
} while (0);
pthread_mutex_unlock(&slot->sync_req_lock);
loc_free_slot(select_id);
return ret_val;
}
/*===========================================================================
FUNCTION loc_sync_send_req
DESCRIPTION
Synchronous req call (thread safe)
DEPENDENCIES
N/A
RETURN VALUE
Loc API 2.0 status
SIDE EFFECTS
N/A
===========================================================================*/
locClientStatusEnumType loc_sync_send_req
(
locClientHandleType client_handle,
uint32_t req_id, /* req id */
locClientReqUnionType req_payload,
uint32_t timeout_msec,
uint32_t ind_id, //ind ID to block for, usually the same as req_id */
void *ind_payload_ptr /* can be NULL*/
)
{
locClientStatusEnumType status = eLOC_CLIENT_SUCCESS ;
int select_id;
int rc = 0;
// Select the callback we are waiting for
select_id = loc_sync_select_ind(client_handle, ind_id, req_id,
ind_payload_ptr);
if (select_id >= 0)
{
status = locClientSendReq (client_handle, req_id, req_payload);
LOC_LOGV("%s:%d]: select_id = %d,locClientSendReq returned %d\n",
__func__, __LINE__, select_id, status);
if (status != eLOC_CLIENT_SUCCESS )
{
loc_free_slot(select_id);
}
else
{
// Wait for the indication callback
if (( rc = loc_sync_wait_for_ind( select_id,
timeout_msec / 1000,
ind_id) ) < 0)
{
if ( rc == -ETIMEDOUT)
status = eLOC_CLIENT_FAILURE_TIMEOUT;
else
status = eLOC_CLIENT_FAILURE_INTERNAL;
// Callback waiting failed
LOC_LOGE("%s:%d]: loc_api_wait_for_ind failed, err %d, "
"select id %d, status %s", __func__, __LINE__, rc ,
select_id, loc_get_v02_client_status_name(status));
}
else
{
status = eLOC_CLIENT_SUCCESS;
LOC_LOGV("%s:%d]: success (select id %d)\n",
__func__, __LINE__, select_id);
}
}
} /* select id */
return status;
}

View file

@ -0,0 +1,70 @@
/* Copyright (c) 2011,2013,2016, The Linux Foundation. All rights reserved
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LOC_SYNC_REQ_H
#define LOC_SYNC_REQ_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdbool.h>
#include <stdint.h>
#include "loc_api_v02_client.h"
#define LOC_ENGINE_SYNC_REQUEST_TIMEOUT (1000) // 1 second
#define LOC_ENGINE_SYNC_REQUEST_LONG_TIMEOUT (5000) // 5 seconds
/* Init function */
extern void loc_sync_req_init();
/* Process Loc API indications to wake up blocked user threads */
extern void loc_sync_process_ind(
locClientHandleType client_handle, /* handle of the client */
uint32_t ind_id , /* respInd id */
void *ind_payload_ptr, /* payload */
uint32_t ind_payload_size /* payload size */
);
/* Thread safe synchronous request, using Loc API status return code */
extern locClientStatusEnumType loc_sync_send_req
(
locClientHandleType client_handle,
uint32_t req_id, /* req id */
locClientReqUnionType req_payload,
uint32_t timeout_msec,
uint32_t ind_id, //ind ID to block for, usually the same as req_id */
void *ind_payload_ptr /* can be NULL*/
);
#ifdef __cplusplus
}
#endif
#endif /* LOC_SYNC_REQ_H */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,298 @@
/* Copyright (c) 2011-2015, 2018-2020 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <loc_api_v02_log.h>
#include <location_service_v02.h>
DECLARE_TBL(loc_v02_event_name) =
{
NAME_VAL(QMI_LOC_GET_SUPPORTED_MSGS_REQ_V02),
NAME_VAL(QMI_LOC_GET_SUPPORTED_FIELDS_REQ_V02),
NAME_VAL(QMI_LOC_INFORM_CLIENT_REVISION_REQ_V02),
NAME_VAL(QMI_LOC_REG_EVENTS_REQ_V02),
NAME_VAL(QMI_LOC_START_REQ_V02),
NAME_VAL(QMI_LOC_STOP_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_POSITION_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GNSS_SV_INFO_IND_V02),
NAME_VAL(QMI_LOC_EVENT_NMEA_IND_V02),
NAME_VAL(QMI_LOC_EVENT_NI_NOTIFY_VERIFY_REQ_IND_V02),
NAME_VAL(QMI_LOC_EVENT_INJECT_TIME_REQ_IND_V02),
NAME_VAL(QMI_LOC_EVENT_INJECT_PREDICTED_ORBITS_REQ_IND_V02),
NAME_VAL(QMI_LOC_EVENT_INJECT_POSITION_REQ_IND_V02),
NAME_VAL(QMI_LOC_EVENT_ENGINE_STATE_IND_V02),
NAME_VAL(QMI_LOC_EVENT_FIX_SESSION_STATE_IND_V02),
NAME_VAL(QMI_LOC_EVENT_WIFI_REQ_IND_V02),
NAME_VAL(QMI_LOC_EVENT_SENSOR_STREAMING_READY_STATUS_IND_V02),
NAME_VAL(QMI_LOC_EVENT_TIME_SYNC_REQ_IND_V02),
NAME_VAL(QMI_LOC_EVENT_SET_SPI_STREAMING_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_LOCATION_SERVER_CONNECTION_REQ_IND_V02),
NAME_VAL(QMI_LOC_GET_SERVICE_REVISION_REQ_V02),
NAME_VAL(QMI_LOC_GET_FIX_CRITERIA_REQ_V02),
NAME_VAL(QMI_LOC_NI_USER_RESPONSE_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_PREDICTED_ORBITS_DATA_REQ_V02),
NAME_VAL(QMI_LOC_GET_PREDICTED_ORBITS_DATA_SOURCE_REQ_V02),
NAME_VAL(QMI_LOC_GET_PREDICTED_ORBITS_DATA_VALIDITY_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_UTC_TIME_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_POSITION_REQ_V02),
NAME_VAL(QMI_LOC_SET_ENGINE_LOCK_REQ_V02),
NAME_VAL(QMI_LOC_GET_ENGINE_LOCK_REQ_V02),
NAME_VAL(QMI_LOC_SET_SBAS_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GET_SBAS_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_SET_NMEA_TYPES_REQ_V02),
NAME_VAL(QMI_LOC_GET_NMEA_TYPES_REQ_V02),
NAME_VAL(QMI_LOC_SET_LOW_POWER_MODE_REQ_V02),
NAME_VAL(QMI_LOC_GET_LOW_POWER_MODE_REQ_V02),
NAME_VAL(QMI_LOC_REGISTER_MASTER_CLIENT_REQ_V02),
NAME_VAL(QMI_LOC_SET_SERVER_REQ_V02),
NAME_VAL(QMI_LOC_GET_SERVER_REQ_V02),
NAME_VAL(QMI_LOC_DELETE_ASSIST_DATA_REQ_V02),
NAME_VAL(QMI_LOC_SET_XTRA_T_SESSION_CONTROL_REQ_V02),
NAME_VAL(QMI_LOC_GET_XTRA_T_SESSION_CONTROL_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_WIFI_POSITION_REQ_V02),
NAME_VAL(QMI_LOC_NOTIFY_WIFI_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_GET_REGISTERED_EVENTS_REQ_V02),
NAME_VAL(QMI_LOC_SET_OPERATION_MODE_REQ_V02),
NAME_VAL(QMI_LOC_GET_OPERATION_MODE_REQ_V02),
NAME_VAL(QMI_LOC_SET_SPI_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_SENSOR_DATA_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_TIME_SYNC_DATA_REQ_V02),
NAME_VAL(QMI_LOC_SET_CRADLE_MOUNT_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GET_CRADLE_MOUNT_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_SET_EXTERNAL_POWER_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GET_EXTERNAL_POWER_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_INFORM_LOCATION_SERVER_CONN_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_SET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02),
NAME_VAL(QMI_LOC_GET_PROTOCOL_CONFIG_PARAMETERS_REQ_V02),
NAME_VAL(QMI_LOC_SET_SENSOR_CONTROL_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GET_SENSOR_CONTROL_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_SET_SENSOR_PROPERTIES_REQ_V02),
NAME_VAL(QMI_LOC_GET_SENSOR_PROPERTIES_REQ_V02),
NAME_VAL(QMI_LOC_SET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02),
NAME_VAL(QMI_LOC_GET_SENSOR_PERFORMANCE_CONTROL_CONFIGURATION_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_SUPL_CERTIFICATE_REQ_V02),
NAME_VAL(QMI_LOC_DELETE_SUPL_CERTIFICATE_REQ_V02),
NAME_VAL(QMI_LOC_SET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02),
NAME_VAL(QMI_LOC_GET_POSITION_ENGINE_CONFIG_PARAMETERS_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_NI_GEOFENCE_NOTIFICATION_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GEOFENCE_GEN_ALERT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GEOFENCE_BREACH_NOTIFICATION_IND_V02),
NAME_VAL(QMI_LOC_ADD_CIRCULAR_GEOFENCE_REQ_V02),
NAME_VAL(QMI_LOC_DELETE_GEOFENCE_REQ_V02),
NAME_VAL(QMI_LOC_QUERY_GEOFENCE_REQ_V02),
NAME_VAL(QMI_LOC_EDIT_GEOFENCE_REQ_V02),
NAME_VAL(QMI_LOC_GET_BEST_AVAILABLE_POSITION_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_MOTION_DATA_REQ_V02),
NAME_VAL(QMI_LOC_GET_NI_GEOFENCE_ID_LIST_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_GSM_CELL_INFO_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_NETWORK_INITIATED_MESSAGE_REQ_V02),
NAME_VAL(QMI_LOC_WWAN_OUT_OF_SERVICE_NOTIFICATION_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_PEDOMETER_CONTROL_IND_V02),
NAME_VAL(QMI_LOC_EVENT_MOTION_DATA_CONTROL_IND_V02),
NAME_VAL(QMI_LOC_PEDOMETER_REPORT_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_WCDMA_CELL_INFO_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_TDSCDMA_CELL_INFO_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_SUBSCRIBER_ID_REQ_V02),
NAME_VAL(QMI_LOC_SET_GEOFENCE_ENGINE_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GET_GEOFENCE_ENGINE_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GET_BATCH_SIZE_REQ_V02),
NAME_VAL(QMI_LOC_START_BATCHING_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_BATCH_FULL_NOTIFICATION_IND_V02),
NAME_VAL(QMI_LOC_EVENT_LIVE_BATCHED_POSITION_REPORT_IND_V02),
NAME_VAL(QMI_LOC_READ_FROM_BATCH_REQ_V02),
NAME_VAL(QMI_LOC_STOP_BATCHING_REQ_V02),
NAME_VAL(QMI_LOC_RELEASE_BATCH_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_INJECT_WIFI_AP_DATA_REQ_IND_V02),
NAME_VAL(QMI_LOC_INJECT_WIFI_AP_DATA_REQ_V02),
NAME_VAL(QMI_LOC_NOTIFY_WIFI_ATTACHMENT_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_NOTIFY_WIFI_ENABLED_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_GEOFENCE_BATCHED_BREACH_NOTIFICATION_IND_V02),
NAME_VAL(QMI_LOC_EVENT_VEHICLE_DATA_READY_STATUS_IND_V02),
NAME_VAL(QMI_LOC_INJECT_VEHICLE_SENSOR_DATA_REQ_V02),
NAME_VAL(QMI_LOC_GET_AVAILABLE_WWAN_POSITION_REQ_V02),
NAME_VAL(QMI_LOC_SET_PREMIUM_SERVICES_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_SET_XTRA_VERSION_CHECK_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_GNSS_MEASUREMENT_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_SV_POLYNOMIAL_REPORT_IND_V02),
NAME_VAL(QMI_LOC_SET_GNSS_CONSTELL_REPORT_CONFIG_V02),
NAME_VAL(QMI_LOC_ADD_GEOFENCE_CONTEXT_REQ_V02),
NAME_VAL(QMI_LOC_SET_GEOFENCE_ENGINE_CONTEXT_REQ_V02),
NAME_VAL(QMI_LOC_DELETE_GEOFENCE_CONTEXT_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_GEOFENCE_PROXIMITY_NOTIFICATION_IND_V02),
NAME_VAL(QMI_LOC_INJECT_GTP_CLIENT_DOWNLOADED_DATA_REQ_V02),
NAME_VAL(QMI_LOC_GDT_UPLOAD_BEGIN_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_GDT_UPLOAD_END_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_GDT_UPLOAD_BEGIN_STATUS_REQ_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GDT_UPLOAD_END_REQ_IND_V02),
NAME_VAL(QMI_LOC_START_DBT_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_DBT_POSITION_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_DBT_SESSION_STATUS_IND_V02),
NAME_VAL(QMI_LOC_STOP_DBT_REQ_V02),
NAME_VAL(QMI_LOC_SECURE_GET_AVAILABLE_POSITION_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_GEOFENCE_BATCHED_DWELL_NOTIFICATION_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GET_TIME_ZONE_INFO_IND_V02),
NAME_VAL(QMI_LOC_INJECT_TIME_ZONE_INFO_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_APCACHE_DATA_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_APDONOTCACHE_DATA_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_BATCHING_STATUS_IND_V02),
NAME_VAL(QMI_LOC_QUERY_AON_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GTP_AP_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_GDT_DOWNLOAD_BEGIN_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_GDT_DOWNLOAD_READY_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_GDT_RECEIVE_DONE_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_GDT_DOWNLOAD_END_STATUS_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_GDT_DOWNLOAD_BEGIN_REQ_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GDT_RECEIVE_DONE_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GDT_DOWNLOAD_END_REQ_IND_V02),
NAME_VAL(QMI_LOC_DELETE_GNSS_SERVICE_DATA_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_XTRA_DATA_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_XTRA_PCID_REQ_V02),
NAME_VAL(QMI_LOC_GET_SUPPORTED_FEATURE_REQ_V02),
NAME_VAL(QMI_LOC_SET_INTERNAL_STATUS_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_INTERNAL_STATUS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_INJECT_SRN_AP_DATA_REQ_IND_V02),
NAME_VAL(QMI_LOC_INJECT_SRN_AP_DATA_REQ_V02),
NAME_VAL(QMI_LOC_CROWDSOURCE_MANAGER_CONTROL_REQ_V02),
NAME_VAL(QMI_LOC_CROWDSOURCE_MANAGER_READ_DATA_REQ_V02),
NAME_VAL(QMI_LOC_QUERY_XTRA_INFO_REQ_V02),
NAME_VAL(QMI_LOC_START_OUTDOOR_TRIP_BATCHING_REQ_V02),
NAME_VAL(QMI_LOC_QUERY_OTB_ACCUMULATED_DISTANCE_REQ_V02),
NAME_VAL(QMI_LOC_GET_FDCL_BS_LIST_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_FDCL_DATA_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_FDCL_SERVICE_REQ_IND_V02),
NAME_VAL(QMI_LOC_SET_BLACKLIST_SV_REQ_V02),
NAME_VAL(QMI_LOC_GET_BLACKLIST_SV_REQ_V02),
NAME_VAL(QMI_LOC_SET_CONSTELLATION_CONTROL_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_UNPROPAGATED_POSITION_REPORT_IND_V02),
NAME_VAL(QMI_LOC_GET_BS_OBS_DATA_REQ_V02),
NAME_VAL(QMI_LOC_GET_CONSTELLATION_CONTROL_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_BS_OBS_DATA_SERVICE_REQ_IND_V02),
NAME_VAL(QMI_LOC_SET_CONSTRAINED_TUNC_MODE_REQ_V02),
NAME_VAL(QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_REQ_V02),
NAME_VAL(QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_GPS_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GLONASS_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_BDS_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GALILEO_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_QZSS_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_SYSTEM_INFO_REQ_V02),
NAME_VAL(QMI_LOC_GET_CONSTELLATION_CONTROL_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_UNPROPAGATED_POSITION_REPORT_IND_V02),
NAME_VAL(QMI_LOC_ENABLE_POSITION_INJECTION_TEST_MODE_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_TEST_POSITION_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_BS_OBS_DATA_SERVICE_REQ_IND_V02),
NAME_VAL(QMI_LOC_GET_BS_OBS_DATA_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_GPS_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GLONASS_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_BDS_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_GALILEO_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_EVENT_QZSS_EPHEMERIS_REPORT_IND_V02),
NAME_VAL(QMI_LOC_SET_CONSTRAINED_TUNC_MODE_REQ_V02),
NAME_VAL(QMI_LOC_ENABLE_POSITION_ASSISTED_CLOCK_EST_REQ_V02),
NAME_VAL(QMI_LOC_QUERY_GNSS_ENERGY_CONSUMED_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_REPORT_IND_V02),
NAME_VAL(QMI_LOC_GET_BAND_MEASUREMENT_METRICS_IND_V02),
NAME_VAL(QMI_LOC_LOCATION_REQUEST_NOTIFICATION_IND_V02),
NAME_VAL(QMI_LOC_INJECT_PLATFORM_POWER_STATE_REQ_V02),
NAME_VAL(QMI_LOC_INJECT_PLATFORM_POWER_STATE_RESP_V02),
NAME_VAL(QMI_LOC_INJECT_PLATFORM_POWER_STATE_IND_V02),
NAME_VAL(QMI_LOC_SET_ROBUST_LOCATION_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GET_ROBUST_LOCATION_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_SET_MIN_GPS_WEEK_NUMBER_REQ_V02),
NAME_VAL(QMI_LOC_GET_MIN_GPS_WEEK_NUMBER_REQ_V02),
NAME_VAL(QMI_LOC_EVENT_QUERY_XTRA_INFO_REQ_IND_V02),
NAME_VAL(QMI_LOC_SET_PARAMETER_REQ_V02),
NAME_VAL(QMI_LOC_GET_PARAMETER_REQ_V02),
NAME_VAL(QMI_LOC_SET_MULTIBAND_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_GET_MULTIBAND_CONFIG_REQ_V02),
NAME_VAL(QMI_LOC_LATENCY_INFORMATION_IND_V02),
};
const char* loc_get_v02_event_name(uint32_t event)
{
return loc_get_name_from_val(loc_v02_event_name_tbl, (int64_t) event);
}
DECLARE_TBL(loc_v02_client_status_name) =
{
NAME_VAL(eLOC_CLIENT_SUCCESS),
NAME_VAL(eLOC_CLIENT_FAILURE_GENERAL),
NAME_VAL(eLOC_CLIENT_FAILURE_UNSUPPORTED),
NAME_VAL(eLOC_CLIENT_FAILURE_INVALID_PARAMETER),
NAME_VAL(eLOC_CLIENT_FAILURE_ENGINE_BUSY),
NAME_VAL(eLOC_CLIENT_FAILURE_PHONE_OFFLINE),
NAME_VAL(eLOC_CLIENT_FAILURE_TIMEOUT),
NAME_VAL(eLOC_CLIENT_FAILURE_SERVICE_NOT_PRESENT),
NAME_VAL(eLOC_CLIENT_FAILURE_SERVICE_VERSION_UNSUPPORTED),
NAME_VAL(eLOC_CLIENT_FAILURE_CLIENT_VERSION_UNSUPPORTED),
NAME_VAL(eLOC_CLIENT_FAILURE_INVALID_HANDLE),
NAME_VAL(eLOC_CLIENT_FAILURE_INTERNAL),
NAME_VAL(eLOC_CLIENT_FAILURE_NOT_INITIALIZED),
NAME_VAL(eLOC_CLIENT_FAILURE_NOT_ENOUGH_MEMORY),
NAME_VAL(eLOC_CLIENT_FAILURE_INVALID_MESSAGE_ID),
};
const char* loc_get_v02_client_status_name(locClientStatusEnumType status)
{
return loc_get_name_from_val(loc_v02_client_status_name_tbl, (int64_t) status);
}
DECLARE_TBL(loc_v02_qmi_status_name) =
{
NAME_VAL(eQMI_LOC_SUCCESS_V02),
NAME_VAL(eQMI_LOC_GENERAL_FAILURE_V02),
NAME_VAL(eQMI_LOC_UNSUPPORTED_V02),
NAME_VAL(eQMI_LOC_INVALID_PARAMETER_V02),
NAME_VAL(eQMI_LOC_ENGINE_BUSY_V02),
NAME_VAL(eQMI_LOC_PHONE_OFFLINE_V02),
NAME_VAL(eQMI_LOC_TIMEOUT_V02),
NAME_VAL(eQMI_LOC_CONFIG_NOT_SUPPORTED_V02),
NAME_VAL(eQMI_LOC_INSUFFICIENT_MEMORY_V02),
NAME_VAL(eQMI_LOC_MAX_GEOFENCE_PROGRAMMED_V02),
NAME_VAL(eQMI_LOC_XTRA_VERSION_CHECK_FAILURE_V02),
NAME_VAL(eQMI_LOC_GNSS_DISABLED_V02),
};
const char* loc_get_v02_qmi_status_name(qmiLocStatusEnumT_v02 status)
{
return loc_get_name_from_val(loc_v02_qmi_status_name_tbl, (int64_t) status);
}
DECLARE_TBL(loc_v02_qmi_reg_mk_status_name) =
{
NAME_VAL(eQMI_LOC_REGISTER_MASTER_CLIENT_SUCCESS_V02),
NAME_VAL(eQMI_LOC_REGISTER_MASTER_CLIENT_INVALID_KEY_V02),
NAME_VAL(eQMI_LOC_REGISTER_MASTER_CLIENT_ALREADY_HAVE_MASTER_CLIENT_V02),
NAME_VAL(eQMI_LOC_REGISTER_MASTER_CLIENT_INTERNAL_FAILURE_V02),
};
const char* loc_get_v02_qmi_reg_mk_status_name(qmiLocRegisterMasterClientStatusEnumT_v02 status)
{
return loc_get_name_from_val(loc_v02_qmi_reg_mk_status_name_tbl, (int64_t)status);
}

View file

@ -0,0 +1,51 @@
/* Copyright (c) 2011, 2018 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef LOC_API_V02_LOG_H
#define LOC_API_V02_LOG_H
#include <loc_log.h>
#include <loc_api_v02_client.h>
#ifdef __cplusplus
extern "C"
{
#endif
const char* loc_get_v02_event_name(uint32_t event);
const char* loc_get_v02_client_status_name(locClientStatusEnumType status);
const char* loc_get_v02_qmi_status_name(qmiLocStatusEnumT_v02 status);
const char* loc_get_v02_qmi_reg_mk_status_name(qmiLocRegisterMasterClientStatusEnumT_v02 status);
#ifdef __cplusplus
}
#endif
#endif /* LOC_API_V02_LOG_H */

View file

@ -0,0 +1,78 @@
/* Copyright (c) 2011-2012, 2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LOC_UTIL_LOG_H
#define LOC_UTIL_LOG_H
#include <log_util.h>
#if defined(_ANDROID_)
#include "loc_api_v02_log.h"
#else // no _ANDROID_
#if defined(__LOC_API_V02_LOG_SILENT__)
#define MSG_LOG
#define LOC_LOGE(...) MSG_LOG(__VA_ARGS__);
#define LOC_LOGW(...) MSG_LOG(__VA_ARGS__);
#define LOC_LOGD(...) MSG_LOG(__VA_ARGS__);
#define LOC_LOGI(...) MSG_LOG(__VA_ARGS__);
#define LOC_LOGV(...) MSG_LOG(__VA_ARGS__);
#elif !defined(USE_GLIB)
// common for QNX and Griffon
//error logs
#define LOC_LOGE(...) printf(__VA_ARGS__)
//warning logs
#define LOC_LOGW(...) printf(__VA_ARGS__)
// debug logs
#define LOC_LOGD(...) printf(__VA_ARGS__)
//info logs
#define LOC_LOGI(...) printf(__VA_ARGS__)
//verbose logs
#define LOC_LOGV(...) printf(__VA_ARGS__)
#endif //__LOC_API_V02_LOG_SILENT__
//specific to OFF TARGET
#ifdef LOC_UTIL_TARGET_OFF_TARGET
# include <stdio.h>
# include <asm/errno.h>
# include <sys/time.h>
// get around strl*: not found in glibc
// TBD:look for presence of eglibc other libraries
// with strlcpy supported.
#define strlcpy(X,Y,Z) strcpy(X,Y)
#define strlcat(X,Y,Z) strcat(X,Y)
#endif //LOC_UTIL_TARGET_OFF_TARGET
#endif //_ANDROID_
#endif //LOC_UTIL_LOG_H

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff