• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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>
20 #include <utility>
21 #include "GnssCallbackEventQueue.h"
22 
23 /* Callback class for data & Event. */
24 class GnssCallbackAidl : public android::hardware::gnss::BnGnssCallback {
25   public:
GnssCallbackAidl()26     GnssCallbackAidl()
27         : capabilities_cbq_("capabilities"),
28           info_cbq_("system_info"),
29           location_cbq_("location"),
30           sv_info_list_cbq_("sv_info"),
31           nmea_cbq_("nmea"){};
~GnssCallbackAidl()32     ~GnssCallbackAidl(){};
33 
34     android::binder::Status gnssSetCapabilitiesCb(const int capabilities) override;
35     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;
46 
47     int last_capabilities_;
48     android::hardware::gnss::IGnssCallback::GnssSystemInfo last_info_;
49     android::hardware::gnss::GnssLocation last_location_;
50 
51     android::hardware::gnss::common::GnssCallbackEventQueue<int> capabilities_cbq_;
52     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_;
60     android::hardware::gnss::common::GnssCallbackEventQueue<std::pair<int64_t, std::string>>
61             nmea_cbq_;
62 };