release ICProtocol8.1_V931
authorSnickerSun <scy@incartech.cn>
Thu, 23 Sep 2021 12:23:55 +0000 (20:23 +0800)
committerSnickerSun <scy@incartech.cn>
Thu, 23 Sep 2021 12:23:55 +0000 (20:23 +0800)
心率测试失败 上报0 message
fzd 添加 LOCATIONMODE 设置 工作模式。

app/build.gradle
app/release/ICProtocol81_V931_2109232020_release.apk [new file with mode: 0644]
app/release/output.json
app/src/main/java/com/ic/protocolSrv/Config.java
app/src/main/java/com/ic/protocolSrv/service/HeartRateManager.java
app/src/main/java/com/ic/protocols/protocolAPIHelper.java
app/src/main/java/com/ic/protocols/protocol_fzd.java
app/version_code.properties
icsupport.iml [deleted file]

index db8107f..9ea3b6d 100644 (file)
@@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
 
 // APK 名称
 static def getApkBaseName() {
-    return "ICProtocol8.1"
+    return "ICProtocol81"
 }
 
 android {
diff --git a/app/release/ICProtocol81_V931_2109232020_release.apk b/app/release/ICProtocol81_V931_2109232020_release.apk
new file mode 100644 (file)
index 0000000..963b26c
Binary files /dev/null and b/app/release/ICProtocol81_V931_2109232020_release.apk differ
index 0653acd..b158c25 100644 (file)
@@ -1 +1 @@
-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":928,"versionName":"2109081956","enabled":true,"outputFile":"ICProtocol8.1_V928_2109081956_release.apk","fullName":"release","baseName":"release"},"path":"ICProtocol8.1_V928_2109081956_release.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":931,"versionName":"2109232020","enabled":true,"outputFile":"ICProtocol81_V931_2109232020_release.apk","fullName":"release","baseName":"release"},"path":"ICProtocol81_V931_2109232020_release.apk","properties":{}}]
\ No newline at end of file
index 3102544..3811342 100644 (file)
@@ -592,7 +592,6 @@ public class Config {
     public static final int PROTOCOL_ANAN = 5;
     public static final int PROTOCOL_S123 = 6;
     public static final int PROTOCOL_GATOR = 7;
-    public static final int PROTOCOL_W100 = 8;
     public static final int PROTOCOL_UNKNOWN = 255;
 
     public static int protocol_no = getProtocolNumber();
index 702d3d8..1304b29 100644 (file)
@@ -260,16 +260,18 @@ public class HeartRateManager extends AbstractInvokeHandlerService {
         //如果为0,那么就不上传了
         if (heartRate.getHeartRate() == 0) {
             ICLogger.d("result invalidate...");
-            return;
+            runtime.getHRS().setHeartrateStat(heartRateStatus.HEARTRATE_WORKINGSTAT.HEARTRATE_TEST_FAILED);
+            uploadResult();
+        }else {
+            //BY TrillGates
+            //判断是否有超出阀值
+            //如果超出的话,插入一条警告通知
+            //如果数据为0,不处理
+            checkHeartRateValue(heartRate);
+            runtime.getHRS().setHeartrateStat(heartRateStatus.HEARTRATE_WORKINGSTAT.HEARTRATE_TEST_SUCCESS);
+            runtime.getHRS().setLastHeartrate(heartRate.getHeartRate(), heartRate.getBloodHeight(), heartRate.getBloodLow(), heartRate.getOxygen());
+            uploadResult();
         }
-        //BY TrillGates
-        //判断是否有超出阀值
-        //如果超出的话,插入一条警告通知
-        //如果数据为0,不处理
-        checkHeartRateValue(heartRate);
-        runtime.getHRS().setHeartrateStat(heartRateStatus.HEARTRATE_WORKINGSTAT.HEARTRATE_TEST_SUCCESS);
-        runtime.getHRS().setLastHeartrate(heartRate.getHeartRate(), heartRate.getBloodHeight(), heartRate.getBloodLow(), heartRate.getOxygen());
-        uploadResult();
     }
 
     private void checkHeartRateValue(HeartRate heartRate) {
@@ -398,7 +400,21 @@ public class HeartRateManager extends AbstractInvokeHandlerService {
             }
 
         } else {
-            ICLogger.i("PPG Failed for Timeout!");
+            ICLogger.i("PPG Failed for Timeout!  send 0 message to server");
+            if (!Runtime.practising) {
+                StringMessage PPGDATA = protocolAPIHelper.getPPG_ECG_MSG(runtime,0,0,0,0);
+                //因为协议中没有时间变量,所以只能实时传输,如果恰巧没有网络也只能丢弃,有时间变量的话,可以考虑通过deliver的buffer来进行缓存发送
+                if (PPGDATA == null) {
+                    StringMessage ppgd = protocolAPIHelper.getPPG_MSG(0, this.runtime);
+                    StringMessage bloodd = protocolAPIHelper.getBlood_MSG(0,0, this.runtime);
+                    StringMessage oxd = protocolAPIHelper.getOxygen_MSG(0, this.runtime);
+                    Deliver.sendLocationMSG(ppgd);
+                    Deliver.sendLocationMSG(bloodd);
+                    Deliver.sendLocationMSG(oxd);
+                } else {
+                    Deliver.sendLocationMSG(PPGDATA);
+                }
+            }
         }
     }
 
index 90d7ad7..559b049 100644 (file)
@@ -961,7 +961,7 @@ public class protocolAPIHelper {
         return ret;
     }
 
-    public static StringMessage getPPG_ECG_MSG(int ppg, int bph, int bpl, int spo2, Runtime runtime) {
+    public static StringMessage getPPG_ECG_MSG(Runtime runtime,int ppg, int bph, int bpl, int spo2 ) {
         if (is_protocol_not_Initialled()) return null;
 
         StringMessage ret = null;
index a95a523..635ccff 100644 (file)
@@ -441,6 +441,7 @@ public class protocol_fzd {
         SOSON,//w100SOS 报警开关
         IP,//配置服务器地址
         SOSREC,//服务器响应S0S消息
+        LOCATIONMODE,//设置工作模式
     }
 
     public static HashMap<CMD_TYPE, String> cmdMap = null;
@@ -520,6 +521,7 @@ public class protocol_fzd {
         cmdMap.put(CMD_TYPE.SOSON, "SOSON");
         cmdMap.put(CMD_TYPE.IP, "IP");
         cmdMap.put(CMD_TYPE.SOSREC, "SOSREC");
+        cmdMap.put(CMD_TYPE.LOCATIONMODE, "LOCATIONMODE");
     }
 
     private Connection mConnection = null;
@@ -1272,6 +1274,41 @@ public class protocol_fzd {
         }
     }
 
+
+    public static StringMessage LOCATIONMODE() {
+
+        return genFZDCMD(cmdMap.get(CMD_TYPE.LOCATIONMODE));
+    }
+
+    public void handleLOCATIONMODE(Connection connection, Runtime runtime, String cmd, String data) {
+        /**
+         * 平台发送:
+         * [XT*YYYYYYYYYYYYYYY*LEN*LOCATIONMODE,mode,cycle_seconds]
+         * 实例:[XT*334588000000156*0012*LOCATIONMODE,8,900]
+         * 终端回复:
+         * [XT*YYYYYYYYYYYYYYY*LEN*LOCATIONMODE]
+         * 实例:[XT*334588000000156*000C*LOCATIONMODE]
+         * @return
+         */
+        connection.send(LOCATIONMODE());
+        try {
+            String list[]=data.split(CMD_SPLIT);
+            if(list.length==2) {
+                int timesecond = Integer.parseInt(list[1]);
+                int mod = Integer.parseInt(list[0]);
+                log("LOCATION_MODE  " + LOCATION_MODE + " mod " + mod);
+                Config.setLocationMode(runtime.getContextProxy().context, mod);
+                Config.setLocationCycle(runtime.getContextProxy().context, timesecond);
+                runtime.getLocationInstance().setLocation_cycle(timesecond);
+                runtime.getLocationInstance().setWorkingMod(mod);
+            }
+//            CoreService.getInstance().setLocationAlarm(runtime.getLocationInstance().getWorkingMod());
+            //此处设置好配置后,会在LocationClient通过消息开始执行及时定位操作。
+        } catch (Exception e) {
+            ICLogger.e(e.getMessage(), e);
+        }
+    }
+
     public static StringMessage heart(int hrt) {
         return genFZDCMD(cmdMap.get(CMD_TYPE.heart), String.valueOf(hrt));
     }
@@ -1695,6 +1732,12 @@ public class protocol_fzd {
                 //通知下面线程状态变化
                 mConnection.DeliverCMDMessageToSystem("setWorkMod", cmd);
                 break;
+            case LOCATIONMODE:
+                //设置工作模式
+                handleLOCATIONMODE(mConnection,mRuntime,cmd,data);
+                //通知下面线程状态变化
+                mConnection.DeliverCMDMessageToSystem("setWorkMod", cmd);
+                break;
             case SOS:
                 //收到设置SOS号码
                 handleSOS(mConnection, mRuntime, cmd, data);
index b2c0774..ee0092a 100644 (file)
@@ -1,2 +1,2 @@
-#Wed Sep 08 19:56:03 CST 2021\r
-VERSION_CODE=928\r
+#Thu Sep 23 20:20:45 CST 2021\r
+VERSION_CODE=931\r
diff --git a/icsupport.iml b/icsupport.iml
deleted file mode 100644 (file)
index 30277a3..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<module external.linked.project.id="icsupport" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">\r
-  <component name="FacetManager">\r
-    <facet type="java-gradle" name="Java-Gradle">\r
-      <configuration>\r
-        <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />\r
-        <option name="BUILDABLE" value="false" />\r
-      </configuration>\r
-    </facet>\r
-  </component>\r
-  <component name="NewModuleRootManager" inherit-compiler-output="true">\r
-    <exclude-output />\r
-    <content url="file://$MODULE_DIR$">\r
-      <excludeFolder url="file://$MODULE_DIR$/.gradle" />\r
-      <excludeFolder url="file://$MODULE_DIR$/build" />\r
-    </content>\r
-    <orderEntry type="inheritedJdk" />\r
-    <orderEntry type="sourceFolder" forTests="false" />\r
-  </component>\r
-</module>
\ No newline at end of file