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_AGNSS_H
22 #define ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H
23 
24 #include <android/hardware/gnss/2.0/IAGnss.h>
25 #include <hidl/Status.h>
26 #include <gps_extended_c.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 struct Gnss;
41 struct AGnss : public V2_0::IAGnss {
42 
43     AGnss(Gnss* gnss);
44     ~AGnss();
45     /*
46      * Methods from ::android::hardware::gnss::V2_0::IAGnss interface follow.
47      * These declarations were generated from IAGnss.hal.
48      */
49     Return<void> setCallback(const sp<V2_0::IAGnssCallback>& callback) override;
50 
51     Return<bool> dataConnClosed() override;
52 
53     Return<bool> dataConnFailed() override;
54 
55     Return<bool> dataConnOpen(uint64_t networkHandle, const hidl_string& apn,
56             V2_0::IAGnss::ApnIpType apnIpType) override;
57 
58     Return<bool> setServer(V2_0::IAGnssCallback::AGnssType type,
59                          const hidl_string& hostname, int32_t port) override;
60 
61     void statusCb(AGpsExtType type, LocAGpsStatusValue status);
62 
63     /* Data call setup callback passed down to GNSS HAL implementation */
64     static void agnssStatusIpV4Cb(AGnssExtStatusIpV4 status);
65 
66  private:
67     Gnss* mGnss = nullptr;
68     sp<IAGnssCallback> mAGnssCbIface = nullptr;
69 };
70 
71 }  // namespace implementation
72 }  // namespace V2_0
73 }  // namespace gnss
74 }  // namespace hardware
75 }  // namespace android
76 
77 #endif  // ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H
78