Merge "hidl gnss hal 1.1 implementation"

This commit is contained in:
Linux Build Service Account 2018-04-14 22:55:26 -07:00 committed by Gerrit - the friendly Code Review server
commit 54b2a1acb1
36 changed files with 444 additions and 212 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution * Not a Contribution
*/ */
/* /*
@ -27,7 +27,7 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
sp<IAGnssCallback> AGnss::sAGnssCbIface = nullptr; sp<IAGnssCallback> AGnss::sAGnssCbIface = nullptr;
@ -182,7 +182,7 @@ Return<bool> AGnss::setServer(IAGnssCallback::AGnssType type,
} }
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution * Not a Contribution
*/ */
/* /*
@ -28,7 +28,7 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::hardware::gnss::V1_0::IAGnss; using ::android::hardware::gnss::V1_0::IAGnss;
@ -69,7 +69,7 @@ struct AGnss : public IAGnss {
}; };
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution * Not a Contribution
*/ */
/* /*
@ -36,7 +36,7 @@ typedef void* (getLocationInterface)();
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
@ -87,7 +87,7 @@ Return<bool> AGnssRil::updateNetworkState(bool connected, NetworkType type, bool
} }
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution * Not a Contribution
*/ */
/* /*
@ -28,7 +28,7 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::hardware::gnss::V1_0::IAGnssRil; using ::android::hardware::gnss::V1_0::IAGnssRil;
@ -75,7 +75,7 @@ struct AGnssRil : public IAGnssRil {
}; };
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,9 +1,8 @@
LOCAL_PATH := $(call my-dir) LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@1.0-impl-qti LOCAL_MODULE := android.hardware.gnss@1.1-impl-qti
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
AGnss.cpp \ AGnss.cpp \
@ -36,8 +35,10 @@ LOCAL_SHARED_LIBRARIES := \
libhidlbase \ libhidlbase \
libhidltransport \ libhidltransport \
libhwbinder \ libhwbinder \
libcutils \
libutils \ libutils \
android.hardware.gnss@1.0 \ android.hardware.gnss@1.0 \
android.hardware.gnss@1.1 \
LOCAL_SHARED_LIBRARIES += \ LOCAL_SHARED_LIBRARIES += \
libloc_core \ libloc_core \
@ -57,10 +58,10 @@ endif # BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET
ifeq ($(BUILD_GNSS_HIDL_SERVICE), true) ifeq ($(BUILD_GNSS_HIDL_SERVICE), true)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.gnss@1.0-service-qti LOCAL_MODULE := android.hardware.gnss@1.1-service-qti
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES) LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_INIT_RC := android.hardware.gnss@1.0-service-qti.rc LOCAL_INIT_RC := android.hardware.gnss@1.1-service-qti.rc
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
service.cpp \ service.cpp \
@ -85,6 +86,7 @@ LOCAL_SHARED_LIBRARIES += \
libhidlbase \ libhidlbase \
libhidltransport \ libhidltransport \
android.hardware.gnss@1.0 \ android.hardware.gnss@1.0 \
android.hardware.gnss@1.1 \
LOCAL_CFLAGS += $(GNSS_CFLAGS) LOCAL_CFLAGS += $(GNSS_CFLAGS)
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution * Not a Contribution
*/ */
/* /*
@ -20,17 +20,59 @@
#define LOG_TAG "LocSvc_GnssInterface" #define LOG_TAG "LocSvc_GnssInterface"
#include <fstream>
#include <log_util.h> #include <log_util.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <cutils/properties.h>
#include "Gnss.h" #include "Gnss.h"
typedef void* (getLocationInterface)(); typedef void* (getLocationInterface)();
#define IMAGES_INFO_FILE "/sys/devices/soc0/images"
#define DELIMITER ";"
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { 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) { void Gnss::GnssDeathRecipient::serviceDied(uint64_t cookie, const wp<IBase>& who) {
LOC_LOGE("%s] service died. cookie: %llu, who: %p", LOC_LOGE("%s] service died. cookie: %llu, who: %p",
__FUNCTION__, static_cast<unsigned long long>(cookie), &who); __FUNCTION__, static_cast<unsigned long long>(cookie), &who);
@ -107,7 +149,7 @@ GnssInterface* Gnss::getGnssInterface() {
return mGnssInterface; return mGnssInterface;
} }
Return<bool> Gnss::setCallback(const sp<IGnssCallback>& callback) { Return<bool> Gnss::setCallback(const sp<V1_0::IGnssCallback>& callback) {
ENTRY_LOG_CALLFLOW(); ENTRY_LOG_CALLFLOW();
if (mGnssCbIface != nullptr) { if (mGnssCbIface != nullptr) {
mGnssCbIface->unlinkToDeath(mGnssDeathRecipient); mGnssCbIface->unlinkToDeath(mGnssDeathRecipient);
@ -251,7 +293,7 @@ Return<bool> Gnss::injectTime(int64_t timeMs, int64_t timeReferenceMs,
} }
} }
Return<void> Gnss::deleteAidingData(IGnss::GnssAidingData aidingDataFlags) { Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) {
ENTRY_LOG_CALLFLOW(); ENTRY_LOG_CALLFLOW();
GnssAPIClient* api = getApi(); GnssAPIClient* api = getApi();
if (api) { if (api) {
@ -260,8 +302,8 @@ Return<void> Gnss::deleteAidingData(IGnss::GnssAidingData aidingDataFlags) {
return Void(); return Void();
} }
Return<bool> Gnss::setPositionMode(IGnss::GnssPositionMode mode, Return<bool> Gnss::setPositionMode(V1_0::IGnss::GnssPositionMode mode,
IGnss::GnssPositionRecurrence recurrence, V1_0::IGnss::GnssPositionRecurrence recurrence,
uint32_t minIntervalMs, uint32_t minIntervalMs,
uint32_t preferredAccuracyMeters, uint32_t preferredAccuracyMeters,
uint32_t preferredTimeMs) { uint32_t preferredTimeMs) {
@ -275,52 +317,90 @@ Return<bool> Gnss::setPositionMode(IGnss::GnssPositionMode mode,
return retVal; return retVal;
} }
Return<sp<IAGnss>> Gnss::getExtensionAGnss() { Return<sp<V1_0::IAGnss>> Gnss::getExtensionAGnss() {
ENTRY_LOG_CALLFLOW(); ENTRY_LOG_CALLFLOW();
mAGnssIface = new AGnss(this); mAGnssIface = new AGnss(this);
return mAGnssIface; return mAGnssIface;
} }
Return<sp<IGnssNi>> Gnss::getExtensionGnssNi() { Return<sp<V1_0::IGnssNi>> Gnss::getExtensionGnssNi() {
ENTRY_LOG_CALLFLOW(); ENTRY_LOG_CALLFLOW();
mGnssNi = new GnssNi(this); mGnssNi = new GnssNi(this);
return mGnssNi; return mGnssNi;
} }
Return<sp<IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() { Return<sp<V1_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
ENTRY_LOG_CALLFLOW(); ENTRY_LOG_CALLFLOW();
if (mGnssMeasurement == nullptr)
mGnssMeasurement = new GnssMeasurement(); mGnssMeasurement = new GnssMeasurement();
return mGnssMeasurement; return mGnssMeasurement;
} }
Return<sp<IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() { Return<sp<V1_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() {
ENTRY_LOG_CALLFLOW(); ENTRY_LOG_CALLFLOW();
mGnssConfig = new GnssConfiguration(this); mGnssConfig = new GnssConfiguration(this);
return mGnssConfig; return mGnssConfig;
} }
Return<sp<IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() { Return<sp<V1_0::IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
ENTRY_LOG_CALLFLOW(); ENTRY_LOG_CALLFLOW();
mGnssGeofencingIface = new GnssGeofencing(); mGnssGeofencingIface = new GnssGeofencing();
return mGnssGeofencingIface; return mGnssGeofencingIface;
} }
Return<sp<IGnssBatching>> Gnss::getExtensionGnssBatching() { Return<sp<V1_0::IGnssBatching>> Gnss::getExtensionGnssBatching() {
mGnssBatching = new GnssBatching(); mGnssBatching = new GnssBatching();
return mGnssBatching; return mGnssBatching;
} }
Return<sp<IGnssDebug>> Gnss::getExtensionGnssDebug() { Return<sp<V1_0::IGnssDebug>> Gnss::getExtensionGnssDebug() {
ENTRY_LOG_CALLFLOW(); ENTRY_LOG_CALLFLOW();
mGnssDebug = new GnssDebug(this); mGnssDebug = new GnssDebug(this);
return mGnssDebug; return mGnssDebug;
} }
Return<sp<IAGnssRil>> Gnss::getExtensionAGnssRil() { Return<sp<V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() {
mGnssRil = new AGnssRil(this); mGnssRil = new AGnssRil(this);
return mGnssRil; 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());
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&) {
ENTRY_LOG_CALLFLOW();
return true;
}
IGnss* HIDL_FETCH_IGnss(const char* hal) { IGnss* HIDL_FETCH_IGnss(const char* hal) {
ENTRY_LOG_CALLFLOW(); ENTRY_LOG_CALLFLOW();
IGnss* iface = nullptr; IGnss* iface = nullptr;
@ -332,7 +412,7 @@ IGnss* HIDL_FETCH_IGnss(const char* hal) {
} }
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018-2018-2018, The Linux Foundation. All rights reserved.
* Not a Contribution * Not a Contribution
*/ */
/* /*
@ -30,7 +30,8 @@
#include <GnssNi.h> #include <GnssNi.h>
#include <GnssDebug.h> #include <GnssDebug.h>
#include <android/hardware/gnss/1.0/IGnss.h> #include <android/hardware/gnss/1.1/IGnss.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h> #include <hidl/Status.h>
#include <GnssAPIClient.h> #include <GnssAPIClient.h>
@ -39,37 +40,27 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_memory;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return; using ::android::hardware::Return;
using ::android::hardware::Void; using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp; using ::android::sp;
using ::android::hardware::gnss::V1_0::GnssLocation;
struct Gnss : public IGnss { struct Gnss : public IGnss {
Gnss(); Gnss();
~Gnss(); ~Gnss();
// registerAsService will call interfaceChain to determine the version of service
/* comment this out until we know really how to manipulate hidl version
using interfaceChain_cb = std::function<
void(const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& descriptors)>;
virtual ::android::hardware::Return<void> interfaceChain(interfaceChain_cb _hidl_cb) override {
_hidl_cb({
"android.hardware.gnss@1.1::IGnss",
::android::hidl::base::V1_0::IBase::descriptor,
});
return ::android::hardware::Void();
}
*/
/* /*
* Methods from ::android::hardware::gnss::V1_0::IGnss follow. * Methods from ::android::hardware::gnss::V1_0::IGnss follow.
* These declarations were generated from Gnss.hal. * These declarations were generated from Gnss.hal.
*/ */
Return<bool> setCallback(const sp<IGnssCallback>& callback) override; Return<bool> setCallback(const sp<V1_0::IGnssCallback>& callback) override;
Return<bool> start() override; Return<bool> start() override;
Return<bool> stop() override; Return<bool> stop() override;
Return<void> cleanup() override; Return<void> cleanup() override;
@ -79,30 +70,40 @@ struct Gnss : public IGnss {
Return<bool> injectTime(int64_t timeMs, Return<bool> injectTime(int64_t timeMs,
int64_t timeReferenceMs, int64_t timeReferenceMs,
int32_t uncertaintyMs) override; int32_t uncertaintyMs) override;
Return<void> deleteAidingData(IGnss::GnssAidingData aidingDataFlags) override; Return<void> deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) override;
Return<bool> setPositionMode(IGnss::GnssPositionMode mode, Return<bool> setPositionMode(V1_0::IGnss::GnssPositionMode mode,
IGnss::GnssPositionRecurrence recurrence, V1_0::IGnss::GnssPositionRecurrence recurrence,
uint32_t minIntervalMs, uint32_t minIntervalMs,
uint32_t preferredAccuracyMeters, uint32_t preferredAccuracyMeters,
uint32_t preferredTimeMs) override; uint32_t preferredTimeMs) override;
Return<sp<IAGnss>> getExtensionAGnss() override; Return<sp<V1_0::IAGnss>> getExtensionAGnss() override;
Return<sp<IGnssNi>> getExtensionGnssNi() override; Return<sp<V1_0::IGnssNi>> getExtensionGnssNi() override;
Return<sp<IGnssMeasurement>> getExtensionGnssMeasurement() override; Return<sp<V1_0::IGnssMeasurement>> getExtensionGnssMeasurement() override;
Return<sp<IGnssConfiguration>> getExtensionGnssConfiguration() override; Return<sp<V1_0::IGnssConfiguration>> getExtensionGnssConfiguration() override;
Return<sp<IGnssGeofencing>> getExtensionGnssGeofencing() override; Return<sp<V1_0::IGnssGeofencing>> getExtensionGnssGeofencing() override;
Return<sp<IGnssBatching>> getExtensionGnssBatching() override; Return<sp<V1_0::IGnssBatching>> getExtensionGnssBatching() override;
Return<sp<IAGnssRil>> getExtensionAGnssRil() override; Return<sp<V1_0::IAGnssRil>> getExtensionAGnssRil() override;
inline Return<sp<IGnssNavigationMessage>> getExtensionGnssNavigationMessage() override { inline Return<sp<V1_0::IGnssNavigationMessage>> getExtensionGnssNavigationMessage() override {
return nullptr; return nullptr;
} }
inline Return<sp<IGnssXtra>> getExtensionXtra() override { inline Return<sp<V1_0::IGnssXtra>> getExtensionXtra() override {
return nullptr; return nullptr;
} }
Return<sp<IGnssDebug>> getExtensionGnssDebug() override; Return<sp<V1_0::IGnssDebug>> getExtensionGnssDebug() override;
// Methods from ::android::hardware::gnss::V1_1::IGnss follow.
Return<bool> setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) override;
Return<bool> setPositionMode_1_1(V1_0::IGnss::GnssPositionMode mode,
V1_0::IGnss::GnssPositionRecurrence recurrence,
uint32_t minIntervalMs, uint32_t preferredAccuracyMeters,
uint32_t preferredTimeMs, bool lowPowerMode) override;
Return<sp<V1_1::IGnssMeasurement>> getExtensionGnssMeasurement_1_1() override;
Return<sp<V1_1::IGnssConfiguration>> getExtensionGnssConfiguration_1_1() override;
Return<bool> injectBestLocation(const GnssLocation& location) override;
// These methods are not part of the IGnss base class. // These methods are not part of the IGnss base class.
GnssAPIClient* getApi(); GnssAPIClient* getApi();
@ -132,8 +133,8 @@ struct Gnss : public IGnss {
sp<AGnssRil> mGnssRil = nullptr; sp<AGnssRil> mGnssRil = nullptr;
GnssAPIClient* mApi = nullptr; GnssAPIClient* mApi = nullptr;
sp<IGnssCallback> mGnssCbIface = nullptr; sp<V1_0::IGnssCallback> mGnssCbIface = nullptr;
sp<IGnssNiCallback> mGnssNiCbIface = nullptr; sp<V1_0::IGnssNiCallback> mGnssNiCbIface = nullptr;
GnssConfig mPendingConfig; GnssConfig mPendingConfig;
GnssInterface* mGnssInterface = nullptr; GnssInterface* mGnssInterface = nullptr;
}; };
@ -141,7 +142,7 @@ struct Gnss : public IGnss {
extern "C" IGnss* HIDL_FETCH_IGnss(const char* name); extern "C" IGnss* HIDL_FETCH_IGnss(const char* name);
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution * Not a Contribution
*/ */
/* /*
@ -27,7 +27,7 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
void GnssBatching::GnssBatchingDeathRecipient::serviceDied( void GnssBatching::GnssBatchingDeathRecipient::serviceDied(
@ -124,7 +124,7 @@ Return<void> GnssBatching::cleanup() {
} }
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution * Not a Contribution
*/ */
/* /*
@ -28,7 +28,7 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssBatching; using ::android::hardware::gnss::V1_0::IGnssBatching;
@ -72,7 +72,7 @@ struct GnssBatching : public IGnssBatching {
}; };
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution * Not a Contribution
*/ */
/* /*
@ -27,7 +27,7 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
GnssConfiguration::GnssConfiguration(Gnss* gnss) : mGnss(gnss) { GnssConfiguration::GnssConfiguration(Gnss* gnss) : mGnss(gnss) {
@ -220,8 +220,16 @@ Return<bool> GnssConfiguration::setEmergencySuplPdn(bool enabled) {
return mGnss->updateConfiguration(config); return mGnss->updateConfiguration(config);
} }
// Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow.
Return<bool> GnssConfiguration::setBlacklist(
const hidl_vec<GnssConfiguration::BlacklistedSource>& /*blacklist*/) {
ENTRY_LOG_CALLFLOW();
return true;
}
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution * Not a Contribution
*/ */
@ -22,16 +22,16 @@
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H #ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H #define ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
#include <android/hardware/gnss/1.0/IGnssConfiguration.h> #include <android/hardware/gnss/1.1/IGnssConfiguration.h>
#include <hidl/Status.h> #include <hidl/Status.h>
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssConfiguration; using ::android::hardware::gnss::V1_1::IGnssConfiguration;
using ::android::hardware::Return; using ::android::hardware::Return;
using ::android::hardware::Void; using ::android::hardware::Void;
using ::android::hardware::hidl_vec; using ::android::hardware::hidl_vec;
@ -58,12 +58,16 @@ struct GnssConfiguration : public IGnssConfiguration {
Return<bool> setEmergencySuplPdn(bool enable) override; Return<bool> setEmergencySuplPdn(bool enable) override;
Return<bool> setGpsLock(uint8_t lock) override; Return<bool> setGpsLock(uint8_t lock) override;
// Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow.
Return<bool> setBlacklist(
const hidl_vec<GnssConfiguration::BlacklistedSource>& blacklist) override;
private: private:
Gnss* mGnss = nullptr; Gnss* mGnss = nullptr;
}; };
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -25,13 +25,19 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::hardware::hidl_vec; using ::android::hardware::hidl_vec;
#define GNSS_DEBUG_UNKNOWN_UTC_TIME (1483228800000ULL) // 1/1/2017 00:00 GMT #define GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS (20000000)
#define GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS (20000)
#define GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC (500)
#define GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG (180)
#define GNSS_DEBUG_UNKNOWN_UTC_TIME (1483228800000LL) // 1/1/2017 00:00 GMT
#define GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC (1.57783680E17) // 5 years in ns #define GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC (1.57783680E17) // 5 years in ns
#define GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC (2.0e5) // ppm
GnssDebug::GnssDebug(Gnss* gnss) : mGnss(gnss) GnssDebug::GnssDebug(Gnss* gnss) : mGnss(gnss)
{ {
@ -79,16 +85,35 @@ Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
data.position.bearingAccuracyDegrees = data.position.bearingAccuracyDegrees =
reports.mLocation.bearingAccuracyDegrees; reports.mLocation.bearingAccuracyDegrees;
struct timespec tv_now; timeval tv_now, tv_report;
clock_gettime(CLOCK_MONOTONIC, &tv_now); tv_report.tv_sec = reports.mLocation.mUtcReported.tv_sec;
tv_report.tv_usec = reports.mLocation.mUtcReported.tv_nsec / 1000ULL;
gettimeofday(&tv_now, NULL);
data.position.ageSeconds = data.position.ageSeconds =
(tv_now.tv_sec - reports.mLocation.mUtcReported.tv_sec) + (tv_now.tv_sec - tv_report.tv_sec) +
(float)((tv_now.tv_nsec - reports.mLocation.mUtcReported.tv_nsec)) / 1000000000LL; (float)((tv_now.tv_usec - tv_report.tv_usec)) / 1000000;
} }
else { else {
data.position.valid = false; data.position.valid = false;
} }
if (data.position.horizontalAccuracyMeters <= 0 ||
data.position.horizontalAccuracyMeters > GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS) {
data.position.horizontalAccuracyMeters = GNSS_DEBUG_UNKNOWN_HORIZONTAL_ACCURACY_METERS;
}
if (data.position.verticalAccuracyMeters <= 0 ||
data.position.verticalAccuracyMeters > GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS) {
data.position.verticalAccuracyMeters = GNSS_DEBUG_UNKNOWN_VERTICAL_ACCURACY_METERS;
}
if (data.position.speedAccuracyMetersPerSecond <= 0 ||
data.position.speedAccuracyMetersPerSecond > GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC) {
data.position.speedAccuracyMetersPerSecond = GNSS_DEBUG_UNKNOWN_SPEED_ACCURACY_PER_SEC;
}
if (data.position.bearingAccuracyDegrees <= 0 ||
data.position.bearingAccuracyDegrees > GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG) {
data.position.bearingAccuracyDegrees = GNSS_DEBUG_UNKNOWN_BEARING_ACCURACY_DEG;
}
// time block // time block
if (reports.mTime.mValid) { if (reports.mTime.mValid) {
data.time.timeEstimate = reports.mTime.timeEstimate; data.time.timeEstimate = reports.mTime.timeEstimate;
@ -96,10 +121,18 @@ Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
data.time.frequencyUncertaintyNsPerSec = data.time.frequencyUncertaintyNsPerSec =
reports.mTime.frequencyUncertaintyNsPerSec; reports.mTime.frequencyUncertaintyNsPerSec;
} }
else {
if (data.time.timeEstimate <= 0 ||
data.time.timeEstimate > GNSS_DEBUG_UNKNOWN_UTC_TIME) {
data.time.timeEstimate = GNSS_DEBUG_UNKNOWN_UTC_TIME; data.time.timeEstimate = GNSS_DEBUG_UNKNOWN_UTC_TIME;
data.time.timeUncertaintyNs = (float)(GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC); }
data.time.frequencyUncertaintyNsPerSec = 0; if (data.time.timeUncertaintyNs <= 0 ||
data.time.timeUncertaintyNs > (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC) {
data.time.timeUncertaintyNs = (float)GNSS_DEBUG_UNKNOWN_UTC_TIME_UNC;
}
if (data.time.frequencyUncertaintyNsPerSec <= 0 ||
data.time.frequencyUncertaintyNsPerSec > (float)GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC) {
data.time.frequencyUncertaintyNsPerSec = (float)GNSS_DEBUG_UNKNOWN_FREQ_UNC_NS_PER_SEC;
} }
// satellite data block // satellite data block
@ -135,7 +168,7 @@ Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb)
} }
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -24,7 +24,7 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssDebug; using ::android::hardware::gnss::V1_0::IGnssDebug;
@ -51,7 +51,7 @@ private:
}; };
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution * Not a Contribution
*/ */
/* /*
@ -27,7 +27,7 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
void GnssGeofencing::GnssGeofencingDeathRecipient::serviceDied( void GnssGeofencing::GnssGeofencingDeathRecipient::serviceDied(
@ -135,7 +135,7 @@ Return<void> GnssGeofencing::removeAllGeofences() {
} }
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution * Not a Contribution
*/ */
/* /*
@ -27,7 +27,7 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssGeofenceCallback; using ::android::hardware::gnss::V1_0::IGnssGeofenceCallback;
@ -83,7 +83,7 @@ struct GnssGeofencing : public IGnssGeofencing {
}; };
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution * Not a Contribution
*/ */
/* /*
@ -27,7 +27,7 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
void GnssMeasurement::GnssMeasurementDeathRecipient::serviceDied( void GnssMeasurement::GnssMeasurementDeathRecipient::serviceDied(
@ -52,8 +52,9 @@ GnssMeasurement::~GnssMeasurement() {
} }
// Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow. // Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
Return<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback( Return<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
const sp<IGnssMeasurementCallback>& callback) { const sp<V1_0::IGnssMeasurementCallback>& callback) {
Return<IGnssMeasurement::GnssMeasurementStatus> ret = Return<IGnssMeasurement::GnssMeasurementStatus> ret =
IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC; IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
@ -72,9 +73,10 @@ Return<IGnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback(
} }
mGnssMeasurementCbIface = callback; mGnssMeasurementCbIface = callback;
mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0 /*cookie*/); mGnssMeasurementCbIface->linkToDeath(mGnssMeasurementDeathRecipient, 0);
return mApi->measurementSetCallback(callback); return mApi->measurementSetCallback(callback);
} }
Return<void> GnssMeasurement::close() { Return<void> GnssMeasurement::close() {
@ -87,13 +89,43 @@ Return<void> GnssMeasurement::close() {
mGnssMeasurementCbIface->unlinkToDeath(mGnssMeasurementDeathRecipient); mGnssMeasurementCbIface->unlinkToDeath(mGnssMeasurementDeathRecipient);
mGnssMeasurementCbIface = nullptr; mGnssMeasurementCbIface = nullptr;
} }
if (mGnssMeasurementCbIface_1_1 != nullptr) {
mGnssMeasurementCbIface_1_1->unlinkToDeath(mGnssMeasurementDeathRecipient);
mGnssMeasurementCbIface_1_1 = nullptr;
}
mApi->measurementClose(); mApi->measurementClose();
return Void(); return Void();
} }
// Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow.
Return<GnssMeasurement::GnssMeasurementStatus> GnssMeasurement::setCallback_1_1(
const sp<IGnssMeasurementCallback>& callback, bool /*enableFullTracking*/) {
Return<IGnssMeasurement::GnssMeasurementStatus> ret =
IGnssMeasurement::GnssMeasurementStatus::ERROR_GENERIC;
if (mGnssMeasurementCbIface_1_1 != nullptr) {
LOC_LOGE("%s]: GnssMeasurementCallback is already set", __FUNCTION__);
return IGnssMeasurement::GnssMeasurementStatus::ERROR_ALREADY_INIT;
}
if (callback == nullptr) {
LOC_LOGE("%s]: callback is nullptr", __FUNCTION__);
return ret;
}
if (mApi == nullptr) {
LOC_LOGE("%s]: mApi is nullptr", __FUNCTION__);
return ret;
}
mGnssMeasurementCbIface_1_1 = callback;
mGnssMeasurementCbIface_1_1->linkToDeath(mGnssMeasurementDeathRecipient, 0);
return mApi->measurementSetCallback_1_1(callback);
}
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution * Not a Contribution
*/ */
/* /*
@ -21,17 +21,18 @@
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H #ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H #define ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
#include <android/hardware/gnss/1.0/IGnssMeasurement.h> #include <android/hardware/gnss/1.1/IGnssMeasurement.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h> #include <hidl/Status.h>
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssMeasurement; using ::android::hardware::gnss::V1_1::IGnssMeasurement;
using ::android::hardware::gnss::V1_0::IGnssMeasurementCallback; using ::android::hardware::gnss::V1_1::IGnssMeasurementCallback;
using ::android::hardware::Return; using ::android::hardware::Return;
using ::android::hardware::Void; using ::android::hardware::Void;
using ::android::hardware::hidl_vec; using ::android::hardware::hidl_vec;
@ -47,10 +48,15 @@ struct GnssMeasurement : public IGnssMeasurement {
* Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow. * Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
* These declarations were generated from IGnssMeasurement.hal. * These declarations were generated from IGnssMeasurement.hal.
*/ */
Return<GnssMeasurementStatus> setCallback( Return<GnssMeasurement::GnssMeasurementStatus> setCallback(
const sp<IGnssMeasurementCallback>& callback) override; const sp<V1_0::IGnssMeasurementCallback>& callback) override;
Return<void> close() override; Return<void> close() override;
// Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow.
Return<GnssMeasurement::GnssMeasurementStatus> setCallback_1_1(
const sp<IGnssMeasurementCallback>& callback,
bool enableFullTracking) override;
private: private:
struct GnssMeasurementDeathRecipient : hidl_death_recipient { struct GnssMeasurementDeathRecipient : hidl_death_recipient {
GnssMeasurementDeathRecipient(sp<GnssMeasurement> gnssMeasurement) : GnssMeasurementDeathRecipient(sp<GnssMeasurement> gnssMeasurement) :
@ -63,12 +69,13 @@ struct GnssMeasurement : public IGnssMeasurement {
private: private:
sp<GnssMeasurementDeathRecipient> mGnssMeasurementDeathRecipient = nullptr; sp<GnssMeasurementDeathRecipient> mGnssMeasurementDeathRecipient = nullptr;
sp<IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr; sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr;
sp<IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1 = nullptr;
MeasurementAPIClient* mApi; MeasurementAPIClient* mApi;
}; };
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution * Not a Contribution
*/ */
/* /*
@ -27,7 +27,7 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
void GnssNi::GnssNiDeathRecipient::serviceDied(uint64_t cookie, const wp<IBase>& who) { void GnssNi::GnssNiDeathRecipient::serviceDied(uint64_t cookie, const wp<IBase>& who) {
@ -79,7 +79,7 @@ Return<void> GnssNi::respond(int32_t notifId, IGnssNiCallback::GnssUserResponseT
} }
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution * Not a Contribution
*/ */
/* /*
@ -27,7 +27,7 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssNi; using ::android::hardware::gnss::V1_0::IGnssNi;
@ -67,7 +67,7 @@ struct GnssNi : public IGnssNi {
}; };
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,4 +1,4 @@
service gnss_service /vendor/bin/hw/android.hardware.gnss@1.0-service-qti service gnss_service /vendor/bin/hw/android.hardware.gnss@1.1-service-qti
class hal class hal
user gps user gps
group system gps radio group system gps radio

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -42,9 +42,13 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssBatching;
using ::android::hardware::gnss::V1_0::IGnssBatchingCallback;
using ::android::hardware::gnss::V1_0::GnssLocation;
static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out, static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions& out,
LocationCapabilitiesMask mask); LocationCapabilitiesMask mask);
@ -153,7 +157,8 @@ void BatchingAPIClient::onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMa
mLocationCapabilitiesMask = capabilitiesMask; mLocationCapabilitiesMask = capabilitiesMask;
} }
void BatchingAPIClient::onBatchingCb(size_t count, Location* location, BatchingOptions /*batchOptions*/) void BatchingAPIClient::onBatchingCb(size_t count, Location* location,
BatchingOptions /*batchOptions*/)
{ {
LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, count); LOC_LOGD("%s]: (count: %zu)", __FUNCTION__, count);
if (mGnssBatchingCbIface != nullptr && count > 0) { if (mGnssBatchingCbIface != nullptr && count > 0) {
@ -185,7 +190,7 @@ static void convertBatchOption(const IGnssBatching::Options& in, LocationOptions
} }
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -39,17 +39,17 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
class BatchingAPIClient : public LocationAPIClientBase class BatchingAPIClient : public LocationAPIClientBase
{ {
public: public:
BatchingAPIClient(const sp<IGnssBatchingCallback>& callback); BatchingAPIClient(const sp<V1_0::IGnssBatchingCallback>& callback);
~BatchingAPIClient(); ~BatchingAPIClient();
int getBatchSize(); int getBatchSize();
int startSession(const IGnssBatching::Options& options); int startSession(const V1_0::IGnssBatching::Options& options);
int updateSessionOptions(const IGnssBatching::Options& options); int updateSessionOptions(const V1_0::IGnssBatching::Options& options);
int stopSession(); int stopSession();
void getBatchedLocation(int last_n_locations); void getBatchedLocation(int last_n_locations);
void flushBatchedLocations(); void flushBatchedLocations();
@ -61,13 +61,13 @@ public:
void onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions) final; void onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions) final;
private: private:
sp<IGnssBatchingCallback> mGnssBatchingCbIface; sp<V1_0::IGnssBatchingCallback> mGnssBatchingCbIface;
uint32_t mDefaultId; uint32_t mDefaultId;
LocationCapabilitiesMask mLocationCapabilitiesMask; LocationCapabilitiesMask mLocationCapabilitiesMask;
}; };
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -39,9 +39,11 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssGeofenceCallback;
using ::android::hardware::gnss::V1_0::GnssLocation;
GeofenceAPIClient::GeofenceAPIClient(const sp<IGnssGeofenceCallback>& callback) : GeofenceAPIClient::GeofenceAPIClient(const sp<IGnssGeofenceCallback>& callback) :
LocationAPIClientBase(), LocationAPIClientBase(),
@ -158,7 +160,7 @@ void GeofenceAPIClient::onGeofenceBreachCb(GeofenceBreachNotification geofenceBr
auto r = mGnssGeofencingCbIface->gnssGeofenceTransitionCb( auto r = mGnssGeofencingCbIface->gnssGeofenceTransitionCb(
geofenceBreachNotification.ids[i], gnssLocation, transition, geofenceBreachNotification.ids[i], gnssLocation, transition,
static_cast<GnssUtcTime>(geofenceBreachNotification.timestamp)); static_cast<V1_0::GnssUtcTime>(geofenceBreachNotification.timestamp));
if (!r.isOk()) { if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssGeofenceTransitionCb description=%s", LOC_LOGE("%s] Error from gnssGeofenceTransitionCb description=%s",
__func__, r.description().c_str()); __func__, r.description().c_str());
@ -267,7 +269,7 @@ void GeofenceAPIClient::onResumeGeofencesCb(size_t count, LocationError* errors,
} }
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -37,7 +37,7 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::sp; using ::android::sp;
@ -45,7 +45,7 @@ using ::android::sp;
class GeofenceAPIClient : public LocationAPIClientBase class GeofenceAPIClient : public LocationAPIClientBase
{ {
public: public:
GeofenceAPIClient(const sp<IGnssGeofenceCallback>& callback); GeofenceAPIClient(const sp<V1_0::IGnssGeofenceCallback>& callback);
virtual ~GeofenceAPIClient() = default; virtual ~GeofenceAPIClient() = default;
void geofenceAdd(uint32_t geofence_id, double latitude, double longitude, void geofenceAdd(uint32_t geofence_id, double latitude, double longitude,
@ -65,11 +65,11 @@ public:
void onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final; void onResumeGeofencesCb(size_t count, LocationError* errors, uint32_t* ids) final;
private: private:
sp<IGnssGeofenceCallback> mGnssGeofencingCbIface; sp<V1_0::IGnssGeofenceCallback> mGnssGeofencingCbIface;
}; };
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -40,9 +40,14 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::hardware::gnss::V1_0::IGnss;
using ::android::hardware::gnss::V1_0::IGnssCallback;
using ::android::hardware::gnss::V1_0::IGnssNiCallback;
using ::android::hardware::gnss::V1_0::GnssLocation;
static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvStatus& out); static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvStatus& out);
GnssAPIClient::GnssAPIClient(const sp<IGnssCallback>& gpsCb, GnssAPIClient::GnssAPIClient(const sp<IGnssCallback>& gpsCb,
@ -414,11 +419,7 @@ void GnssAPIClient::onGnssNiCb(uint32_t id, GnssNiNotification gnssNiNotificatio
notificationGnss.notificationIdEncoding = notificationGnss.notificationIdEncoding =
IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UCS2; IGnssNiCallback::GnssNiEncodingType::ENC_SUPL_UCS2;
auto r = gnssNiCbIface->niNotifyCb(notificationGnss); gnssNiCbIface->niNotifyCb(notificationGnss);
if (!r.isOk()) {
LOC_LOGE("%s] Error from niNotifyCb description=%s",
__func__, r.description().c_str());
}
} }
void GnssAPIClient::onGnssSvCb(GnssSvNotification gnssSvNotification) void GnssAPIClient::onGnssSvCb(GnssSvNotification gnssSvNotification)
@ -449,7 +450,7 @@ void GnssAPIClient::onGnssNmeaCb(GnssNmeaNotification gnssNmeaNotification)
android::hardware::hidl_string nmeaString; android::hardware::hidl_string nmeaString;
nmeaString.setToExternal(gnssNmeaNotification.nmea, gnssNmeaNotification.length); nmeaString.setToExternal(gnssNmeaNotification.nmea, gnssNmeaNotification.length);
auto r = gnssCbIface->gnssNmeaCb( auto r = gnssCbIface->gnssNmeaCb(
static_cast<GnssUtcTime>(gnssNmeaNotification.timestamp), nmeaString); static_cast<V1_0::GnssUtcTime>(gnssNmeaNotification.timestamp), nmeaString);
if (!r.isOk()) { if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssNmeaCb nmea=%s length=%zu description=%s", __func__, LOC_LOGE("%s] Error from gnssNmeaCb nmea=%s length=%zu description=%s", __func__,
gnssNmeaNotification.nmea, gnssNmeaNotification.length, r.description().c_str()); gnssNmeaNotification.nmea, gnssNmeaNotification.length, r.description().c_str());
@ -503,10 +504,10 @@ static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvSta
{ {
memset(&out, 0, sizeof(IGnssCallback::GnssSvStatus)); memset(&out, 0, sizeof(IGnssCallback::GnssSvStatus));
out.numSvs = in.count; out.numSvs = in.count;
if (out.numSvs > static_cast<uint32_t>(GnssMax::SVS_COUNT)) { if (out.numSvs > static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT)) {
LOC_LOGW("%s]: Too many satellites %u. Clamps to %d.", LOC_LOGW("%s]: Too many satellites %u. Clamps to %d.",
__FUNCTION__, out.numSvs, GnssMax::SVS_COUNT); __FUNCTION__, out.numSvs, V1_0::GnssMax::SVS_COUNT);
out.numSvs = static_cast<uint32_t>(GnssMax::SVS_COUNT); out.numSvs = static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT);
} }
for (size_t i = 0; i < out.numSvs; i++) { for (size_t i = 0; i < out.numSvs; i++) {
IGnssCallback::GnssSvInfo& info = out.gnssSvList[i]; IGnssCallback::GnssSvInfo& info = out.gnssSvList[i];
@ -526,7 +527,7 @@ static void convertGnssSvStatus(GnssSvNotification& in, IGnssCallback::GnssSvSta
} }
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -30,16 +30,17 @@
#ifndef GNSS_API_CLINET_H #ifndef GNSS_API_CLINET_H
#define GNSS_API_CLINET_H #define GNSS_API_CLINET_H
#include <mutex> #include <mutex>
#include <android/hardware/gnss/1.0/IGnss.h> #include <android/hardware/gnss/1.1/IGnss.h>
#include <android/hardware/gnss/1.0/IGnssCallback.h> #include <android/hardware/gnss/1.1/IGnssCallback.h>
#include <android/hardware/gnss/1.0/IGnssNiCallback.h> #include <android/hardware/gnss/1.0/IGnssNiCallback.h>
#include <LocationAPIClientBase.h> #include <LocationAPIClientBase.h>
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::sp; using ::android::sp;
@ -47,28 +48,28 @@ using ::android::sp;
class GnssAPIClient : public LocationAPIClientBase class GnssAPIClient : public LocationAPIClientBase
{ {
public: public:
GnssAPIClient(const sp<IGnssCallback>& gpsCb, GnssAPIClient(const sp<V1_0::IGnssCallback>& gpsCb,
const sp<IGnssNiCallback>& niCb); const sp<V1_0::IGnssNiCallback>& niCb);
virtual ~GnssAPIClient(); virtual ~GnssAPIClient();
GnssAPIClient(const GnssAPIClient&) = delete; GnssAPIClient(const GnssAPIClient&) = delete;
GnssAPIClient& operator=(const GnssAPIClient&) = delete; GnssAPIClient& operator=(const GnssAPIClient&) = delete;
// for GpsInterface // for GpsInterface
void gnssUpdateCallbacks(const sp<IGnssCallback>& gpsCb, void gnssUpdateCallbacks(const sp<V1_0::IGnssCallback>& gpsCb,
const sp<IGnssNiCallback>& niCb); const sp<V1_0::IGnssNiCallback>& niCb);
bool gnssStart(); bool gnssStart();
bool gnssStop(); bool gnssStop();
bool gnssSetPositionMode(IGnss::GnssPositionMode mode, bool gnssSetPositionMode(V1_0::IGnss::GnssPositionMode mode,
IGnss::GnssPositionRecurrence recurrence, V1_0::IGnss::GnssPositionRecurrence recurrence,
uint32_t minIntervalMs, uint32_t minIntervalMs,
uint32_t preferredAccuracyMeters, uint32_t preferredAccuracyMeters,
uint32_t preferredTimeMs); uint32_t preferredTimeMs);
// for GpsNiInterface // for GpsNiInterface
void gnssNiRespond(int32_t notifId, IGnssNiCallback::GnssUserResponseType userResponse); void gnssNiRespond(int32_t notifId, V1_0::IGnssNiCallback::GnssUserResponseType userResponse);
// these apis using LocationAPIControlClient // these apis using LocationAPIControlClient
void gnssDeleteAidingData(IGnss::GnssAidingData aidingDataFlags); void gnssDeleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags);
void gnssEnable(LocationTechnologyType techType); void gnssEnable(LocationTechnologyType techType);
void gnssDisable(); void gnssDisable();
void gnssConfigurationUpdate(const GnssConfig& gnssConfig); void gnssConfigurationUpdate(const GnssConfig& gnssConfig);
@ -89,17 +90,18 @@ public:
void onStopTrackingCb(LocationError error) final; void onStopTrackingCb(LocationError error) final;
private: private:
sp<IGnssCallback> mGnssCbIface; sp<V1_0::IGnssCallback> mGnssCbIface;
sp<IGnssNiCallback> mGnssNiCbIface; sp<V1_0::IGnssNiCallback> mGnssNiCbIface;
std::mutex mMutex; std::mutex mMutex;
LocationAPIControlClient* mControlClient; LocationAPIControlClient* mControlClient;
LocationCapabilitiesMask mLocationCapabilitiesMask; LocationCapabilitiesMask mLocationCapabilitiesMask;
bool mLocationCapabilitiesCached; bool mLocationCapabilitiesCached;
LocationOptions mLocationOptions; LocationOptions mLocationOptions;
}; };
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -32,9 +32,13 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::hardware::gnss::V1_0::GnssLocation;
using ::android::hardware::gnss::V1_0::GnssConstellationType;
using ::android::hardware::gnss::V1_0::GnssLocationFlags;
void convertGnssLocation(Location& in, GnssLocation& out) void convertGnssLocation(Location& in, GnssLocation& out)
{ {
memset(&out, 0, sizeof(GnssLocation)); memset(&out, 0, sizeof(GnssLocation));
@ -63,7 +67,7 @@ void convertGnssLocation(Location& in, GnssLocation& out)
out.verticalAccuracyMeters = in.verticalAccuracy; out.verticalAccuracyMeters = in.verticalAccuracy;
out.speedAccuracyMetersPerSecond = in.speedAccuracy; out.speedAccuracyMetersPerSecond = in.speedAccuracy;
out.bearingAccuracyDegrees = in.bearingAccuracy; out.bearingAccuracyDegrees = in.bearingAccuracy;
out.timestamp = static_cast<GnssUtcTime>(in.timestamp); out.timestamp = static_cast<V1_0::GnssUtcTime>(in.timestamp);
} }
void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out) void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out)
@ -147,7 +151,7 @@ void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEph
} }
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -37,17 +37,17 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
void convertGnssLocation(Location& in, GnssLocation& out); void convertGnssLocation(Location& in, V1_0::GnssLocation& out);
void convertGnssConstellationType(GnssSvType& in, GnssConstellationType& out); void convertGnssConstellationType(GnssSvType& in, V1_0::GnssConstellationType& out);
void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out); void convertGnssEphemerisType(GnssEphemerisType& in, GnssDebug::SatelliteEphemerisType& out);
void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out); void convertGnssEphemerisSource(GnssEphemerisSource& in, GnssDebug::SatelliteEphemerisSource& out);
void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out); void convertGnssEphemerisHealth(GnssEphemerisHealth& in, GnssDebug::SatelliteEphemerisHealth& out);
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -39,17 +39,23 @@
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssMeasurement;
using ::android::hardware::gnss::V1_1::IGnssMeasurementCallback;
static void convertGnssData(GnssMeasurementsNotification& in, static void convertGnssData(GnssMeasurementsNotification& in,
V1_0::IGnssMeasurementCallback::GnssData& out);
static void convertGnssData_1_1(GnssMeasurementsNotification& in,
IGnssMeasurementCallback::GnssData& out); IGnssMeasurementCallback::GnssData& out);
static void convertGnssMeasurement(GnssMeasurementsData& in, static void convertGnssMeasurement(GnssMeasurementsData& in,
IGnssMeasurementCallback::GnssMeasurement& out); V1_0::IGnssMeasurementCallback::GnssMeasurement& out);
static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out); static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback::GnssClock& out);
MeasurementAPIClient::MeasurementAPIClient() : MeasurementAPIClient::MeasurementAPIClient() :
mGnssMeasurementCbIface(nullptr), mGnssMeasurementCbIface(nullptr),
mGnssMeasurementCbIface_1_1(nullptr),
mTracking(false) mTracking(false)
{ {
LOC_LOGD("%s]: ()", __FUNCTION__); LOC_LOGD("%s]: ()", __FUNCTION__);
@ -62,7 +68,7 @@ MeasurementAPIClient::~MeasurementAPIClient()
// for GpsInterface // for GpsInterface
Return<IGnssMeasurement::GnssMeasurementStatus> Return<IGnssMeasurement::GnssMeasurementStatus>
MeasurementAPIClient::measurementSetCallback(const sp<IGnssMeasurementCallback>& callback) MeasurementAPIClient::measurementSetCallback(const sp<V1_0::IGnssMeasurementCallback>& callback)
{ {
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback); LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
@ -70,6 +76,24 @@ MeasurementAPIClient::measurementSetCallback(const sp<IGnssMeasurementCallback>&
mGnssMeasurementCbIface = callback; mGnssMeasurementCbIface = callback;
mMutex.unlock(); mMutex.unlock();
return startTracking();
}
Return<IGnssMeasurement::GnssMeasurementStatus>
MeasurementAPIClient::measurementSetCallback_1_1(const sp<IGnssMeasurementCallback>& callback)
{
LOC_LOGD("%s]: (%p)", __FUNCTION__, &callback);
mMutex.lock();
mGnssMeasurementCbIface_1_1 = callback;
mMutex.unlock();
return startTracking();
}
Return<IGnssMeasurement::GnssMeasurementStatus>
MeasurementAPIClient::startTracking()
{
LocationCallbacks locationCallbacks; LocationCallbacks locationCallbacks;
memset(&locationCallbacks, 0, sizeof(LocationCallbacks)); memset(&locationCallbacks, 0, sizeof(LocationCallbacks));
locationCallbacks.size = sizeof(LocationCallbacks); locationCallbacks.size = sizeof(LocationCallbacks);
@ -84,7 +108,7 @@ MeasurementAPIClient::measurementSetCallback(const sp<IGnssMeasurementCallback>&
locationCallbacks.gnssNmeaCb = nullptr; locationCallbacks.gnssNmeaCb = nullptr;
locationCallbacks.gnssMeasurementsCb = nullptr; locationCallbacks.gnssMeasurementsCb = nullptr;
if (mGnssMeasurementCbIface != nullptr) { if (mGnssMeasurementCbIface_1_1 != nullptr || mGnssMeasurementCbIface != nullptr) {
locationCallbacks.gnssMeasurementsCb = locationCallbacks.gnssMeasurementsCb =
[this](GnssMeasurementsNotification gnssMeasurementsNotification) { [this](GnssMeasurementsNotification gnssMeasurementsNotification) {
onGnssMeasurementsCb(gnssMeasurementsNotification); onGnssMeasurementsCb(gnssMeasurementsNotification);
@ -119,11 +143,25 @@ void MeasurementAPIClient::onGnssMeasurementsCb(
__FUNCTION__, gnssMeasurementsNotification.count, mTracking); __FUNCTION__, gnssMeasurementsNotification.count, mTracking);
if (mTracking) { if (mTracking) {
mMutex.lock(); mMutex.lock();
auto gnssMeasurementCbIface(mGnssMeasurementCbIface); sp<V1_0::IGnssMeasurementCallback> gnssMeasurementCbIface = nullptr;
sp<IGnssMeasurementCallback> gnssMeasurementCbIface_1_1 = nullptr;
if (mGnssMeasurementCbIface_1_1 != nullptr) {
gnssMeasurementCbIface_1_1 = mGnssMeasurementCbIface_1_1;
} else if (mGnssMeasurementCbIface != nullptr) {
gnssMeasurementCbIface = mGnssMeasurementCbIface;
}
mMutex.unlock(); mMutex.unlock();
if (gnssMeasurementCbIface != nullptr) { if (gnssMeasurementCbIface_1_1 != nullptr) {
IGnssMeasurementCallback::GnssData gnssData; IGnssMeasurementCallback::GnssData gnssData;
convertGnssData_1_1(gnssMeasurementsNotification, gnssData);
auto r = gnssMeasurementCbIface_1_1->gnssMeasurementCb(gnssData);
if (!r.isOk()) {
LOC_LOGE("%s] Error from gnssMeasurementCb description=%s",
__func__, r.description().c_str());
}
} else if (gnssMeasurementCbIface != nullptr) {
V1_0::IGnssMeasurementCallback::GnssData gnssData;
convertGnssData(gnssMeasurementsNotification, gnssData); convertGnssData(gnssMeasurementsNotification, gnssData);
auto r = gnssMeasurementCbIface->GnssMeasurementCb(gnssData); auto r = gnssMeasurementCbIface->GnssMeasurementCb(gnssData);
if (!r.isOk()) { if (!r.isOk()) {
@ -135,7 +173,7 @@ void MeasurementAPIClient::onGnssMeasurementsCb(
} }
static void convertGnssMeasurement(GnssMeasurementsData& in, static void convertGnssMeasurement(GnssMeasurementsData& in,
IGnssMeasurementCallback::GnssMeasurement& out) V1_0::IGnssMeasurementCallback::GnssMeasurement& out)
{ {
memset(&out, 0, sizeof(IGnssMeasurementCallback::GnssMeasurement)); memset(&out, 0, sizeof(IGnssMeasurementCallback::GnssMeasurement));
if (in.flags & GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT) if (in.flags & GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT)
@ -242,13 +280,13 @@ static void convertGnssClock(GnssMeasurementsClock& in, IGnssMeasurementCallback
} }
static void convertGnssData(GnssMeasurementsNotification& in, static void convertGnssData(GnssMeasurementsNotification& in,
IGnssMeasurementCallback::GnssData& out) V1_0::IGnssMeasurementCallback::GnssData& out)
{ {
out.measurementCount = in.count; out.measurementCount = in.count;
if (out.measurementCount > static_cast<uint32_t>(GnssMax::SVS_COUNT)) { if (out.measurementCount > static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT)) {
LOC_LOGW("%s]: Too many measurement %u. Clamps to %d.", LOC_LOGW("%s]: Too many measurement %u. Clamps to %d.",
__FUNCTION__, out.measurementCount, GnssMax::SVS_COUNT); __FUNCTION__, out.measurementCount, V1_0::GnssMax::SVS_COUNT);
out.measurementCount = static_cast<uint32_t>(GnssMax::SVS_COUNT); out.measurementCount = static_cast<uint32_t>(V1_0::GnssMax::SVS_COUNT);
} }
for (size_t i = 0; i < out.measurementCount; i++) { for (size_t i = 0; i < out.measurementCount; i++) {
convertGnssMeasurement(in.measurements[i], out.measurements[i]); convertGnssMeasurement(in.measurements[i], out.measurements[i]);
@ -256,8 +294,18 @@ static void convertGnssData(GnssMeasurementsNotification& in,
convertGnssClock(in.clock, out.clock); convertGnssClock(in.clock, out.clock);
} }
static void convertGnssData_1_1(GnssMeasurementsNotification& in,
IGnssMeasurementCallback::GnssData& out)
{
out.measurements.resize(in.count);
for (size_t i = 0; i < in.count; i++) {
convertGnssMeasurement(in.measurements[i], out.measurements[i].v1_0);
}
convertGnssClock(in.clock, out.clock);
}
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@ -31,18 +31,17 @@
#define MEASUREMENT_API_CLINET_H #define MEASUREMENT_API_CLINET_H
#include <mutex> #include <mutex>
#include <android/hardware/gnss/1.0/IGnssMeasurement.h> #include <android/hardware/gnss/1.1/IGnssMeasurement.h>
#include <android/hardware/gnss/1.0/IGnssMeasurementCallback.h> #include <android/hardware/gnss/1.1/IGnssMeasurementCallback.h>
#include <LocationAPIClientBase.h> #include <LocationAPIClientBase.h>
#include <hidl/Status.h> #include <hidl/Status.h>
namespace android { namespace android {
namespace hardware { namespace hardware {
namespace gnss { namespace gnss {
namespace V1_0 { namespace V1_1 {
namespace implementation { namespace implementation {
using ::android::hardware::gnss::V1_0::IGnssMeasurement;
using ::android::sp; using ::android::sp;
class MeasurementAPIClient : public LocationAPIClientBase class MeasurementAPIClient : public LocationAPIClientBase
@ -54,21 +53,26 @@ public:
MeasurementAPIClient& operator=(const MeasurementAPIClient&) = delete; MeasurementAPIClient& operator=(const MeasurementAPIClient&) = delete;
// for GpsMeasurementInterface // for GpsMeasurementInterface
Return<IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback( Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback(
const sp<V1_0::IGnssMeasurementCallback>& callback);
Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> measurementSetCallback_1_1(
const sp<IGnssMeasurementCallback>& callback); const sp<IGnssMeasurementCallback>& callback);
void measurementClose(); void measurementClose();
Return<IGnssMeasurement::GnssMeasurementStatus> startTracking();
// callbacks we are interested in // callbacks we are interested in
void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final; void onGnssMeasurementsCb(GnssMeasurementsNotification gnssMeasurementsNotification) final;
private: private:
sp<IGnssMeasurementCallback> mGnssMeasurementCbIface;
std::mutex mMutex; std::mutex mMutex;
sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface;
sp<IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1;
bool mTracking; bool mTracking;
}; };
} // namespace implementation } // namespace implementation
} // namespace V1_0 } // namespace V1_1
} // namespace gnss } // namespace gnss
} // namespace hardware } // namespace hardware
} // namespace android } // namespace android

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
* Not a Contribution * Not a Contribution
*/ */
/* /*
@ -18,12 +18,12 @@
* limitations under the License. * limitations under the License.
*/ */
#define LOG_TAG "android.hardware.gnss@1.0-service-qti" #define LOG_TAG "android.hardware.gnss@1.1-service-qti"
#include <android/hardware/gnss/1.0/IGnss.h> #include <android/hardware/gnss/1.1/IGnss.h>
#include <hidl/LegacySupport.h> #include <hidl/LegacySupport.h>
using android::hardware::gnss::V1_0::IGnss; using android::hardware::gnss::V1_1::IGnss;
using android::hardware::defaultPassthroughServiceImplementation; using android::hardware::defaultPassthroughServiceImplementation;
int main() { int main() {

View file

@ -6,8 +6,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := libloc_core LOCAL_MODULE := libloc_core
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
ifeq ($(TARGET_DEVICE),apq8026_lw) ifeq ($(TARGET_DEVICE),apq8026_lw)

View file

@ -6,8 +6,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := libgnss LOCAL_MODULE := libgnss
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := \ LOCAL_SHARED_LIBRARIES := \

View file

@ -3002,6 +3002,9 @@ bool GnssAdapter::getDebugReport(GnssDebugReport& r)
r.mLocation.mLocation.longitude = r.mLocation.mLocation.longitude =
(double)(reports.mBestPosition.back().mBestLon) * RAD2DEG; (double)(reports.mBestPosition.back().mBestLon) * RAD2DEG;
r.mLocation.mLocation.altitude = reports.mBestPosition.back().mBestAlt; r.mLocation.mLocation.altitude = reports.mBestPosition.back().mBestAlt;
r.mLocation.mLocation.accuracy =
(double)(reports.mBestPosition.back().mBestHepe);
r.mLocation.mUtcReported = reports.mBestPosition.back().mUtcReported; r.mLocation.mUtcReported = reports.mBestPosition.back().mUtcReported;
} }
else { else {

View file

@ -6,8 +6,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := liblocation_api LOCAL_MODULE := liblocation_api
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := \ LOCAL_SHARED_LIBRARIES := \

View file

@ -44,8 +44,7 @@ LOCAL_HEADER_LIBRARIES := \
liblocation_api_headers liblocation_api_headers
LOCAL_MODULE := libgps.utils LOCAL_MODULE := libgps.utils
LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib LOCAL_VENDOR_MODULE := true
LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
LOCAL_MODULE_TAGS := optional LOCAL_MODULE_TAGS := optional
LOCAL_PRELINK_MODULE := false LOCAL_PRELINK_MODULE := false