blob: a9495ba3c2261df95da9f614c5ef0fbb3eeaff0e [file] [log] [blame]
Yu-Han Yang1e1a6762020-09-30 17:01:53 -07001/*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <android/hardware/gnss/BnGnssCallback.h>
Yu-Han Yang19a32b62022-04-27 09:57:01 -070020#include <utility>
Yu-Han Yang1e1a6762020-09-30 17:01:53 -070021#include "GnssCallbackEventQueue.h"
22
23/* Callback class for data & Event. */
24class GnssCallbackAidl : public android::hardware::gnss::BnGnssCallback {
25 public:
Yu-Han Yang1afbd5f2021-11-24 16:39:13 -080026 GnssCallbackAidl()
27 : capabilities_cbq_("capabilities"),
28 info_cbq_("system_info"),
29 location_cbq_("location"),
Yu-Han Yang19a32b62022-04-27 09:57:01 -070030 sv_info_list_cbq_("sv_info"),
31 nmea_cbq_("nmea"){};
Yu-Han Yang1e1a6762020-09-30 17:01:53 -070032 ~GnssCallbackAidl(){};
33
34 android::binder::Status gnssSetCapabilitiesCb(const int capabilities) override;
Yu-Han Yang1afbd5f2021-11-24 16:39:13 -080035 android::binder::Status gnssStatusCb(const GnssStatusValue status) override;
36 android::binder::Status gnssSvStatusCb(const std::vector<GnssSvInfo>& svInfoList) override;
37 android::binder::Status gnssLocationCb(
38 const android::hardware::gnss::GnssLocation& location) override;
39 android::binder::Status gnssNmeaCb(const int64_t timestamp, const std::string& nmea) override;
40 android::binder::Status gnssAcquireWakelockCb() override;
41 android::binder::Status gnssReleaseWakelockCb() override;
42 android::binder::Status gnssSetSystemInfoCb(const GnssSystemInfo& info) override;
43 android::binder::Status gnssRequestTimeCb() override;
44 android::binder::Status gnssRequestLocationCb(const bool independentFromGnss,
45 const bool isUserEmergency) override;
Yu-Han Yang1e1a6762020-09-30 17:01:53 -070046
47 int last_capabilities_;
Yu-Han Yang1afbd5f2021-11-24 16:39:13 -080048 android::hardware::gnss::IGnssCallback::GnssSystemInfo last_info_;
49 android::hardware::gnss::GnssLocation last_location_;
50
Yu-Han Yang1e1a6762020-09-30 17:01:53 -070051 android::hardware::gnss::common::GnssCallbackEventQueue<int> capabilities_cbq_;
Yu-Han Yang1afbd5f2021-11-24 16:39:13 -080052 android::hardware::gnss::common::GnssCallbackEventQueue<
53 android::hardware::gnss::IGnssCallback::GnssSystemInfo>
54 info_cbq_;
55 android::hardware::gnss::common::GnssCallbackEventQueue<android::hardware::gnss::GnssLocation>
56 location_cbq_;
57 android::hardware::gnss::common::GnssCallbackEventQueue<
58 std::vector<android::hardware::gnss::IGnssCallback::GnssSvInfo>>
59 sv_info_list_cbq_;
Yu-Han Yang19a32b62022-04-27 09:57:01 -070060 android::hardware::gnss::common::GnssCallbackEventQueue<std::pair<int64_t, std::string>>
61 nmea_cbq_;
Yu-Han Yang1e1a6762020-09-30 17:01:53 -070062};