release V661
authorsnickersun <scy@incartech.cn>
Fri, 16 Oct 2020 10:13:25 +0000 (18:13 +0800)
committersnickersun <scy@incartech.cn>
Fri, 16 Oct 2020 10:13:25 +0000 (18:13 +0800)
1、解决5分钟定位时,一直无法上报ud的问题(属于心跳的5分钟检测和定位的5分钟冲突问题)
2、去掉Deliver缓存3次发送会丢弃数据的逻辑,保存数据直到数据发送完毕。如果buffer满,目前的逻辑是丢弃新的数据包。

13 files changed:
app/release/ICSer_V661_2010161805_release.apk [moved from app/release/ICSer_V660_2010152053_release.apk with 78% similarity]
app/release/output.json
app/src/main/java/com/enqualcomm/support/CoreService.java
app/src/main/java/com/enqualcomm/support/ICSmsManager.java
app/src/main/java/com/enqualcomm/support/LocationClient.java
app/src/main/java/com/enqualcomm/support/adapter/BTHelper.java
app/src/main/java/com/enqualcomm/support/service/AntiMonitorService.java
app/src/main/java/com/enqualcomm/support/service/Deliver.java
app/src/main/java/com/enqualcomm/support/service/HeartRateManager.java
app/src/main/java/com/enqualcomm/support/service/KeepAlive.java
app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java
app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java
app/version_code.properties

similarity index 78%
rename from app/release/ICSer_V660_2010152053_release.apk
rename to app/release/ICSer_V661_2010161805_release.apk
index 46c2467..65a6a8b 100644 (file)
Binary files a/app/release/ICSer_V660_2010152053_release.apk and b/app/release/ICSer_V661_2010161805_release.apk differ
index 90d083c..53821ec 100644 (file)
@@ -1 +1 @@
-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":660,"versionName":"2010152053","enabled":true,"outputFile":"ICSer_V660_2010152053_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V660_2010152053_release.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":661,"versionName":"2010161805","enabled":true,"outputFile":"ICSer_V661_2010161805_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V661_2010161805_release.apk","properties":{}}]
\ No newline at end of file
index 65863d0..505db86 100644 (file)
@@ -204,6 +204,7 @@ public class CoreService extends Service {
                 }\r
                     runtime.setAlarmType(Runtime.AlarmType.ALARM_SOS);\r
                     //trigger AP10 报警定位\r
+                     ICLogger.i("triggerSOSLocationProcess ");\r
                     LocationClient.getInstance().triggerSOSLocationProcess();\r
 //                    Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));\r
 \r
@@ -936,6 +937,7 @@ public class CoreService extends Service {
                     if(Config.isAlarmTypeEnabled(Runtime.AlarmType.ALARM_SEDENTARY)){\r
                         runtime.setAlarmType(Runtime.AlarmType.ALARM_SEDENTARY);\r
 //                        Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));\r
+                        ICLogger.i("triggerSOSLocationProcess ");\r
                         locationClient.triggerSOSLocationProcess();\r
                     }\r
                 }else{\r
@@ -1148,6 +1150,7 @@ public class CoreService extends Service {
                 if (this.mKeepAlive != null) {\r
                     if (connection.isServerConnected() && runtime.isServerProtocolConnected()) {\r
                         this.mKeepAlive.onHeartAlarm(this.connection, this.runtime);\r
+                        ICLogger.i("triggerBLEProcess ");\r
                         locationClient.triggerBLEProcess();//每次心跳检测一次BLE\r
                     } else {\r
                        // if (this.mKeepAlive.is_retry_time_above_limit()) {\r
@@ -1265,6 +1268,7 @@ public class CoreService extends Service {
 //            ICLogger.i("自由锻炼中,跳过原有的循环定位!");\r
 //            return;\r
 //        }\r
+        ICLogger.i("triggerLocationProcess ");\r
         locationClient.triggerLocationProcess();\r
 \r
     }\r
index 842094c..6c6c2c1 100644 (file)
@@ -867,6 +867,7 @@ public class ICSmsManager  extends BroadcastReceiver {
                 LocationClient locationClient=LocationClient.getInstance();\r
                 if (locationClient!=null){\r
                     locationClient.setLocationResponse(replayLocation);\r
+                    ICLogger.i("triggerLocationProcess ");\r
                     locationClient.triggerLocationProcess();\r
                 }\r
             }else if (sms.startsWith(ENCRYPED_HEADER+"#setLogSrv#=")&& sms.endsWith("#")) {\r
@@ -955,6 +956,7 @@ public class ICSmsManager  extends BroadcastReceiver {
                         sendSMS(phonenumber, "set noLocationCycle false! and trigger one Location");\r
                         LocationClient locationClient=LocationClient.getInstance();\r
                         if (locationClient!=null){\r
+                            ICLogger.i("triggerLocationProcess ");\r
                             locationClient.triggerLocationProcess();\r
                         }\r
                     }else if (strtmp.equalsIgnoreCase("true")){\r
index 2ef3f78..2757e71 100644 (file)
@@ -143,7 +143,13 @@ public class LocationClient {
       public void OnScanFinished(ArrayList<String> btPairedScanResult, ArrayList<String> btNewScanResult) {\r
 \r
         if (btNewScanResult!=null && btNewScanResult.size() > 0) {\r
-          ICLogger.i("found bt mac " + btNewScanResult.size() + " btMacList " + runtime.bleInfo.btMacList.size());\r
+          StringBuilder sb=new StringBuilder();\r
+          sb.append("found bt mac ").append(btNewScanResult.size() );\r
+          sb.append(" bounding BeaconMacList ").append(runtime.bleInfo.btMacList.size() );\r
+          for(String mac:runtime.bleInfo.btMacList){\r
+            sb.append(" ").append(mac);\r
+          }\r
+          ICLogger.i( sb.toString() );\r
           boolean in_area = false;\r
           try {\r
             for (String mac : btNewScanResult) {\r
@@ -188,11 +194,8 @@ public class LocationClient {
               //只有上一次在区域内,这次出区域才需要报警\r
               ICLogger.i("BT 不在区域内,且上次在区域内,报警!");\r
               //如果需要报警定位,则强制进行sos定位,不能通过triggerSOS,因为函数中调用了BLEScan会造成循环调用\r
-\r
                 StringMessage AL_CMD = protocolAPIHelper.getWarningMSG(runtime);\r
                 DeliverMessage(AL_CMD);\r
-\r
-\r
             }\r
           }else{\r
             ICLogger.i("BT 在区域内!");\r
@@ -232,8 +235,10 @@ public class LocationClient {
               DeliverMessage(AP01_CMD);\r
               startSOSLocation=false;\r
             }else {\r
-              StringMessage AP01_CMD = protocolAPIHelper.getGPSLocationMSG(runtime);\r
-              DeliverMessage(AP01_CMD);\r
+                //已经通过蓝牙定位,则清除 forceLocation=0\r
+                forceLocation=0;\r
+                StringMessage AP01_CMD = protocolAPIHelper.getGPSLocationMSG(runtime);\r
+                DeliverMessage(AP01_CMD);\r
             }\r
           }\r
         }\r
@@ -321,11 +326,6 @@ public class LocationClient {
 \r
   public void triggerSOSLocationProcess(){\r
 \r
-\r
-\r
-\r
-\r
-\r
       mhandler.sendEmptyMessage(msgWhat_StartSOSLocationProcess);\r
 \r
   }\r
@@ -426,9 +426,14 @@ public class LocationClient {
             });\r
           }else if (msg.what == msgWhat_StartLocationProcess) {\r
             if (runtime.bleInfo.btMacList.size() > 0) {\r
-              //有蓝牙搜索要求则 先进行蓝牙扫描\r
-              if (needLocationForBT())\r
-                btHelper.scanBLE();\r
+              if(scanBLEOnly && btHelper.isBtscanning()){\r
+                //如果正在进行独立蓝牙扫描,则强制切换为正常扫描。\r
+                scanBLEOnly=false;\r
+              }else {\r
+                //有蓝牙搜索要求则 先进行蓝牙扫描\r
+                if (needLocationForBT())\r
+                  btHelper.scanBLE();\r
+              }\r
             } else {\r
               //没有蓝牙搜索要求,就正常定位\r
               startLocationProcess(runtime.getLocationInstance().getWorkingMod());\r
@@ -436,10 +441,13 @@ public class LocationClient {
           }else if (msg.what == msgWhat_StartBLEProcess){\r
             if (runtime.bleInfo.btMacList.size() > 0) {\r
               //有蓝牙搜索要求则 先进行蓝牙扫描\r
-              scanBLEOnly=true;\r
-\r
-              if (needLocationForBT())\r
-                btHelper.scanBLE();\r
+              if (! btHelper.isBtscanning()) {\r
+                scanBLEOnly = true;\r
+                if (needLocationForBT())\r
+                  btHelper.scanBLE();\r
+              }else{\r
+                ICLogger.i("BT Scanning skip ScanBLE only!");\r
+              }\r
             }\r
           }else if (msg.what == msgWhat_StartSOSLocationProcess){\r
 \r
@@ -449,11 +457,17 @@ public class LocationClient {
               CellInfoUtil.getCellInfo(runtime.getContextProxy().getTelephonyManager(),runtime);\r
 \r
               if (runtime.bleInfo.btMacList.size() > 0) {\r
-                //有蓝牙搜索要求则 先进行蓝牙扫描\r
-                startSOSLocation=true;//启动SOS定位,为了快速响应,只要wifi定位即可。\r
-                forceLocation=1;\r
-                if (needLocationForBT())\r
-                  btHelper.scanBLE();\r
+                if(scanBLEOnly && btHelper.isBtscanning())\r
+                {\r
+                  //如果正在进行独立蓝牙扫描,则强制切换为正常扫描。\r
+                  scanBLEOnly = false;\r
+                }else {\r
+                  //有蓝牙搜索要求则 先进行蓝牙扫描\r
+                  startSOSLocation = true;//启动SOS定位,为了快速响应,只要wifi定位即可。\r
+                  forceLocation = 1;\r
+                  if (needLocationForBT())\r
+                    btHelper.scanBLE();\r
+                }\r
               } else {\r
                 try{\r
                   Thread.sleep(1000);\r
@@ -823,6 +837,7 @@ public void updateCellInfo() {
       ICLogger.i("No Move ,skip BT location!");\r
       return false;\r
     }\r
+    ICLogger.i("BT NoMoveTimeout "+NoMoveTimeout+", forceLocation="+forceLocation+", Config.forceMoveCheck="+Config.forceMoveCheck+", skipMoveCheck="+skipMoveCheck);\r
     return true;\r
   }\r
    public void startLocationProcess(int mod){\r
@@ -1026,6 +1041,7 @@ public void updateCellInfo() {
         runtime.setAlarmType(Runtime.AlarmType.ALARM_LOWBATTERY);\r
         //trigger AP10 报警低电\r
 //        connection.send(protocolAPIHelper.getWarningMSG(runtime));\r
+        ICLogger.i("triggerSOSLocationProcess ");\r
         LocationClient.getInstance().triggerSOSLocationProcess();\r
       }\r
 \r
index af923d7..eb8146c 100644 (file)
@@ -159,6 +159,9 @@ public class BTHelper {
 //\r
 //    }\r
 \r
+    public boolean isBtscanning(){\r
+        return btscanning;\r
+    }\r
     //开始扫描BLE\r
     public void scanBLE() {\r
         ICLogger.i( "BT doDiscovery()");\r
index 5595cbb..d70d031 100644 (file)
@@ -103,6 +103,7 @@ public class AntiMonitorService extends AbstractInvokeHandlerService {
                 if(mRuntime.setAlarmType(Runtime.AlarmType.ALARM_LOCK_WATCH)) {\r
 //                    StringMessage msg = protocolAPIHelper.getWarningMSG(mRuntime);\r
 //                    Deliver.sendLocationMSG(msg); //消息很重要,所以利用带buffer的对列来发送!\r
+                    ICLogger.i("triggerSOSLocationProcess ");\r
                     LocationClient.getInstance().triggerSOSLocationProcess();\r
                 }\r
 \r
@@ -122,6 +123,7 @@ public class AntiMonitorService extends AbstractInvokeHandlerService {
                 }\r
                 mRuntime.Cut_off_flag=1;\r
                 if(mRuntime.setAlarmType(Runtime.AlarmType.ALARM_CUTOFF)) {\r
+                    ICLogger.i("triggerSOSLocationProcess ");\r
                     LocationClient.getInstance().triggerSOSLocationProcess();\r
 //                    StringMessage msg = protocolAPIHelper.getWarningMSG(mRuntime);\r
 //                    Deliver.sendLocationMSG(msg); //消息很重要,所以利用带buffer的对列来发送!\r
@@ -142,6 +144,7 @@ public class AntiMonitorService extends AbstractInvokeHandlerService {
                 }\r
                 mRuntime.Anti_off_flag = 0;\r
                 if(mRuntime.setAlarmType(Runtime.AlarmType.ALARM_WEARED)) {\r
+                    ICLogger.i("triggerSOSLocationProcess ");\r
                     LocationClient.getInstance().triggerSOSLocationProcess();\r
 //                    StringMessage msg = protocolAPIHelper.getWarningMSG(mRuntime);\r
 //                    Deliver.sendLocationMSG(msg); //消息很重要,所以利用带buffer的对列来发送!\r
@@ -162,6 +165,7 @@ public class AntiMonitorService extends AbstractInvokeHandlerService {
                 }\r
                 mRuntime.Anti_off_flag=1;\r
                 if(mRuntime.setAlarmType(Runtime.AlarmType.ALARM_ANTIOFF)) {\r
+                    ICLogger.i("triggerSOSLocationProcess ");\r
                     LocationClient.getInstance().triggerSOSLocationProcess();\r
 //                    StringMessage msg = protocolAPIHelper.getWarningMSG(mRuntime);\r
 //                    Deliver.sendLocationMSG(msg); //消息很重要,所以利用带buffer的对列来发送!\r
index 40981b0..e97f9d7 100644 (file)
@@ -178,7 +178,8 @@ public class Deliver extends AbstractConnectionService {
         //如果需要,且没有服务器反馈\r
         if (NeedCheckServerResponse==true && ServerResponsed==false){\r
           //刚刚发送的包不为空,且检测次数小于3,则保留数据,进行下一次重试。\r
-          if (needCheckResponseCMD!=null && CheckCount < 3) {\r
+//          if (needCheckResponseCMD!=null && CheckCount < 3) {\r
+          if (needCheckResponseCMD!=null ) {  //一直检测 是否服务器收到。\r
             //如果cmd有效,且尝试次数小于3, 没有收到反馈的情况下,可以重新插入queue进行下一次尝试!\r
             ICLogger.i("checkSrvResponse "+CheckCount+" times for "+needCheckResponseCMD.cmd()+ " "+needCheckResponseCMD.isFromCache());\r
             if (!ServiceUtil.offerQueue(needCheckResponseCMD, true)) {\r
index a691ef9..0a28a4c 100644 (file)
@@ -64,6 +64,7 @@ public class HeartRateManager extends AbstractInvokeHandlerService implements Se
       if(runtime.setAlarmType(Runtime.AlarmType.ALARM_HEART_RATE_HIGH)) {\r
         //trigger AP10 报警定位\r
 //        Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));\r
+        ICLogger.i("triggerSOSLocationProcess ");\r
         LocationClient.getInstance().triggerSOSLocationProcess();\r
       }\r
 \r
@@ -71,6 +72,7 @@ public class HeartRateManager extends AbstractInvokeHandlerService implements Se
       if( runtime.setAlarmType(Runtime.AlarmType.ALARM_HEART_RATE_LOW)) {\r
         //trigger AP10 报警定位\r
 //        Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));\r
+        ICLogger.i("triggerSOSLocationProcess ");\r
         LocationClient.getInstance().triggerSOSLocationProcess();\r
       }\r
     }\r
@@ -80,6 +82,7 @@ public class HeartRateManager extends AbstractInvokeHandlerService implements Se
 \r
       if(runtime.setAlarmType(Runtime.AlarmType.ALARM_BPH_HIGH)) {\r
         //trigger AP10 报警定位\r
+        ICLogger.i("triggerSOSLocationProcess ");\r
         LocationClient.getInstance().triggerSOSLocationProcess();\r
 //        Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));\r
       }\r
@@ -87,6 +90,7 @@ public class HeartRateManager extends AbstractInvokeHandlerService implements Se
     }else if ( runtime.getHRS().bph_threshold_min>0 && runtime.getHRS().getBPH()<runtime.getHRS().bph_threshold_min) {\r
       if(runtime.setAlarmType(Runtime.AlarmType.ALARM_BPH_LOW)) {\r
         //trigger AP10 报警定位\r
+        ICLogger.i("triggerSOSLocationProcess ");\r
         LocationClient.getInstance().triggerSOSLocationProcess();\r
 //        Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));\r
       }\r
@@ -97,6 +101,7 @@ public class HeartRateManager extends AbstractInvokeHandlerService implements Se
 \r
      if(runtime.setAlarmType(Runtime.AlarmType.ALARM_BPL_HIGH)) {\r
        //trigger AP10 报警定位\r
+       ICLogger.i("triggerSOSLocationProcess ");\r
        LocationClient.getInstance().triggerSOSLocationProcess();\r
 //       Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));\r
      }\r
@@ -104,6 +109,7 @@ public class HeartRateManager extends AbstractInvokeHandlerService implements Se
     }else if ( runtime.getHRS().bpl_threshold_min>0 && runtime.getHRS().getBPL()<runtime.getHRS().bpl_threshold_min) {\r
       if(runtime.setAlarmType(Runtime.AlarmType.ALARM_BPL_LOW)) {\r
         //trigger AP10 报警定位\r
+        ICLogger.i("triggerSOSLocationProcess ");\r
         LocationClient.getInstance().triggerSOSLocationProcess();\r
 //        Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));\r
       }\r
index bac7436..abd8488 100644 (file)
@@ -411,6 +411,7 @@ public class KeepAlive extends AbstractConnectionService {
 //          if (KeepAlive.this.mRuntime.getBatteryLow()){\r
 //          KeepAlive.this.mRuntime.setAlarmType(Runtime.AlarmType.ALARM_LOWBATTERY);\r
           KeepAlive.this.mRuntime.setAlarmType(Runtime.AlarmType.ALARM_POWER_OFF);\r
+        ICLogger.i("triggerSOSLocationProcess ");\r
           LocationClient.getInstance().triggerSOSLocationProcess();\r
 //          Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(KeepAlive.this.mRuntime));\r
 \r
index 18ef312..a73be70 100644 (file)
@@ -158,6 +158,7 @@ public class BatteryUtil {
       runtime.setAlarmType(Runtime.AlarmType.ALARM_LOWBATTERY);\r
       //trigger AP10 报警定位\r
 //      Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));\r
+      ICLogger.i("triggerSOSLocationProcess ");\r
       LocationClient.getInstance().triggerSOSLocationProcess();\r
     }else if (runtime.isPowerConnected()==false && runtime.getBatterylevel()< 5 ) {\r
       //没有充电,上次电池level > 15% , 上次电池并且不是 电池低电状态,则报警\r
@@ -169,6 +170,7 @@ public class BatteryUtil {
       runtime.setAlarmType(Runtime.AlarmType.ALARM_LOWBATTERY);\r
       //trigger AP10 报警定位\r
 //      Deliver.sendLocationMSG( protocolAPIHelper.getWarningMSG(runtime));\r
+      ICLogger.i("triggerSOSLocationProcess ");\r
       LocationClient.getInstance().triggerSOSLocationProcess();\r
     }\r
   }\r
index 7cad5e9..6fa1083 100644 (file)
@@ -125,6 +125,7 @@ public class TemperatureUtil {
                     case 1:\r
                         if(runtime.setAlarmType(Runtime.AlarmType.ALARM_TEMP_HIGH)) {\r
                             //trigger AP10 报警定位\r
+                            ICLogger.i("triggerSOSLocationProcess ");\r
                             LocationClient.getInstance().triggerSOSLocationProcess();\r
 //                            Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));\r
                         }\r
@@ -132,6 +133,7 @@ public class TemperatureUtil {
                     case 2:\r
                         if(runtime.setAlarmType(Runtime.AlarmType.ALARM_TEMP_LOW)) {\r
                             //trigger AP10 报警定位\r
+                            ICLogger.i("triggerSOSLocationProcess ");\r
                             LocationClient.getInstance().triggerSOSLocationProcess();\r
 //                            Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));\r
                         }\r
index 85837ea..5f4591c 100644 (file)
@@ -1,2 +1,2 @@
-#Thu Oct 15 20:53:54 CST 2020\r
-VERSION_CODE=660\r
+#Fri Oct 16 18:05:48 CST 2020\r
+VERSION_CODE=661\r