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