blob: 001c27d8e79e14b9f9e2f199f9c11cb594e14142 [file] [log] [blame]
Wyatt Rileyad03ab22016-12-14 14:54:29 -08001#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H
2#define ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H
3
4#include <android/hardware/gnss/1.0/IGnssBatching.h>
5#include <hardware/fused_location.h>
6#include <hidl/MQDescriptor.h>
7#include <hidl/Status.h>
8
Wyatt Rileyad03ab22016-12-14 14:54:29 -08009namespace android {
10namespace hardware {
11namespace gnss {
12namespace V1_0 {
13namespace implementation {
14
15using ::android::hardware::gnss::V1_0::IGnssBatching;
16using ::android::hardware::gnss::V1_0::IGnssBatchingCallback;
17using ::android::hidl::base::V1_0::IBase;
18using ::android::hardware::hidl_array;
19using ::android::hardware::hidl_memory;
20using ::android::hardware::hidl_string;
21using ::android::hardware::hidl_vec;
22using ::android::hardware::Return;
23using ::android::hardware::Void;
24using ::android::sp;
25
26struct GnssBatching : public IGnssBatching {
27 GnssBatching(const FlpLocationInterface* flpLocationIface);
28
29 // Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow.
30 Return<bool> init(const sp<IGnssBatchingCallback>& callback) override;
31 Return<uint16_t> getBatchSize() override;
32 Return<bool> start(const IGnssBatching::Options& options ) override;
33 Return<void> flush() override;
34 Return<bool> stop() override;
35 Return<void> cleanup() override;
36
Wyatt Riley8791e7b2017-01-17 12:12:25 -080037 /*
38 * Callback methods to be passed into the conventional FLP HAL by the default
39 * implementation. These methods are not part of the IGnssBatching base class.
40 */
41 static void locationCb(int32_t locationsCount, FlpLocation** locations);
42 static void acquireWakelockCb();
43 static void releaseWakelockCb();
44 static int32_t setThreadEventCb(ThreadEvent event);
45 static void flpCapabilitiesCb(int32_t capabilities);
46 static void flpStatusCb(int32_t status);
47
48 /*
49 * Holds function pointers to the callback methods.
50 */
51 static FlpCallbacks sFlpCb;
52
Wyatt Rileyad03ab22016-12-14 14:54:29 -080053 private:
54 const FlpLocationInterface* mFlpLocationIface = nullptr;
Wyatt Riley8791e7b2017-01-17 12:12:25 -080055 static sp<IGnssBatchingCallback> sGnssBatchingCbIface;
56 static bool sFlpSupportsBatching;
Wyatt Rileyad03ab22016-12-14 14:54:29 -080057};
58
59extern "C" IGnssBatching* HIDL_FETCH_IGnssBatching(const char* name);
60
61} // namespace implementation
62} // namespace V1_0
63} // namespace gnss
64} // namespace hardware
65} // namespace android
66
67#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H