1 /* 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 <log/log.h> 20 21 #include "GnssDebug.h" 22 23 namespace android { 24 namespace hardware { 25 namespace gnss { 26 namespace V1_0 { 27 namespace implementation { 28 GnssDebug(const GpsDebugInterface * gpsDebugIface)29GnssDebug::GnssDebug(const GpsDebugInterface* gpsDebugIface) : mGnssDebugIface(gpsDebugIface) {} 30 31 // Methods from ::android::hardware::gnss::V1_0::IGnssDebug follow. getDebugData(getDebugData_cb _hidl_cb)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 60