12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #ifndef BATCHING_API_CLINET_H
- #define BATCHING_API_CLINET_H
- #include <mutex>
- #include <android/hardware/gnss/2.0/IGnssBatching.h>
- #include <android/hardware/gnss/2.0/IGnssBatchingCallback.h>
- #include <pthread.h>
- #include <LocationAPIClientBase.h>
- namespace android {
- namespace hardware {
- namespace gnss {
- namespace V2_0 {
- namespace implementation {
- class BatchingAPIClient : public LocationAPIClientBase
- {
- public:
- BatchingAPIClient(const sp<V1_0::IGnssBatchingCallback>& callback);
- BatchingAPIClient(const sp<V2_0::IGnssBatchingCallback>& callback);
- void gnssUpdateCallbacks(const sp<V1_0::IGnssBatchingCallback>& callback);
- void gnssUpdateCallbacks_2_0(const sp<V2_0::IGnssBatchingCallback>& callback);
- int getBatchSize();
- int startSession(const V1_0::IGnssBatching::Options& options);
- int updateSessionOptions(const V1_0::IGnssBatching::Options& options);
- int stopSession();
- void getBatchedLocation(int last_n_locations);
- void flushBatchedLocations();
- inline LocationCapabilitiesMask getCapabilities() { return mLocationCapabilitiesMask; }
-
- void onCapabilitiesCb(LocationCapabilitiesMask capabilitiesMask) final;
- void onBatchingCb(size_t count, Location* location, BatchingOptions batchOptions) final;
- private:
- void setCallbacks();
- ~BatchingAPIClient();
- std::mutex mMutex;
- sp<V1_0::IGnssBatchingCallback> mGnssBatchingCbIface;
- uint32_t mDefaultId;
- LocationCapabilitiesMask mLocationCapabilitiesMask;
- sp<V2_0::IGnssBatchingCallback> mGnssBatchingCbIface_2_0;
- };
- }
- }
- }
- }
- }
- #endif
|