summaryrefslogtreecommitdiff
path: root/gnss/aidl/vts/GnssCallbackAidl.h
blob: a9495ba3c2261df95da9f614c5ef0fbb3eeaff0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <android/hardware/gnss/BnGnssCallback.h>
#include <utility>
#include "GnssCallbackEventQueue.h"

/* Callback class for data & Event. */
class GnssCallbackAidl : public android::hardware::gnss::BnGnssCallback {
  public:
    GnssCallbackAidl()
        : capabilities_cbq_("capabilities"),
          info_cbq_("system_info"),
          location_cbq_("location"),
          sv_info_list_cbq_("sv_info"),
          nmea_cbq_("nmea"){};
    ~GnssCallbackAidl(){};

    android::binder::Status gnssSetCapabilitiesCb(const int capabilities) override;
    android::binder::Status gnssStatusCb(const GnssStatusValue status) override;
    android::binder::Status gnssSvStatusCb(const std::vector<GnssSvInfo>& svInfoList) override;
    android::binder::Status gnssLocationCb(
            const android::hardware::gnss::GnssLocation& location) override;
    android::binder::Status gnssNmeaCb(const int64_t timestamp, const std::string& nmea) override;
    android::binder::Status gnssAcquireWakelockCb() override;
    android::binder::Status gnssReleaseWakelockCb() override;
    android::binder::Status gnssSetSystemInfoCb(const GnssSystemInfo& info) override;
    android::binder::Status gnssRequestTimeCb() override;
    android::binder::Status gnssRequestLocationCb(const bool independentFromGnss,
                                                  const bool isUserEmergency) override;

    int last_capabilities_;
    android::hardware::gnss::IGnssCallback::GnssSystemInfo last_info_;
    android::hardware::gnss::GnssLocation last_location_;

    android::hardware::gnss::common::GnssCallbackEventQueue<int> capabilities_cbq_;
    android::hardware::gnss::common::GnssCallbackEventQueue<
            android::hardware::gnss::IGnssCallback::GnssSystemInfo>
            info_cbq_;
    android::hardware::gnss::common::GnssCallbackEventQueue<android::hardware::gnss::GnssLocation>
            location_cbq_;
    android::hardware::gnss::common::GnssCallbackEventQueue<
            std::vector<android::hardware::gnss::IGnssCallback::GnssSvInfo>>
            sv_info_list_cbq_;
    android::hardware::gnss::common::GnssCallbackEventQueue<std::pair<int64_t, std::string>>
            nmea_cbq_;
};