Release V377
authorsnicker <snickersun@163.com>
Sun, 15 Mar 2020 16:09:36 +0000 (00:09 +0800)
committersnicker <snickersun@163.com>
Sun, 15 Mar 2020 16:09:36 +0000 (00:09 +0800)
1、为每条GPS定位记录都加上 度坐标转换。方便在其他软件中定位。
2、为每次定位开始时判定只有当当前定位不是是GPS定位的情况下才需要关闭GPSListen,解决有时第一次定位困难问题。
3、增加 10次心跳无法连接,就重置SIM卡的功能。尝试解决掉卡问题,不过这种掉卡后 大于 10*6=60分钟重置一次的恢复机制,是不是太长了,需要和客户讨论。暂时只是提供了这样一个机制。

app/release/ICSer_V377_2003160004_release.apk [new file with mode: 0644]
app/src/main/java/com/enqualcomm/support/CoreService.java
app/src/main/java/com/enqualcomm/support/NMEAListener.java
app/src/main/java/com/enqualcomm/support/service/Deliver.java
app/version_code.properties
local.properties

diff --git a/app/release/ICSer_V377_2003160004_release.apk b/app/release/ICSer_V377_2003160004_release.apk
new file mode 100644 (file)
index 0000000..3965f6b
Binary files /dev/null and b/app/release/ICSer_V377_2003160004_release.apk differ
index 1437020..7384b32 100644 (file)
@@ -889,6 +889,7 @@ public class CoreService extends Service {
         }\r
     }\r
 \r
+    private static int no_network_Heartbeats_Count=0;\r
 \r
     public void ReConnectToServer(){\r
 \r
@@ -897,11 +898,13 @@ public class CoreService extends Service {
             // isServerConnected 成功则停止重试, KeepAlive会检测AP03心跳包的成功与否。此处只管socket连接是否成功\r
             if (connection.isServerConnected()) {\r
                 ICLogger.i("retry  如果连接成功则停止重试!");\r
+                no_network_Heartbeats_Count=0;\r
                 stopConnectionRetryTimer();\r
             }else {\r
                 if (retry_connect_count >= retry_connect_max_times) {\r
 \r
                     ICLogger.i("retry " + retry_connect_count + " 次 >= " + retry_connect_max_times + " ,停止重试!等待下一次心跳再重试!");\r
+                    no_network_Heartbeats_Count++;\r
                     stopConnectionRetryTimer();\r
 \r
                 } else {\r
@@ -918,8 +921,13 @@ public class CoreService extends Service {
         }else{\r
             //没有网络就不用重新尝试连接网络了。网络连接后再重新尝试联网\r
             ICLogger.i("retry 没有网络就不用重新尝试连接网络了。网络连接后再重新尝试联网!");\r
+            no_network_Heartbeats_Count++;\r
             stopConnectionRetryTimer();\r
         }\r
+        if( no_network_Heartbeats_Count >10){\r
+            ICLogger.i("当前第"+no_network_Heartbeats_Count+"次心跳都没有连接服务器成功 > 10 ,重置SIM卡尝试重新注册网络!");\r
+            SimSignalUtil.send_at_to_onoff_simcard(runtime);\r
+        }\r
     }\r
 \r
     public void stopConnectionRetryTimer(){\r
index cd4ccd7..23b0be6 100644 (file)
@@ -68,9 +68,24 @@ public class NMEAListener implements NmeaListener, LocationListener {
 \r
   public void setNoStop(boolean nostop){\r
     noStop=nostop;\r
-    ICLogger.i("setNoStop"+nostop);\r
-    if (noStop==false){\r
-      stopListen();\r
+    ICLogger.i("setNoStop "+nostop);\r
+    if (noStop==false ){\r
+      switch (runtime.getLocationInstance().getWorkingMod()){\r
+        case ICLocation.CUSTOM_MOD:\r
+        case ICLocation.EMERGNECY_MOD:\r
+        case ICLocation.REALTIME_MOD:\r
+          //GPS 定位模式不关闭GPS,防止 1分钟定位超时后,重新关闭开启GPS。\r
+          //不给GPS继续定位的机会,造成第一次定位困难!\r
+          break;\r
+        case ICLocation.LOWPOWER_MOD:\r
+        case ICLocation.NORMAL_MOD:\r
+        default:\r
+          ICLogger.i("非GPS定位模式,关闭GPS");\r
+          //非GPS定位模式的话,需要关闭GPS。\r
+          stopListen();\r
+          break;\r
+      }\r
+\r
     }\r
   }\r
   public NMEAListener(LocationManager paramLocationManager, Runtime paramRuntime) {\r
@@ -265,9 +280,30 @@ public class NMEAListener implements NmeaListener, LocationListener {
       String usedStarts=tmplist[7];\r
       String hdop=tmplist[8];\r
       if ( (fixed.trim().equals("1"))||(fixed.trim().equals("2"))||(fixed.trim().equals("6"))){\r
+\r
+\r
+          // 转换GPS坐标为度,以便在各种应用中可以方便查找。\r
+          latitude=Double.valueOf(Lat);\r
+          longitude=Double.valueOf(lon);\r
+          // 转换单位,从分转换到度\r
+\r
+          double intdu= (int)(longitude /100f); //小数转换到分为单位\r
+          double du=(longitude - intdu*100)/60f;\r
+          double last= intdu+du;\r
+          longitude =last;\r
+          intdu= (int)(latitude /100f); //小数转换到分为单位\r
+          du=(latitude - intdu*100)/60f;\r
+          last= intdu+du;\r
+          latitude=last;\r
+\r
+          // 经纬度 保留4位小数点\r
+          DecimalFormat df = new DecimalFormat("#.000000");\r
+          String strLatitude = df.format(latitude);\r
+          String strLongitude = df.format(longitude);\r
+\r
         //定位\r
         StringBuilder sb=new StringBuilder();\r
-        sb.append("GPGGA, location time= " + TimeUtil.getLocalTime() + ", FixedCount=" + locationFixedCount + ", GPSTime="+utctime+", Lat="+Lat+", Lon="+lon+", fixed="+fixed+", hdop="+hdop+", usedStarts="+usedStarts);\r
+        sb.append("GPGGA, location time= " + TimeUtil.getLocalTime() + ", FixedCount=" + locationFixedCount + ", GPSTime="+utctime+", Lat="+Lat+" ("+strLatitude+"), Lon="+lon+" ("+strLongitude+"), fixed="+fixed+", hdop="+hdop+", usedStarts="+usedStarts);\r
         ICLogger.i(sb.toString());\r
         if (Config.LOG_TOFILE)\r
           FileOutputUtil.fileOutput(this.runtime.getCacheDir(), "GPS", sb.toString());\r
@@ -284,31 +320,6 @@ public class NMEAListener implements NmeaListener, LocationListener {
                 只有当前GPS已经定位,且location不为空才给 runtime赋值GPS坐标。\r
                 延迟MaxFixedTimes秒后才设置runtime的定位标志,以便稳定坐标值。\r
               */\r
-\r
-            //log msg变量\r
-            StringBuffer sb2 = new StringBuffer();\r
-            sb2.append(" gps lat=").append(Lat).append(", gps lon=").append(lon);\r
-\r
-            latitude=Double.valueOf(Lat);\r
-            longitude=Double.valueOf(lon);\r
-            // 转换单位,从分转换到度\r
-\r
-            double intdu= (int)(longitude /100f); //小数转换到分为单位\r
-            double du=(longitude - intdu*100)/60f;\r
-            double last= intdu+du;\r
-            longitude =last;\r
-            intdu= (int)(latitude /100f); //小数转换到分为单位\r
-            du=(latitude - intdu*100)/60f;\r
-            last= intdu+du;\r
-            latitude=last;\r
-\r
-            // 经纬度 保留4位小数点\r
-            DecimalFormat df = new DecimalFormat("#.000000");\r
-            String strLatitude = df.format(latitude);\r
-            String strLongitude = df.format(longitude);\r
-            sb2.append(" real lat=").append(strLatitude).append(" lon=").append(strLongitude);\r
-            ICLogger.i(sb2.toString());\r
-\r
             runtime.getLocationInstance().setLocation(Lat,lon);\r
             runtime.getLocationInstance().setUsedStarts(Integer.valueOf(usedStarts.trim()));\r
             runtime.getLocationInstance().setHod(Float.valueOf(hdop.trim()));\r
index 1d1bd53..2f1b2f6 100644 (file)
@@ -78,7 +78,7 @@ public class Deliver extends AbstractConnectionService {
   private static ReentrantLock lock = new ReentrantLock();\r
   private static Condition mCondition = mLock.newCondition();\r
 \r
-  public static LinkedBlockingDeque<StringMessage> queue = new LinkedBlockingDeque(50);\r
+  public static LinkedBlockingDeque<StringMessage> queue = new LinkedBlockingDeque(90);\r
 \r
   private static FileCache fileCache;\r
   private static NettyConnection connection;\r
index 439698b..70a983d 100644 (file)
@@ -1,2 +1,2 @@
-#Sat Mar 14 17:23:03 CST 2020\r
-VERSION_CODE=376\r
+#Mon Mar 16 00:04:13 CST 2020\r
+VERSION_CODE=377\r
index e532068..2d9e691 100644 (file)
@@ -4,5 +4,5 @@
 # Location of the SDK. This is only used by Gradle.\r
 # For customization when using a Version Control System, please read the\r
 # header note.\r
-#Sat Feb 29 15:03:30 CST 2020\r
-sdk.dir=C\:\\Users\\incar\\AppData\\Local\\Android\\Sdk\r
+#Sun Mar 15 23:29:11 CST 2020\r
+sdk.dir=E\:\\Android\\sdk\r