Michael Bestas | 3a0209e | 2023-05-04 01:15:47 +0300 | [diff] [blame] | 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 | #ifndef ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H |
| 22 | #define ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H |
| 23 | |
Michael Bestas | 222c86c | 2024-07-18 12:36:55 -0400 | [diff] [blame^] | 24 | #include <mutex> |
Michael Bestas | 3a0209e | 2023-05-04 01:15:47 +0300 | [diff] [blame] | 25 | #include <android/hardware/gnss/2.0/IAGnss.h> |
| 26 | #include <hidl/Status.h> |
| 27 | #include <gps_extended_c.h> |
| 28 | |
| 29 | namespace android { |
| 30 | namespace hardware { |
| 31 | namespace gnss { |
| 32 | namespace V2_1 { |
| 33 | namespace implementation { |
| 34 | |
| 35 | using ::android::hardware::Return; |
| 36 | using ::android::hardware::Void; |
| 37 | using ::android::hardware::hidl_vec; |
| 38 | using ::android::hardware::hidl_string; |
| 39 | using ::android::sp; |
| 40 | using ::android::hardware::gnss::V2_0::IAGnssCallback; |
| 41 | |
| 42 | struct Gnss; |
| 43 | struct AGnss : public V2_0::IAGnss { |
| 44 | |
| 45 | AGnss(Gnss* gnss); |
| 46 | ~AGnss(); |
| 47 | /* |
| 48 | * Methods from ::android::hardware::gnss::V2_0::IAGnss interface follow. |
| 49 | * These declarations were generated from IAGnss.hal. |
| 50 | */ |
| 51 | Return<void> setCallback(const sp<V2_0::IAGnssCallback>& callback) override; |
| 52 | |
| 53 | Return<bool> dataConnClosed() override; |
| 54 | |
| 55 | Return<bool> dataConnFailed() override; |
| 56 | |
| 57 | Return<bool> dataConnOpen(uint64_t networkHandle, const hidl_string& apn, |
| 58 | V2_0::IAGnss::ApnIpType apnIpType) override; |
| 59 | |
| 60 | Return<bool> setServer(V2_0::IAGnssCallback::AGnssType type, |
| 61 | const hidl_string& hostname, int32_t port) override; |
| 62 | |
| 63 | void statusCb(AGpsExtType type, LocAGpsStatusValue status); |
| 64 | |
| 65 | /* Data call setup callback passed down to GNSS HAL implementation */ |
| 66 | static void agnssStatusIpV4Cb(AGnssExtStatusIpV4 status); |
| 67 | |
| 68 | private: |
| 69 | Gnss* mGnss = nullptr; |
Michael Bestas | 222c86c | 2024-07-18 12:36:55 -0400 | [diff] [blame^] | 70 | std::mutex mMutex; |
Michael Bestas | 3a0209e | 2023-05-04 01:15:47 +0300 | [diff] [blame] | 71 | sp<V2_0::IAGnssCallback> mAGnssCbIface = nullptr; |
| 72 | |
| 73 | AGpsExtType mType; |
| 74 | }; |
| 75 | |
| 76 | } // namespace implementation |
| 77 | } // namespace V2_1 |
| 78 | } // namespace gnss |
| 79 | } // namespace hardware |
| 80 | } // namespace android |
| 81 | |
| 82 | #endif // ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H |