From ad786ce26ceda78da0f8cb201d290128a937a492 Mon Sep 17 00:00:00 2001 From: SnickerSun Date: Wed, 30 Jun 2021 14:28:47 +0800 Subject: [PATCH] =?utf8?q?L004=20=E8=AE=BE=E7=BD=AE=E9=BB=98=E8=AE=A4?= =?utf8?q?=E5=BF=83=E7=8E=87=E7=9B=91=E6=B5=8B=E5=91=A8=E6=9C=9F=20?= =?utf8?q?=E5=8D=95=E4=BD=8D=E5=BC=84=E9=94=99=EF=BC=8C=20=E7=9B=AE?= =?utf8?q?=E5=89=8D=E6=8A=8A=E6=89=80=E6=9C=89=E7=9B=B8=E5=85=B3=E5=8F=98?= =?utf8?q?=E9=87=8F=E9=83=BD=E5=A2=9E=E5=8A=A0=E4=BA=86InMinutes=E5=90=8E?= =?utf8?q?=E7=BC=80=EF=BC=8C=E6=8F=90=E9=86=92=E4=BB=A5=E5=90=8E=E5=88=AB?= =?utf8?q?=E9=94=99=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 3 +- .../java/com/enqualcomm/support/Config.java | 34 +++++++++---------- .../com/enqualcomm/support/CoreService.java | 10 +++--- .../com/enqualcomm/support/bean/Runtime.java | 10 +++--- .../support/service/HeartRateManager.java | 8 ++--- .../support/utils/DeviceInfoUtil.java | 11 +++--- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a887fc35..c1032fd8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -108,7 +108,8 @@ - + diff --git a/app/src/main/java/com/enqualcomm/support/Config.java b/app/src/main/java/com/enqualcomm/support/Config.java index 22c249c5..2862b507 100644 --- a/app/src/main/java/com/enqualcomm/support/Config.java +++ b/app/src/main/java/com/enqualcomm/support/Config.java @@ -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; } diff --git a/app/src/main/java/com/enqualcomm/support/CoreService.java b/app/src/main/java/com/enqualcomm/support/CoreService.java index 844d698a..5aac6c08 100644 --- a/app/src/main/java/com/enqualcomm/support/CoreService.java +++ b/app/src/main/java/com/enqualcomm/support/CoreService.java @@ -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(); diff --git a/app/src/main/java/com/enqualcomm/support/bean/Runtime.java b/app/src/main/java/com/enqualcomm/support/bean/Runtime.java index 25a8374c..9d18c3a4 100644 --- a/app/src/main/java/com/enqualcomm/support/bean/Runtime.java +++ b/app/src/main/java/com/enqualcomm/support/bean/Runtime.java @@ -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() { diff --git a/app/src/main/java/com/enqualcomm/support/service/HeartRateManager.java b/app/src/main/java/com/enqualcomm/support/service/HeartRateManager.java index 5633169f..13d6a9c3 100644 --- a/app/src/main/java/com/enqualcomm/support/service/HeartRateManager.java +++ b/app/src/main/java/com/enqualcomm/support/service/HeartRateManager.java @@ -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()); } } }; diff --git a/app/src/main/java/com/enqualcomm/support/utils/DeviceInfoUtil.java b/app/src/main/java/com/enqualcomm/support/utils/DeviceInfoUtil.java index 18fd99f0..ec0a6044 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/DeviceInfoUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/DeviceInfoUtil.java @@ -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) { -- 2.17.1