1 /* 2 * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 3 * Not a Contribution 4 */ 5 /* 6 * Copyright (C) 2016 The Android Open Source Project 7 * 8 * Licensed under the Apache License, Version 2_0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2_0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 */ 20 21 /* âââââChanges from Qualcomm Innovation Center are provided under the following license: 22 * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. 23 * SPDX-License-Identifier: BSD-3-Clause-Clear 24 */ 25 26 #ifndef ANDROID_HARDWARE_GNSS_V2_1_GNSSMEASUREMENT_H 27 #define ANDROID_HARDWARE_GNSS_V2_1_GNSSMEASUREMENT_H 28 29 #include <android/hardware/gnss/2.1/IGnssMeasurement.h> 30 #include <hidl/MQDescriptor.h> 31 #include <hidl/Status.h> 32 #include "MeasurementAPIClient.h" 33 34 namespace android { 35 namespace hardware { 36 namespace gnss { 37 namespace V2_1 { 38 namespace implementation { 39 40 using ::android::hardware::Return; 41 using ::android::hardware::Void; 42 using ::android::hardware::hidl_vec; 43 using ::android::hardware::hidl_string; 44 using ::android::sp; 45 46 class MeasurementAPIClient; 47 struct GnssMeasurement : public V2_1::IGnssMeasurement { 48 GnssMeasurement(); 49 ~GnssMeasurement(); 50 51 /* 52 * Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow. 53 * These declarations were generated from IGnssMeasurement.hal. 54 */ 55 Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback( 56 const sp<V1_0::IGnssMeasurementCallback>& callback) override; 57 Return<void> close() override; 58 59 // Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow. 60 Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback_1_1( 61 const sp<V1_1::IGnssMeasurementCallback>& callback, 62 bool enableFullTracking) override; 63 64 // Methods from ::android::hardware::gnss::V2_0::IGnssMeasurement follow. 65 Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback_2_0( 66 const sp<V2_0::IGnssMeasurementCallback>& callback, 67 bool enableFullTracking) override; 68 // Methods from ::android::hardware::gnss::V2_1::IGnssMeasurement follow. 69 Return<V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback_2_1( 70 const sp<::android::hardware::gnss::V2_1::IGnssMeasurementCallback>& callback, 71 bool enableFullTracking) override; 72 73 private: 74 struct GnssMeasurementDeathRecipient : hidl_death_recipient { GnssMeasurementDeathRecipientGnssMeasurement::GnssMeasurementDeathRecipient75 GnssMeasurementDeathRecipient(sp<GnssMeasurement> gnssMeasurement) : 76 mGnssMeasurement(gnssMeasurement) { 77 } 78 ~GnssMeasurementDeathRecipient() = default; 79 virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override; 80 sp<GnssMeasurement> mGnssMeasurement; 81 }; 82 83 template <typename T> 84 Return<IGnssMeasurement::GnssMeasurementStatus> setCallback( 85 const sp<T>& callback, sp<T>& myCallback, GnssPowerMode powerMode); 86 sp<GnssMeasurementDeathRecipient> mGnssMeasurementDeathRecipient = nullptr; 87 sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr; 88 sp<V1_1::IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1 = nullptr; 89 sp<V2_0::IGnssMeasurementCallback> mGnssMeasurementCbIface_2_0 = nullptr; 90 sp<V2_1::IGnssMeasurementCallback> mGnssMeasurementCbIface_2_1 = nullptr; 91 MeasurementAPIClient* mApi; 92 void clearInterfaces(); 93 }; 94 95 } // namespace implementation 96 } // namespace V2_1 97 } // namespace gnss 98 } // namespace hardware 99 } // namespace android 100 101 #endif // ANDROID_HARDWARE_GNSS_V2_1_GNSSMEASUREMENT_H 102