L004 设置默认心率监测周期 单位弄错, 目前把所有相关变量都增加了InMinutes后缀,提醒以后别错。
authorSnickerSun <scy@incartech.cn>
Wed, 30 Jun 2021 06:28:47 +0000 (14:28 +0800)
committerSnickerSun <scy@incartech.cn>
Wed, 30 Jun 2021 06:28:47 +0000 (14:28 +0800)
app/src/main/AndroidManifest.xml
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/bean/Runtime.java
app/src/main/java/com/enqualcomm/support/service/HeartRateManager.java
app/src/main/java/com/enqualcomm/support/utils/DeviceInfoUtil.java

index a887fc3..c1032fd 100644 (file)
         <activity android:name=".toolActivity" />
         <activity android:name=".GPSActivity" />
         <activity android:name=".DeviceInfoActivity" />
-        <activity android:name=".MainActivity">
+        <activity android:name=".MainActivity"
+            android:screenOrientation="portrait">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
 
index 22c249c..2862b50 100644 (file)
@@ -160,7 +160,7 @@ public class Config {
 
     public static int DefaultLocationMode = CUSTOM_MOD8_GPS;
     public static int DefaultLocationCycle = 60 * 60;
-    public static int DefaultPPGTestCycle = 60;
+    public static int DefaultPPGTestCycleInMinutes = 60;
     public static int DefaultTemperatureTestCycle = 60 * 60;
 
     public static int DefaultWifiStatus = 0; //0 close , 1 open, 2 open and connect using default wifi
@@ -321,11 +321,11 @@ public class Config {
 
     public static void loadModCycleSettings(Runtime runtime) {
         Context context = runtime.getContextProxy().context;
-        ICLogger.i("current Cycles PPG " + runtime.getPpgTestCycle() + " , LocationCycle " + runtime.getLocationInstance().getLocation_cycle() + " LocationMode " + runtime.getLocationInstance().getWorkingMod());
-        runtime.setPpgTestCycle(Config.getPPGTestCycle(context));
+        ICLogger.i("current Cycles PPG " + runtime.getPpgTestCycleInMinutes() + " , LocationCycle " + runtime.getLocationInstance().getLocation_cycle() + " LocationMode " + runtime.getLocationInstance().getWorkingMod());
+        runtime.setPpgTestCycleInMinutes(Config.getPPGTestCycleInMinutes(context));
         runtime.getLocationInstance().setLocation_cycle(Config.getLocationCycle(context));
         runtime.getLocationInstance().setWorkingMod(Config.getLocationMode(context));
-        ICLogger.i("current Cycles PPG " + runtime.getPpgTestCycle() + " , LocationCycle " + runtime.getLocationInstance().getLocation_cycle() + " LocationMode " + runtime.getLocationInstance().getWorkingMod());
+        ICLogger.i("current Cycles PPG " + runtime.getPpgTestCycleInMinutes() + " , LocationCycle " + runtime.getLocationInstance().getLocation_cycle() + " LocationMode " + runtime.getLocationInstance().getWorkingMod());
 
         int mastervolume = getMasterVolume(context);
         ICAudioManager.setMasterVolumn(context, mastervolume);
@@ -380,11 +380,11 @@ public class Config {
         return SharePreferenceUtil.getPrefString(context, KeyLogServerUrl, DefaultHttpLogServerUrl);
     }
 
-    public static void setPPGTestCycle(Context context, int cycle_ninutes) {
-        SharePreferenceUtil.setPrefInt(context, KeyPpgTestCycle, cycle_ninutes);
+    public static void setPPGTestCycleInMinutes(Context context, int cycle_minutes) {
+        SharePreferenceUtil.setPrefInt(context, KeyPpgTestCycle, cycle_minutes);
     }
 
-    public static int getPPGTestCycle(Context context) {
+    public static int getPPGTestCycleInMinutes(Context context) {
         return SharePreferenceUtil.getPrefInt(context, KeyPpgTestCycle, 0);
     }
 
@@ -878,7 +878,7 @@ public class Config {
             ConfigAlarm(Runtime.AlarmType.ALARM_WEARED, true);
             DefaultLocationMode = CUSTOM_MOD8_GPS;
             DefaultLocationCycle = 60 * 60;
-            DefaultPPGTestCycle = 60;
+            DefaultPPGTestCycleInMinutes = 60;
             DefaultTemperatureTestCycle = 60 * 60;
 
             noPushTxtNotifyDialog = true;
@@ -894,7 +894,7 @@ public class Config {
             ConfigAlarm(Runtime.AlarmType.ALARM_LOCK_WATCH, true);
             DefaultLocationMode = CUSTOM_MOD8_GPS;
             DefaultLocationCycle = 10 * 60;
-            DefaultPPGTestCycle = 60 * 60;
+            DefaultPPGTestCycleInMinutes = 6;
             DefaultTemperatureTestCycle = 60 * 60;
             noPushTxtNotifyDialog = true;
             noSMSNotifyDialog = true;
@@ -915,7 +915,7 @@ public class Config {
             ConfigAlarm(Runtime.AlarmType.ALARM_LOCK_WATCH, true);
             DefaultLocationMode = CUSTOM_MOD8_GPS;
             DefaultLocationCycle = 10 * 60;
-            DefaultPPGTestCycle = 0;
+            DefaultPPGTestCycleInMinutes = 0;
             DefaultTemperatureTestCycle = 0;
             noPushTxtNotifyDialog = true;
             noSMSNotifyDialog = true;
@@ -939,7 +939,7 @@ public class Config {
             ConfigAlarm(Runtime.AlarmType.ALARM_MSGREAD, true);
             DefaultLocationMode = NORMAL_MOD;
             DefaultLocationCycle = 15 * 60;
-            DefaultPPGTestCycle = 0;
+            DefaultPPGTestCycleInMinutes = 0;
             DefaultTemperatureTestCycle = 0;
 
             noPushTxtNotifyDialog = false;
@@ -965,7 +965,7 @@ public class Config {
             enableSleep = true;
             DefaultLocationMode = NORMAL_MOD;
             DefaultLocationCycle = 900;
-            DefaultPPGTestCycle = 0;
+            DefaultPPGTestCycleInMinutes = 0;
             DefaultTemperatureTestCycle = 0;
 
             noPushTxtNotifyDialog = true;
@@ -985,7 +985,7 @@ public class Config {
 
             DefaultLocationMode = NORMAL_MOD;
             DefaultLocationCycle = 900;
-            DefaultPPGTestCycle = 0;
+            DefaultPPGTestCycleInMinutes = 0;
             DefaultTemperatureTestCycle = 0;
 
             noPushTxtNotifyDialog = false;
@@ -1005,7 +1005,7 @@ public class Config {
 
             DefaultLocationMode = CUSTOM_MOD8_GPS;
             DefaultLocationCycle = 5 * 60;
-            DefaultPPGTestCycle = 0;
+            DefaultPPGTestCycleInMinutes = 0;
             DefaultTemperatureTestCycle = 0;
 
             noPushTxtNotifyDialog = false;
@@ -1024,7 +1024,7 @@ public class Config {
             Config.forceMoveCheck = false; //即爱对gps不进行运动检测,此变量专门为了给其他协议进行强制运动检测用的。
             DefaultLocationMode = NORMAL_MOD;
             DefaultLocationCycle = 900;
-            DefaultPPGTestCycle = 0;
+            DefaultPPGTestCycleInMinutes = 0;
             DefaultTemperatureTestCycle = 0;
             noPushTxtReadReply = false;//即爱需要阅读反馈
             noBroadCastPushTxtNotify = true;
@@ -1037,13 +1037,13 @@ public class Config {
             enableSleep = false;
             DefaultLocationMode = CUSTOM_MOD8_GPS;
             DefaultLocationCycle = 15 * 60;
-            DefaultPPGTestCycle = 15;
+            DefaultPPGTestCycleInMinutes = 15;
             DefaultTemperatureTestCycle = 15 * 60;
 
         } else {
             DefaultLocationMode = NORMAL_MOD;
             DefaultLocationCycle = 900;
-            DefaultPPGTestCycle = 0;
+            DefaultPPGTestCycleInMinutes = 0;
             DefaultTemperatureTestCycle = 0;
             noBroadCastPushTxtNotify = true;
         }
index 844d698..5aac6c0 100644 (file)
@@ -726,7 +726,7 @@ public class CoreService extends Service {
             Config.load_config_fromfile();
             Config.setLocationMode(this, Config.DefaultLocationMode);
             Config.setLocationCycle(this, Config.DefaultLocationCycle);
-            Config.setPPGTestCycle(this, Config.DefaultPPGTestCycle);
+            Config.setPPGTestCycleInMinutes(this, Config.DefaultPPGTestCycleInMinutes);
             Config.setTemperatureTestCycle(runtime, Config.DefaultTemperatureTestCycle);
             Config.setConfigInitFlag(this, 1);
         }
@@ -851,7 +851,7 @@ public class CoreService extends Service {
         setHeartBeatAlarm();
 
         //设置心率检测频率
-        setHeartRateDetectAlarm(runtime.getPpgTestCycle()); //3分钟一次
+        setHeartRateDetectAlarm(runtime.getPpgTestCycleInMinutes()); //3分钟一次
 
         //获取天气时间
         setWeatherAlarm();
@@ -1239,7 +1239,7 @@ public class CoreService extends Service {
                 //此消息来源于BroadCaset,收到开始测试的消息。
                 //此时需要重置HeartRateDetect Timer
                 //倘若有 参数 PPGTestCycle,则根据这个数值进行设置
-                setHeartRateDetectAlarm(runtime.getPpgTestCycle());//重置心率检测周期,并触发一次检测
+                setHeartRateDetectAlarm(runtime.getPpgTestCycleInMinutes());//重置心率检测周期,并触发一次检测
 
             } else if (ACTION_SEND_EMEGENCY_LOCATION_STOP.equals(paramIntent.getAction())) {
                 //stop Emegency location Stop
@@ -1297,8 +1297,8 @@ public class CoreService extends Service {
         ICLogger.d("ppgtestCycle == > " + heartRateDetectAlarmCycleMinutes);
         //如果周期不为0,那么就设置到配置信息里头去。
         if (heartRateDetectAlarmCycleMinutes > 1) {
-            Config.setPPGTestCycle(runtime.getContextProxy().context, heartRateDetectAlarmCycleMinutes);
-            runtime.setPpgTestCycle(Config.getPPGTestCycle(runtime.getContextProxy().context));
+            Config.setPPGTestCycleInMinutes(runtime.getContextProxy().context, heartRateDetectAlarmCycleMinutes);
+            runtime.setPpgTestCycleInMinutes(Config.getPPGTestCycleInMinutes(runtime.getContextProxy().context));
             ICLogger.i("get and set PPGTestCycle " + heartRateDetectAlarmCycleMinutes);
         }
         StringBuilder sb = new StringBuilder();
index 25a8374..9d18c3a 100644 (file)
@@ -61,7 +61,7 @@ public class Runtime {
     private String currentCellInfo;
 
     //  public String currentWifiInfo="";
-    private static int ppgTestCycle;
+    private static int ppgTestCycleInMinutes;
 
     private DBHelper dbHelper;
 
@@ -131,12 +131,12 @@ public class Runtime {
         return ServerHeartBeadReceived;
     }
 
-    public void setPpgTestCycle(int cycle) {
-        ppgTestCycle = cycle;
+    public void setPpgTestCycleInMinutes(int cycleInMinutes) {
+        ppgTestCycleInMinutes = cycleInMinutes;
     }
 
-    public int getPpgTestCycle() {
-        return ppgTestCycle;
+    public int getPpgTestCycleInMinutes() {
+        return ppgTestCycleInMinutes;
     }
 
     public String getIccid() {
index 5633169..13d6a9c 100644 (file)
@@ -127,8 +127,6 @@ public class HeartRateManager extends AbstractInvokeHandlerService {
 
     public void init(Runtime runtime) {
         this.runtime = runtime;
-        //此注册不能去掉,否则无法定时检测心率
-        regReceiver();
     }
 
     private IHeartRateSensorService heartRateSensorService;
@@ -257,12 +255,12 @@ public class HeartRateManager extends AbstractInvokeHandlerService {
                 //倘若有 参数 PPGTestCycle,则根据这个数值进行设置
                 int ppgtestCycle = param1Intent.getIntExtra("PPGTestCycle", -1);
                 if (ppgtestCycle > 0) {
-                    Config.setPPGTestCycle(runtime.getContextProxy().context, ppgtestCycle);
-                    runtime.setPpgTestCycle(Config.getPPGTestCycle(runtime.getContextProxy().context));
+                    Config.setPPGTestCycleInMinutes(runtime.getContextProxy().context, ppgtestCycle);
+                    runtime.setPpgTestCycleInMinutes(Config.getPPGTestCycleInMinutes(runtime.getContextProxy().context));
                     ICLogger.i("get and set PPGTestCycle " + ppgtestCycle);
                 }
                 ICLogger.i("PPGStartReceiver ACTION_HEATR_RATE_START " + ppgtestCycle);
-                CoreService.getInstance().setHeartRateDetectAlarm(runtime.getPpgTestCycle());
+                CoreService.getInstance().setHeartRateDetectAlarm(runtime.getPpgTestCycleInMinutes());
             }
         }
     };
index 18fd99f..ec0a604 100644 (file)
@@ -259,7 +259,7 @@ public class DeviceInfoUtil {
                 .append(" \n Location Cycle ").append(runtime.getLocationInstance().getLocation_cycle()).append("s")
                 .append(" \n LocationType ").append(runtime.getLocationInstance().getLocationType())
                 .append(" at ").append(runtime.getLocationInstance().getLocationTime())
-                .append(" \n PPGTestCycle ").append(runtime.getPpgTestCycle()).append("m")
+                .append(" \n PPGTestCycle ").append(runtime.getPpgTestCycleInMinutes()).append("m")
                 .append("\n LastPPG ").append(runtime.getHRS().getPPG())
                 .append(",bph ").append(runtime.getHRS().getBPH())
                 .append(",bpl ").append(runtime.getHRS().getBPL())
@@ -292,16 +292,17 @@ public class DeviceInfoUtil {
                 .append("s,T").append(runtime.getLocationInstance().getLocationType())
                 .append(",").append(runtime.getLocationInstance().getLocationTime())
                 .append(",BTIn").append(runtime.bleInfo.is_in_area)
-                .append("]\nPPG[C").append(runtime.getPpgTestCycle())
+                .append("]\nPPG[C").append(runtime.getPpgTestCycleInMinutes())
+                .append("m]\nTemp[C")
+                .append(runtime.temp_test_Cycle_Seconds).append("s]").toString();
 //            .append(",P").append(runtime.getHRS().getPPG())
 //            .append(",H").append(runtime.getHRS().getBPH())
 //            .append(",L").append(runtime.getHRS().getBPL())
 //            .append(",T").append(String.format("%1$.2f",wrist_temp))
 //            .append(",TA").append(String.format("%1$.2f",TemperatureUtil.getBodyTemp(wrist_temp,26.0f)))
 //            .append(",").append(runtime.getHRS().getTestTime())
-                .append("m]\nTemp[C")
-                .append(runtime.temp_test_Cycle_Seconds).append("s]")
-                .toString();
+
+
     }
 
     public static String getDeviceVersion(Runtime runtime) {