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