From: TrillGates Date: Tue, 16 Nov 2021 07:59:56 +0000 (+0800) Subject: 添加了Log X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=f59908293cad2a9acc1397f5b3982ca14ae0e670;p=protocol_srv.git 添加了Log --- diff --git a/app/src/main/java/com/ic/protocolSrv/NMEAListener.java b/app/src/main/java/com/ic/protocolSrv/NMEAListener.java index 7d1a35fa..42e14c96 100644 --- a/app/src/main/java/com/ic/protocolSrv/NMEAListener.java +++ b/app/src/main/java/com/ic/protocolSrv/NMEAListener.java @@ -138,9 +138,22 @@ public class NMEAListener implements NmeaListener, LocationListener { static int satindex = 0; + /** + * GPS信息类型: + *

+ * GPGSV:可见卫星信息 + * GPGLL:地理定位信息 + * GPRMC:推荐最小定位信息 + * GPVTG:地面速度信息 + * GPGGA:GPS定位信息 + * GPGSA:当前卫星信息 + * + * @param paramLong + * @param nmeastr + */ public void onNmeaReceived(long paramLong, String nmeastr) { // EqcAlgorithmNative.native_EqcAlgorithmMethod5(paramString); -// ICLogger.i("Nmea :"+nmeastr+" "+paramLong); + ICLogger.i("Nmea :" + nmeastr + " " + paramLong); if (Config.LOG_TOFILE) ICLogger.logToFile("Nmea", nmeastr); @@ -169,7 +182,10 @@ public class NMEAListener implements NmeaListener, LocationListener { ICLogger.i(sb.toString()); // 卫星总数小于2 ,或者 snr小于20 - if (runtime.getLocationInstance().numSatelliteList.size() < 3 && (runtime.getLocationInstance().max3Satellite.size() > 0 ? (runtime.getLocationInstance().max3Satellite.get(0).getSnr() < 20 ? true : false) : true)) { + ICLogger.d("runtime.getLocationInstance().numSatelliteList.size() ==> " + runtime.getLocationInstance().numSatelliteList.size()); + if (runtime.getLocationInstance().numSatelliteList.size() < 3 && + (runtime.getLocationInstance().max3Satellite.size() <= 0 || + (runtime.getLocationInstance().max3Satellite.get(0).getSnr() < 20))) { noSignalCount++; } else { noSignalCount = 0;//只要有一次满足有信号,则重新开始计数。 @@ -192,10 +208,9 @@ public class NMEAListener implements NmeaListener, LocationListener { } } ICLogger.i(sb2.toString()); - if (Config.LOG_TOFILE) + if (Config.LOG_TOFILE) { ICLogger.logToFile("GPS", sb2.toString()); - - + } if (mCallback != null) mCallback.on_locating_changed(get_gps_status()); } @@ -292,6 +307,7 @@ public class NMEAListener implements NmeaListener, LocationListener { } try { SatlitesCount = Integer.valueOf(tmplist[3]); + ICLogger.d("SatlitesCount ==> " + SatlitesCount); } catch (Exception e) { } if (maxPageCount > 0 && currentPage == 1) { @@ -300,30 +316,37 @@ public class NMEAListener implements NmeaListener, LocationListener { gps_status.satlite_numbss = SatlitesCount; } int satcount = (tmplist.length - 4) / 4; -// ICLogger.i("Nmea :"+nmeastr+" "+satcount); + ICLogger.d("satcount ==> " + satcount); + ICLogger.i("Nmea :" + nmeastr + " " + satcount); runtime.getLocationInstance().set_adding_satlite_flag(true); for (int i = 0; i < satcount; i++) { satindex++; String prn = tmplist[i * 4 + 4]; String snr = tmplist[i * 4 + 4 + 3]; + ICLogger.d("snr ==> " + snr); + ICLogger.d("prn ==> " + prn); if (snr.contains("*")) { snr = snr.substring(0, snr.indexOf("*")); } + ICLogger.d("snr ***> " + snr); if (snr.trim().isEmpty()) { snr = "0"; } -// ICLogger.i("Sat=" + satindex + ",prn=" + prn + ",snr=" + snr); - + ICLogger.d("snr after empty > " + snr); + //ICLogger.i("Sat=" + satindex + ",prn=" + prn + ",snr=" + snr); int intprn = 0; try { - intprn = Integer.valueOf(prn); + intprn = Integer.parseInt(prn); } catch (Exception e) { } float floatsnr = 0; try { - floatsnr = Float.valueOf(snr); + ICLogger.d("snr before parse==> " + snr); + floatsnr = Float.parseFloat(snr); + ICLogger.d("floatsnr parse ==> " + floatsnr); } catch (Exception e) { } + ICLogger.d("floatsnr ==> " + floatsnr); if (floatsnr > 0) { //排序取得最大3个SNR get3MaxSnrSatellite(new ICLocation.GpsSatellitePriv(intprn, floatsnr)); @@ -441,7 +464,7 @@ public class NMEAListener implements NmeaListener, LocationListener { } } - }else if (nmeastr.startsWith("$GPGSA,") || nmeastr.startsWith("$GNGSA,") || nmeastr.startsWith("$BDGSA,")) { + } else if (nmeastr.startsWith("$GPGSA,") || nmeastr.startsWith("$GNGSA,") || nmeastr.startsWith("$BDGSA,")) { // GPGSA编辑 //( 当前卫星信息) @@ -628,7 +651,7 @@ public class NMEAListener implements NmeaListener, LocationListener { //做个热启动 return true;//gpsHotStart(); - }else { + } else { ICLogger.i(" location listening, skip !"); runtime.getLocationInstance().setLocationStat(ICLocation.LOCATION_STAT.LOCATION_SEARCHING);