#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSS_H #define ANDROID_HARDWARE_GNSS_V1_1_GNSS_H #include #include #include #include #include #include #include "GnssConfiguration.h" namespace android { namespace hardware { namespace gnss { 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::sp; using GnssConstellationType = V1_0::GnssConstellationType; using GnssLocation = V1_0::GnssLocation; using GnssSvInfo = V1_0::IGnssCallback::GnssSvInfo; using GnssSvStatus = V1_0::IGnssCallback::GnssSvStatus; /** * Unlike the gnss/1.0/default implementation, which is a shim layer to the legacy gps.h, this * default implementation serves as a mock implementation for emulators */ struct Gnss : public IGnss { Gnss(); ~Gnss(); // Methods from ::android::hardware::gnss::V1_0::IGnss follow. Return setCallback( const sp<::android::hardware::gnss::V1_0::IGnssCallback>& callback) override; Return start() override; Return stop() override; Return cleanup() override; Return injectTime(int64_t timeMs, int64_t timeReferenceMs, int32_t uncertaintyMs) override; Return injectLocation(double latitudeDegrees, double longitudeDegrees, float accuracyMeters) override; Return deleteAidingData( ::android::hardware::gnss::V1_0::IGnss::GnssAidingData aidingDataFlags) override; Return setPositionMode( ::android::hardware::gnss::V1_0::IGnss::GnssPositionMode mode, ::android::hardware::gnss::V1_0::IGnss::GnssPositionRecurrence recurrence, uint32_t minIntervalMs, uint32_t preferredAccuracyMeters, uint32_t preferredTimeMs) override; Return> getExtensionAGnssRil() override; Return> getExtensionGnssGeofencing() override; Return> getExtensionAGnss() override; Return> getExtensionGnssNi() override; Return> getExtensionGnssMeasurement() override; Return> getExtensionGnssNavigationMessage() override; Return> getExtensionXtra() override; Return> getExtensionGnssConfiguration() override; Return> getExtensionGnssDebug() override; Return> getExtensionGnssBatching() override; // Methods from ::android::hardware::gnss::V1_1::IGnss follow. Return setCallback_1_1( const sp<::android::hardware::gnss::V1_1::IGnssCallback>& callback) override; Return setPositionMode_1_1( ::android::hardware::gnss::V1_0::IGnss::GnssPositionMode mode, ::android::hardware::gnss::V1_0::IGnss::GnssPositionRecurrence recurrence, uint32_t minIntervalMs, uint32_t preferredAccuracyMeters, uint32_t preferredTimeMs, bool lowPowerMode) override; Return> getExtensionGnssConfiguration_1_1() override; Return> getExtensionGnssMeasurement_1_1() override; Return injectBestLocation( const ::android::hardware::gnss::V1_0::GnssLocation& location) override; // Methods from ::android::hidl::base::V1_0::IBase follow. private: Return getMockSvStatus() const; Return reportLocation(const GnssLocation&) const; Return reportSvStatus(const GnssSvStatus&) const; static sp sGnssCallback; std::atomic mMinIntervalMs; sp mGnssConfiguration; std::atomic mIsActive; std::thread mThread; mutable std::mutex mMutex; }; } // namespace implementation } // namespace V1_1 } // namespace gnss } // namespace hardware } // namespace android #endif // ANDROID_HARDWARE_GNSS_V1_1_GNSS_H