blob: e227e1710247bb5df747985094a984a1ce73a95c [file] [log] [blame]
Hridya Valsaraju29dc1e02016-10-21 14:41:12 -07001/*
2 * Copyright (C) 2016 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 "GnssHAL_GnssDebugInterface"
18
19#include "GnssDebug.h"
20
21namespace android {
22namespace hardware {
23namespace gnss {
24namespace V1_0 {
25namespace implementation {
26
27GnssDebug::GnssDebug(const GpsDebugInterface* gpsDebugIface) : mGnssDebugIface(gpsDebugIface) {}
28
29// Methods from ::android::hardware::gnss::V1_0::IGnssDebug follow.
30Return<void> GnssDebug::getDebugData(getDebugData_cb _hidl_cb) {
31 /*
32 * This is a new interface and hence there is no way to retrieve the
33 * debug data from the HAL.
34 */
35 DebugData data = {};
36
37 _hidl_cb(data);
38
39 /*
40 * Log the debug data sent from the conventional Gnss HAL. This code is
41 * moved here from GnssLocationProvider.
42 */
43 if (mGnssDebugIface) {
44 char buffer[kMaxDebugStrLen + 1];
45 size_t length = mGnssDebugIface->get_internal_state(buffer, kMaxDebugStrLen);
46 length = std::max(length, kMaxDebugStrLen);
47 buffer[length] = '\0';
48 ALOGD("Gnss Debug Data: %s", buffer);
49 }
50 return Void();
51}
52
53} // namespace implementation
54} // namespace V1_0
55} // namespace gnss
56} // namespace hardware
57} // namespace android