blob: 4fa542659e0c7f219667ea36fb7006a8e931d40f [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef android_hardware_gnss_V1_1_GnssMeasurement_H_
18#define android_hardware_gnss_V1_1_GnssMeasurement_H_
19
20#include <ThreadCreationWrapper.h>
21#include <android/hardware/gnss/1.1/IGnssMeasurement.h>
22#include <hidl/Status.h>
23#include <hardware/gps.h>
24#include <hardware/gps_mtk.h>
25
26namespace android {
27namespace hardware {
28namespace gnss {
29namespace V1_1 {
30namespace implementation {
31
32using ::android::hardware::gnss::V1_1::IGnssMeasurement;
33using ::android::hardware::gnss::V1_1::IGnssMeasurementCallback;
34using ::android::hardware::Return;
35using ::android::hardware::Void;
36using ::android::hardware::hidl_vec;
37using ::android::hardware::hidl_string;
38using ::android::sp;
39
40
41/*
42 * Extended interface for GNSS Measurements support. Also contains wrapper methods to allow methods
43 * from IGnssMeasurementCallback interface to be passed into the conventional implementation of the
44 * GNSS HAL.
45 */
46struct GnssMeasurement : public IGnssMeasurement {
47 GnssMeasurement(const GpsMeasurementInterface_ext* gpsMeasurementIface);
48
49 /*
50 * Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
51 * These declarations were generated from IGnssMeasurement.hal.
52 */
53 Return<::android::hardware::gnss::V1_0::IGnssMeasurement::GnssMeasurementStatus> setCallback(
54 const sp<::android::hardware::gnss::V1_0::IGnssMeasurementCallback>& callback) override;
55 Return<void> close() override;
56
57 // Methods from ::android::hardware::gnss::V1_1::IGnssMeasurement follow.
58 Return<::android::hardware::gnss::V1_0::IGnssMeasurement::GnssMeasurementStatus>
59 setCallback_1_1(const sp<::android::hardware::gnss::V1_1::IGnssMeasurementCallback>& callback,
60 bool enableFullTracking) override;
61
62 /*
63 * Callback methods to be passed into the conventional GNSS HAL by the default
64 * implementation. These methods are not part of the IGnssMeasurement base class.
65 */
66 static void gnssMeasurementCb(GnssData_ext* data);
67 /*
68 * Deprecated callback added for backward compatibity for devices that do
69 * not support GnssData measurements.
70 */
71 static void gpsMeasurementCb(GpsData* data);
72
73 /*
74 * Holds function pointers to the callback methods.
75 */
76 static GpsMeasurementCallbacks_ext sGnssMeasurementCbs;
77
78 private:
79 const GpsMeasurementInterface_ext* mGnssMeasureIface = nullptr;
80 static sp<IGnssMeasurementCallback> sGnssMeasureCbIface;
81};
82
83} // namespace implementation
84} // namespace V1_1
85} // namespace gnss
86} // namespace hardware
87} // namespace android
88
89#endif // android_hardware_gnss_V1_0_GnssMeasurement_H_