diff options
Diffstat (limited to 'gps/android/Gnss.h')
-rw-r--r-- | gps/android/Gnss.h | 75 |
1 files changed, 40 insertions, 35 deletions
diff --git a/gps/android/Gnss.h b/gps/android/Gnss.h index e4589d6..4c0c8b0 100644 --- a/gps/android/Gnss.h +++ b/gps/android/Gnss.h @@ -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 */ /* @@ -30,7 +30,8 @@ #include <GnssNi.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 <GnssAPIClient.h> @@ -39,37 +40,27 @@ namespace android { namespace hardware { namespace gnss { -namespace V1_0 { +namespace V1_1 { 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::Void; -using ::android::hardware::hidl_vec; -using ::android::hardware::hidl_string; using ::android::sp; +using ::android::hardware::gnss::V1_0::GnssLocation; struct Gnss : public IGnss { 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. * 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> stop() override; Return<void> cleanup() override; @@ -79,30 +70,40 @@ struct Gnss : public IGnss { Return<bool> injectTime(int64_t timeMs, int64_t timeReferenceMs, int32_t uncertaintyMs) override; - Return<void> deleteAidingData(IGnss::GnssAidingData aidingDataFlags) override; - Return<bool> setPositionMode(IGnss::GnssPositionMode mode, - IGnss::GnssPositionRecurrence recurrence, + Return<void> deleteAidingData(V1_0::IGnss::GnssAidingData aidingDataFlags) override; + Return<bool> setPositionMode(V1_0::IGnss::GnssPositionMode mode, + V1_0::IGnss::GnssPositionRecurrence recurrence, uint32_t minIntervalMs, uint32_t preferredAccuracyMeters, uint32_t preferredTimeMs) override; - Return<sp<IAGnss>> getExtensionAGnss() override; - Return<sp<IGnssNi>> getExtensionGnssNi() override; - Return<sp<IGnssMeasurement>> getExtensionGnssMeasurement() override; - Return<sp<IGnssConfiguration>> getExtensionGnssConfiguration() override; - Return<sp<IGnssGeofencing>> getExtensionGnssGeofencing() override; - Return<sp<IGnssBatching>> getExtensionGnssBatching() override; + Return<sp<V1_0::IAGnss>> getExtensionAGnss() override; + Return<sp<V1_0::IGnssNi>> getExtensionGnssNi() override; + Return<sp<V1_0::IGnssMeasurement>> getExtensionGnssMeasurement() override; + Return<sp<V1_0::IGnssConfiguration>> getExtensionGnssConfiguration() override; + Return<sp<V1_0::IGnssGeofencing>> getExtensionGnssGeofencing() 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; } - inline Return<sp<IGnssXtra>> getExtensionXtra() override { + inline Return<sp<V1_0::IGnssXtra>> getExtensionXtra() override { 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. GnssAPIClient* getApi(); @@ -110,6 +111,9 @@ struct Gnss : public IGnss { Return<bool> updateConfiguration(GnssConfig& gnssConfig); GnssInterface* getGnssInterface(); + // Callback for ODCPI request + void odcpiRequestCb(const OdcpiRequestInfo& request); + private: struct GnssDeathRecipient : hidl_death_recipient { GnssDeathRecipient(sp<Gnss> gnss) : mGnss(gnss) { @@ -132,8 +136,9 @@ struct Gnss : public IGnss { sp<AGnssRil> mGnssRil = nullptr; GnssAPIClient* mApi = nullptr; - sp<IGnssCallback> mGnssCbIface = nullptr; - sp<IGnssNiCallback> mGnssNiCbIface = nullptr; + sp<V1_0::IGnssCallback> mGnssCbIface = nullptr; + sp<V1_1::IGnssCallback> mGnssCbIface_1_1 = nullptr; + sp<V1_0::IGnssNiCallback> mGnssNiCbIface = nullptr; GnssConfig mPendingConfig; GnssInterface* mGnssInterface = nullptr; }; @@ -141,7 +146,7 @@ struct Gnss : public IGnss { extern "C" IGnss* HIDL_FETCH_IGnss(const char* name); } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace gnss } // namespace hardware } // namespace android |