blob: 9b2699b6e207ba0372b622309ff51cd28b03b9d3 (
plain)
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
|
#ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
#define ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
#include <android/hardware/gnss/1.1/IGnssCallback.h>
#include <android/hardware/gnss/1.1/IGnssConfiguration.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <mutex>
#include <unordered_set>
namespace android {
namespace hardware {
namespace gnss {
namespace V1_1 {
namespace implementation {
using ::android::hardware::hidl_array;
using ::android::hardware::hidl_memory;
using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::sp;
using BlacklistedSource = ::android::hardware::gnss::V1_1::IGnssConfiguration::BlacklistedSource;
using GnssConstellationType = V1_0::GnssConstellationType;
using GnssSvInfo = V1_0::IGnssCallback::GnssSvInfo;
struct BlacklistedSourceHash {
inline int operator()(const BlacklistedSource& source) const {
return int(source.constellation) * 1000 + int(source.svid);
}
};
struct BlacklistedSourceEqual {
inline bool operator()(const BlacklistedSource& s1, const BlacklistedSource& s2) const {
return (s1.constellation == s2.constellation) && (s1.svid == s2.svid);
}
};
using BlacklistedSourceSet =
std::unordered_set<BlacklistedSource, BlacklistedSourceHash, BlacklistedSourceEqual>;
using BlacklistedConstellationSet = std::unordered_set<GnssConstellationType>;
struct GnssConfiguration : public IGnssConfiguration {
// Methods from ::android::hardware::gnss::V1_0::IGnssConfiguration follow.
Return<bool> setSuplEs(bool enabled) override;
Return<bool> setSuplVersion(uint32_t version) override;
Return<bool> setSuplMode(hidl_bitfield<SuplMode> mode) override;
Return<bool> setGpsLock(hidl_bitfield<GpsLock> lock) override;
Return<bool> setLppProfile(hidl_bitfield<LppProfile> lppProfile) override;
Return<bool> setGlonassPositioningProtocol(hidl_bitfield<GlonassPosProtocol> protocol) override;
Return<bool> setEmergencySuplPdn(bool enable) override;
// Methods from ::android::hardware::gnss::V1_1::IGnssConfiguration follow.
Return<bool> setBlacklist(const hidl_vec<BlacklistedSource>& blacklist) override;
Return<bool> isBlacklisted(const GnssSvInfo& gnssSvInfo) const;
std::recursive_mutex& getMutex() const;
private:
BlacklistedSourceSet mBlacklistedSourceSet;
BlacklistedConstellationSet mBlacklistedConstellationSet;
mutable std::recursive_mutex mMutex;
};
} // namespace implementation
} // namespace V1_1
} // namespace gnss
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSCONFIGURATION_H
|