summaryrefslogtreecommitdiffstats
path: root/gnss/1.0-legacy/GnssBatching.h
blob: 001c27d8e79e14b9f9e2f199f9c11cb594e14142 (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
#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H
#define ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H

#include <android/hardware/gnss/1.0/IGnssBatching.h>
#include <hardware/fused_location.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>

namespace android {
namespace hardware {
namespace gnss {
namespace V1_0 {
namespace implementation {

using ::android::hardware::gnss::V1_0::IGnssBatching;
using ::android::hardware::gnss::V1_0::IGnssBatchingCallback;
using ::android::hidl::base::V1_0::IBase;
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;

struct GnssBatching : public IGnssBatching {
    GnssBatching(const FlpLocationInterface* flpLocationIface);

    // Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow.
    Return<bool> init(const sp<IGnssBatchingCallback>& callback) override;
    Return<uint16_t> getBatchSize() override;
    Return<bool> start(const IGnssBatching::Options& options ) override;
    Return<void> flush() override;
    Return<bool> stop() override;
    Return<void> cleanup() override;

    /*
     * Callback methods to be passed into the conventional FLP HAL by the default
     * implementation. These methods are not part of the IGnssBatching base class.
     */
    static void locationCb(int32_t locationsCount, FlpLocation** locations);
    static void acquireWakelockCb();
    static void releaseWakelockCb();
    static int32_t setThreadEventCb(ThreadEvent event);
    static void flpCapabilitiesCb(int32_t capabilities);
    static void flpStatusCb(int32_t status);

    /*
     * Holds function pointers to the callback methods.
     */
    static FlpCallbacks sFlpCb;

 private:
    const FlpLocationInterface* mFlpLocationIface = nullptr;
    static sp<IGnssBatchingCallback> sGnssBatchingCbIface;
    static bool sFlpSupportsBatching;
};

extern "C" IGnssBatching* HIDL_FETCH_IGnssBatching(const char* name);

}  // namespace implementation
}  // namespace V1_0
}  // namespace gnss
}  // namespace hardware
}  // namespace android

#endif  // ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H