Home | History | Annotate | Download | only in default
      1 #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 
      9 namespace android {
     10 namespace hardware {
     11 namespace gnss {
     12 namespace V1_0 {
     13 namespace implementation {
     14 
     15 using ::android::hardware::gnss::V1_0::IGnssBatching;
     16 using ::android::hardware::gnss::V1_0::IGnssBatchingCallback;
     17 using ::android::hidl::base::V1_0::IBase;
     18 using ::android::hardware::hidl_array;
     19 using ::android::hardware::hidl_memory;
     20 using ::android::hardware::hidl_string;
     21 using ::android::hardware::hidl_vec;
     22 using ::android::hardware::Return;
     23 using ::android::hardware::Void;
     24 using ::android::sp;
     25 
     26 struct 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 
     37     /*
     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 
     53  private:
     54     const FlpLocationInterface* mFlpLocationIface = nullptr;
     55     static sp<IGnssBatchingCallback> sGnssBatchingCbIface;
     56     static bool sFlpSupportsBatching;
     57 };
     58 
     59 extern "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
     68