diff options
author | GuaiYiHu <guaiyihu@foxmail.com> | 2019-01-22 21:24:19 +0800 |
---|---|---|
committer | Isaac Chen <tingyi364@gmail.com> | 2019-09-01 16:44:11 +0200 |
commit | d15d528204bd14c319317b7c6f31784897056d0a (patch) | |
tree | 8bc23f04089a537b3b52e3f052068449a27eebd5 /gps/android/Gnss.cpp | |
parent | 5fd4d9f756d4ed53088c959df2c23f7ab1ddc808 (diff) |
wayne-common: Update GPS from LA.UM.7.2.r1-05800-sdm660.0
Change-Id: Idaec6889200d67c776222aebecdc9c0255e2b963
Signed-off-by: Isaac Chen <isaacchen@isaacchen.cn>
Diffstat (limited to 'gps/android/Gnss.cpp')
-rw-r--r-- | gps/android/Gnss.cpp | 113 |
1 files changed, 2 insertions, 111 deletions
diff --git a/gps/android/Gnss.cpp b/gps/android/Gnss.cpp index de1430c..c844118 100644 --- a/gps/android/Gnss.cpp +++ b/gps/android/Gnss.cpp @@ -29,52 +29,12 @@ typedef void* (getLocationInterface)(); -#define IMAGES_INFO_FILE "/sys/devices/soc0/images" -#define DELIMITER ";" - namespace android { namespace hardware { namespace gnss { -namespace V1_1 { +namespace V1_0 { namespace implementation { -static std::string getVersionString() { - static std::string version; - if (!version.empty()) - return version; - - char value[PROPERTY_VALUE_MAX] = {0}; - property_get("ro.hardware", value, "unknown"); - version.append(value).append(DELIMITER); - - std::ifstream in(IMAGES_INFO_FILE); - std::string s; - while(getline(in, s)) { - std::size_t found = s.find("CRM:"); - if (std::string::npos == found) { - continue; - } - - // skip over space characters after "CRM:" - const char* substr = s.c_str(); - found += 4; - while (0 != substr[found] && isspace(substr[found])) { - found++; - } - if (s.find("11:") != found) { - continue; - } - s.erase(0, found + 3); - - found = s.find_first_of("\r\n"); - if (std::string::npos != found) { - s.erase(s.begin() + found, s.end()); - } - version.append(s).append(DELIMITER); - } - return version; -} - void Gnss::GnssDeathRecipient::serviceDied(uint64_t cookie, const wp<IBase>& who) { LOC_LOGE("%s] service died. cookie: %llu, who: %p", __FUNCTION__, static_cast<unsigned long long>(cookie), &who); @@ -366,75 +326,6 @@ Return<sp<V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() { return mGnssRil; } -// Methods from ::android::hardware::gnss::V1_1::IGnss follow. -Return<bool> Gnss::setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) { - ENTRY_LOG_CALLFLOW(); - callback->gnssNameCb(getVersionString()); - mGnssCbIface_1_1 = callback; - GnssInterface* gnssInterface = getGnssInterface(); - if (nullptr != gnssInterface) { - OdcpiRequestCallback cb = [this](const OdcpiRequestInfo& odcpiRequest) { - odcpiRequestCb(odcpiRequest); - }; - gnssInterface->odcpiInit(cb); - } - return setCallback(callback); -} - -Return<bool> Gnss::setPositionMode_1_1(V1_0::IGnss::GnssPositionMode mode, - V1_0::IGnss::GnssPositionRecurrence recurrence, - uint32_t minIntervalMs, - uint32_t preferredAccuracyMeters, - uint32_t preferredTimeMs, - bool /*lowPowerMode*/) { - ENTRY_LOG_CALLFLOW(); - return setPositionMode(mode, recurrence, minIntervalMs, - preferredAccuracyMeters, preferredTimeMs); -} - -Return<sp<V1_1::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_1_1() { - ENTRY_LOG_CALLFLOW(); - if (mGnssMeasurement == nullptr) - mGnssMeasurement = new GnssMeasurement(); - return mGnssMeasurement; -} - -Return<sp<V1_1::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_1_1() { - ENTRY_LOG_CALLFLOW(); - if (mGnssConfig == nullptr) - mGnssConfig = new GnssConfiguration(this); - return mGnssConfig; -} - -Return<bool> Gnss::injectBestLocation(const GnssLocation& gnssLocation) { - ENTRY_LOG_CALLFLOW(); - GnssInterface* gnssInterface = getGnssInterface(); - if (nullptr != gnssInterface) { - Location location = {}; - convertGnssLocation(gnssLocation, location); - gnssInterface->odcpiInject(location); - } - return true; -} - -void Gnss::odcpiRequestCb(const OdcpiRequestInfo& request) { - ENTRY_LOG_CALLFLOW(); - if (mGnssCbIface_1_1 != nullptr) { - // For emergency mode, request DBH (Device based hybrid) location - // Mark Independent from GNSS flag to false. - if (ODCPI_REQUEST_TYPE_START == request.type) { - auto r = mGnssCbIface_1_1->gnssRequestLocationCb(!request.isEmergencyMode); - if (!r.isOk()) { - LOC_LOGe("Error invoking gnssRequestLocationCb %s", r.description().c_str()); - } - } else { - LOC_LOGv("Unsupported ODCPI request type: %d", request.type); - } - } else { - LOC_LOGe("ODCPI request not supported."); - } -} - IGnss* HIDL_FETCH_IGnss(const char* hal) { ENTRY_LOG_CALLFLOW(); IGnss* iface = nullptr; @@ -446,7 +337,7 @@ IGnss* HIDL_FETCH_IGnss(const char* hal) { } } // namespace implementation -} // namespace V1_1 +} // namespace V1_0 } // namespace gnss } // namespace hardware } // namespace android |