From: snickersun Date: Tue, 27 Oct 2020 10:37:18 +0000 (+0800) Subject: release V680 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=fbe2599ca0000179a2324e438af6c0ec872be230;p=protocol_srv.git release V680 1、解决协议后台测试心率会上报两次,并且没有同步给launcher 血氧 2、修复协议下发后台测试心率不执行问题。(之前优化过度。。。) --- diff --git a/app/app.iml b/app/app.iml index d1100d69..497b2ac8 100644 --- a/app/app.iml +++ b/app/app.iml @@ -29,14 +29,14 @@ - - + + - + diff --git a/app/release/ICSer_V678_2010262143_release.apk b/app/release/ICSer_V680_2010271815_release.apk similarity index 78% rename from app/release/ICSer_V678_2010262143_release.apk rename to app/release/ICSer_V680_2010271815_release.apk index 4daa1ff0..040c7e1d 100644 Binary files a/app/release/ICSer_V678_2010262143_release.apk and b/app/release/ICSer_V680_2010271815_release.apk differ diff --git a/app/release/output.json b/app/release/output.json index b654b530..366412b5 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":678,"versionName":"2010262143","enabled":true,"outputFile":"ICSer_V678_2010262143_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V678_2010262143_release.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":680,"versionName":"2010271815","enabled":true,"outputFile":"ICSer_V680_2010271815_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V680_2010271815_release.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/java/com/enqualcomm/support/CoreService.java b/app/src/main/java/com/enqualcomm/support/CoreService.java index 2ca2d425..b32a851b 100644 --- a/app/src/main/java/com/enqualcomm/support/CoreService.java +++ b/app/src/main/java/com/enqualcomm/support/CoreService.java @@ -1225,6 +1225,7 @@ public class CoreService extends Service { public void setHeartRateDetectAlarm(int heartRateDetectAlarmCycle){ if (Config.noPPGSensor) { + ICLogger.i("setHeartRateDetectAlarm oPPGSensor"); return; } StringBuilder sb=new StringBuilder(); @@ -1327,8 +1328,10 @@ public class CoreService extends Service { StringBuilder sb=new StringBuilder(); int cycle=runtime.temp_test_Cycle; - if(Config.noTempSensor) - return; + if(Config.noTempSensor) { + ICLogger.i("setTempAlarm noTempSensor"); + return; + } if (cycle>1) { AlarmHelper.setRealTimeAlarmInSeconds(runtime.getContextProxy().context, cycle, TEMP_ALARM); sb.append(" setTempAlarm " + TEMP_ALARM + ", cycle " + cycle); 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 efefa7a1..81169beb 100644 --- a/app/src/main/java/com/enqualcomm/support/service/HeartRateManager.java +++ b/app/src/main/java/com/enqualcomm/support/service/HeartRateManager.java @@ -118,11 +118,12 @@ public class HeartRateManager extends AbstractInvokeHandlerService implements Se } private static final String HEART_ACTION = "com.ic.action.BLOOD_HEART"; - private void sendHeartBroadcast(int count) { + private void sendHeartBroadcast(int count,int spo2) { Intent pedIntent = new Intent(); pedIntent.setAction(HEART_ACTION); pedIntent.putExtra("BLOOD_HEART", count); - ICLogger.i("sendHeartBroadcast "+HEART_ACTION+" BLOOD_HEART "+count); + pedIntent.putExtra("BLOOD_SPO2", spo2); + ICLogger.i("sendHeartBroadcast "+HEART_ACTION+" BLOOD_HEART "+count+" BLOOD_SPO2 "+spo2); runtime.getContextProxy().context.sendBroadcast(pedIntent); } public HeartRateManager(Runtime _runtime,Connection _connection){ @@ -143,7 +144,7 @@ public class HeartRateManager extends AbstractInvokeHandlerService implements Se if (runtime.getHRS().getHeartrateWorkingStat() == heartRateStatus.HEARTRATE_WORKINGSTAT.HEARTRATE_TEST_SUCCESS) { runtime.getHRS().setLastTestTime(TimeUtil.getSystemTime3()); //发送PPG给Launcher,显示在主界面用 - sendHeartBroadcast(runtime.getHRS().getPPG()); + sendHeartBroadcast(runtime.getHRS().getPPG(),runtime.getHRS().getSpo2()); if(Runtime.practising==true){ ICLogger.i("自由锻炼中,设置测量心率! "+runtime.getHRS().getPPG()+","+runtime.getHRS().getBPH()+","+runtime.getHRS().getBPL()+","+runtime.getHRS().getSpo2()); Runtime.healthInfo.setPPGECGData(runtime.getHRS().getPPG(),runtime.getHRS().getBPH(),runtime.getHRS().getBPL(),runtime.getHRS().getSpo2()); @@ -169,6 +170,7 @@ public class HeartRateManager extends AbstractInvokeHandlerService implements Se } }else { StringMessage PPGDATA = protocolAPIHelper.getPPG_ECG_MSG(runtime); + //发送给EQC服务器的 sendBroadcastPPGResult(); //因为协议中没有时间变量,所以只能实时传输,如果恰巧没有网络也只能丢弃,有时间变量的话,可以考虑通过deliver的buffer来进行缓存发送 if (PPGDATA == null) { @@ -391,18 +393,48 @@ public class HeartRateManager extends AbstractInvokeHandlerService implements Se } } + private BroadcastReceiver PPGStartReceiver = new BroadcastReceiver() { + public void onReceive(Context param1Context, Intent param1Intent) { + if (ACTION_HEATR_RATE_START.equals(param1Intent.getAction())) { + + //此消息来源于BroadCaset,收到开始测试的消息。 + //此时需要重置HeartRateDetect Timer + //倘若有 参数 PPGTestCycle,则根据这个数值进行设置 + int ppgtestCycle=param1Intent.getIntExtra("PPGTestCycle",-1); + if (ppgtestCycle >0){ + Config.setPPGTestCycle(runtime.getContextProxy().context,ppgtestCycle); + runtime.setPpgTestCycle(Config.getPPGTestCycle(runtime.getContextProxy().context)); + ICLogger.i("get and set PPGTestCycle "+ppgtestCycle); + } + ICLogger.i("PPGStartReceiver ACTION_HEATR_RATE_START "+ppgtestCycle); + CoreService.getInstance().setHeartRateDetectAlarm(runtime.getPpgTestCycle()); +// HeartRateManager.this.startPPG(); + } + + } + }; + public void regReceiver(){ + //注册“ACTION_HEATR_RATE_START”的广播接收器,接收来自协议的设置广播 + IntentFilter intentFilter = new IntentFilter(); + intentFilter.addAction(ACTION_HEATR_RATE_START); + runtime.getContextProxy().context.registerReceiver(PPGStartReceiver, intentFilter); + } + + public void unRegReceiver(){ + runtime.getContextProxy().context.unregisterReceiver(PPGStartReceiver); + } public void onAlarmClock(Connection paramConnection, Runtime paramRuntime) {} public void onAttach(Connection paramConnection, Runtime paramRuntime) { // this.mSignalUtil = SimSignalUtil.getInstance((paramRuntime.getContextProxy()).context); - + regReceiver(); } public void onDetach(Connection paramConnection, Runtime paramRuntime) { - + unRegReceiver(); } public boolean onUserRequest(Intent paramIntent, Connection paramConnection, final Runtime runtime) { diff --git a/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java b/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java index b1a9456f..3cf6b5d1 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java +++ b/app/src/main/java/com/enqualcomm/support/utils/ContextProxy.java @@ -323,6 +323,7 @@ public class ContextProxy { } public void sendBrodcast(String action,Intent intent){ intent.setAction(action); + ICLogger.i("send broadcast action "+action); this.context.sendBroadcast(intent); } diff --git a/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java b/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java index 33b289a4..bf12b65c 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java +++ b/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java @@ -59,6 +59,7 @@ import static com.enqualcomm.support.Constants.KEY_TEMP_WRIST; import static com.enqualcomm.support.Constants.RESUME_ACTION; import static com.enqualcomm.support.bean.Content.CONTACT_CATEGORY_GROUP; +import static com.enqualcomm.support.utils.TemperatureUtil.KEY_TEMP_BYPROTOCOL; import static com.enqualcomm.support.utils.TemperatureUtil.KEY_TEMP_OUT; @@ -425,14 +426,18 @@ public class ProcessReceiver extends BroadcastReceiver { double wrist_temp = paramIntent.getDoubleExtra(KEY_TEMP_WRIST, 0.0f); double body_temp = paramIntent.getDoubleExtra(KEY_TEMP_BODY, 0.0f); double tempOut = paramIntent.getDoubleExtra(KEY_TEMP_OUT, 0.0f); - - ICLogger.i("Received Temperature wrist "+wrist_temp+" body "+body_temp); - StringMessage temperatureMsg = protocolAPIHelper.getTemperatureMSG(wrist_temp, body_temp,tempOut,null); - if (temperatureMsg!=null) - { + boolean byprotocol=paramIntent.getBooleanExtra(KEY_TEMP_BYPROTOCOL,false); + if(byprotocol==false) { + ICLogger.i("Received Temperature wrist "+wrist_temp+" body "+body_temp); + StringMessage temperatureMsg = protocolAPIHelper.getTemperatureMSG(wrist_temp, body_temp, tempOut, null); + if (temperatureMsg != null) { ICLogger.i("temp 发送体温测量值 " + temperatureMsg.isFromCache()); } Deliver.sendLocationMSG(temperatureMsg); + }else{ + ICLogger.i("Skip protocol Temperature wrist "+wrist_temp+" body "+body_temp); + + } }else if (ACTION_SET_SIT_RANGE.equals(str)) { if (paramIntent.hasExtra( Constants.KEY_SIT_RANGE)){ int sitrange=paramIntent.getIntExtra(Constants.KEY_SIT_RANGE,0); diff --git a/app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java b/app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java index 4074e037..74f26518 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java @@ -65,12 +65,14 @@ public class TemperatureUtil { public static final String KEY_TEMP_BODY = "body"; // double 体温 public static final String KEY_TEMP_WRIST = "wrist"; // double 腕温 public static final String KEY_TEMP_OUT = "out"; //temp out + public static final String KEY_TEMP_BYPROTOCOL = "protocol"; //temp out private static void sendTempBroadcast(double value, double animal,double tempOut) { Intent pedIntent = new Intent(); pedIntent.setAction(ACTION_TEMP_RESULT); pedIntent.putExtra(KEY_TEMP_WRIST, value); pedIntent.putExtra(KEY_TEMP_BODY, animal); pedIntent.putExtra(KEY_TEMP_OUT, tempOut); + pedIntent.putExtra(KEY_TEMP_BYPROTOCOL,true); if(CoreService.getInstance()!=null) CoreService.getInstance().sendBroadcast(pedIntent); } diff --git a/app/src/main/java/com/ic/protocols/protocol_ic.java b/app/src/main/java/com/ic/protocols/protocol_ic.java index ac75b3cc..700718c3 100644 --- a/app/src/main/java/com/ic/protocols/protocol_ic.java +++ b/app/src/main/java/com/ic/protocols/protocol_ic.java @@ -35,6 +35,8 @@ import java.util.Date; import java.util.HashMap; import java.util.Locale; +import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; +import static android.content.Intent.FLAG_INCLUDE_STOPPED_PACKAGES; import static com.enqualcomm.support.Constants.ACTION_HEATR_RATE_START; import static com.enqualcomm.support.Constants.ACTION_REMOTE_CAMERA; import static com.enqualcomm.support.LocationClient.LOCATION_MODE; @@ -1211,7 +1213,6 @@ public class protocol_ic { if (cmdlist.length == 4){ String cmdindex=cmdlist[2]; String txtmsg=cmdlist[3]; - txtmsg=Util.UrlGB2312ToUTF8(txtmsg); StringMessage msg=AP40(cmdindex,1); //设定当前工作模式及循环频率 @@ -1652,6 +1653,8 @@ public class protocol_ic { //发送重置PPGCycle的广播,会在CoreServer里面执行 Intent intent = new Intent(); intent.putExtra("PPGTestCycle", Integer.parseInt(cycle)); + intent.setFlags(FLAG_INCLUDE_STOPPED_PACKAGES); + intent.setFlags(FLAG_ACTIVITY_NEW_TASK); runtime.getContextProxy().sendBrodcast(ACTION_HEATR_RATE_START, intent); }catch (Exception e){ ICLogger.e(e.getMessage(),e); diff --git a/app/version_code.properties b/app/version_code.properties index f3b99f96..75b56ed0 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Mon Oct 26 21:43:41 CST 2020 -VERSION_CODE=678 +#Tue Oct 27 18:15:20 CST 2020 +VERSION_CODE=680