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 #define LOG_TAG "GnssPwrIndCallback"
18
19 #include "GnssPowerIndicationCallback.h"
20 #include <log/log.h>
21
22 using android::hardware::gnss::GnssPowerStats;
23
setCapabilitiesCb(const int capabilities)24 android::binder::Status GnssPowerIndicationCallback::setCapabilitiesCb(const int capabilities) {
25 ALOGI("Capabilities received %d", capabilities);
26 capabilities_cbq_.store(capabilities);
27 return android::binder::Status::ok();
28 }
29
gnssPowerStatsCb(const GnssPowerStats & gnssPowerStats)30 android::binder::Status GnssPowerIndicationCallback::gnssPowerStatsCb(
31 const GnssPowerStats& gnssPowerStats) {
32 ALOGI("gnssPowerStatsCb");
33 ALOGI("elapsedRealtime: %ld, totalEnergyMilliJoule: %f",
34 (long)gnssPowerStats.elapsedRealtime.timestampNs, gnssPowerStats.totalEnergyMilliJoule);
35 ALOGI("singlebandTrackingModeEnergyMilliJoule: %f, multibandTrackingModeEnergyMilliJoule: %f",
36 gnssPowerStats.singlebandTrackingModeEnergyMilliJoule,
37 gnssPowerStats.multibandTrackingModeEnergyMilliJoule);
38 ALOGI("singlebandAcquisitionModeEnergyMilliJoule: %f, "
39 "multibandAcquisitionModeEnergyMilliJoule: %f",
40 gnssPowerStats.singlebandAcquisitionModeEnergyMilliJoule,
41 gnssPowerStats.multibandAcquisitionModeEnergyMilliJoule);
42 for (const auto& otherModeEnergyMilliJoule : gnssPowerStats.otherModesEnergyMilliJoule) {
43 ALOGI("otherModeEnergyMilliJoule: %f", otherModeEnergyMilliJoule);
44 }
45 gnss_power_stats_cbq_.store(gnssPowerStats);
46 return android::binder::Status::ok();
47 }
48