• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2017-2018, 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_V1_1_GNSSMEASUREMENT_H
22 #define ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
23 
24 #include <android/hardware/gnss/1.1/IGnssMeasurement.h>
25 #include <hidl/MQDescriptor.h>
26 #include <hidl/Status.h>
27 
28 namespace android {
29 namespace hardware {
30 namespace gnss {
31 namespace V1_1 {
32 namespace implementation {
33 
34 using ::android::hardware::gnss::V1_1::IGnssMeasurement;
35 using ::android::hardware::gnss::V1_1::IGnssMeasurementCallback;
36 using ::android::hardware::Return;
37 using ::android::hardware::Void;
38 using ::android::hardware::hidl_vec;
39 using ::android::hardware::hidl_string;
40 using ::android::sp;
41 
42 class MeasurementAPIClient;
43 struct GnssMeasurement : public IGnssMeasurement {
44     GnssMeasurement();
45     ~GnssMeasurement();
46 
47     /*
48      * Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
49      * These declarations were generated from IGnssMeasurement.hal.
50      */
51     Return<GnssMeasurement::GnssMeasurementStatus> setCallback(
52         const sp<V1_0::IGnssMeasurementCallback>& callback) override;
53     Return<void> close() override;
54 
55     // Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow.
56     Return<GnssMeasurement::GnssMeasurementStatus> setCallback_1_1(
57             const sp<IGnssMeasurementCallback>& callback,
58             bool enableFullTracking) override;
59 
60  private:
61     struct GnssMeasurementDeathRecipient : hidl_death_recipient {
GnssMeasurementDeathRecipientGnssMeasurement::GnssMeasurementDeathRecipient62         GnssMeasurementDeathRecipient(sp<GnssMeasurement> gnssMeasurement) :
63             mGnssMeasurement(gnssMeasurement) {
64         }
65         ~GnssMeasurementDeathRecipient() = default;
66         virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
67         sp<GnssMeasurement> mGnssMeasurement;
68     };
69 
70  private:
71     sp<GnssMeasurementDeathRecipient> mGnssMeasurementDeathRecipient = nullptr;
72     sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr;
73     sp<IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1 = nullptr;
74     MeasurementAPIClient* mApi;
75 };
76 
77 }  // namespace implementation
78 }  // namespace V1_1
79 }  // namespace gnss
80 }  // namespace hardware
81 }  // namespace android
82 
83 #endif  // ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
84