sdm660-common: gps: Checkout gps hal from LA.UM.8.2.r1-07400-sdm660.0
* Removed depricated dependencies * Restored needed config for gps Signed-off-by: OdSazib <odsazib@gmail.com>
This commit is contained in:
parent
a4303640df
commit
36e5c637a7
50 changed files with 617 additions and 359 deletions
|
@ -70,7 +70,7 @@ Gnss::Gnss() {
|
|||
Gnss::~Gnss() {
|
||||
ENTRY_LOG_CALLFLOW();
|
||||
if (mApi != nullptr) {
|
||||
delete mApi;
|
||||
mApi->destroy();
|
||||
mApi = nullptr;
|
||||
}
|
||||
sGnss = nullptr;
|
||||
|
@ -254,6 +254,11 @@ Return<bool> Gnss::injectLocation(double latitudeDegrees,
|
|||
|
||||
Return<bool> Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
|
||||
int32_t uncertaintyMs) {
|
||||
ENTRY_LOG_CALLFLOW();
|
||||
const GnssInterface* gnssInterface = getGnssInterface();
|
||||
if ((nullptr != gnssInterface) && (gnssInterface->isSS5HWEnabled())) {
|
||||
gnssInterface->injectTime(timeMs, timeReferenceMs, uncertaintyMs);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ GnssBatching::GnssBatching() : mApi(nullptr) {
|
|||
|
||||
GnssBatching::~GnssBatching() {
|
||||
if (mApi != nullptr) {
|
||||
delete mApi;
|
||||
mApi->destroy();
|
||||
mApi = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ GnssBatching::~GnssBatching() {
|
|||
Return<bool> GnssBatching::init(const sp<IGnssBatchingCallback>& callback) {
|
||||
if (mApi != nullptr) {
|
||||
LOC_LOGD("%s]: mApi is NOT nullptr, delete it first", __FUNCTION__);
|
||||
delete mApi;
|
||||
mApi->destroy();
|
||||
mApi = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ GnssGeofencing::GnssGeofencing() : mApi(nullptr) {
|
|||
|
||||
GnssGeofencing::~GnssGeofencing() {
|
||||
if (mApi != nullptr) {
|
||||
delete mApi;
|
||||
mApi->destroy();
|
||||
mApi = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ GnssMeasurement::GnssMeasurement() {
|
|||
|
||||
GnssMeasurement::~GnssMeasurement() {
|
||||
if (mApi) {
|
||||
delete mApi;
|
||||
mApi->destroy();
|
||||
mApi = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@ class BatchingAPIClient : public LocationAPIClientBase
|
|||
{
|
||||
public:
|
||||
BatchingAPIClient(const sp<V1_0::IGnssBatchingCallback>& callback);
|
||||
~BatchingAPIClient();
|
||||
int getBatchSize();
|
||||
int startSession(const V1_0::IGnssBatching::Options& options);
|
||||
int updateSessionOptions(const V1_0::IGnssBatching::Options& options);
|
||||
|
@ -61,6 +60,7 @@ public:
|
|||
void onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions) final;
|
||||
|
||||
private:
|
||||
~BatchingAPIClient();
|
||||
sp<V1_0::IGnssBatchingCallback> mGnssBatchingCbIface;
|
||||
uint32_t mDefaultId;
|
||||
LocationCapabilitiesMask mLocationCapabilitiesMask;
|
||||
|
|
|
@ -46,8 +46,6 @@ class GeofenceAPIClient : public LocationAPIClientBase
|
|||
{
|
||||
public:
|
||||
GeofenceAPIClient(const sp<V1_0::IGnssGeofenceCallback>& callback);
|
||||
virtual ~GeofenceAPIClient() = default;
|
||||
|
||||
void geofenceAdd(uint32_t geofence_id, double latitude, double longitude,
|
||||
double radius_meters, int32_t last_transition, int32_t monitor_transitions,
|
||||
uint32_t notification_responsiveness_ms, uint32_t unknown_timer_ms);
|
||||
|
@ -65,6 +63,7 @@ public:
|
|||
void onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
|
||||
|
||||
private:
|
||||
virtual ~GeofenceAPIClient() = default;
|
||||
sp<V1_0::IGnssGeofenceCallback> mGnssGeofencingCbIface;
|
||||
};
|
||||
|
||||
|
|
|
@ -331,16 +331,17 @@ void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
|||
}
|
||||
}
|
||||
if (gnssCbIface != nullptr) {
|
||||
IGnssCallback::GnssSystemInfo gnssInfo;
|
||||
IGnssCallback::GnssSystemInfo gnssInfo = { .yearOfHw = 2015 };
|
||||
|
||||
if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT) {
|
||||
gnssInfo.yearOfHw++; // 2016
|
||||
if (capabilitiesMask & LOCATION_CAPABILITIES_DEBUG_NMEA_BIT) {
|
||||
gnssInfo.yearOfHw++; // 2017
|
||||
if (capabilitiesMask & LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT ||
|
||||
capabilitiesMask & LOCATION_CAPABILITIES_AGPM_BIT) {
|
||||
gnssInfo.yearOfHw = 2018;
|
||||
} else if (capabilitiesMask & LOCATION_CAPABILITIES_DEBUG_NMEA_BIT) {
|
||||
gnssInfo.yearOfHw = 2017;
|
||||
} else if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT) {
|
||||
gnssInfo.yearOfHw = 2016;
|
||||
} else {
|
||||
gnssInfo.yearOfHw = 2015;
|
||||
gnssInfo.yearOfHw++; // 2018
|
||||
}
|
||||
}
|
||||
}
|
||||
LOC_LOGV("%s:%d] set_system_info_cb (%d)", __FUNCTION__, __LINE__, gnssInfo.yearOfHw);
|
||||
auto r = gnssCbIface->gnssSetSystemInfoCb(gnssInfo);
|
||||
|
|
|
@ -50,7 +50,6 @@ class GnssAPIClient : public LocationAPIClientBase
|
|||
public:
|
||||
GnssAPIClient(const sp<V1_0::IGnssCallback>& gpsCb,
|
||||
const sp<V1_0::IGnssNiCallback>& niCb);
|
||||
virtual ~GnssAPIClient();
|
||||
GnssAPIClient(const GnssAPIClient&) = delete;
|
||||
GnssAPIClient& operator=(const GnssAPIClient&) = delete;
|
||||
|
||||
|
@ -92,6 +91,8 @@ public:
|
|||
void onStopTrackingCb(LocationError error) final;
|
||||
|
||||
private:
|
||||
virtual ~GnssAPIClient();
|
||||
|
||||
sp<V1_0::IGnssCallback> mGnssCbIface;
|
||||
sp<V1_0::IGnssNiCallback> mGnssNiCbIface;
|
||||
std::mutex mMutex;
|
||||
|
|
|
@ -49,7 +49,6 @@ class MeasurementAPIClient : public LocationAPIClientBase
|
|||
{
|
||||
public:
|
||||
MeasurementAPIClient();
|
||||
virtual ~MeasurementAPIClient();
|
||||
MeasurementAPIClient(const MeasurementAPIClient&) = delete;
|
||||
MeasurementAPIClient& operator=(const MeasurementAPIClient&) = delete;
|
||||
|
||||
|
@ -63,6 +62,7 @@ public:
|
|||
void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final;
|
||||
|
||||
private:
|
||||
virtual ~MeasurementAPIClient();
|
||||
std::mutex mMutex;
|
||||
sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface;
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ Gnss::Gnss() {
|
|||
Gnss::~Gnss() {
|
||||
ENTRY_LOG_CALLFLOW();
|
||||
if (mApi != nullptr) {
|
||||
delete mApi;
|
||||
mApi->destroy();
|
||||
mApi = nullptr;
|
||||
}
|
||||
sGnss = nullptr;
|
||||
|
@ -295,6 +295,11 @@ Return<bool> Gnss::injectLocation(double latitudeDegrees,
|
|||
|
||||
Return<bool> Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
|
||||
int32_t uncertaintyMs) {
|
||||
ENTRY_LOG_CALLFLOW();
|
||||
const GnssInterface* gnssInterface = getGnssInterface();
|
||||
if ((nullptr != gnssInterface) && (gnssInterface->isSS5HWEnabled())) {
|
||||
gnssInterface->injectTime(timeMs, timeReferenceMs, uncertaintyMs);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ GnssBatching::GnssBatching() : mApi(nullptr) {
|
|||
|
||||
GnssBatching::~GnssBatching() {
|
||||
if (mApi != nullptr) {
|
||||
delete mApi;
|
||||
mApi->destroy();
|
||||
mApi = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ GnssBatching::~GnssBatching() {
|
|||
Return<bool> GnssBatching::init(const sp<IGnssBatchingCallback>& callback) {
|
||||
if (mApi != nullptr) {
|
||||
LOC_LOGD("%s]: mApi is NOT nullptr, delete it first", __FUNCTION__);
|
||||
delete mApi;
|
||||
mApi->destroy();
|
||||
mApi = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ GnssGeofencing::GnssGeofencing() : mApi(nullptr) {
|
|||
|
||||
GnssGeofencing::~GnssGeofencing() {
|
||||
if (mApi != nullptr) {
|
||||
delete mApi;
|
||||
mApi->destroy();
|
||||
mApi = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ GnssMeasurement::GnssMeasurement() {
|
|||
|
||||
GnssMeasurement::~GnssMeasurement() {
|
||||
if (mApi) {
|
||||
delete mApi;
|
||||
mApi->destroy();
|
||||
mApi = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@ class BatchingAPIClient : public LocationAPIClientBase
|
|||
{
|
||||
public:
|
||||
BatchingAPIClient(const sp<V1_0::IGnssBatchingCallback>& callback);
|
||||
~BatchingAPIClient();
|
||||
int getBatchSize();
|
||||
int startSession(const V1_0::IGnssBatching::Options& options);
|
||||
int updateSessionOptions(const V1_0::IGnssBatching::Options& options);
|
||||
|
@ -61,6 +60,8 @@ public:
|
|||
void onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions) final;
|
||||
|
||||
private:
|
||||
~BatchingAPIClient();
|
||||
|
||||
sp<V1_0::IGnssBatchingCallback> mGnssBatchingCbIface;
|
||||
uint32_t mDefaultId;
|
||||
LocationCapabilitiesMask mLocationCapabilitiesMask;
|
||||
|
|
|
@ -46,8 +46,6 @@ class GeofenceAPIClient : public LocationAPIClientBase
|
|||
{
|
||||
public:
|
||||
GeofenceAPIClient(const sp<V1_0::IGnssGeofenceCallback>& callback);
|
||||
virtual ~GeofenceAPIClient() = default;
|
||||
|
||||
void geofenceAdd(uint32_t geofence_id, double latitude, double longitude,
|
||||
double radius_meters, int32_t last_transition, int32_t monitor_transitions,
|
||||
uint32_t notification_responsiveness_ms, uint32_t unknown_timer_ms);
|
||||
|
@ -65,6 +63,8 @@ public:
|
|||
void onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
|
||||
|
||||
private:
|
||||
virtual ~GeofenceAPIClient() = default;
|
||||
|
||||
sp<V1_0::IGnssGeofenceCallback> mGnssGeofencingCbIface;
|
||||
};
|
||||
|
||||
|
|
|
@ -331,16 +331,17 @@ void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
|||
}
|
||||
}
|
||||
if (gnssCbIface != nullptr) {
|
||||
IGnssCallback::GnssSystemInfo gnssInfo;
|
||||
IGnssCallback::GnssSystemInfo gnssInfo = { .yearOfHw = 2015 };
|
||||
|
||||
if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT) {
|
||||
gnssInfo.yearOfHw++; // 2016
|
||||
if (capabilitiesMask & LOCATION_CAPABILITIES_DEBUG_NMEA_BIT) {
|
||||
gnssInfo.yearOfHw++; // 2017
|
||||
if (capabilitiesMask & LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT ||
|
||||
capabilitiesMask & LOCATION_CAPABILITIES_AGPM_BIT) {
|
||||
gnssInfo.yearOfHw = 2018;
|
||||
} else if (capabilitiesMask & LOCATION_CAPABILITIES_DEBUG_NMEA_BIT) {
|
||||
gnssInfo.yearOfHw = 2017;
|
||||
} else if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT) {
|
||||
gnssInfo.yearOfHw = 2016;
|
||||
} else {
|
||||
gnssInfo.yearOfHw = 2015;
|
||||
gnssInfo.yearOfHw++; // 2018
|
||||
}
|
||||
}
|
||||
}
|
||||
LOC_LOGV("%s:%d] set_system_info_cb (%d)", __FUNCTION__, __LINE__, gnssInfo.yearOfHw);
|
||||
auto r = gnssCbIface->gnssSetSystemInfoCb(gnssInfo);
|
||||
|
|
|
@ -50,7 +50,6 @@ class GnssAPIClient : public LocationAPIClientBase
|
|||
public:
|
||||
GnssAPIClient(const sp<V1_0::IGnssCallback>& gpsCb,
|
||||
const sp<V1_0::IGnssNiCallback>& niCb);
|
||||
virtual ~GnssAPIClient();
|
||||
GnssAPIClient(const GnssAPIClient&) = delete;
|
||||
GnssAPIClient& operator=(const GnssAPIClient&) = delete;
|
||||
|
||||
|
@ -92,6 +91,7 @@ public:
|
|||
void onStopTrackingCb(LocationError error) final;
|
||||
|
||||
private:
|
||||
virtual ~GnssAPIClient();
|
||||
sp<V1_0::IGnssCallback> mGnssCbIface;
|
||||
sp<V1_0::IGnssNiCallback> mGnssNiCbIface;
|
||||
std::mutex mMutex;
|
||||
|
|
|
@ -49,7 +49,6 @@ class MeasurementAPIClient : public LocationAPIClientBase
|
|||
{
|
||||
public:
|
||||
MeasurementAPIClient();
|
||||
virtual ~MeasurementAPIClient();
|
||||
MeasurementAPIClient(const MeasurementAPIClient&) = delete;
|
||||
MeasurementAPIClient& operator=(const MeasurementAPIClient&) = delete;
|
||||
|
||||
|
@ -69,6 +68,8 @@ public:
|
|||
void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final;
|
||||
|
||||
private:
|
||||
virtual ~MeasurementAPIClient();
|
||||
|
||||
std::mutex mMutex;
|
||||
sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface;
|
||||
sp<IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1;
|
||||
|
|
|
@ -34,7 +34,7 @@ typedef const GnssInterface* (getLocationInterface)();
|
|||
|
||||
#define IMAGES_INFO_FILE "/sys/devices/soc0/images"
|
||||
#define DELIMITER ";"
|
||||
|
||||
#define MAX_GNSS_ACCURACY_ALLOWED 10000
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace gnss {
|
||||
|
@ -97,6 +97,7 @@ void location_on_battery_status_changed(bool charging) {
|
|||
Gnss::Gnss() {
|
||||
ENTRY_LOG_CALLFLOW();
|
||||
sGnss = this;
|
||||
mIsGnssClient = true;
|
||||
// initilize gnss interface at first in case needing notify battery status
|
||||
sGnss->getGnssInterface()->initialize();
|
||||
// register health client to listen on battery change
|
||||
|
@ -109,7 +110,7 @@ Gnss::Gnss() {
|
|||
Gnss::~Gnss() {
|
||||
ENTRY_LOG_CALLFLOW();
|
||||
if (mApi != nullptr) {
|
||||
delete mApi;
|
||||
mApi->destroy();
|
||||
mApi = nullptr;
|
||||
}
|
||||
sGnss = nullptr;
|
||||
|
@ -190,6 +191,7 @@ Return<bool> Gnss::setCallback(const sp<V1_0::IGnssCallback>& callback) {
|
|||
|
||||
GnssAPIClient* api = getApi();
|
||||
if (api != nullptr) {
|
||||
mIsGnssClient = true;
|
||||
api->gnssUpdateCallbacks(mGnssCbIface, mGnssNiCbIface);
|
||||
api->gnssEnable(LOCATION_TECHNOLOGY_TYPE_GNSS);
|
||||
api->requestCapabilities();
|
||||
|
@ -321,6 +323,11 @@ Return<bool> Gnss::injectLocation(double latitudeDegrees,
|
|||
|
||||
Return<bool> Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
|
||||
int32_t uncertaintyMs) {
|
||||
ENTRY_LOG_CALLFLOW();
|
||||
const GnssInterface* gnssInterface = getGnssInterface();
|
||||
if ((nullptr != gnssInterface) && (gnssInterface->isSS5HWEnabled())) {
|
||||
gnssInterface->injectTime(timeMs, timeReferenceMs, uncertaintyMs);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -333,6 +340,28 @@ Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags)
|
|||
return Void();
|
||||
}
|
||||
|
||||
void Gnss::updateCallbacksByAccuracy(uint32_t preferredAccuracyMeters, GnssAPIClient* api) {
|
||||
if (preferredAccuracyMeters >= MAX_GNSS_ACCURACY_ALLOWED && mIsGnssClient) {
|
||||
// Swith to timebased FLP client, if request accuracy is very low
|
||||
LOC_LOGd("Swith to timebased FlpClient due to low accuracy(m): %d",
|
||||
preferredAccuracyMeters);
|
||||
mIsGnssClient = false;
|
||||
api->gnssUpdateFlpCallbacks();
|
||||
} else if (preferredAccuracyMeters < MAX_GNSS_ACCURACY_ALLOWED && !mIsGnssClient) {
|
||||
LOC_LOGd("Swith to timebased GnssClient accuracy(m):%d", preferredAccuracyMeters);
|
||||
mIsGnssClient = true;
|
||||
if (mGnssCbIface_2_0 != nullptr) {
|
||||
api->gnssUpdateCallbacks_2_0(mGnssCbIface_2_0);
|
||||
} else if (mGnssCbIface_1_1 != nullptr) {
|
||||
api->gnssUpdateCallbacks(mGnssCbIface_1_1, mGnssNiCbIface);
|
||||
} else if (mGnssCbIface != nullptr) {
|
||||
api->gnssUpdateCallbacks(mGnssCbIface, mGnssNiCbIface);
|
||||
} else {
|
||||
LOC_LOGe("All client callbacks are null...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Return<bool> Gnss::setPositionMode(V1_0::IGnss::GnssPositionMode mode,
|
||||
V1_0::IGnss::GnssPositionRecurrence recurrence,
|
||||
uint32_t minIntervalMs,
|
||||
|
@ -342,6 +371,7 @@ Return<bool> Gnss::setPositionMode(V1_0::IGnss::GnssPositionMode mode,
|
|||
bool retVal = false;
|
||||
GnssAPIClient* api = getApi();
|
||||
if (api) {
|
||||
updateCallbacksByAccuracy(preferredAccuracyMeters, api);
|
||||
retVal = api->gnssSetPositionMode(mode, recurrence, minIntervalMs,
|
||||
preferredAccuracyMeters, preferredTimeMs);
|
||||
}
|
||||
|
@ -450,6 +480,7 @@ Return<bool> Gnss::setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) {
|
|||
|
||||
GnssAPIClient* api = getApi();
|
||||
if (api != nullptr) {
|
||||
mIsGnssClient = true;
|
||||
api->gnssUpdateCallbacks(mGnssCbIface_1_1, mGnssNiCbIface);
|
||||
api->gnssEnable(LOCATION_TECHNOLOGY_TYPE_GNSS);
|
||||
api->requestCapabilities();
|
||||
|
@ -468,6 +499,7 @@ Return<bool> Gnss::setPositionMode_1_1(V1_0::IGnss::GnssPositionMode mode,
|
|||
bool retVal = false;
|
||||
GnssAPIClient* api = getApi();
|
||||
if (api) {
|
||||
updateCallbacksByAccuracy(preferredAccuracyMeters, api);
|
||||
GnssPowerMode powerMode = lowPowerMode?
|
||||
GNSS_POWER_MODE_M4 : GNSS_POWER_MODE_M2;
|
||||
retVal = api->gnssSetPositionMode(mode, recurrence, minIntervalMs,
|
||||
|
@ -583,6 +615,7 @@ Return<bool> Gnss::setCallback_2_0(const sp<V2_0::IGnssCallback>& callback) {
|
|||
|
||||
GnssAPIClient* api = getApi();
|
||||
if (api != nullptr) {
|
||||
mIsGnssClient = true;
|
||||
api->gnssUpdateCallbacks_2_0(mGnssCbIface_2_0);
|
||||
api->gnssEnable(LOCATION_TECHNOLOGY_TYPE_GNSS);
|
||||
api->requestCapabilities();
|
||||
|
@ -656,11 +689,7 @@ Return<sp<V2_0::IGnssDebug>> Gnss::getExtensionGnssDebug_2_0() {
|
|||
}
|
||||
|
||||
Return<sp<V2_0::IGnssBatching>> Gnss::getExtensionGnssBatching_2_0() {
|
||||
ENTRY_LOG_CALLFLOW();
|
||||
if (mGnssBatching == nullptr) {
|
||||
mGnssBatching = new GnssBatching();
|
||||
}
|
||||
return mGnssBatching;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
V1_0::IGnss* HIDL_FETCH_IGnss(const char* hal) {
|
||||
|
|
|
@ -142,7 +142,7 @@ struct Gnss : public IGnss {
|
|||
|
||||
// Callback for ODCPI request
|
||||
void odcpiRequestCb(const OdcpiRequestInfo& request);
|
||||
|
||||
void updateCallbacksByAccuracy(uint32_t preferredAccuracyMeters, GnssAPIClient* api);
|
||||
private:
|
||||
struct GnssDeathRecipient : hidl_death_recipient {
|
||||
GnssDeathRecipient(sp<Gnss> gnss) : mGnss(gnss) {
|
||||
|
@ -174,6 +174,7 @@ struct Gnss : public IGnss {
|
|||
GnssAPIClient* mApi = nullptr;
|
||||
GnssConfig mPendingConfig;
|
||||
const GnssInterface* mGnssInterface = nullptr;
|
||||
bool mIsGnssClient;
|
||||
};
|
||||
|
||||
extern "C" V1_0::IGnss* HIDL_FETCH_IGnss(const char* name);
|
||||
|
|
|
@ -46,7 +46,7 @@ GnssBatching::GnssBatching() : mApi(nullptr) {
|
|||
|
||||
GnssBatching::~GnssBatching() {
|
||||
if (mApi != nullptr) {
|
||||
delete mApi;
|
||||
mApi->destroy();
|
||||
mApi = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ GnssBatching::~GnssBatching() {
|
|||
Return<bool> GnssBatching::init(const sp<V1_0::IGnssBatchingCallback>& callback) {
|
||||
if (mApi != nullptr) {
|
||||
LOC_LOGD("%s]: mApi is NOT nullptr, delete it first", __FUNCTION__);
|
||||
delete mApi;
|
||||
mApi->destroy();
|
||||
mApi = nullptr;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ Return<void> GnssBatching::cleanup() {
|
|||
Return<bool> GnssBatching::init_2_0(const sp<V2_0::IGnssBatchingCallback>& callback) {
|
||||
if (mApi != nullptr) {
|
||||
LOC_LOGD("%s]: mApi is NOT nullptr, delete it first", __FUNCTION__);
|
||||
delete mApi;
|
||||
mApi->destroy();
|
||||
mApi = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ GnssGeofencing::GnssGeofencing() : mApi(nullptr) {
|
|||
|
||||
GnssGeofencing::~GnssGeofencing() {
|
||||
if (mApi != nullptr) {
|
||||
delete mApi;
|
||||
mApi->destroy();
|
||||
mApi = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ GnssMeasurement::GnssMeasurement() {
|
|||
|
||||
GnssMeasurement::~GnssMeasurement() {
|
||||
if (mApi) {
|
||||
delete mApi;
|
||||
mApi->destroy();
|
||||
mApi = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ public:
|
|||
BatchingAPIClient(const sp<V2_0::IGnssBatchingCallback>& callback);
|
||||
void gnssUpdateCallbacks(const sp<V1_0::IGnssBatchingCallback>& callback);
|
||||
void gnssUpdateCallbacks_2_0(const sp<V2_0::IGnssBatchingCallback>& callback);
|
||||
~BatchingAPIClient();
|
||||
int getBatchSize();
|
||||
int startSession(const V1_0::IGnssBatching::Options& options);
|
||||
int updateSessionOptions(const V1_0::IGnssBatching::Options& options);
|
||||
|
@ -66,6 +65,7 @@ public:
|
|||
|
||||
private:
|
||||
void setCallbacks();
|
||||
~BatchingAPIClient();
|
||||
std::mutex mMutex;
|
||||
sp<V1_0::IGnssBatchingCallback> mGnssBatchingCbIface;
|
||||
uint32_t mDefaultId;
|
||||
|
|
|
@ -46,8 +46,6 @@ class GeofenceAPIClient : public LocationAPIClientBase
|
|||
{
|
||||
public:
|
||||
GeofenceAPIClient(const sp<V1_0::IGnssGeofenceCallback>& callback);
|
||||
virtual ~GeofenceAPIClient() = default;
|
||||
|
||||
void geofenceAdd(uint32_t geofence_id, double latitude, double longitude,
|
||||
double radius_meters, int32_t last_transition, int32_t monitor_transitions,
|
||||
uint32_t notification_responsiveness_ms, uint32_t unknown_timer_ms);
|
||||
|
@ -65,6 +63,8 @@ public:
|
|||
void onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
|
||||
|
||||
private:
|
||||
virtual ~GeofenceAPIClient() = default;
|
||||
|
||||
sp<V1_0::IGnssGeofenceCallback> mGnssGeofencingCbIface;
|
||||
};
|
||||
|
||||
|
|
|
@ -105,13 +105,24 @@ void GnssAPIClient::initLocationOptions()
|
|||
mTrackingOptions.mode = GNSS_SUPL_MODE_STANDALONE;
|
||||
}
|
||||
|
||||
void GnssAPIClient::setFlpCallbacks() {
|
||||
LOC_LOGd("Going to set Flp Callbacks...");
|
||||
LocationCallbacks locationCallbacks;
|
||||
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
|
||||
locationCallbacks.size = sizeof(LocationCallbacks);
|
||||
|
||||
locationCallbacks.trackingCb = [this](Location location) {
|
||||
onTrackingCb(location);
|
||||
};
|
||||
locAPISetCallbacks(locationCallbacks);
|
||||
}
|
||||
|
||||
void GnssAPIClient::setCallbacks()
|
||||
{
|
||||
LocationCallbacks locationCallbacks;
|
||||
memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
|
||||
locationCallbacks.size = sizeof(LocationCallbacks);
|
||||
|
||||
locationCallbacks.trackingCb = nullptr;
|
||||
locationCallbacks.trackingCb = [this](Location location) {
|
||||
onTrackingCb(location);
|
||||
};
|
||||
|
@ -134,12 +145,10 @@ void GnssAPIClient::setCallbacks()
|
|||
}
|
||||
}
|
||||
|
||||
locationCallbacks.gnssSvCb = nullptr;
|
||||
locationCallbacks.gnssSvCb = [this](GnssSvNotification gnssSvNotification) {
|
||||
onGnssSvCb(gnssSvNotification);
|
||||
};
|
||||
|
||||
locationCallbacks.gnssNmeaCb = nullptr;
|
||||
locationCallbacks.gnssNmeaCb = [this](GnssNmeaNotification gnssNmeaNotification) {
|
||||
onGnssNmeaCb(gnssNmeaNotification);
|
||||
};
|
||||
|
@ -178,6 +187,12 @@ void GnssAPIClient::gnssUpdateCallbacks_2_0(const sp<V2_0::IGnssCallback>& gpsCb
|
|||
}
|
||||
}
|
||||
|
||||
void GnssAPIClient::gnssUpdateFlpCallbacks() {
|
||||
if (mGnssCbIface_2_0 != nullptr || mGnssCbIface != nullptr) {
|
||||
setFlpCallbacks();
|
||||
}
|
||||
}
|
||||
|
||||
bool GnssAPIClient::gnssStart()
|
||||
{
|
||||
LOC_LOGD("%s]: ()", __FUNCTION__);
|
||||
|
@ -380,18 +395,20 @@ void GnssAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask)
|
|||
if (capabilitiesMask & LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT)
|
||||
data |= IGnssCallback::Capabilities::SATELLITE_BLACKLIST;
|
||||
|
||||
IGnssCallback::GnssSystemInfo gnssInfo;
|
||||
if (capabilitiesMask & LOCATION_CAPABILITIES_PRIVACY_BIT) {
|
||||
gnssInfo.yearOfHw = 2019;
|
||||
} else if (capabilitiesMask & LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT ||
|
||||
IGnssCallback::GnssSystemInfo gnssInfo = { .yearOfHw = 2015 };
|
||||
|
||||
if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT) {
|
||||
gnssInfo.yearOfHw++; // 2016
|
||||
if (capabilitiesMask & LOCATION_CAPABILITIES_DEBUG_NMEA_BIT) {
|
||||
gnssInfo.yearOfHw++; // 2017
|
||||
if (capabilitiesMask & LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT ||
|
||||
capabilitiesMask & LOCATION_CAPABILITIES_AGPM_BIT) {
|
||||
gnssInfo.yearOfHw = 2018;
|
||||
} else if (capabilitiesMask & LOCATION_CAPABILITIES_DEBUG_NMEA_BIT) {
|
||||
gnssInfo.yearOfHw = 2017;
|
||||
} else if (capabilitiesMask & LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT) {
|
||||
gnssInfo.yearOfHw = 2016;
|
||||
} else {
|
||||
gnssInfo.yearOfHw = 2015;
|
||||
gnssInfo.yearOfHw++; // 2018
|
||||
if (capabilitiesMask & LOCATION_CAPABILITIES_PRIVACY_BIT) {
|
||||
gnssInfo.yearOfHw++; // 2019
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
LOC_LOGV("%s:%d] set_system_info_cb (%d)", __FUNCTION__, __LINE__, gnssInfo.yearOfHw);
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@ public:
|
|||
GnssAPIClient(const sp<V1_0::IGnssCallback>& gpsCb,
|
||||
const sp<V1_0::IGnssNiCallback>& niCb);
|
||||
GnssAPIClient(const sp<V2_0::IGnssCallback>& gpsCb);
|
||||
virtual ~GnssAPIClient();
|
||||
GnssAPIClient(const GnssAPIClient&) = delete;
|
||||
GnssAPIClient& operator=(const GnssAPIClient&) = delete;
|
||||
|
||||
|
@ -58,6 +57,7 @@ public:
|
|||
void gnssUpdateCallbacks(const sp<V1_0::IGnssCallback>& gpsCb,
|
||||
const sp<V1_0::IGnssNiCallback>& niCb);
|
||||
void gnssUpdateCallbacks_2_0(const sp<V2_0::IGnssCallback>& gpsCb);
|
||||
void gnssUpdateFlpCallbacks();
|
||||
bool gnssStart();
|
||||
bool gnssStop();
|
||||
bool gnssSetPositionMode(V1_0::IGnss::GnssPositionMode mode,
|
||||
|
@ -93,7 +93,9 @@ public:
|
|||
void onStopTrackingCb(LocationError error) final;
|
||||
|
||||
private:
|
||||
virtual ~GnssAPIClient();
|
||||
void setCallbacks();
|
||||
void setFlpCallbacks();
|
||||
void initLocationOptions();
|
||||
sp<V1_0::IGnssCallback> mGnssCbIface;
|
||||
sp<V1_0::IGnssNiCallback> mGnssNiCbIface;
|
||||
|
|
|
@ -137,17 +137,16 @@ void convertGnssLocation(Location& in, V2_0::GnssLocation& out)
|
|||
if (currentTimeNanos >= locationTimeNanos) {
|
||||
int64_t ageTimeNanos = currentTimeNanos - locationTimeNanos;
|
||||
LOC_LOGD("%s]: ageTimeNanos:%" PRIi64 ")", __FUNCTION__, ageTimeNanos);
|
||||
// the max trusted propagation time 30s for ageTimeNanos to avoid user setting
|
||||
// the max trusted propagation time 100ms for ageTimeNanos to avoid user setting
|
||||
//wrong time, it will affect elapsedRealtimeNanos
|
||||
if (ageTimeNanos >= 0 && ageTimeNanos <= 30000000000) {
|
||||
if (ageTimeNanos <= 100000000) {
|
||||
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
|
||||
out.elapsedRealtime.timestampNs = sinceBootTimeNanos - ageTimeNanos;
|
||||
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
|
||||
// time uncertainty is the max value between abs(AP_UTC - MP_UTC) and 100ms, to
|
||||
//verify if user change the sys time
|
||||
out.elapsedRealtime.timeUncertaintyNs =
|
||||
std::max((int64_t)abs(currentTimeNanos - locationTimeNanos),
|
||||
(int64_t)100000000);
|
||||
std::max(ageTimeNanos, (int64_t)100000000);
|
||||
LOC_LOGD("%s]: timestampNs:%" PRIi64 ")",
|
||||
__FUNCTION__, out.elapsedRealtime.timestampNs);
|
||||
}
|
||||
|
|
|
@ -296,7 +296,7 @@ static void convertGnssMeasurement(GnssMeasurementsData& in,
|
|||
|
||||
static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out)
|
||||
{
|
||||
memset(&out, 0, sizeof(IGnssMeasurementCallback::GnssClock));
|
||||
memset(&out, 0, sizeof(out));
|
||||
if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT)
|
||||
out.gnssClockFlags |= IGnssMeasurementCallback::GnssClockFlags::HAS_LEAP_SECOND;
|
||||
if (in.flags & GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_UNCERTAINTY_BIT)
|
||||
|
@ -325,6 +325,7 @@ static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback
|
|||
static void convertGnssData(GnssMeasurementsNotification& in,
|
||||
V1_0::IGnssMeasurementCallback::GnssData& out)
|
||||
{
|
||||
memset(&out, 0, sizeof(out));
|
||||
out.measurementCount = in.count;
|
||||
if (out.measurementCount > static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT)) {
|
||||
LOC_LOGW("%s]: Too many measurement %u. Clamps to %d.",
|
||||
|
@ -340,6 +341,7 @@ static void convertGnssData(GnssMeasurementsNotification& in,
|
|||
static void convertGnssData_1_1(GnssMeasurementsNotification& in,
|
||||
V1_1::IGnssMeasurementCallback::GnssData& out)
|
||||
{
|
||||
memset(&out, 0, sizeof(out));
|
||||
out.measurements.resize(in.count);
|
||||
for (size_t i = 0; i < in.count; i++) {
|
||||
convertGnssMeasurement(in.measurements[i], out.measurements[i].v1_0);
|
||||
|
@ -362,6 +364,7 @@ static void convertGnssData_1_1(GnssMeasurementsNotification& in,
|
|||
static void convertGnssData_2_0(GnssMeasurementsNotification& in,
|
||||
V2_0::IGnssMeasurementCallback::GnssData& out)
|
||||
{
|
||||
memset(&out, 0, sizeof(out));
|
||||
out.measurements.resize(in.count);
|
||||
for (size_t i = 0; i < in.count; i++) {
|
||||
convertGnssMeasurement(in.measurements[i], out.measurements[i].v1_1.v1_0);
|
||||
|
@ -436,12 +439,16 @@ static void convertGnssData_2_0(GnssMeasurementsNotification& in,
|
|||
if (currentTimeNanos >= measTimeNanos) {
|
||||
int64_t ageTimeNanos = currentTimeNanos - measTimeNanos;
|
||||
LOC_LOGD("%s]: ageTimeNanos:%" PRIi64 ")", __FUNCTION__, ageTimeNanos);
|
||||
if (ageTimeNanos >= 0 && ageTimeNanos <= sinceBootTimeNanos) {
|
||||
// the max trusted propagation time 100ms for ageTimeNanos to avoid user setting
|
||||
//wrong time, it will affect elapsedRealtimeNanos
|
||||
if (ageTimeNanos <= 100000000) {
|
||||
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIMESTAMP_NS;
|
||||
out.elapsedRealtime.timestampNs = sinceBootTimeNanos - ageTimeNanos;
|
||||
out.elapsedRealtime.flags |= ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS;
|
||||
// time uncertainty is 1 ms since it is calculated from utc time that is in ms
|
||||
out.elapsedRealtime.timeUncertaintyNs = 1000000;
|
||||
// time uncertainty is the max value between abs(AP_UTC - MP_UTC) and 100ms, to
|
||||
//verify if user change the sys time
|
||||
out.elapsedRealtime.timeUncertaintyNs =
|
||||
std::max(ageTimeNanos, (int64_t)100000000);
|
||||
LOC_LOGd("timestampNs:%" PRIi64 ") timeUncertaintyNs:%" PRIi64 ")",
|
||||
out.elapsedRealtime.timestampNs,
|
||||
out.elapsedRealtime.timeUncertaintyNs);
|
||||
|
|
|
@ -49,7 +49,6 @@ class MeasurementAPIClient : public LocationAPIClientBase
|
|||
{
|
||||
public:
|
||||
MeasurementAPIClient();
|
||||
virtual ~MeasurementAPIClient();
|
||||
MeasurementAPIClient(const MeasurementAPIClient&) = delete;
|
||||
MeasurementAPIClient& operator=(const MeasurementAPIClient&) = delete;
|
||||
|
||||
|
@ -73,6 +72,8 @@ public:
|
|||
void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final;
|
||||
|
||||
private:
|
||||
virtual ~MeasurementAPIClient();
|
||||
|
||||
std::mutex mMutex;
|
||||
sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface;
|
||||
sp<V1_1::IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1;
|
||||
|
|
|
@ -23,11 +23,11 @@ GNSS_HIDL_1_0_TARGET_LIST += msm8610
|
|||
GNSS_HIDL_1_0_TARGET_LIST += apq8084
|
||||
GNSS_HIDL_1_0_TARGET_LIST += msm8916
|
||||
GNSS_HIDL_1_0_TARGET_LIST += msm8994
|
||||
GNSS_HIDL_1_0_TARGET_LIST += msm8909
|
||||
GNSS_HIDL_2_0_TARGET_LIST := msm8909
|
||||
GNSS_HIDL_1_0_TARGET_LIST += msm8952
|
||||
GNSS_HIDL_1_0_TARGET_LIST += msm8992
|
||||
GNSS_HIDL_1_0_TARGET_LIST += msm8996
|
||||
GNSS_HIDL_2_0_TARGET_LIST := msm8937
|
||||
GNSS_HIDL_2_0_TARGET_LIST += msm8937
|
||||
GNSS_HIDL_2_0_TARGET_LIST += msm8953
|
||||
GNSS_HIDL_2_0_TARGET_LIST += msm8998
|
||||
GNSS_HIDL_2_0_TARGET_LIST += apq8098_latv
|
||||
|
|
|
@ -92,6 +92,7 @@ const loc_param_s_type ContextBase::mGps_conf_table[] =
|
|||
{"CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED",
|
||||
&mGps_conf.CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED, NULL, 'n'},
|
||||
{"NI_SUPL_DENY_ON_NFW_LOCKED", &mGps_conf.NI_SUPL_DENY_ON_NFW_LOCKED, NULL, 'n'},
|
||||
{"ENABLE_NMEA_PRINT", &mGps_conf.ENABLE_NMEA_PRINT, NULL, 'n'}
|
||||
};
|
||||
|
||||
const loc_param_s_type ContextBase::mSap_conf_table[] =
|
||||
|
@ -193,6 +194,8 @@ void ContextBase::readConfig()
|
|||
mGps_conf.CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED = 0;
|
||||
/* default configuration for NI_SUPL_DENY_ON_NFW_LOCKED */
|
||||
mGps_conf.NI_SUPL_DENY_ON_NFW_LOCKED = 1;
|
||||
/* By default NMEA Printing is disabled */
|
||||
mGps_conf.ENABLE_NMEA_PRINT = 0;
|
||||
|
||||
UTIL_READ_CONF(LOC_PATH_GPS_CONF, mGps_conf_table);
|
||||
UTIL_READ_CONF(LOC_PATH_SAP_CONF, mSap_conf_table);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2017, 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
|
||||
|
@ -76,6 +76,7 @@ typedef struct loc_gps_cfg_s
|
|||
uint32_t GNSS_DEPLOYMENT;
|
||||
uint32_t CUSTOM_NMEA_GGA_FIX_QUALITY_ENABLED;
|
||||
uint32_t NI_SUPL_DENY_ON_NFW_LOCKED;
|
||||
uint32_t ENABLE_NMEA_PRINT;
|
||||
} loc_gps_cfg_s_type;
|
||||
|
||||
/* NOTE: the implementaiton of the parser casts number
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2015, 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
|
||||
|
@ -53,7 +53,7 @@ void LocPosMode::logv() const
|
|||
}
|
||||
|
||||
/* GPS status names */
|
||||
static const loc_name_val_s_type gps_status_name[] =
|
||||
DECLARE_TBL(gps_status_name) =
|
||||
{
|
||||
NAME_VAL( LOC_GPS_STATUS_NONE ),
|
||||
NAME_VAL( LOC_GPS_STATUS_SESSION_BEGIN ),
|
||||
|
@ -61,18 +61,16 @@ static const loc_name_val_s_type gps_status_name[] =
|
|||
NAME_VAL( LOC_GPS_STATUS_ENGINE_ON ),
|
||||
NAME_VAL( LOC_GPS_STATUS_ENGINE_OFF ),
|
||||
};
|
||||
static const int gps_status_num = sizeof(gps_status_name) / sizeof(loc_name_val_s_type);
|
||||
|
||||
/* Find Android GPS status name */
|
||||
const char* loc_get_gps_status_name(LocGpsStatusValue gps_status)
|
||||
{
|
||||
return loc_get_name_from_val(gps_status_name, gps_status_num,
|
||||
(long) gps_status);
|
||||
return loc_get_name_from_val(gps_status_name_tbl, (int64_t) gps_status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static const loc_name_val_s_type loc_eng_position_modes[] =
|
||||
DECLARE_TBL(loc_eng_position_modes) =
|
||||
{
|
||||
NAME_VAL( LOC_POSITION_MODE_STANDALONE ),
|
||||
NAME_VAL( LOC_POSITION_MODE_MS_BASED ),
|
||||
|
@ -83,25 +81,23 @@ static const loc_name_val_s_type loc_eng_position_modes[] =
|
|||
NAME_VAL( LOC_POSITION_MODE_RESERVED_4 ),
|
||||
NAME_VAL( LOC_POSITION_MODE_RESERVED_5 )
|
||||
};
|
||||
static const int loc_eng_position_mode_num = sizeof(loc_eng_position_modes) / sizeof(loc_name_val_s_type);
|
||||
|
||||
const char* loc_get_position_mode_name(LocGpsPositionMode mode)
|
||||
{
|
||||
return loc_get_name_from_val(loc_eng_position_modes, loc_eng_position_mode_num, (long) mode);
|
||||
return loc_get_name_from_val(loc_eng_position_modes_tbl, (int64_t) mode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static const loc_name_val_s_type loc_eng_position_recurrences[] =
|
||||
DECLARE_TBL(loc_eng_position_recurrences) =
|
||||
{
|
||||
NAME_VAL( LOC_GPS_POSITION_RECURRENCE_PERIODIC ),
|
||||
NAME_VAL( LOC_GPS_POSITION_RECURRENCE_SINGLE )
|
||||
};
|
||||
static const int loc_eng_position_recurrence_num = sizeof(loc_eng_position_recurrences) / sizeof(loc_name_val_s_type);
|
||||
|
||||
const char* loc_get_position_recurrence_name(LocGpsPositionRecurrence recur)
|
||||
{
|
||||
return loc_get_name_from_val(loc_eng_position_recurrences, loc_eng_position_recurrence_num, (long) recur);
|
||||
return loc_get_name_from_val(loc_eng_position_recurrences_tbl, (int64_t) recur);
|
||||
}
|
||||
|
||||
const char* loc_get_aiding_data_mask_names(LocGpsAidingData /*data*/)
|
||||
|
@ -110,7 +106,7 @@ const char* loc_get_aiding_data_mask_names(LocGpsAidingData /*data*/)
|
|||
}
|
||||
|
||||
|
||||
static const loc_name_val_s_type loc_eng_agps_types[] =
|
||||
DECLARE_TBL(loc_eng_agps_types) =
|
||||
{
|
||||
NAME_VAL( LOC_AGPS_TYPE_INVALID ),
|
||||
NAME_VAL( LOC_AGPS_TYPE_ANY ),
|
||||
|
@ -118,44 +114,41 @@ static const loc_name_val_s_type loc_eng_agps_types[] =
|
|||
NAME_VAL( LOC_AGPS_TYPE_C2K ),
|
||||
NAME_VAL( LOC_AGPS_TYPE_WWAN_ANY )
|
||||
};
|
||||
static const int loc_eng_agps_type_num = sizeof(loc_eng_agps_types) / sizeof(loc_name_val_s_type);
|
||||
|
||||
const char* loc_get_agps_type_name(LocAGpsType type)
|
||||
{
|
||||
return loc_get_name_from_val(loc_eng_agps_types, loc_eng_agps_type_num, (long) type);
|
||||
return loc_get_name_from_val(loc_eng_agps_types_tbl, (int64_t) type);
|
||||
}
|
||||
|
||||
|
||||
static const loc_name_val_s_type loc_eng_ni_types[] =
|
||||
DECLARE_TBL(loc_eng_ni_types) =
|
||||
{
|
||||
NAME_VAL( LOC_GPS_NI_TYPE_VOICE ),
|
||||
NAME_VAL( LOC_GPS_NI_TYPE_UMTS_SUPL ),
|
||||
NAME_VAL( LOC_GPS_NI_TYPE_UMTS_CTRL_PLANE ),
|
||||
NAME_VAL( LOC_GPS_NI_TYPE_EMERGENCY_SUPL )
|
||||
};
|
||||
static const int loc_eng_ni_type_num = sizeof(loc_eng_ni_types) / sizeof(loc_name_val_s_type);
|
||||
|
||||
const char* loc_get_ni_type_name(LocGpsNiType type)
|
||||
{
|
||||
return loc_get_name_from_val(loc_eng_ni_types, loc_eng_ni_type_num, (long) type);
|
||||
return loc_get_name_from_val(loc_eng_ni_types_tbl, (int64_t) type);
|
||||
}
|
||||
|
||||
|
||||
static const loc_name_val_s_type loc_eng_ni_responses[] =
|
||||
DECLARE_TBL(loc_eng_ni_responses) =
|
||||
{
|
||||
NAME_VAL( LOC_GPS_NI_RESPONSE_ACCEPT ),
|
||||
NAME_VAL( LOC_GPS_NI_RESPONSE_DENY ),
|
||||
NAME_VAL( LOC_GPS_NI_RESPONSE_DENY )
|
||||
};
|
||||
static const int loc_eng_ni_reponse_num = sizeof(loc_eng_ni_responses) / sizeof(loc_name_val_s_type);
|
||||
|
||||
const char* loc_get_ni_response_name(LocGpsUserResponseType response)
|
||||
{
|
||||
return loc_get_name_from_val(loc_eng_ni_responses, loc_eng_ni_reponse_num, (long) response);
|
||||
return loc_get_name_from_val(loc_eng_ni_responses_tbl, (int64_t) response);
|
||||
}
|
||||
|
||||
|
||||
static const loc_name_val_s_type loc_eng_ni_encodings[] =
|
||||
DECLARE_TBL(loc_eng_ni_encodings) =
|
||||
{
|
||||
NAME_VAL( LOC_GPS_ENC_NONE ),
|
||||
NAME_VAL( LOC_GPS_ENC_SUPL_GSM_DEFAULT ),
|
||||
|
@ -163,55 +156,51 @@ static const loc_name_val_s_type loc_eng_ni_encodings[] =
|
|||
NAME_VAL( LOC_GPS_ENC_SUPL_UCS2 ),
|
||||
NAME_VAL( LOC_GPS_ENC_UNKNOWN )
|
||||
};
|
||||
static const int loc_eng_ni_encoding_num = sizeof(loc_eng_ni_encodings) / sizeof(loc_name_val_s_type);
|
||||
|
||||
const char* loc_get_ni_encoding_name(LocGpsNiEncodingType encoding)
|
||||
{
|
||||
return loc_get_name_from_val(loc_eng_ni_encodings, loc_eng_ni_encoding_num, (long) encoding);
|
||||
return loc_get_name_from_val(loc_eng_ni_encodings_tbl, (int64_t) encoding);
|
||||
}
|
||||
|
||||
static const loc_name_val_s_type loc_eng_agps_bears[] =
|
||||
DECLARE_TBL(loc_eng_agps_bears) =
|
||||
{
|
||||
NAME_VAL( AGPS_APN_BEARER_INVALID ),
|
||||
NAME_VAL( AGPS_APN_BEARER_IPV4 ),
|
||||
NAME_VAL( AGPS_APN_BEARER_IPV6 ),
|
||||
NAME_VAL( AGPS_APN_BEARER_IPV4V6 )
|
||||
};
|
||||
static const int loc_eng_agps_bears_num = sizeof(loc_eng_agps_bears) / sizeof(loc_name_val_s_type);
|
||||
|
||||
const char* loc_get_agps_bear_name(AGpsBearerType bearer)
|
||||
{
|
||||
return loc_get_name_from_val(loc_eng_agps_bears, loc_eng_agps_bears_num, (long) bearer);
|
||||
return loc_get_name_from_val(loc_eng_agps_bears_tbl, (int64_t) bearer);
|
||||
}
|
||||
|
||||
static const loc_name_val_s_type loc_eng_server_types[] =
|
||||
DECLARE_TBL(loc_eng_server_types) =
|
||||
{
|
||||
NAME_VAL( LOC_AGPS_CDMA_PDE_SERVER ),
|
||||
NAME_VAL( LOC_AGPS_CUSTOM_PDE_SERVER ),
|
||||
NAME_VAL( LOC_AGPS_MPC_SERVER ),
|
||||
NAME_VAL( LOC_AGPS_SUPL_SERVER )
|
||||
};
|
||||
static const int loc_eng_server_types_num = sizeof(loc_eng_server_types) / sizeof(loc_name_val_s_type);
|
||||
|
||||
const char* loc_get_server_type_name(LocServerType type)
|
||||
{
|
||||
return loc_get_name_from_val(loc_eng_server_types, loc_eng_server_types_num, (long) type);
|
||||
return loc_get_name_from_val(loc_eng_server_types_tbl, (int64_t) type);
|
||||
}
|
||||
|
||||
static const loc_name_val_s_type loc_eng_position_sess_status_types[] =
|
||||
DECLARE_TBL(loc_eng_position_sess_status_types) =
|
||||
{
|
||||
NAME_VAL( LOC_SESS_SUCCESS ),
|
||||
NAME_VAL( LOC_SESS_INTERMEDIATE ),
|
||||
NAME_VAL( LOC_SESS_FAILURE )
|
||||
};
|
||||
static const int loc_eng_position_sess_status_num = sizeof(loc_eng_position_sess_status_types) / sizeof(loc_name_val_s_type);
|
||||
|
||||
const char* loc_get_position_sess_status_name(enum loc_sess_status status)
|
||||
{
|
||||
return loc_get_name_from_val(loc_eng_position_sess_status_types, loc_eng_position_sess_status_num, (long) status);
|
||||
return loc_get_name_from_val(loc_eng_position_sess_status_types_tbl, (int64_t) status);
|
||||
}
|
||||
|
||||
static const loc_name_val_s_type loc_eng_agps_status_names[] =
|
||||
DECLARE_TBL(loc_eng_agps_status_names) =
|
||||
{
|
||||
NAME_VAL( LOC_GPS_REQUEST_AGPS_DATA_CONN ),
|
||||
NAME_VAL( LOC_GPS_RELEASE_AGPS_DATA_CONN ),
|
||||
|
@ -219,9 +208,8 @@ static const loc_name_val_s_type loc_eng_agps_status_names[] =
|
|||
NAME_VAL( LOC_GPS_AGPS_DATA_CONN_DONE ),
|
||||
NAME_VAL( LOC_GPS_AGPS_DATA_CONN_FAILED )
|
||||
};
|
||||
static const int loc_eng_agps_status_num = sizeof(loc_eng_agps_status_names) / sizeof(loc_name_val_s_type);
|
||||
|
||||
const char* loc_get_agps_status_name(LocAGpsStatusValue status)
|
||||
{
|
||||
return loc_get_name_from_val(loc_eng_agps_status_names, loc_eng_agps_status_num, (long) status);
|
||||
return loc_get_name_from_val(loc_eng_agps_status_names_tbl, (int64_t) status);
|
||||
}
|
||||
|
|
21
gps/etc/Android.mk
Normal file
21
gps/etc/Android.mk
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := gps.conf
|
||||
LOCAL_VENDOR_MODULE := true
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := ETC
|
||||
LOCAL_SRC_FILES := gps.conf
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)
|
||||
include $(BUILD_PREBUILT)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := flp.conf
|
||||
LOCAL_VENDOR_MODULE := true
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := ETC
|
||||
LOCAL_SRC_FILES := flp.conf
|
||||
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)
|
||||
include $(BUILD_PREBUILT)
|
||||
|
|
@ -36,14 +36,6 @@ OUTDOOR_TRIP_BATCH_SIZE=600
|
|||
# defaults to 20 seconds by the modem.
|
||||
# BATCH_SESSION_TIMEOUT=20000
|
||||
|
||||
###################################
|
||||
# FLP CAPABILITIES BIT MASK
|
||||
###################################
|
||||
# GEOFENCE = 0x01
|
||||
# BATCHING = 0x02
|
||||
# default = GEOFENCE | BATCHING
|
||||
CAPABILITIES=0x03
|
||||
|
||||
###################################
|
||||
# FLP BATCHING ACCURACY
|
||||
###################################
|
||||
|
@ -57,32 +49,6 @@ CAPABILITIES=0x03
|
|||
# High accuracy = 2
|
||||
ACCURACY=1
|
||||
|
||||
###################################
|
||||
# FLP GEOFENCE RESPONSIVENESS
|
||||
###################################
|
||||
# If set to one of the defined values below,
|
||||
# it will override the responsiveness for
|
||||
# FLP geofence, which implements the fused
|
||||
# location API. If not set to a value defined
|
||||
# below, which is default, it will not
|
||||
# override the responsivness.
|
||||
# FLP_GEOFENCE_RESPONSIVENESS_OVERRIDE Values:
|
||||
# 1: LOW responsiveness
|
||||
# 2: MEDIUM responsiveness
|
||||
# 3: HIGH responsiveness
|
||||
FLP_GEOFENCE_RESPONSIVENESS_OVERRIDE = 0
|
||||
|
||||
####################################
|
||||
# By default APPS must support LB only if modem support
|
||||
# LB 1.5 and above. This parameter adds an exception
|
||||
# for targets where modem only supports LB 1.0.
|
||||
# This might be useful for primarily outdoor devices.
|
||||
# 0: MUST NOT ALLOW LB IF MODEM ONLY SUPPORTS
|
||||
# LB 1.0
|
||||
# 1: ALLOW LB IF MODEM ONLY SUPPORTS LB 1.0
|
||||
####################################
|
||||
ALLOW_LB_1_0 = 0
|
||||
|
||||
####################################
|
||||
# By default if network fixes are not sensor assisted
|
||||
# these fixes must be dropped. This parameter adds an exception
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
#Uncommenting these urls would only enable
|
||||
#the power up auto injection and force injection(test case).
|
||||
#XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra2.bin
|
||||
#XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra2.bin
|
||||
#XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra2.bin
|
||||
|
||||
#Version check for XTRA
|
||||
#DISABLE = 0
|
||||
#AUTO = 1
|
||||
|
@ -30,18 +24,11 @@ DEBUG_LEVEL = 3
|
|||
# Intermediate position report, 1=enable, 0=disable
|
||||
INTERMEDIATE_POS=0
|
||||
|
||||
# Below bit mask configures how GPS functionalities
|
||||
# should be locked when user turns off GPS on Settings
|
||||
# Set bit 0x1 if MO GPS functionalities are to be locked
|
||||
# Set bit 0x2 if NI GPS functionalities are to be locked
|
||||
# default - non is locked for backward compatibility
|
||||
#GPS_LOCK = 0
|
||||
|
||||
# supl version 1.0
|
||||
SUPL_VER=0x10000
|
||||
|
||||
# Emergency SUPL, 1=enable, 0=disable
|
||||
#SUPL_ES=0
|
||||
#SUPL_ES=1
|
||||
|
||||
#Choose PDN for Emergency SUPL
|
||||
#1 - Use emergency PDN
|
||||
|
@ -60,9 +47,8 @@ SUPL_VER=0x10000
|
|||
# MSB = 0x02
|
||||
# MSA = 0x04
|
||||
# ON_DEMAND_TIME = 0x10
|
||||
# GEOFENCE = 0x20
|
||||
# default = ON_DEMAND_TIME | MSA | MSB | SCHEDULING | GEOFENCE
|
||||
CAPABILITIES=0x37
|
||||
# default = ON_DEMAND_TIME | MSA | MSB | SCHEDULING
|
||||
CAPABILITIES=0x17
|
||||
|
||||
# Accuracy threshold for intermediate positions
|
||||
# less accurate positions are ignored, 0 for passing all positions
|
||||
|
@ -156,7 +142,7 @@ A_GLONASS_POS_PROTOCOL_SELECT = 0
|
|||
# 0x2: WLAN AP Measurements for LPPe CP
|
||||
# 0x4: SRN AP measurement for CP
|
||||
# 0x8: Sensor Barometer Measurement LPPe CP
|
||||
LPPE_CP_TECHNOLOGY = 0
|
||||
#LPPE_CP_TECHNOLOGY = 0
|
||||
|
||||
##################################################
|
||||
# Select technology for LPPe User Plane
|
||||
|
@ -165,7 +151,7 @@ LPPE_CP_TECHNOLOGY = 0
|
|||
# 0x2: WLAN AP Measurements for LPPe UP
|
||||
# 0x4: SRN AP measurement for UP
|
||||
# 0x8: Sensor Barometer Measurement LPPe UP
|
||||
LPPE_UP_TECHNOLOGY = 0
|
||||
#LPPE_UP_TECHNOLOGY = 0
|
||||
|
||||
##################################################
|
||||
# AGPS_CONFIG_INJECT
|
||||
|
@ -310,7 +296,7 @@ MODEM_TYPE = 1
|
|||
# 1 : enabled
|
||||
# This setting enables GPS engine to estimate clock
|
||||
# bias and drift when the signal from at least 1
|
||||
# SV is available and the UE's position is known by
|
||||
# SV is available and the UE’s position is known by
|
||||
# other position engines.
|
||||
#POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED = 0
|
||||
|
||||
|
@ -332,8 +318,9 @@ CP_MTLR_ES=0
|
|||
##################################################
|
||||
# 0 : Enable QTI GNSS (default)
|
||||
# 1 : Enable QCSR SS5
|
||||
# This setting use to select between QTI GNSS
|
||||
# and QCSR SS5 hardware receiver.
|
||||
# 2 : Enable PDS API
|
||||
# This setting use to select between QTI GNSS,
|
||||
# QCSR SS5 hardware receiver, and PDS API.
|
||||
# By default QTI GNSS receiver is enabled.
|
||||
# GNSS_DEPLOYMENT = 0
|
||||
|
||||
|
|
|
@ -3434,9 +3434,9 @@ GnssAdapter::needReportForGnssClient(const UlpLocation& ulpLocation,
|
|||
bool
|
||||
GnssAdapter::needReportForFlpClient(enum loc_sess_status status,
|
||||
LocPosTechMask techMask) {
|
||||
if ((status == LOC_SESS_INTERMEDIATE) &&
|
||||
!(techMask & LOC_POS_TECH_MASK_SENSORS) &&
|
||||
(!getAllowFlpNetworkFixes())) {
|
||||
if (((LOC_SESS_INTERMEDIATE == status) && !(techMask & LOC_POS_TECH_MASK_SENSORS) &&
|
||||
(!getAllowFlpNetworkFixes())) ||
|
||||
(LOC_SESS_FAILURE == status)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
@ -3611,7 +3611,7 @@ void
|
|||
GnssAdapter::reportSv(GnssSvNotification& svNotify)
|
||||
{
|
||||
int numSv = svNotify.count;
|
||||
int16_t gnssSvId = 0;
|
||||
uint16_t gnssSvId = 0;
|
||||
uint64_t svUsedIdMask = 0;
|
||||
for (int i=0; i < numSv; i++) {
|
||||
svUsedIdMask = 0;
|
||||
|
@ -3655,6 +3655,9 @@ GnssAdapter::reportSv(GnssSvNotification& svNotify)
|
|||
svUsedIdMask = mGnssSvIdUsedInPosition.glo_sv_used_ids_mask;
|
||||
}
|
||||
}
|
||||
// map the svid to respective constellation range 1..xx
|
||||
// then repective constellation svUsedIdMask map correctly to svid
|
||||
gnssSvId = gnssSvId - GLO_SV_PRN_MIN + 1;
|
||||
break;
|
||||
case GNSS_SV_TYPE_BEIDOU:
|
||||
if (mGnssSvIdUsedInPosAvail) {
|
||||
|
@ -3680,6 +3683,7 @@ GnssAdapter::reportSv(GnssSvNotification& svNotify)
|
|||
svUsedIdMask = mGnssSvIdUsedInPosition.bds_sv_used_ids_mask;
|
||||
}
|
||||
}
|
||||
gnssSvId = gnssSvId - BDS_SV_PRN_MIN + 1;
|
||||
break;
|
||||
case GNSS_SV_TYPE_GALILEO:
|
||||
if (mGnssSvIdUsedInPosAvail) {
|
||||
|
@ -3699,6 +3703,7 @@ GnssAdapter::reportSv(GnssSvNotification& svNotify)
|
|||
svUsedIdMask = mGnssSvIdUsedInPosition.gal_sv_used_ids_mask;
|
||||
}
|
||||
}
|
||||
gnssSvId = gnssSvId - GAL_SV_PRN_MIN + 1;
|
||||
break;
|
||||
case GNSS_SV_TYPE_QZSS:
|
||||
if (mGnssSvIdUsedInPosAvail) {
|
||||
|
@ -3721,11 +3726,13 @@ GnssAdapter::reportSv(GnssSvNotification& svNotify)
|
|||
svUsedIdMask = mGnssSvIdUsedInPosition.qzss_sv_used_ids_mask;
|
||||
}
|
||||
}
|
||||
gnssSvId = gnssSvId - QZSS_SV_PRN_MIN + 1;
|
||||
break;
|
||||
case GNSS_SV_TYPE_NAVIC:
|
||||
if (mGnssSvIdUsedInPosAvail) {
|
||||
svUsedIdMask = mGnssSvIdUsedInPosition.navic_sv_used_ids_mask;
|
||||
}
|
||||
gnssSvId = gnssSvId - NAVIC_SV_PRN_MIN + 1;
|
||||
break;
|
||||
default:
|
||||
svUsedIdMask = 0;
|
||||
|
@ -3734,7 +3741,7 @@ GnssAdapter::reportSv(GnssSvNotification& svNotify)
|
|||
|
||||
// If SV ID was used in previous position fix, then set USED_IN_FIX
|
||||
// flag, else clear the USED_IN_FIX flag.
|
||||
if ((gnssSvId < 64) && (svUsedIdMask & (1ULL << (gnssSvId - 1)))) {
|
||||
if (svFitsMask(svUsedIdMask, gnssSvId) && (svUsedIdMask & (1ULL << (gnssSvId - 1)))) {
|
||||
svNotify.gnssSvs[i].gnssSvOptionsMask |= GNSS_SV_OPTIONS_USED_IN_FIX_BIT;
|
||||
}
|
||||
}
|
||||
|
@ -3758,6 +3765,7 @@ GnssAdapter::reportSv(GnssSvNotification& svNotify)
|
|||
}
|
||||
|
||||
mGnssSvIdUsedInPosAvail = false;
|
||||
mGnssMbSvIdUsedInPosAvail = false;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3824,6 +3832,10 @@ GnssAdapter::reportNmea(const char* nmea, size_t length)
|
|||
it->second.gnssNmeaCb(nmeaNotification);
|
||||
}
|
||||
}
|
||||
|
||||
if (isNMEAPrintEnabled()) {
|
||||
LOC_LOGd("[%" PRId64 ", %zu] %s", now, length, nmea);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#define LOC_NI_NO_RESPONSE_TIME 20
|
||||
#define LOC_GPS_NI_RESPONSE_IGNORE 4
|
||||
#define ODCPI_EXPECTED_INJECTION_TIME_MS 10000
|
||||
#define IS_SS5_HW_ENABLED (1)
|
||||
|
||||
class GnssAdapter;
|
||||
|
||||
|
@ -305,6 +306,8 @@ public:
|
|||
void resetSvConfig(uint32_t sessionId);
|
||||
void configLeverArm(uint32_t sessionId, const LeverArmConfigInfo& configInfo);
|
||||
void configRobustLocation(uint32_t sessionId, bool enable, bool enableForE911);
|
||||
inline bool isSS5HWEnabled()
|
||||
{ return ((mContext != NULL) && (IS_SS5_HW_ENABLED == mContext->mGps_conf.GNSS_DEPLOYMENT)); }
|
||||
|
||||
/* ==== NI ============================================================================= */
|
||||
/* ======== COMMANDS ====(Called from Client Thread)==================================== */
|
||||
|
@ -521,6 +524,10 @@ public:
|
|||
void notifyClientOfCachedLocationSystemInfo(LocationAPI* client,
|
||||
const LocationCallbacks& callbacks);
|
||||
void updateSystemPowerStateCommand(PowerStateType systemPowerState);
|
||||
inline bool isNMEAPrintEnabled() {
|
||||
return (((mContext != NULL) && (0 != mContext->mGps_conf.ENABLE_NMEA_PRINT)) ?
|
||||
(true) : (false));
|
||||
}
|
||||
};
|
||||
|
||||
#endif //GNSS_ADAPTER_H
|
||||
|
|
|
@ -88,6 +88,7 @@ static uint32_t gnssUpdateSvConfig(const GnssSvTypeConfig& svTypeConfig,
|
|||
static uint32_t gnssResetSvConfig();
|
||||
static uint32_t configLeverArm(const LeverArmConfigInfo& configInfo);
|
||||
static uint32_t configRobustLocation(bool enable, bool enableForE911);
|
||||
static bool isSS5HWEnabled();
|
||||
|
||||
static const GnssInterface gGnssInterface = {
|
||||
sizeof(GnssInterface),
|
||||
|
@ -134,6 +135,7 @@ static const GnssInterface gGnssInterface = {
|
|||
gnssResetSvConfig,
|
||||
configLeverArm,
|
||||
configRobustLocation,
|
||||
isSS5HWEnabled,
|
||||
};
|
||||
|
||||
#ifndef DEBUG_X86
|
||||
|
@ -457,6 +459,13 @@ static uint32_t configLeverArm(const LeverArmConfigInfo& configInfo){
|
|||
}
|
||||
}
|
||||
|
||||
static bool isSS5HWEnabled() {
|
||||
if (NULL != gGnssAdapter) {
|
||||
return gGnssAdapter->isSS5HWEnabled();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static uint32_t configRobustLocation(bool enable, bool enableForE911){
|
||||
if (NULL != gGnssAdapter) {
|
||||
return gGnssAdapter->configRobustLocationCommand(enable, enableForE911);
|
||||
|
|
|
@ -119,9 +119,11 @@ void LocationAPI::onRemoveClientCompleteCb (LocationAdapterTypeMask adapterType)
|
|||
}
|
||||
pthread_mutex_unlock(&gDataMutex);
|
||||
|
||||
if ((true == invokeCallback) && (nullptr != destroyCompleteCb)) {
|
||||
if (invokeCallback) {
|
||||
LOC_LOGd("invoke client destroy cb");
|
||||
if (!destroyCompleteCb) {
|
||||
(destroyCompleteCb) ();
|
||||
}
|
||||
|
||||
delete this;
|
||||
}
|
||||
|
@ -273,7 +275,7 @@ LocationAPI::destroy(locationApiDestroyCompleteCallback destroyCompleteCb)
|
|||
|
||||
gData.clientData.erase(it);
|
||||
|
||||
if ((NULL != destroyCompleteCb) && (false == needToWait)) {
|
||||
if (!needToWait) {
|
||||
invokeDestroyCb = true;
|
||||
}
|
||||
} else {
|
||||
|
@ -282,8 +284,10 @@ LocationAPI::destroy(locationApiDestroyCompleteCallback destroyCompleteCb)
|
|||
}
|
||||
|
||||
pthread_mutex_unlock(&gDataMutex);
|
||||
if (invokeDestroyCb == true) {
|
||||
if (invokeDestroyCb) {
|
||||
if (!destroyCompleteCb) {
|
||||
(destroyCompleteCb) ();
|
||||
}
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2017 The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2017-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
|
||||
|
@ -310,25 +310,43 @@ void LocationAPIClientBase::locAPISetCallbacks(LocationCallbacks& locationCallba
|
|||
pthread_mutex_unlock(&mMutex);
|
||||
}
|
||||
|
||||
LocationAPIClientBase::~LocationAPIClientBase()
|
||||
void LocationAPIClientBase::destroy()
|
||||
{
|
||||
LOC_LOGD("LocationAPIClientBase::destroy()");
|
||||
|
||||
pthread_mutex_lock(&mMutex);
|
||||
|
||||
mGeofenceBreachCallback = nullptr;
|
||||
|
||||
if (mLocationAPI) {
|
||||
mLocationAPI->destroy();
|
||||
mLocationAPI = nullptr;
|
||||
}
|
||||
|
||||
for (int i = 0; i < REQUEST_MAX; i++) {
|
||||
mRequestQueues[i].reset((uint32_t)0);
|
||||
}
|
||||
|
||||
LocationAPI* localHandle = nullptr;
|
||||
if (nullptr != mLocationAPI) {
|
||||
localHandle = mLocationAPI;
|
||||
mLocationAPI = nullptr;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&mMutex);
|
||||
|
||||
// Invoking destroy has the possibility of destroy complete callback
|
||||
// being invoked right away in the same context, hence no instance
|
||||
// member must be accessed after the destroy call.
|
||||
if (nullptr != localHandle) {
|
||||
localHandle->destroy([this]() {onLocationApiDestroyCompleteCb();});
|
||||
}
|
||||
}
|
||||
|
||||
LocationAPIClientBase::~LocationAPIClientBase()
|
||||
{
|
||||
pthread_mutex_destroy(&mMutex);
|
||||
}
|
||||
void LocationAPIClientBase::onLocationApiDestroyCompleteCb()
|
||||
{
|
||||
LOC_LOGD("LocationAPIClientBase::onLocationApiDestroyCompleteCb()");
|
||||
delete this;
|
||||
}
|
||||
|
||||
uint32_t LocationAPIClientBase::locAPIStartTracking(TrackingOptions& options)
|
||||
{
|
||||
|
@ -378,11 +396,12 @@ void LocationAPIClientBase::locAPIUpdateTrackingOptions(TrackingOptions& options
|
|||
if (mLocationAPI) {
|
||||
uint32_t session = 0;
|
||||
session = mRequestQueues[REQUEST_TRACKING].getSession();
|
||||
if (session > 0) {
|
||||
// Not allowing to update the tracking options for stopped session
|
||||
if (session > 0 && mTracking) {
|
||||
mRequestQueues[REQUEST_TRACKING].push(new UpdateTrackingOptionsRequest(*this));
|
||||
mLocationAPI->updateTrackingOptions(session, options);
|
||||
} else {
|
||||
LOC_LOGE("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__, session);
|
||||
LOC_LOGe("invalid or stopped session: %d.", session);
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&mMutex);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2017-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
|
||||
|
@ -200,10 +200,12 @@ private:
|
|||
class LocationAPIClientBase {
|
||||
public:
|
||||
LocationAPIClientBase();
|
||||
virtual ~LocationAPIClientBase();
|
||||
LocationAPIClientBase(const LocationAPIClientBase&) = delete;
|
||||
LocationAPIClientBase& operator=(const LocationAPIClientBase&) = delete;
|
||||
|
||||
void destroy();
|
||||
void onLocationApiDestroyCompleteCb();
|
||||
|
||||
void locAPISetCallbacks(LocationCallbacks& locationCallbacks);
|
||||
void removeSession(uint32_t session);
|
||||
LocationAPIRequest* getRequestBySession(uint32_t session);
|
||||
|
@ -283,6 +285,9 @@ public:
|
|||
|
||||
inline virtual void onLocationSystemInfoCb(LocationSystemInfo /*locationSystemInfo*/) {}
|
||||
|
||||
protected:
|
||||
virtual ~LocationAPIClientBase();
|
||||
|
||||
private:
|
||||
// private inner classes
|
||||
typedef struct {
|
||||
|
@ -421,10 +426,10 @@ private:
|
|||
public:
|
||||
StopTrackingRequest(LocationAPIClientBase& API) : mAPI(API) {}
|
||||
inline void onResponse(LocationError error, uint32_t id) {
|
||||
mAPI.onStopTrackingCb(error);
|
||||
if (error == LOCATION_ERROR_SUCCESS) {
|
||||
mAPI.removeSession(id);
|
||||
}
|
||||
mAPI.onStopTrackingCb(error);
|
||||
}
|
||||
LocationAPIClientBase& mAPI;
|
||||
};
|
||||
|
|
|
@ -96,6 +96,7 @@ struct GnssInterface {
|
|||
uint32_t (*gnssResetSvConfig)();
|
||||
uint32_t (*configLeverArm)(const LeverArmConfigInfo& configInfo);
|
||||
uint32_t (*configRobustLocation)(bool enable, bool enableForE911);
|
||||
bool (*isSS5HWEnabled)();
|
||||
};
|
||||
|
||||
struct BatchingInterface {
|
||||
|
|
|
@ -468,6 +468,13 @@ typedef uint32_t GnssAdditionalSystemInfoMask;
|
|||
#define NAVIC_SV_PRN_MIN 401
|
||||
#define NAVIC_SV_PRN_MAX 414
|
||||
|
||||
/* Checking svIdOneBase can be set to the corresponding bit in mask */
|
||||
#define svFitsMask(mask, svIdOneBase) \
|
||||
((svIdOneBase) >= 1 && (svIdOneBase) <= (sizeof(mask) << 3))
|
||||
/* Setting svIdOneBase specific bit in the mask if the bit offset fits */
|
||||
#define setSvMask(mask, svIdOneBase) \
|
||||
if (svFitsMask(mask, svIdOneBase)) mask |= (1ULL << ((svIdOneBase) - 1))
|
||||
|
||||
typedef enum {
|
||||
LOC_RELIABILITY_NOT_SET = 0,
|
||||
LOC_RELIABILITY_VERY_LOW = 1,
|
||||
|
|
|
@ -628,6 +628,10 @@ int loc_read_process_conf(const char* conf_file_name, uint32_t * process_count_p
|
|||
LOC_LOGD("%s:%d]: Setting GTP MODE to mode: SDK", __func__, __LINE__);
|
||||
loc_service_mask |= LOC_FEATURE_MASK_GTP_WIFI_BASIC;
|
||||
}
|
||||
else if (strcmp(conf.feature_gtp_mode, "SDK_WIFI") == 0) {
|
||||
LOC_LOGD("%s:%d]: Setting GTP MODE to mode: SDK", __func__, __LINE__);
|
||||
loc_service_mask |= LOC_FEATURE_MASK_GTP_WIFI_BASIC;
|
||||
}
|
||||
//conf file has a garbage value
|
||||
else {
|
||||
LOC_LOGE("%s:%d]: Unrecognized value for GTP MODE Mode."\
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011-2012, 2015, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, 2015, 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
|
||||
|
@ -52,38 +52,43 @@ const char EXIT_TAG[] = "Exiting";
|
|||
const char ENTRY_TAG[] = "Entering";
|
||||
const char EXIT_ERROR_TAG[] = "Exiting with error";
|
||||
|
||||
const string gEmptyStr = "";
|
||||
const string gUnknownStr = "UNKNOWN";
|
||||
/* Logging Mechanism */
|
||||
loc_logger_s_type loc_logger;
|
||||
|
||||
/* Get names from value */
|
||||
const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < table_size; i++)
|
||||
{
|
||||
if (table[i].val & (long) mask)
|
||||
{
|
||||
return table[i].name;
|
||||
/* returns the least signification bit that is set in the mask
|
||||
Param
|
||||
mask - bit mask.
|
||||
clearTheBit - if true, mask gets modified upon return.
|
||||
returns 0 if mask is 0.
|
||||
*/
|
||||
uint64_t loc_get_least_bit(uint64_t& mask, bool clearTheBit) {
|
||||
uint64_t bit = 0;
|
||||
|
||||
if (mask > 0) {
|
||||
uint64_t less1 = mask - 1;
|
||||
bit = mask & ~(less1);
|
||||
if (clearTheBit) {
|
||||
mask &= less1;
|
||||
}
|
||||
}
|
||||
return UNKNOWN_STR;
|
||||
}
|
||||
|
||||
/* Get names from value */
|
||||
const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < table_size; i++)
|
||||
{
|
||||
if (table[i].val == (long) value)
|
||||
{
|
||||
return table[i].name;
|
||||
}
|
||||
}
|
||||
return UNKNOWN_STR;
|
||||
return bit;
|
||||
}
|
||||
|
||||
static const loc_name_val_s_type loc_msg_q_status[] =
|
||||
string loc_get_bit_defs(uint64_t mask, const NameValTbl& tbl) {
|
||||
string out;
|
||||
while (mask > 0) {
|
||||
out += loc_get_name_from_tbl(tbl, loc_get_least_bit(mask));
|
||||
if (mask > 0) {
|
||||
out += " | ";
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
DECLARE_TBL(loc_msg_q_status) =
|
||||
{
|
||||
NAME_VAL( eMSG_Q_SUCCESS ),
|
||||
NAME_VAL( eMSG_Q_FAILURE_GENERAL ),
|
||||
|
@ -92,21 +97,15 @@ static const loc_name_val_s_type loc_msg_q_status[] =
|
|||
NAME_VAL( eMSG_Q_UNAVAILABLE_RESOURCE ),
|
||||
NAME_VAL( eMSG_Q_INSUFFICIENT_BUFFER )
|
||||
};
|
||||
static const size_t loc_msg_q_status_num = LOC_TABLE_SIZE(loc_msg_q_status);
|
||||
|
||||
/* Find msg_q status name */
|
||||
const char* loc_get_msg_q_status(int status)
|
||||
{
|
||||
return loc_get_name_from_val(loc_msg_q_status, loc_msg_q_status_num, (long) status);
|
||||
}
|
||||
|
||||
const char* log_succ_fail_string(int is_succ)
|
||||
{
|
||||
return is_succ? "successful" : "failed";
|
||||
return loc_get_name_from_val(loc_msg_q_status_tbl, (int64_t) status);
|
||||
}
|
||||
|
||||
//Target names
|
||||
static const loc_name_val_s_type target_name[] =
|
||||
DECLARE_TBL(target_name) =
|
||||
{
|
||||
NAME_VAL(GNSS_NONE),
|
||||
NAME_VAL(GNSS_MSM),
|
||||
|
@ -116,8 +115,6 @@ static const loc_name_val_s_type target_name[] =
|
|||
NAME_VAL(GNSS_UNKNOWN)
|
||||
};
|
||||
|
||||
static const size_t target_name_num = LOC_TABLE_SIZE(target_name);
|
||||
|
||||
/*===========================================================================
|
||||
|
||||
FUNCTION loc_get_target_name
|
||||
|
@ -133,21 +130,13 @@ RETURN VALUE
|
|||
===========================================================================*/
|
||||
const char *loc_get_target_name(unsigned int target)
|
||||
{
|
||||
int index = 0;
|
||||
int64_t index = 0;
|
||||
static char ret[BUFFER_SIZE];
|
||||
|
||||
index = getTargetGnssType(target);
|
||||
if( index < 0 || (unsigned)index >= target_name_num )
|
||||
index = target_name_num - 1;
|
||||
snprintf(ret, sizeof(ret), " %s with%s SSC",
|
||||
loc_get_name_from_val(target_name_tbl, getTargetGnssType(target)),
|
||||
((target & HAS_SSC) == HAS_SSC) ? gEmptyStr.c_str() : "out");
|
||||
|
||||
if( (target & HAS_SSC) == HAS_SSC ) {
|
||||
snprintf(ret, sizeof(ret), " %s with SSC",
|
||||
loc_get_name_from_val(target_name, target_name_num, (long)index) );
|
||||
}
|
||||
else {
|
||||
snprintf(ret, sizeof(ret), " %s without SSC",
|
||||
loc_get_name_from_val(target_name, target_name_num, (long)index) );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2011-2012, 2015 The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2011-2012, 2015, 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
|
||||
|
@ -30,42 +30,93 @@
|
|||
#ifndef LOC_LOG_H
|
||||
#define LOC_LOG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <unordered_map>
|
||||
#include <string>
|
||||
#include "loc_target.h"
|
||||
#include "loc_misc_utils.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
long val;
|
||||
} loc_name_val_s_type;
|
||||
using std::string;
|
||||
using std::unordered_map;
|
||||
|
||||
#define NAME_VAL(x) {"" #x "", x }
|
||||
typedef unordered_map<int64_t, string> NameValTbl;
|
||||
|
||||
#define UNKNOWN_STR "UNKNOWN"
|
||||
#define NAME_VAL(x) {x, "" #x ""}
|
||||
#define DECLARE_TBL(T) static const NameValTbl T##_tbl
|
||||
|
||||
extern const string gEmptyStr;
|
||||
extern const string gUnknownStr;
|
||||
|
||||
#define CHECK_MASK(type, value, mask_var, mask) \
|
||||
(((mask_var) & (mask)) ? (type) (value) : (type) (-1))
|
||||
|
||||
#define LOC_TABLE_SIZE(table) (sizeof(table)/sizeof((table)[0]))
|
||||
|
||||
#define FIELDVAL_DEC(field) \
|
||||
loc_put_tag_val(#field, to_string(field))
|
||||
#define FIELDVAL_DEC_ARR(field) \
|
||||
loc_put_tag_val(#field, \
|
||||
loc_parenthesize(loc_prim_arr_to_string(field, \
|
||||
sizeof(field)/sizeof(field[0]))))
|
||||
#define FIELDVAL_HEX(field) \
|
||||
loc_put_tag_val(#field, to_string_hex(field))
|
||||
#define FIELDVAL_HEX_ARR(field) \
|
||||
loc_put_tag_val(#field, \
|
||||
loc_parenthesize(loc_prim_arr_to_string(field, \
|
||||
sizeof(field)/sizeof(field[0]), \
|
||||
false)))
|
||||
#define FIELDVAL_ENUM(field, tbl) \
|
||||
loc_put_tag_val(#field, \
|
||||
loc_get_name_from_tbl(tbl, field, gUnknownStr))
|
||||
#define FIELDVAL_MASK(field, tbl) \
|
||||
loc_put_tag_val(#field, \
|
||||
to_string_hex((uint64_t)field) + " " + \
|
||||
loc_parenthesize(loc_get_bit_defs(field, tbl)))
|
||||
|
||||
/* get from a table of strings with index */
|
||||
/* tbl - map of <int, string> entries
|
||||
key - key to the matching entry
|
||||
defalt - default pointer in case of incorrect parameters
|
||||
*/
|
||||
inline static const string& loc_get_name_from_tbl(const NameValTbl& tbl, int64_t key,
|
||||
const string& defalt = gEmptyStr) {
|
||||
auto item = tbl.find(key);
|
||||
if (item != tbl.end()) {
|
||||
return item->second;
|
||||
} else {
|
||||
return defalt;
|
||||
}
|
||||
}
|
||||
|
||||
/* puts to string formatted "TAG: VAL" with option ending string, default to newline */
|
||||
inline string loc_put_tag_val(const string& tag, const string& val, const string& eol = "\n") {
|
||||
return tag + ": " + val + eol;
|
||||
}
|
||||
|
||||
inline string loc_parenthesize(const string& str) {
|
||||
return "(" + str + ")";
|
||||
}
|
||||
|
||||
/* Get names from value */
|
||||
const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask);
|
||||
const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value);
|
||||
inline const char* loc_get_name_from_val(const NameValTbl& table, int64_t value) {
|
||||
return loc_get_name_from_tbl(table, value, gUnknownStr).c_str();
|
||||
}
|
||||
|
||||
inline const char* log_succ_fail_string(int is_succ) {
|
||||
return is_succ? "successful" : "failed";
|
||||
}
|
||||
|
||||
/* prints mask into a string with bit definitions from tbl */
|
||||
/* mask - bit mask, to be expanded into " BIT_NAMEx | BIT_NAMEy ... "
|
||||
tbl - a table with defs for each bit, defined as <bit, name> entries
|
||||
{{bit0, "BIT0_NAME"}, {bit1, "BIT1_NAME"}, .... {bitn, "BITn_NAME"} }
|
||||
entries - number of strings in the table
|
||||
*/
|
||||
string loc_get_bit_defs(uint64_t mask, const NameValTbl& tbl);
|
||||
uint64_t loc_get_least_bit(uint64_t& mask, bool clearThebit = true);
|
||||
const char* loc_get_msg_q_status(int status);
|
||||
const char* loc_get_target_name(unsigned int target);
|
||||
|
||||
extern const char* log_succ_fail_string(int is_succ);
|
||||
|
||||
extern char *loc_get_time(char *time_string, size_t buf_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
char *loc_get_time(char *time_string, size_t buf_size);
|
||||
|
||||
#endif /* LOC_LOG_H */
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
*/
|
||||
#ifndef _LOC_MISC_UTILS_H_
|
||||
#define _LOC_MISC_UTILS_H_
|
||||
#include <ios>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -137,13 +140,68 @@ RETURN VALUE
|
|||
SIDE EFFECTS
|
||||
N/A
|
||||
===========================================================================*/
|
||||
|
||||
|
||||
uint64_t getQTimerTickCount();
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
using std::hex;
|
||||
using std::string;
|
||||
using std::stringstream;
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION to_string_hex
|
||||
|
||||
DESCRIPTION
|
||||
This function works similar to std::to_string, but puts only in hex format.
|
||||
|
||||
DEPENDENCIES
|
||||
N/A
|
||||
|
||||
RETURN VALUE
|
||||
string, of input val in hex format
|
||||
|
||||
SIDE EFFECTS
|
||||
N/A
|
||||
===========================================================================*/
|
||||
template <typename T>
|
||||
string to_string_hex(T val) {
|
||||
stringstream ss;
|
||||
if (val < 0) {
|
||||
val = -val;
|
||||
ss << "-";
|
||||
}
|
||||
ss << hex << "0x" << val;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
FUNCTION loc_prim_arr_to_string
|
||||
|
||||
DESCRIPTION
|
||||
This function puts out primitive array in DEC or EHX format.
|
||||
|
||||
DEPENDENCIES
|
||||
N/A
|
||||
|
||||
RETURN VALUE
|
||||
string, space separated string of values in the input array, either
|
||||
in decimal or hex format, depending on the value of decIfTrue
|
||||
|
||||
SIDE EFFECTS
|
||||
N/A
|
||||
===========================================================================*/
|
||||
template <typename T>
|
||||
static string loc_prim_arr_to_string(T* arr, uint32_t size, bool decIfTrue = true) {
|
||||
stringstream ss;
|
||||
for (uint32_t i = 0; i < size; i++) {
|
||||
ss << (decIfTrue ? to_string(arr[i]) : to_string_hex(arr[i]));
|
||||
if (i != size - 1) {
|
||||
ss << " ";
|
||||
}
|
||||
}
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
#endif //_LOC_MISC_UTILS_H_
|
||||
|
|
|
@ -130,12 +130,15 @@ typedef struct loc_sv_cache_info_s
|
|||
uint64_t bds_used_mask;
|
||||
uint64_t navic_used_mask;
|
||||
uint32_t gps_l1_count;
|
||||
uint32_t gps_l2_count;
|
||||
uint32_t gps_l5_count;
|
||||
uint32_t glo_g1_count;
|
||||
uint32_t glo_g2_count;
|
||||
uint32_t gal_e1_count;
|
||||
uint32_t gal_e5_count;
|
||||
uint32_t gal_e5b_count;
|
||||
uint32_t qzss_l1_count;
|
||||
uint32_t qzss_l2_count;
|
||||
uint32_t qzss_l5_count;
|
||||
uint32_t bds_b1_count;
|
||||
uint32_t bds_b2_count;
|
||||
|
@ -408,10 +411,16 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
|
|||
sv_meta.talker[1] = 'P';
|
||||
sv_meta.mask = sv_cache_info.gps_used_mask;
|
||||
sv_meta.systemId = SYSTEM_ID_GPS;
|
||||
if (GNSS_SIGNAL_GPS_L1CA == signalType) {
|
||||
switch (signalType) {
|
||||
case GNSS_SIGNAL_GPS_L1CA:
|
||||
sv_meta.svCount = sv_cache_info.gps_l1_count;
|
||||
} else if (GNSS_SIGNAL_GPS_L5 == signalType) {
|
||||
break;
|
||||
case GNSS_SIGNAL_GPS_L5:
|
||||
sv_meta.svCount = sv_cache_info.gps_l5_count;
|
||||
break;
|
||||
case GNSS_SIGNAL_GPS_L2:
|
||||
sv_meta.svCount = sv_cache_info.gps_l2_count;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GNSS_SV_TYPE_GLONASS:
|
||||
|
@ -421,10 +430,13 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
|
|||
// GLONASS SV ids are from 65-96
|
||||
sv_meta.svIdOffset = GLONASS_SV_ID_OFFSET;
|
||||
sv_meta.systemId = SYSTEM_ID_GLONASS;
|
||||
if (GNSS_SIGNAL_GLONASS_G1 == signalType) {
|
||||
switch (signalType) {
|
||||
case GNSS_SIGNAL_GLONASS_G1:
|
||||
sv_meta.svCount = sv_cache_info.glo_g1_count;
|
||||
} else if (GNSS_SIGNAL_GLONASS_G2 == signalType) {
|
||||
break;
|
||||
case GNSS_SIGNAL_GLONASS_G2:
|
||||
sv_meta.svCount = sv_cache_info.glo_g2_count;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GNSS_SV_TYPE_GALILEO:
|
||||
|
@ -434,10 +446,16 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
|
|||
// GALILEO SV ids are from 301-336, So keep svIdOffset 300
|
||||
sv_meta.svIdOffset = GALILEO_SV_ID_OFFSET;
|
||||
sv_meta.systemId = SYSTEM_ID_GALILEO;
|
||||
if (GNSS_SIGNAL_GALILEO_E1 == signalType) {
|
||||
switch (signalType) {
|
||||
case GNSS_SIGNAL_GALILEO_E1:
|
||||
sv_meta.svCount = sv_cache_info.gal_e1_count;
|
||||
} else if (GNSS_SIGNAL_GALILEO_E5A == signalType) {
|
||||
break;
|
||||
case GNSS_SIGNAL_GALILEO_E5A:
|
||||
sv_meta.svCount = sv_cache_info.gal_e5_count;
|
||||
break;
|
||||
case GNSS_SIGNAL_GALILEO_E5B:
|
||||
sv_meta.svCount = sv_cache_info.gal_e5b_count;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GNSS_SV_TYPE_QZSS:
|
||||
|
@ -447,10 +465,16 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
|
|||
// QZSS SV ids are from 193-197. So keep svIdOffset 192
|
||||
sv_meta.svIdOffset = QZSS_SV_ID_OFFSET;
|
||||
sv_meta.systemId = SYSTEM_ID_QZSS;
|
||||
if (GNSS_SIGNAL_QZSS_L1CA == signalType) {
|
||||
switch (signalType) {
|
||||
case GNSS_SIGNAL_QZSS_L1CA:
|
||||
sv_meta.svCount = sv_cache_info.qzss_l1_count;
|
||||
} else if (GNSS_SIGNAL_QZSS_L5 == signalType) {
|
||||
break;
|
||||
case GNSS_SIGNAL_QZSS_L2:
|
||||
sv_meta.svCount = sv_cache_info.qzss_l2_count;
|
||||
break;
|
||||
case GNSS_SIGNAL_QZSS_L5:
|
||||
sv_meta.svCount = sv_cache_info.qzss_l5_count;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GNSS_SV_TYPE_BEIDOU:
|
||||
|
@ -460,10 +484,13 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
|
|||
// BDS SV ids are from 201-237. So keep svIdOffset 200
|
||||
sv_meta.svIdOffset = BDS_SV_ID_OFFSET;
|
||||
sv_meta.systemId = SYSTEM_ID_BDS;
|
||||
if (GNSS_SIGNAL_BEIDOU_B1I == signalType) {
|
||||
switch (signalType) {
|
||||
case GNSS_SIGNAL_BEIDOU_B1I:
|
||||
sv_meta.svCount = sv_cache_info.bds_b1_count;
|
||||
} else if (GNSS_SIGNAL_BEIDOU_B2AI == signalType) {
|
||||
break;
|
||||
case GNSS_SIGNAL_BEIDOU_B2AI:
|
||||
sv_meta.svCount = sv_cache_info.bds_b2_count;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GNSS_SV_TYPE_NAVIC:
|
||||
|
@ -472,8 +499,10 @@ static loc_nmea_sv_meta* loc_nmea_sv_meta_init(loc_nmea_sv_meta& sv_meta,
|
|||
sv_meta.mask = sv_cache_info.navic_used_mask;
|
||||
// NAVIC SV ids are from 401-414. So keep svIdOffset 0
|
||||
sv_meta.systemId = SYSTEM_ID_NAVIC;
|
||||
if (GNSS_SIGNAL_NAVIC_L5 == signalType) {
|
||||
switch (signalType) {
|
||||
case GNSS_SIGNAL_NAVIC_L5:
|
||||
sv_meta.svCount = sv_cache_info.navic_l5_count;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -2074,41 +2103,41 @@ void loc_nmea_generate_sv(const GnssSvNotification &svNotify,
|
|||
ENTRY_LOG();
|
||||
|
||||
char sentence[NMEA_SENTENCE_MAX_LENGTH] = {0};
|
||||
int svCount = svNotify.count;
|
||||
int svNumber = 1;
|
||||
loc_sv_cache_info sv_cache_info = {};
|
||||
|
||||
//Count GPS SVs for saparating GPS from GLONASS and throw others
|
||||
for(svNumber=1; svNumber <= svCount; svNumber++) {
|
||||
if (GNSS_SV_TYPE_GPS == svNotify.gnssSvs[svNumber - 1].type)
|
||||
for(uint32_t svOffset = 0; svOffset < svNotify.count; svOffset++) {
|
||||
if (GNSS_SV_TYPE_GPS == svNotify.gnssSvs[svOffset].type)
|
||||
{
|
||||
// cache the used in fix mask, as it will be needed to send $GPGSA
|
||||
// during the position report
|
||||
if (GNSS_SV_OPTIONS_USED_IN_FIX_BIT ==
|
||||
(svNotify.gnssSvs[svNumber - 1].gnssSvOptionsMask &
|
||||
(svNotify.gnssSvs[svOffset].gnssSvOptionsMask &
|
||||
GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
|
||||
{
|
||||
sv_cache_info.gps_used_mask |= (1ULL << (svNotify.gnssSvs[svNumber - 1].svId - 1));
|
||||
setSvMask(sv_cache_info.gps_used_mask, svNotify.gnssSvs[svOffset].svId);
|
||||
}
|
||||
if (GNSS_SIGNAL_GPS_L5 == svNotify.gnssSvs[svNumber - 1].gnssSignalTypeMask) {
|
||||
if (GNSS_SIGNAL_GPS_L5 == svNotify.gnssSvs[svOffset].gnssSignalTypeMask) {
|
||||
sv_cache_info.gps_l5_count++;
|
||||
} else if (GNSS_SIGNAL_GPS_L2 == svNotify.gnssSvs[svOffset].gnssSignalTypeMask) {
|
||||
sv_cache_info.gps_l2_count++;
|
||||
} else {
|
||||
// GNSS_SIGNAL_GPS_L1CA or default
|
||||
// If no signal type in report, it means default L1
|
||||
sv_cache_info.gps_l1_count++;
|
||||
}
|
||||
}
|
||||
else if (GNSS_SV_TYPE_GLONASS == svNotify.gnssSvs[svNumber - 1].type)
|
||||
else if (GNSS_SV_TYPE_GLONASS == svNotify.gnssSvs[svOffset].type)
|
||||
{
|
||||
// cache the used in fix mask, as it will be needed to send $GNGSA
|
||||
// during the position report
|
||||
if (GNSS_SV_OPTIONS_USED_IN_FIX_BIT ==
|
||||
(svNotify.gnssSvs[svNumber - 1].gnssSvOptionsMask &
|
||||
(svNotify.gnssSvs[svOffset].gnssSvOptionsMask &
|
||||
GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
|
||||
{
|
||||
sv_cache_info.glo_used_mask |= (1ULL << (svNotify.gnssSvs[svNumber - 1].svId - 1));
|
||||
setSvMask(sv_cache_info.glo_used_mask, svNotify.gnssSvs[svOffset].svId);
|
||||
}
|
||||
if (GNSS_SIGNAL_GLONASS_G2 == svNotify.gnssSvs[svNumber - 1].gnssSignalTypeMask){
|
||||
if (GNSS_SIGNAL_GLONASS_G2 == svNotify.gnssSvs[svOffset].gnssSignalTypeMask){
|
||||
sv_cache_info.glo_g2_count++;
|
||||
} else {
|
||||
// GNSS_SIGNAL_GLONASS_G1 or default
|
||||
|
@ -2116,56 +2145,60 @@ void loc_nmea_generate_sv(const GnssSvNotification &svNotify,
|
|||
sv_cache_info.glo_g1_count++;
|
||||
}
|
||||
}
|
||||
else if (GNSS_SV_TYPE_GALILEO == svNotify.gnssSvs[svNumber - 1].type)
|
||||
else if (GNSS_SV_TYPE_GALILEO == svNotify.gnssSvs[svOffset].type)
|
||||
{
|
||||
// cache the used in fix mask, as it will be needed to send $GAGSA
|
||||
// during the position report
|
||||
if (GNSS_SV_OPTIONS_USED_IN_FIX_BIT ==
|
||||
(svNotify.gnssSvs[svNumber - 1].gnssSvOptionsMask &
|
||||
(svNotify.gnssSvs[svOffset].gnssSvOptionsMask &
|
||||
GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
|
||||
{
|
||||
sv_cache_info.gal_used_mask |= (1ULL << (svNotify.gnssSvs[svNumber - 1].svId - 1));
|
||||
setSvMask(sv_cache_info.gal_used_mask, svNotify.gnssSvs[svOffset].svId);
|
||||
}
|
||||
if(GNSS_SIGNAL_GALILEO_E5A == svNotify.gnssSvs[svNumber - 1].gnssSignalTypeMask){
|
||||
if(GNSS_SIGNAL_GALILEO_E5A == svNotify.gnssSvs[svOffset].gnssSignalTypeMask){
|
||||
sv_cache_info.gal_e5_count++;
|
||||
} else if (GNSS_SIGNAL_GALILEO_E5B == svNotify.gnssSvs[svOffset].gnssSignalTypeMask) {
|
||||
sv_cache_info.gal_e5b_count++;
|
||||
} else {
|
||||
// GNSS_SIGNAL_GALILEO_E1 or default
|
||||
// If no signal type in report, it means default E1
|
||||
sv_cache_info.gal_e1_count++;
|
||||
}
|
||||
}
|
||||
else if (GNSS_SV_TYPE_QZSS == svNotify.gnssSvs[svNumber - 1].type)
|
||||
else if (GNSS_SV_TYPE_QZSS == svNotify.gnssSvs[svOffset].type)
|
||||
{
|
||||
// cache the used in fix mask, as it will be needed to send $PQGSA
|
||||
// during the position report
|
||||
if (GNSS_SV_OPTIONS_USED_IN_FIX_BIT ==
|
||||
(svNotify.gnssSvs[svNumber - 1].gnssSvOptionsMask &
|
||||
(svNotify.gnssSvs[svOffset].gnssSvOptionsMask &
|
||||
GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
|
||||
{
|
||||
// For QZSS we adjusted SV id's in GnssAdapter, we need to re-adjust here
|
||||
sv_cache_info.qzss_used_mask |=
|
||||
(1ULL << (svNotify.gnssSvs[svNumber - 1].svId - (QZSS_SV_PRN_MIN - 1) - 1));
|
||||
setSvMask(sv_cache_info.qzss_used_mask,
|
||||
svNotify.gnssSvs[svOffset].svId - (QZSS_SV_PRN_MIN - 1));
|
||||
}
|
||||
if (GNSS_SIGNAL_QZSS_L5 == svNotify.gnssSvs[svNumber - 1].gnssSignalTypeMask) {
|
||||
if (GNSS_SIGNAL_QZSS_L5 == svNotify.gnssSvs[svOffset].gnssSignalTypeMask) {
|
||||
sv_cache_info.qzss_l5_count++;
|
||||
} else if (GNSS_SIGNAL_QZSS_L2 == svNotify.gnssSvs[svOffset].gnssSignalTypeMask) {
|
||||
sv_cache_info.qzss_l2_count++;
|
||||
} else {
|
||||
// GNSS_SIGNAL_QZSS_L1CA or default
|
||||
// If no signal type in report, it means default L1
|
||||
sv_cache_info.qzss_l1_count++;
|
||||
}
|
||||
}
|
||||
else if (GNSS_SV_TYPE_BEIDOU == svNotify.gnssSvs[svNumber - 1].type)
|
||||
else if (GNSS_SV_TYPE_BEIDOU == svNotify.gnssSvs[svOffset].type)
|
||||
{
|
||||
// cache the used in fix mask, as it will be needed to send $PQGSA
|
||||
// during the position report
|
||||
if (GNSS_SV_OPTIONS_USED_IN_FIX_BIT ==
|
||||
(svNotify.gnssSvs[svNumber - 1].gnssSvOptionsMask &
|
||||
(svNotify.gnssSvs[svOffset].gnssSvOptionsMask &
|
||||
GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
|
||||
{
|
||||
sv_cache_info.bds_used_mask |= (1ULL << (svNotify.gnssSvs[svNumber - 1].svId - 1));
|
||||
setSvMask(sv_cache_info.bds_used_mask, svNotify.gnssSvs[svOffset].svId);
|
||||
}
|
||||
if ((GNSS_SIGNAL_BEIDOU_B2AI == svNotify.gnssSvs[svNumber - 1].gnssSignalTypeMask) ||
|
||||
(GNSS_SIGNAL_BEIDOU_B2AQ == svNotify.gnssSvs[svNumber - 1].gnssSignalTypeMask)) {
|
||||
if ((GNSS_SIGNAL_BEIDOU_B2AI == svNotify.gnssSvs[svOffset].gnssSignalTypeMask) ||
|
||||
(GNSS_SIGNAL_BEIDOU_B2AQ == svNotify.gnssSvs[svOffset].gnssSignalTypeMask)) {
|
||||
sv_cache_info.bds_b2_count++;
|
||||
} else {
|
||||
// GNSS_SIGNAL_BEIDOU_B1I or default
|
||||
|
@ -2173,16 +2206,15 @@ void loc_nmea_generate_sv(const GnssSvNotification &svNotify,
|
|||
sv_cache_info.bds_b1_count++;
|
||||
}
|
||||
}
|
||||
else if (GNSS_SV_TYPE_NAVIC == svNotify.gnssSvs[svNumber - 1].type)
|
||||
else if (GNSS_SV_TYPE_NAVIC == svNotify.gnssSvs[svOffset].type)
|
||||
{
|
||||
// cache the used in fix mask, as it will be needed to send $PQGSA
|
||||
// during the position report
|
||||
if (GNSS_SV_OPTIONS_USED_IN_FIX_BIT ==
|
||||
(svNotify.gnssSvs[svNumber - 1].gnssSvOptionsMask &
|
||||
(svNotify.gnssSvs[svOffset].gnssSvOptionsMask &
|
||||
GNSS_SV_OPTIONS_USED_IN_FIX_BIT))
|
||||
{
|
||||
sv_cache_info.navic_used_mask |=
|
||||
(1ULL << (svNotify.gnssSvs[svNumber - 1].svId - 1));
|
||||
setSvMask(sv_cache_info.navic_used_mask, svNotify.gnssSvs[svOffset].svId);
|
||||
}
|
||||
// GNSS_SIGNAL_NAVIC_L5 is the only signal type for NAVIC
|
||||
sv_cache_info.navic_l5_count++;
|
||||
|
@ -2205,6 +2237,14 @@ void loc_nmea_generate_sv(const GnssSvNotification &svNotify,
|
|||
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
|
||||
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GPS,
|
||||
GNSS_SIGNAL_GPS_L5, false), nmeaArraystr);
|
||||
|
||||
// ---------------------
|
||||
// ------$GPGSV:L2------
|
||||
// ---------------------
|
||||
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
|
||||
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GPS,
|
||||
GNSS_SIGNAL_GPS_L2, false), nmeaArraystr);
|
||||
|
||||
// ---------------------
|
||||
// ------$GLGSV:G1------
|
||||
// ---------------------
|
||||
|
@ -2236,8 +2276,15 @@ void loc_nmea_generate_sv(const GnssSvNotification &svNotify,
|
|||
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GALILEO,
|
||||
GNSS_SIGNAL_GALILEO_E5A, false), nmeaArraystr);
|
||||
|
||||
// -------------------------
|
||||
// ------$GAGSV:E5B---------
|
||||
// -------------------------
|
||||
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
|
||||
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_GALILEO,
|
||||
GNSS_SIGNAL_GALILEO_E5B, false), nmeaArraystr);
|
||||
|
||||
// -----------------------------
|
||||
// ------$PQGSV (QZSS):L1CA-----
|
||||
// ------$GQGSV (QZSS):L1CA-----
|
||||
// -----------------------------
|
||||
|
||||
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
|
||||
|
@ -2245,14 +2292,23 @@ void loc_nmea_generate_sv(const GnssSvNotification &svNotify,
|
|||
GNSS_SIGNAL_QZSS_L1CA, false), nmeaArraystr);
|
||||
|
||||
// -----------------------------
|
||||
// ------$PQGSV (QZSS):L5-------
|
||||
// ------$GQGSV (QZSS):L5-------
|
||||
// -----------------------------
|
||||
|
||||
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
|
||||
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_QZSS,
|
||||
GNSS_SIGNAL_QZSS_L5, false), nmeaArraystr);
|
||||
|
||||
// -----------------------------
|
||||
// ------$PQGSV (BEIDOU:B1I)----
|
||||
// ------$GQGSV (QZSS):L2-------
|
||||
// -----------------------------
|
||||
|
||||
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
|
||||
loc_nmea_sv_meta_init(sv_meta, sv_cache_info, GNSS_SV_TYPE_QZSS,
|
||||
GNSS_SIGNAL_QZSS_L2, false), nmeaArraystr);
|
||||
|
||||
// -----------------------------
|
||||
// ------$GBGSV (BEIDOU:B1I)----
|
||||
// -----------------------------
|
||||
|
||||
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
|
||||
|
@ -2260,7 +2316,7 @@ void loc_nmea_generate_sv(const GnssSvNotification &svNotify,
|
|||
GNSS_SIGNAL_BEIDOU_B1I,false), nmeaArraystr);
|
||||
|
||||
// -----------------------------
|
||||
// ------$PQGSV (BEIDOU:B2AI)---
|
||||
// ------$GBGSV (BEIDOU:B2AI)---
|
||||
// -----------------------------
|
||||
|
||||
loc_nmea_generate_GSV(svNotify, sentence, sizeof(sentence),
|
||||
|
|
Loading…
Reference in a new issue