Michael Bestas | 3a0209e | 2023-05-04 01:15:47 +0300 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2017-2019, 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 | #ifndef ANDROID_HARDWARE_GNSS_V2_0_GNSSMEASUREMENT_H |
| 22 | #define ANDROID_HARDWARE_GNSS_V2_0_GNSSMEASUREMENT_H |
| 23 | |
| 24 | #include <android/hardware/gnss/2.0/IGnssMeasurement.h> |
| 25 | #include <hidl/MQDescriptor.h> |
| 26 | #include <hidl/Status.h> |
| 27 | |
| 28 | namespace android { |
| 29 | namespace hardware { |
| 30 | namespace gnss { |
| 31 | namespace V2_0 { |
| 32 | namespace implementation { |
| 33 | |
| 34 | using ::android::hardware::Return; |
| 35 | using ::android::hardware::Void; |
| 36 | using ::android::hardware::hidl_vec; |
| 37 | using ::android::hardware::hidl_string; |
| 38 | using ::android::sp; |
| 39 | |
| 40 | class MeasurementAPIClient; |
| 41 | struct GnssMeasurement : public V2_0::IGnssMeasurement { |
| 42 | GnssMeasurement(); |
| 43 | ~GnssMeasurement(); |
| 44 | |
| 45 | /* |
| 46 | * Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow. |
| 47 | * These declarations were generated from IGnssMeasurement.hal. |
| 48 | */ |
| 49 | Return<GnssMeasurement::GnssMeasurementStatus> setCallback( |
| 50 | const sp<V1_0::IGnssMeasurementCallback>& callback) override; |
| 51 | Return<void> close() override; |
| 52 | |
| 53 | // Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow. |
| 54 | Return<GnssMeasurement::GnssMeasurementStatus> setCallback_1_1( |
| 55 | const sp<V1_1::IGnssMeasurementCallback>& callback, |
| 56 | bool enableFullTracking) override; |
| 57 | |
| 58 | // Methods from ::android::hardware::gnss::V2_0::IGnssMeasurement follow. |
| 59 | Return<GnssMeasurement::GnssMeasurementStatus> setCallback_2_0( |
| 60 | const sp<V2_0::IGnssMeasurementCallback>& callback, |
| 61 | bool enableFullTracking) override; |
| 62 | private: |
| 63 | struct GnssMeasurementDeathRecipient : hidl_death_recipient { |
| 64 | GnssMeasurementDeathRecipient(sp<GnssMeasurement> gnssMeasurement) : |
| 65 | mGnssMeasurement(gnssMeasurement) { |
| 66 | } |
| 67 | ~GnssMeasurementDeathRecipient() = default; |
| 68 | virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override; |
| 69 | sp<GnssMeasurement> mGnssMeasurement; |
| 70 | }; |
| 71 | |
| 72 | private: |
| 73 | sp<GnssMeasurementDeathRecipient> mGnssMeasurementDeathRecipient = nullptr; |
| 74 | sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr; |
| 75 | sp<V1_1::IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1 = nullptr; |
| 76 | sp<V2_0::IGnssMeasurementCallback> mGnssMeasurementCbIface_2_0 = nullptr; |
| 77 | MeasurementAPIClient* mApi; |
| 78 | void clearInterfaces(); |
| 79 | }; |
| 80 | |
| 81 | } // namespace implementation |
| 82 | } // namespace V2_0 |
| 83 | } // namespace gnss |
| 84 | } // namespace hardware |
| 85 | } // namespace android |
| 86 | |
| 87 | #endif // ANDROID_HARDWARE_GNSS_V2_0_GNSSMEASUREMENT_H |