-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGnss.h
148 lines (124 loc) · 4.99 KB
/
Gnss.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_GNSS_V1_0_RENESAS_H_
#define ANDROID_HARDWARE_GNSS_V1_0_RENESAS_H_
#include <android/hardware/gnss/1.0/IGnss.h>
#include <hidl/Status.h>
#include <AGnss.h>
#include <AGnssRil.h>
#include <GnssBatching.h>
#include <GnssConfiguration.h>
#include <GnssDebug.h>
#include <GnssGeofencing.h>
#include <GnssMeasurement.h>
#include <GnssNavigationMessage.h>
#include <GnssNi.h>
#include <GnssXtra.h>
#include "GnssHw.h"
namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace renesas {
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;
using ::android::sp;
struct Gnss : public IGnss {
Gnss(void);
~Gnss(void);
/*
* Methods from ::android::hardware::gnss::V1_0::IGnss follow.
*/
Return<bool> setCallback(const sp<IGnssCallback>& callback) override;
Return<bool> start(void) override;
Return<bool> stop(void) override;
Return<void> cleanup(void) override;
Return<bool> injectLocation(double latitudeDegrees,
double longitudeDegrees,
float accuracyMeters) override;
Return<bool> injectTime(int64_t timeMs,
int64_t timeReferenceMs,
int32_t uncertaintyMs) override;
Return<void> deleteAidingData(IGnss::GnssAidingData aidingDataFlags) override;
Return<bool> setPositionMode(IGnss::GnssPositionMode mode,
IGnss::GnssPositionRecurrence recurrence,
uint32_t minIntervalMs,
uint32_t preferredAccuracyMeters,
uint32_t preferredTimeMs) override;
Return<sp<IAGnssRil>> getExtensionAGnssRil(void) override;
Return<sp<IGnssGeofencing>> getExtensionGnssGeofencing(void) override;
Return<sp<IAGnss>> getExtensionAGnss(void) override;
Return<sp<IGnssNi>> getExtensionGnssNi(void) override;
Return<sp<IGnssMeasurement>> getExtensionGnssMeasurement(void) override;
Return<sp<IGnssNavigationMessage>> getExtensionGnssNavigationMessage(void) override;
Return<sp<IGnssXtra>> getExtensionXtra(void) override;
Return<sp<IGnssConfiguration>> getExtensionGnssConfiguration(void) override;
Return<sp<IGnssDebug>> getExtensionGnssDebug(void) override;
Return<sp<IGnssBatching>> getExtensionGnssBatching(void) override;
/*
* Wakelock consolidation, only needed for dual use of a gps.h & fused_location.h HAL
*
* Ensures that if the last call from either legacy .h was to acquire a wakelock, that a
* wakelock is held. Otherwise releases it.
*/
static void acquireWakelockFused();
static void releaseWakelockFused();
private:
/*
* For handling system-server death while GNSS service lives on.
*/
class GnssHidlDeathRecipient : public hidl_death_recipient {
public:
GnssHidlDeathRecipient(const sp<Gnss> gnss) : mGnss(gnss) { }
virtual void serviceDied(uint64_t /*cookie*/,
const wp<::android::hidl::base::V1_0::IBase>& /*who*/) {
mGnss->handleHidlDeath();
}
private:
sp<Gnss> mGnss;
};
// for wakelock consolidation, see above
static void acquireWakelockGnss();
static void releaseWakelockGnss();
static void updateWakelock();
static bool sWakelockHeldGnss;
static bool sWakelockHeldFused;
/* Cleanup for death notification */
void handleHidlDeath(void);
sp<GnssXtra> mGnssXtraIface = nullptr;
sp<AGnssRil> mGnssRil = nullptr;
sp<GnssGeofencing> mGnssGeofencingIface = nullptr;
sp<AGnss> mAGnssIface = nullptr;
sp<GnssNi> mGnssNi = nullptr;
sp<GnssMeasurementImpl> mGnssMeasurement = nullptr;
sp<GnssNavigationMessage> mGnssNavigationMessage = nullptr;
sp<GnssDebug> mGnssDebug = nullptr;
sp<GnssConfiguration> mGnssConfig = nullptr;
sp<GnssBatching> mGnssBatching = nullptr;
sp<GnssHwIface> mGnssHwIface = nullptr;
sp<GnssHidlDeathRecipient> mDeathRecipient = nullptr;
sp<IGnssCallback> mGnssCbIface = nullptr;
const GpsInterface* mGnssIface = nullptr;
static sp<IGnssCallback> sGnssCbIface;
};
} // namespace renesas
} // namespace V1_0
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_0_RENESAS_H_