From: snicker Date: Sun, 15 Mar 2020 16:09:36 +0000 (+0800) Subject: Release V377 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=48fa9c5195cf55f1e713a24baea4606d3812948f;p=protocol_srv.git Release V377 1、为每条GPS定位记录都加上 度坐标转换。方便在其他软件中定位。 2、为每次定位开始时判定只有当当前定位不是是GPS定位的情况下才需要关闭GPSListen,解决有时第一次定位困难问题。 3、增加 10次心跳无法连接,就重置SIM卡的功能。尝试解决掉卡问题,不过这种掉卡后 大于 10*6=60分钟重置一次的恢复机制,是不是太长了,需要和客户讨论。暂时只是提供了这样一个机制。 --- diff --git a/app/release/ICSer_V377_2003160004_release.apk b/app/release/ICSer_V377_2003160004_release.apk new file mode 100644 index 00000000..3965f6b6 Binary files /dev/null and b/app/release/ICSer_V377_2003160004_release.apk differ diff --git a/app/src/main/java/com/enqualcomm/support/CoreService.java b/app/src/main/java/com/enqualcomm/support/CoreService.java index 1437020d..7384b324 100644 --- a/app/src/main/java/com/enqualcomm/support/CoreService.java +++ b/app/src/main/java/com/enqualcomm/support/CoreService.java @@ -889,6 +889,7 @@ public class CoreService extends Service { } } + private static int no_network_Heartbeats_Count=0; public void ReConnectToServer(){ @@ -897,11 +898,13 @@ public class CoreService extends Service { // isServerConnected 成功则停止重试, KeepAlive会检测AP03心跳包的成功与否。此处只管socket连接是否成功 if (connection.isServerConnected()) { ICLogger.i("retry 如果连接成功则停止重试!"); + no_network_Heartbeats_Count=0; stopConnectionRetryTimer(); }else { if (retry_connect_count >= retry_connect_max_times) { ICLogger.i("retry " + retry_connect_count + " 次 >= " + retry_connect_max_times + " ,停止重试!等待下一次心跳再重试!"); + no_network_Heartbeats_Count++; stopConnectionRetryTimer(); } else { @@ -918,8 +921,13 @@ public class CoreService extends Service { }else{ //没有网络就不用重新尝试连接网络了。网络连接后再重新尝试联网 ICLogger.i("retry 没有网络就不用重新尝试连接网络了。网络连接后再重新尝试联网!"); + no_network_Heartbeats_Count++; stopConnectionRetryTimer(); } + if( no_network_Heartbeats_Count >10){ + ICLogger.i("当前第"+no_network_Heartbeats_Count+"次心跳都没有连接服务器成功 > 10 ,重置SIM卡尝试重新注册网络!"); + SimSignalUtil.send_at_to_onoff_simcard(runtime); + } } public void stopConnectionRetryTimer(){ diff --git a/app/src/main/java/com/enqualcomm/support/NMEAListener.java b/app/src/main/java/com/enqualcomm/support/NMEAListener.java index cd4ccd79..23b0be68 100644 --- a/app/src/main/java/com/enqualcomm/support/NMEAListener.java +++ b/app/src/main/java/com/enqualcomm/support/NMEAListener.java @@ -68,9 +68,24 @@ public class NMEAListener implements NmeaListener, LocationListener { public void setNoStop(boolean nostop){ noStop=nostop; - ICLogger.i("setNoStop"+nostop); - if (noStop==false){ - stopListen(); + ICLogger.i("setNoStop "+nostop); + if (noStop==false ){ + switch (runtime.getLocationInstance().getWorkingMod()){ + case ICLocation.CUSTOM_MOD: + case ICLocation.EMERGNECY_MOD: + case ICLocation.REALTIME_MOD: + //GPS 定位模式不关闭GPS,防止 1分钟定位超时后,重新关闭开启GPS。 + //不给GPS继续定位的机会,造成第一次定位困难! + break; + case ICLocation.LOWPOWER_MOD: + case ICLocation.NORMAL_MOD: + default: + ICLogger.i("非GPS定位模式,关闭GPS"); + //非GPS定位模式的话,需要关闭GPS。 + stopListen(); + break; + } + } } public NMEAListener(LocationManager paramLocationManager, Runtime paramRuntime) { @@ -265,9 +280,30 @@ public class NMEAListener implements NmeaListener, LocationListener { String usedStarts=tmplist[7]; String hdop=tmplist[8]; if ( (fixed.trim().equals("1"))||(fixed.trim().equals("2"))||(fixed.trim().equals("6"))){ + + + // 转换GPS坐标为度,以便在各种应用中可以方便查找。 + latitude=Double.valueOf(Lat); + longitude=Double.valueOf(lon); + // 转换单位,从分转换到度 + + double intdu= (int)(longitude /100f); //小数转换到分为单位 + double du=(longitude - intdu*100)/60f; + double last= intdu+du; + longitude =last; + intdu= (int)(latitude /100f); //小数转换到分为单位 + du=(latitude - intdu*100)/60f; + last= intdu+du; + latitude=last; + + // 经纬度 保留4位小数点 + DecimalFormat df = new DecimalFormat("#.000000"); + String strLatitude = df.format(latitude); + String strLongitude = df.format(longitude); + //定位 StringBuilder sb=new StringBuilder(); - sb.append("GPGGA, location time= " + TimeUtil.getLocalTime() + ", FixedCount=" + locationFixedCount + ", GPSTime="+utctime+", Lat="+Lat+", Lon="+lon+", fixed="+fixed+", hdop="+hdop+", usedStarts="+usedStarts); + sb.append("GPGGA, location time= " + TimeUtil.getLocalTime() + ", FixedCount=" + locationFixedCount + ", GPSTime="+utctime+", Lat="+Lat+" ("+strLatitude+"), Lon="+lon+" ("+strLongitude+"), fixed="+fixed+", hdop="+hdop+", usedStarts="+usedStarts); ICLogger.i(sb.toString()); if (Config.LOG_TOFILE) FileOutputUtil.fileOutput(this.runtime.getCacheDir(), "GPS", sb.toString()); @@ -284,31 +320,6 @@ public class NMEAListener implements NmeaListener, LocationListener { 只有当前GPS已经定位,且location不为空才给 runtime赋值GPS坐标。 延迟MaxFixedTimes秒后才设置runtime的定位标志,以便稳定坐标值。 */ - - //log msg变量 - StringBuffer sb2 = new StringBuffer(); - sb2.append(" gps lat=").append(Lat).append(", gps lon=").append(lon); - - latitude=Double.valueOf(Lat); - longitude=Double.valueOf(lon); - // 转换单位,从分转换到度 - - double intdu= (int)(longitude /100f); //小数转换到分为单位 - double du=(longitude - intdu*100)/60f; - double last= intdu+du; - longitude =last; - intdu= (int)(latitude /100f); //小数转换到分为单位 - du=(latitude - intdu*100)/60f; - last= intdu+du; - latitude=last; - - // 经纬度 保留4位小数点 - DecimalFormat df = new DecimalFormat("#.000000"); - String strLatitude = df.format(latitude); - String strLongitude = df.format(longitude); - sb2.append(" real lat=").append(strLatitude).append(" lon=").append(strLongitude); - ICLogger.i(sb2.toString()); - runtime.getLocationInstance().setLocation(Lat,lon); runtime.getLocationInstance().setUsedStarts(Integer.valueOf(usedStarts.trim())); runtime.getLocationInstance().setHod(Float.valueOf(hdop.trim())); diff --git a/app/src/main/java/com/enqualcomm/support/service/Deliver.java b/app/src/main/java/com/enqualcomm/support/service/Deliver.java index 1d1bd532..2f1b2f67 100644 --- a/app/src/main/java/com/enqualcomm/support/service/Deliver.java +++ b/app/src/main/java/com/enqualcomm/support/service/Deliver.java @@ -78,7 +78,7 @@ public class Deliver extends AbstractConnectionService { private static ReentrantLock lock = new ReentrantLock(); private static Condition mCondition = mLock.newCondition(); - public static LinkedBlockingDeque queue = new LinkedBlockingDeque(50); + public static LinkedBlockingDeque queue = new LinkedBlockingDeque(90); private static FileCache fileCache; private static NettyConnection connection; diff --git a/app/version_code.properties b/app/version_code.properties index 439698ba..70a983de 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Sat Mar 14 17:23:03 CST 2020 -VERSION_CODE=376 +#Mon Mar 16 00:04:13 CST 2020 +VERSION_CODE=377 diff --git a/local.properties b/local.properties index e532068d..2d9e691a 100644 --- a/local.properties +++ b/local.properties @@ -4,5 +4,5 @@ # Location of the SDK. This is only used by Gradle. # For customization when using a Version Control System, please read the # header note. -#Sat Feb 29 15:03:30 CST 2020 -sdk.dir=C\:\\Users\\incar\\AppData\\Local\\Android\\Sdk +#Sun Mar 15 23:29:11 CST 2020 +sdk.dir=E\:\\Android\\sdk