blob: ccafff2c74abdf7f67686a1ccb375a63e951c462 [file] [log] [blame]
Michael Bestas3a0209e2023-05-04 01:15:47 +03001/*
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
Michael Bestas222c86c2024-07-18 12:36:55 -040021/* ​​​​​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
Michael Bestas3a0209e2023-05-04 01:15:47 +030026#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
27#define ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H
28
29#include <android/hardware/gnss/1.1/IGnssMeasurement.h>
30#include <hidl/MQDescriptor.h>
31#include <hidl/Status.h>
Michael Bestas222c86c2024-07-18 12:36:55 -040032#include "MeasurementAPIClient.h"
Michael Bestas3a0209e2023-05-04 01:15:47 +030033
34namespace android {
35namespace hardware {
36namespace gnss {
37namespace V1_1 {
38namespace implementation {
39
40using ::android::hardware::gnss::V1_1::IGnssMeasurement;
41using ::android::hardware::gnss::V1_1::IGnssMeasurementCallback;
42using ::android::hardware::Return;
43using ::android::hardware::Void;
44using ::android::hardware::hidl_vec;
45using ::android::hardware::hidl_string;
46using ::android::sp;
47
48class MeasurementAPIClient;
49struct GnssMeasurement : public IGnssMeasurement {
50 GnssMeasurement();
51 ~GnssMeasurement();
52
53 /*
54 * Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
55 * These declarations were generated from IGnssMeasurement.hal.
56 */
57 Return<GnssMeasurement::GnssMeasurementStatus> setCallback(
58 const sp<V1_0::IGnssMeasurementCallback>& callback) override;
59 Return<void> close() override;
60
61 // Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow.
62 Return<GnssMeasurement::GnssMeasurementStatus> setCallback_1_1(
63 const sp<IGnssMeasurementCallback>& callback,
64 bool enableFullTracking) override;
65
66 private:
67 struct GnssMeasurementDeathRecipient : hidl_death_recipient {
68 GnssMeasurementDeathRecipient(sp<GnssMeasurement> gnssMeasurement) :
69 mGnssMeasurement(gnssMeasurement) {
70 }
71 ~GnssMeasurementDeathRecipient() = default;
72 virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
73 sp<GnssMeasurement> mGnssMeasurement;
74 };
75
Michael Bestas222c86c2024-07-18 12:36:55 -040076 template <typename T>
77 Return<IGnssMeasurement::GnssMeasurementStatus> setCallback(
78 const sp<T>& callback, sp<T>& myCallback, GnssPowerMode powerMode);
Michael Bestas3a0209e2023-05-04 01:15:47 +030079 sp<GnssMeasurementDeathRecipient> mGnssMeasurementDeathRecipient = nullptr;
80 sp<V1_0::IGnssMeasurementCallback> mGnssMeasurementCbIface = nullptr;
81 sp<IGnssMeasurementCallback> mGnssMeasurementCbIface_1_1 = nullptr;
82 MeasurementAPIClient* mApi;
83};
84
85} // namespace implementation
86} // namespace V1_1
87} // namespace gnss
88} // namespace hardware
89} // namespace android
90
91#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSMEASUREMENT_H