blob: 8fab85767ea4db31e8bf14cdfe447468ddfbe8ce [file] [log] [blame]
Michael Bestas3a0209e2023-05-04 01:15:47 +03001/*
2 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
3 * Not a Contribution
4 */
5/*
6 * Copyright (C) 2016 The Android Open Source Project
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21#ifndef ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H
22#define ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H
23
24#include <android/hardware/gnss/1.0/IGnssBatching.h>
25#include <hidl/Status.h>
26
27
28namespace android {
29namespace hardware {
30namespace gnss {
31namespace V1_0 {
32namespace implementation {
33
34using ::android::hardware::gnss::V1_0::IGnssBatching;
35using ::android::hardware::gnss::V1_0::IGnssBatchingCallback;
36using ::android::hidl::base::V1_0::IBase;
37using ::android::hardware::hidl_array;
38using ::android::hardware::hidl_memory;
39using ::android::hardware::hidl_string;
40using ::android::hardware::hidl_vec;
41using ::android::hardware::Return;
42using ::android::hardware::Void;
43using ::android::sp;
44
45class BatchingAPIClient;
46struct GnssBatching : public IGnssBatching {
47 GnssBatching();
48 ~GnssBatching();
49
50 // Methods from ::android::hardware::gnss::V1_0::IGnssBatching follow.
51 Return<bool> init(const sp<IGnssBatchingCallback>& callback) override;
52 Return<uint16_t> getBatchSize() override;
53 Return<bool> start(const IGnssBatching::Options& options ) override;
54 Return<void> flush() override;
55 Return<bool> stop() override;
56 Return<void> cleanup() override;
57
58 private:
59 struct GnssBatchingDeathRecipient : hidl_death_recipient {
60 GnssBatchingDeathRecipient(sp<GnssBatching> gnssBatching) :
61 mGnssBatching(gnssBatching) {
62 }
63 ~GnssBatchingDeathRecipient() = default;
64 virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override;
65 sp<GnssBatching> mGnssBatching;
66 };
67
68 private:
69 sp<GnssBatchingDeathRecipient> mGnssBatchingDeathRecipient = nullptr;
70 sp<IGnssBatchingCallback> mGnssBatchingCbIface = nullptr;
71 BatchingAPIClient* mApi = nullptr;
72};
73
74} // namespace implementation
75} // namespace V1_0
76} // namespace gnss
77} // namespace hardware
78} // namespace android
79
80#endif // ANDROID_HARDWARE_GNSS_V1_0_GNSSBATCHING_H