给 运动检测扩展到所有定位模式,且是不运动3分钟后才不进行定位。
authorsnickersun <scy@incartech.cn>
Fri, 25 Sep 2020 13:08:22 +0000 (21:08 +0800)
committersnickersun <scy@incartech.cn>
Fri, 25 Sep 2020 13:08:22 +0000 (21:08 +0800)
app/src/main/java/com/enqualcomm/support/Config.java
app/src/main/java/com/enqualcomm/support/CoreService.java
app/src/main/java/com/enqualcomm/support/LocationClient.java

index 0313f45..be0f34d 100644 (file)
@@ -35,7 +35,7 @@ public class Config {
   public static int defaultHeartbeatCycle=5;\r
   public static int sw_release_no = -1;\r
   public static int bleScanTimeout=10;\r
-  public static boolean forceMoveCheck=false;\r
+  public static boolean forceMoveCheck=true;\r
   public static String work_mode = "2@1";\r
 \r
   public static final String JiAiHost="watch.jiai.pro";\r
@@ -56,7 +56,7 @@ public class Config {
   public static final int WiFiLocationTimeoutInSeconds=12;\r
 \r
   public static String c43_branch_name="none";\r
-  public static String custom_branch_name="none";\r
+  public static String custom_name="none";\r
 \r
   public static boolean noSMSNotifyDialog=false;\r
   public static boolean noPushTxtNotifyDialog=false;\r
@@ -404,23 +404,23 @@ public class Config {
           noPPGSensor=true;\r
         }\r
     }\r
-    custom_branch_name=Util.getSystemProperties("persist.sys.customname");\r
-    ICLogger.i("get CUSTOMNAME "+custom_branch_name);\r
-    if (custom_branch_name.equals("H88")||custom_branch_name.equals("H88A") ){\r
+    custom_name=Util.getSystemProperties("persist.sys.customname");\r
+    ICLogger.i("get CUSTOMNAME "+custom_name);\r
+    if (custom_name.equals("H88")||custom_name.equals("H88A") ){\r
       noPushTxtNotifyDialog=true;\r
       noSMSNotifyDialog=false;\r
       noVoiceNotifyDialog=false;\r
       noPPGSensor=false;\r
       noTempSensor=false;\r
       needBroadcastAntiAlarm=false;\r
-    }else if  ((custom_branch_name.equals("AK")) ){\r
+    }else if  ((custom_name.equals("AK")) ){\r
         noPushTxtNotifyDialog=true;\r
         noSMSNotifyDialog=true;\r
         noVoiceNotifyDialog=true;\r
       noPPGSensor=false;\r
       noTempSensor=true;\r
       SOSNoNeedDial=true; //采用新写的SOS,协议只需要发送消息,无需控制拨号。\r
-    }else if ((custom_branch_name.equals("l004")) ) {\r
+    }else if ((custom_name.equals("l004")) ) {\r
       noPushTxtNotifyDialog=true;\r
       noSMSNotifyDialog=true;\r
       noVoiceNotifyDialog=true;\r
@@ -431,7 +431,7 @@ public class Config {
       noPPGSensor=false;\r
       noTempSensor=false;\r
       L004_BroadCastActionStrip=true;\r
-    }else if (custom_branch_name.equals("YQ") ||custom_branch_name.equals("YQ_EN")  ) { //A9-YQ\r
+    }else if (custom_name.equals("YQ") ||custom_name.equals("YQ_EN")  ) { //A9-YQ\r
       noPushTxtNotifyDialog=true;\r
       noSMSNotifyDialog=true;\r
       noVoiceNotifyDialog=true;\r
index 71dfe6a..33c8bec 100644 (file)
@@ -623,7 +623,7 @@ public class CoreService extends Service {
         //初始化消息相关配置\r
         Config.LoadMessageConfigs();\r
 \r
-        if (Config.custom_branch_name.equals("H88")) {\r
+        if (Config.custom_name.equals("H88")) {\r
 \r
             if (Config.getConfigInitFlag(this) == 0) {\r
                 Config.setLocationMode(this, CUSTOM_MOD8_GPS);\r
@@ -634,7 +634,7 @@ public class CoreService extends Service {
                 Config.ConfigAlarm(Runtime.AlarmType.ALARM_ANTIOFF,true);\r
                 Config.ConfigAlarm(Runtime.AlarmType.ALARM_WEARED,true);\r
             }\r
-        }else if (Config.custom_branch_name.equals("l004")) {\r
+        }else if (Config.custom_name.equals("l004")) {\r
             if (Config.getConfigInitFlag(this) == 0) {\r
                 Config.setLocationMode(this, CUSTOM_MOD8_GPS);\r
                 Config.setLocationCycle(this, 600);\r
@@ -645,7 +645,7 @@ public class CoreService extends Service {
                 Config.ConfigAlarm(Runtime.AlarmType.ALARM_ILLEGAL_CUTOFF,true);\r
                 Config.ConfigAlarm(Runtime.AlarmType.ALARM_LOCK_WATCH,true);\r
             }\r
-        }else if (Config.custom_branch_name.equals("AK")) {\r
+        }else if (Config.custom_name.equals("AK")) {\r
             if (Config.getConfigInitFlag(this)==0) {\r
                 Config.setPPGTestCycle(this, 0);\r
                 Config.setTemperatureTestCycle(runtime, 0);\r
@@ -664,7 +664,7 @@ public class CoreService extends Service {
 //                    runtime.getDbHelper().saveContacts(contactArray,false,false,false,false,false,true);\r
 //                }\r
             }\r
-        }else if (Config.custom_branch_name.equals("SGL")) { //C5项目\r
+        }else if (Config.custom_name.equals("SGL")) { //C5项目\r
             if (Config.getConfigInitFlag(this)==0) {\r
                 Config.setLocationMode(this, CUSTOM_MOD8_GPS);\r
                 Config.setLocationCycle(this, 1800);\r
@@ -684,6 +684,13 @@ public class CoreService extends Service {
 //                    runtime.getDbHelper().saveContacts(contactArray,false,false,false,false,false,true);\r
 //                }\r
             }\r
+        }else if (Config.custom_name.equals("JIAI")) { //L02\r
+            if (Config.getConfigInitFlag(this)==0) {\r
+                Config.setPPGTestCycle(this, 0);\r
+                Config.setTemperatureTestCycle(runtime, 0);\r
+                Config.forceMoveCheck=false;\r
+                Config.setConfigInitFlag(this, 1);\r
+            }\r
         }else{\r
 \r
             if (Config.getConfigInitFlag(this)==0) {\r
index 6b41132..285e768 100644 (file)
@@ -696,20 +696,35 @@ public void updateCellInfo() {
   private static boolean NoMoveAndNoGPSsignalSkipGpsFlag=false;\r
   private static boolean noMove=false;\r
   private static boolean last_noMove=false;\r
-  private static int noMoveCount=0;\r
-  private static final int MaxNoMoveTimeout=3000;\r
+  private static final int MaxNoMoveTimeout=3*60*1000; //3分钟\r
+  private static long first_NoMove_timestamp=0;\r
 \r
-  private static void checkNoMove(){\r
+\r
+  /***\r
+   *noMove and timeout return true\r
+   * else return false\r
+   */\r
+  private boolean checkNoMoveTimeout(){\r
 \r
 \r
     noMove=runtime.getLastStepCount() == runtime.getTotalStepCount();\r
     runtime.updateFZDDevStatusMoving(!noMove); //设置当前运动状态\r
 \r
-  }\r
-\r
+    if (last_noMove==false&& noMove==true){\r
+      first_NoMove_timestamp=System.currentTimeMillis();\r
+    }else if (noMove==false){\r
+      first_NoMove_timestamp=0;\r
+    }\r
+    //属于 判断是否 不动的状态超时\r
+    if (noMove==true&& first_NoMove_timestamp>0.01  && System.currentTimeMillis()-first_NoMove_timestamp > MaxNoMoveTimeout){\r
+      return true;\r
+    }else{\r
+      return false;\r
+    }\r
 \r
+  }\r
 \r
-  public void startLocationProcess(int mod){\r
+   public void startLocationProcess(int mod){\r
 \r
     updateStepCount();//update StepCount,保证每次定位前,计步数据是最新的。防止丢数据。\r
     ICLogger.i("forceLocation="+forceLocation+", WorkingMod="+mod+", isLocating="+isLocating+", lastStep="+runtime.getLastStepCount()+", currentStep="+ runtime.getTotalStepCount());\r
@@ -717,13 +732,12 @@ public void updateCellInfo() {
       ICLogger.i("locating ,skip location!");\r
       return;\r
     }\r
-\r
-    checkNoMove();\r
-\r
+  //如果没有动,且超时。则跳过定位\r
+    boolean NoMoveTimeout=checkNoMoveTimeout();\r
     // 不强制定位 且 WorkingMod 不是紧急模式,且 没有移动过\r
     if ( ( forceLocation != 1 ) &&\r
             ((( mod == ICLocation.NORMAL_MOD ) ||  ( mod == ICLocation.LOWPOWER_MOD ) || (mod == ICLocation.CUSTOM_MOD8_WIFI ) ) || Config.forceMoveCheck==true)  &&\r
-            (noMove) && (skipMoveCheck ==false  )){\r
+            (NoMoveTimeout) && (skipMoveCheck ==false  )){\r
       ICLogger.i("No Move ,skip location!");\r
       return ;\r
     }\r