/* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_HARDWARE_GNSS_V2_0_GNSS_H #define ANDROID_HARDWARE_GNSS_V2_0_GNSS_H #include #include #include #include #include #include namespace android { namespace hardware { namespace gnss { namespace V2_0 { namespace implementation { using ::android::sp; 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 GnssConstellationType = V1_0::GnssConstellationType; using GnssLocation = V1_0::GnssLocation; using GnssSvInfo = V1_0::IGnssCallback::GnssSvInfo; using GnssSvStatus = V1_0::IGnssCallback::GnssSvStatus; struct Gnss : public IGnss { Gnss(); ~Gnss(); // Methods from V1_0::IGnss follow. Return setCallback(const sp& 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(V1_0::IGnss::GnssAidingData aidingDataFlags) override; Return setPositionMode(V1_0::IGnss::GnssPositionMode mode, 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 V1_1::IGnss follow. Return setCallback_1_1(const sp& callback) override; Return 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> getExtensionGnssConfiguration_1_1() override; Return> getExtensionGnssMeasurement_1_1() override; Return injectBestLocation(const GnssLocation& location) override; // Methods from V2_0::IGnss follow. Return> getExtensionGnssConfiguration_2_0() override; Return> getExtensionGnssDebug_2_0() override; Return> getExtensionAGnss_2_0() override; Return> getExtensionAGnssRil_2_0() override; Return> getExtensionGnssMeasurement_2_0() override; Return setCallback_2_0(const sp& callback) override; Return> getExtensionMeasurementCorrections() override; Return> getExtensionVisibilityControl() override; Return> getExtensionGnssBatching_2_0() override; Return injectBestLocation_2_0(const V2_0::GnssLocation& location) override; private: Return reportLocation(const V2_0::GnssLocation&) const; static sp sGnssCallback_2_0; static sp sGnssCallback_1_1; std::atomic mMinIntervalMs; std::atomic mIsActive; std::thread mThread; mutable std::mutex mMutex; }; } // namespace implementation } // namespace V2_0 } // namespace gnss } // namespace hardware } // namespace android #endif // ANDROID_HARDWARE_GNSS_V2_0_GNSS_H