add warning msg.
authorTrillGates <williamtrillgates@gmail.com>
Tue, 20 Jul 2021 03:33:35 +0000 (11:33 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Tue, 20 Jul 2021 03:33:35 +0000 (11:33 +0800)
16 files changed:
app/release/ICSer_V894_2107192045_release.apk [moved from app/release/ICSer_V893_2107171959_release.apk with 77% similarity]
app/release/output.json
app/src/main/java/com/enqualcomm/support/Constants.java
app/src/main/java/com/enqualcomm/support/CoreService.java
app/src/main/java/com/enqualcomm/support/service/HeartRateManager.java
app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java
app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java
app/src/main/java/com/ic/protocols/protocol_s123.java
app/src/main/res/values-de-rCH/strings.xml
app/src/main/res/values-fr-rCH/strings.xml
app/src/main/res/values-it-rCH/strings.xml
app/src/main/res/values-ja/strings.xml
app/src/main/res/values-w820dp/strings.xml
app/src/main/res/values-zh-rCN/strings.xml
app/src/main/res/values/strings.xml
app/version_code.properties

similarity index 77%
rename from app/release/ICSer_V893_2107171959_release.apk
rename to app/release/ICSer_V894_2107192045_release.apk
index 3951fbd..105bb90 100644 (file)
Binary files a/app/release/ICSer_V893_2107171959_release.apk and b/app/release/ICSer_V894_2107192045_release.apk differ
index 9d8ee17..6433691 100644 (file)
@@ -1 +1 @@
-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":893,"versionName":"2107171959","enabled":true,"outputFile":"ICSer_V893_2107171959_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V893_2107171959_release.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":894,"versionName":"2107192045","enabled":true,"outputFile":"ICSer_V894_2107192045_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V894_2107192045_release.apk","properties":{}}]
\ No newline at end of file
index 5db4b0f..a8f01e4 100644 (file)
@@ -401,5 +401,16 @@ public interface Constants {
     int FROM_ALARM = 1;
     int FROM_CLIENT = 2;
 
+
+    /*警告信息类型*/
+    //1表示环境温度过高,2表示心率异常,3表示血氧异常
+    //4表示血压异常,5表示体温过高,6表示SOS紧急报警,7低电量报警
+    int WARNING_MSG_TYPE_ENV_TEMP = 1;
+    int WARNING_MSG_TYPE_HEART_RATE = 2;
+    int WARNING_MSG_TYPE_BLOOD_OXYGEN = 3;
+    int WARNING_MSG_TYPE_BLOOD_PRESSURE = 4;
+    int WARNING_MSG_TYPE_BODY_TEMP = 5;
+    int WARNING_MSG_TYPE_SOS = 6;
+    int WARNING_MSG_TYPE_POWER_LOW = 7;
 }
 
index 54a628f..06f763d 100644 (file)
@@ -7,6 +7,7 @@ import android.app.PendingIntent;
 import android.app.Service;
 import android.content.BroadcastReceiver;
 import android.content.ContentResolver;
+import android.content.ContentValues;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
@@ -34,6 +35,7 @@ import com.enqualcomm.support.bean.SleepRecord;
 import com.enqualcomm.support.bean.StringMessage;
 import com.enqualcomm.support.bean.heartRateStatus;
 import com.enqualcomm.support.provider.ICDatabaseHelper;
+import com.enqualcomm.support.provider.WarningItemProvider;
 import com.enqualcomm.support.provider.WeTalkMessageProvider;
 import com.enqualcomm.support.service.AntiMonitorService;
 import com.enqualcomm.support.service.CheckSIM;
@@ -236,22 +238,33 @@ public class CoreService extends Service {
                 setEmegencyLocationSTOPAlarm(5);
             } else if (ACTION_LOCAL_SOS_ACTION.endsWith(param1Intent.getAction())) {
                 VibrateUtil.getInstance(runtime.getContextProxy().context).vibrateOn(true);
-//               if( param1Intent.getIntExtra("type", 1) == 1) {
+                //if( param1Intent.getIntExtra("type", 1) == 1) {
                 if (needHRSTestOnSOS) {
                     //触发一次心率检测
                     ICLogger.d("needHRSTestOnSOS =}}= > setHeartRateDetectAlarm ");
                     setHeartRateDetectAlarm(1);
                 }
+                //add by TrillGates=====start
+                //S123的项目需要加警告信息
+                //保存一份到警告信息中
+                ContentValues warningMsgValues = new ContentValues();
+                //设置数据
+                warningMsgValues.put(ICDatabaseHelper.warning_msg_type, Constants.WARNING_MSG_TYPE_SOS);
+                warningMsgValues.put(ICDatabaseHelper.warning_msg_title,
+                        runtime.getContextProxy().context.getString(R.string.sos_warning_msg_text));
+                warningMsgValues.put(ICDatabaseHelper.warning_msg_has_read, 1);
+                warningMsgValues.put(ICDatabaseHelper.warning_msg_create_time, System.currentTimeMillis());
+                runtime.getContextProxy().getResolver().insert(Uri.parse(WarningItemProvider.WARNING_MSG),
+                        warningMsgValues);
+                //add by TrillGates=====end
                 runtime.setAlarmType(Runtime.AlarmType.ALARM_SOS);
                 //trigger AP10 报警定位
                 ICLogger.i("triggerSOSLocationProcess ");
                 LocationClient.getInstance().triggerSOSLocationProcess();
-//                    Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));
-
+                //Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));
                 //开启紧急定位模式,GPS 优先1分钟一次定位,持续5分钟
                 runtime.getLocationInstance().setWorkingMod(EMERGNECY_MOD);
                 setLocationAlarm(runtime.getLocationInstance().getWorkingMod());
-
                 //SOS模式,心率测试1分钟一次,持续5分钟
                 if (needHRSTestOnSOS) {
                     //只触发一次心率检测
@@ -265,7 +278,6 @@ public class CoreService extends Service {
                     mHandler.postDelayed(mTriggerSOSCALLThread, 500);
                 }
             } else if (ACTION_QUERY_WEATHER.equals(param1Intent.getAction())) {
-
                 ICLogger.i("ACTION_QUERY_WEATHER ");
                 connection.send(protocolAPIHelper.getWeatherMSG(runtime));
             }
@@ -319,7 +331,6 @@ public class CoreService extends Service {
                     //停止自由锻炼,恢复正常
                     Runtime.practising = false;
                     Util.setSystemProperties(Config.KeyPractiseState, "false");
-
                     //最后检测是否还有数据需要发送
                     if (Runtime.healthInfo.check_info_item_finished()) {
                         Runtime.healthInfo.appendBuffer(Runtime.healthInfo.getHealthInfoString());
@@ -327,10 +338,10 @@ public class CoreService extends Service {
                     }
                     if (Runtime.healthInfo.getInfoCount() >= 0) {
                         //超过30次发送数据给服务器
-                        ICLogger.i("自由锻炼结束,发送数据给服务器 " + Runtime.healthInfo.getBufferData().length);
+                        ICLogger.i("自由锻炼结束,发送数据给服务器 "
+                                + Runtime.healthInfo.getBufferData().length);
                         mHandler.post(mupdatePracticeData);
                     }
-
                 }
             }
         }
index db58e28..c28f405 100644 (file)
@@ -14,6 +14,7 @@ import android.os.IBinder;
 import android.os.Message;
 
 import com.enqualcomm.support.Config;
+import com.enqualcomm.support.Constants;
 import com.enqualcomm.support.CoreService;
 import com.enqualcomm.support.ICApplication;
 import com.enqualcomm.support.LocationClient;
@@ -24,6 +25,7 @@ import com.enqualcomm.support.bean.heartRateStatus;
 import com.enqualcomm.support.provider.ICDatabaseHelper;
 import com.enqualcomm.support.provider.ICGlobalSettingsProvider;
 import com.enqualcomm.support.provider.ICNotificationProvider;
+import com.enqualcomm.support.provider.WarningItemProvider;
 import com.enqualcomm.support.service.base.AbstractInvokeHandlerService;
 import com.enqualcomm.support.utils.Connection;
 import com.enqualcomm.support.utils.HeartRateOxygenTestType;
@@ -200,21 +202,22 @@ public class HeartRateManager extends AbstractInvokeHandlerService {
         int bloodHeightValue = heartRate.getBloodHeight();
         int bloodLowValue = heartRate.getBloodLow();
         Context context = runtime.getContextProxy().context;
+
         if (oxygenValue != 0 && Config.LIMIT_VALUE_OXYGEN != 0 && oxygenValue < Config.LIMIT_VALUE_OXYGEN) {
             //发出警告
             createWarningNotification(context.getString(R.string.oxygen_exception_tips_text) + oxygenValue + "%)",
-                    NOTIFICATION_TYPE_BLOOD_OXYGEN);
+                    NOTIFICATION_TYPE_BLOOD_OXYGEN, Constants.WARNING_MSG_TYPE_BLOOD_OXYGEN);
         }
         if (heartRateValue != 0 && Config.LIMIT_VALUE_PPGH != 0 && heartRateValue > Config.LIMIT_VALUE_PPGH) {
             //判断是否超出阀值,上限
             createWarningNotification(context.getString(R.string.heart_rate_exception_tips_text) + heartRateValue + ")",
-                    NOTIFICATION_TYPE_HEART_RATE);
+                    NOTIFICATION_TYPE_HEART_RATE, Constants.WARNING_MSG_TYPE_HEART_RATE);
         }
 
         if (heartRateValue != 0 && Config.LIMIT_VALUE_PPGH != 0 && heartRateValue < Config.LIMIT_VALUE_PPGL) {
             //判断是否超出阀值,下限
             createWarningNotification(context.getString(R.string.heart_rate_exception_tips_text) + heartRateValue + ")",
-                    NOTIFICATION_TYPE_HEART_RATE);
+                    NOTIFICATION_TYPE_HEART_RATE, Constants.WARNING_MSG_TYPE_HEART_RATE);
         }
 
         if (bloodHeightValue != 0 && Config.LIMIT_VALUE_BPH_H != 0 && Config.LIMIT_VALUE_BPH_L != 0) {
@@ -222,7 +225,7 @@ public class HeartRateManager extends AbstractInvokeHandlerService {
             if (bloodHeightValue > Config.LIMIT_VALUE_BPH_H || bloodHeightValue < Config.LIMIT_VALUE_BPH_L) {
                 //警报,血压高值超出范围
                 createWarningNotification(context.getString(R.string.blood_presure_exception_tips_text) + bloodHeightValue + "/100mmHg)",
-                        NOTIFICATION_TYPE_BLOOD_PRESSURE);
+                        NOTIFICATION_TYPE_BLOOD_PRESSURE, Constants.WARNING_MSG_TYPE_BLOOD_PRESSURE);
             }
         }
 
@@ -231,7 +234,7 @@ public class HeartRateManager extends AbstractInvokeHandlerService {
             if (bloodHeightValue > Config.LIMIT_VALUE_BPL_H || bloodHeightValue < Config.LIMIT_VALUE_BPL_L) {
                 //警报,血压低值超出范围
                 createWarningNotification(context.getString(R.string.blood_presure_exception_tips_text) + bloodHeightValue + "/100mmHg)",
-                        NOTIFICATION_TYPE_BLOOD_PRESSURE);
+                        NOTIFICATION_TYPE_BLOOD_PRESSURE, Constants.WARNING_MSG_TYPE_BLOOD_PRESSURE);
             }
         }
     }
@@ -240,7 +243,7 @@ public class HeartRateManager extends AbstractInvokeHandlerService {
     public static final String NOTIFICATION_TYPE_BLOOD_PRESSURE = "blood_pressure";
     public static final String NOTIFICATION_TYPE_BLOOD_OXYGEN = "blood_oxygen";
 
-    private void createWarningNotification(String title, String type) {
+    private void createWarningNotification(String title, String type, int typeValue) {
         ContentValues contentValues = new ContentValues();
         //分类是心率的包名
         contentValues.put(ICDatabaseHelper.notification_category, "com.ic.blood");
@@ -252,6 +255,14 @@ public class HeartRateManager extends AbstractInvokeHandlerService {
         ContentResolver resolver = runtime.getContextProxy().getResolver();
         resolver.insert(Uri.parse(ICNotificationProvider.NOTIFICATIONS), contentValues);
         updateSettingsValue();
+        //保存一份到警告信息中
+        ContentValues warningMsgValues = new ContentValues();
+        //设置数据
+        warningMsgValues.put(ICDatabaseHelper.warning_msg_type, typeValue);
+        warningMsgValues.put(ICDatabaseHelper.warning_msg_title, title);
+        warningMsgValues.put(ICDatabaseHelper.warning_msg_has_read, 1);
+        warningMsgValues.put(ICDatabaseHelper.warning_msg_create_time, System.currentTimeMillis());
+        resolver.insert(Uri.parse(WarningItemProvider.WARNING_MSG), warningMsgValues);
     }
 
     private void updateSettingsValue() {
@@ -264,7 +275,6 @@ public class HeartRateManager extends AbstractInvokeHandlerService {
     }
 
 
-
     private void uploadResult() {
         //只有检测PPG成功,且网络连接中才发送数据
         if (this.runtime.getHRS().getHeartrateWorkingStat() == heartRateStatus.HEARTRATE_WORKINGSTAT.HEARTRATE_TEST_SUCCESS) {
index 8e38dc2..6509203 100644 (file)
@@ -1,20 +1,26 @@
 package com.enqualcomm.support.utils;
 
 import android.content.BroadcastReceiver;
+import android.content.ContentValues;
 import android.content.Context;
 import android.content.ContextWrapper;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.net.Uri;
 import android.os.BatteryManager;
 import android.os.Handler;
 import android.os.Message;
 import android.os.PowerManager;
 
 import com.enqualcomm.support.Config;
+import com.enqualcomm.support.Constants;
 import com.enqualcomm.support.CoreService;
 import com.enqualcomm.support.LocationClient;
+import com.enqualcomm.support.R;
 import com.enqualcomm.support.bean.EventLooperHandlerThread;
 import com.enqualcomm.support.bean.Runtime;
+import com.enqualcomm.support.provider.ICDatabaseHelper;
+import com.enqualcomm.support.provider.WarningItemProvider;
 import com.enqualcomm.support.service.AntiMonitorService;
 import com.enqualcomm.support.service.AudioService;
 import com.ic.protocols.protocolAPIHelper;
@@ -166,9 +172,19 @@ public class BatteryUtil {
     }
 
     public static void checkAndSendBatteryEvent(Context context, Runtime runtime) {
-
+        //add by TrillGates======start
+        //保存一份到警告信息中
+        ContentValues warningMsgValues = new ContentValues();
+        //设置数据
+        warningMsgValues.put(ICDatabaseHelper.warning_msg_type, Constants.WARNING_MSG_TYPE_POWER_LOW);
+        warningMsgValues.put(ICDatabaseHelper.warning_msg_title, runtime.getContextProxy().context.getString(R.string.low_power_warning_text));
+        warningMsgValues.put(ICDatabaseHelper.warning_msg_has_read, 1);
+        warningMsgValues.put(ICDatabaseHelper.warning_msg_create_time, System.currentTimeMillis());
+        runtime.getContextProxy().getResolver().insert(Uri.parse(WarningItemProvider.WARNING_MSG),
+                warningMsgValues);
+        //add by TrillGates======end
         //没有充电,上次电池level > 15% , 上次电池并且不是 低电状态,则报警
-        if (runtime.isPowerConnected() == false && runtime.getBatterylevel() <= 15 && runtime.getBatterylevel() > 10 && runtime.getBatteryLow() == false) {
+        if (!runtime.isPowerConnected() && runtime.getBatterylevel() <= 15 && runtime.getBatterylevel() > 10 && !runtime.getBatteryLow()) {
             Intent intent = new Intent();
             intent.setAction(ACTION_BATTERYLOW);
             intent.putExtra(KEY_BATTERY_EVENT, 1);
@@ -176,10 +192,10 @@ public class BatteryUtil {
             play_waning_notify(context);
             runtime.setAlarmType(Runtime.AlarmType.ALARM_LOWBATTERY);
             //trigger AP10 报警定位
-//      Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));
+            //Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));
             ICLogger.i("triggerSOSLocationProcess ");
             LocationClient.getInstance().triggerSOSLocationProcess();
-        } else if (runtime.isPowerConnected() == false && runtime.getBatterylevel() <= 10 && runtime.getBatterylevel() > 5 && runtime.getBatteryLow() == false) {
+        } else if (!runtime.isPowerConnected() && runtime.getBatterylevel() <= 10 && runtime.getBatterylevel() > 5 && !runtime.getBatteryLow()) {
             //百分之10以内的还不能正常报数,需要后面再优化
             Intent intent = new Intent();
             intent.setAction(ACTION_BATTERYLOW);
@@ -188,10 +204,10 @@ public class BatteryUtil {
             play_waning_notify(context);
             runtime.setAlarmType(Runtime.AlarmType.ALARM_LOWBATTERY);
             //trigger AP10 报警定位
-//      Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));
+            //Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime));
             ICLogger.i("triggerSOSLocationProcess ");
             LocationClient.getInstance().triggerSOSLocationProcess();
-        } else if (runtime.isPowerConnected() == false && runtime.getBatterylevel() <= 5) {
+        } else if (!runtime.isPowerConnected() && runtime.getBatterylevel() <= 5) {
             //没有充电,上次电池level > 15% , 上次电池并且不是 电池低电状态,则报警
             Intent intent = new Intent();
             intent.setAction(ACTION_BATTERYLOW);
@@ -200,7 +216,7 @@ public class BatteryUtil {
             play_waning_notify(context);
             runtime.setAlarmType(Runtime.AlarmType.ALARM_LOWBATTERY);
             //trigger AP10 报警定位
-//      Deliver.sendLocationMSG( protocolAPIHelper.getWarningMSG(runtime));
+            //Deliver.sendLocationMSG( protocolAPIHelper.getWarningMSG(runtime));
             ICLogger.i("triggerSOSLocationProcess ");
             LocationClient.getInstance().triggerSOSLocationProcess();
         }
index 8641d4e..6a78796 100644 (file)
@@ -10,6 +10,7 @@ import android.net.Uri;
 import android.os.IBinder;
 
 import com.enqualcomm.support.Config;
+import com.enqualcomm.support.Constants;
 import com.enqualcomm.support.CoreService;
 import com.enqualcomm.support.ICApplication;
 import com.enqualcomm.support.LocationClient;
@@ -19,6 +20,7 @@ import com.enqualcomm.support.bean.StringMessage;
 import com.enqualcomm.support.provider.ICDatabaseHelper;
 import com.enqualcomm.support.provider.ICGlobalSettingsProvider;
 import com.enqualcomm.support.provider.ICNotificationProvider;
+import com.enqualcomm.support.provider.WarningItemProvider;
 import com.enqualcomm.support.service.Deliver;
 import com.ic.protocols.protocolAPIHelper;
 import com.ic.work.ITempSensorCallback;
@@ -161,6 +163,14 @@ public class TemperatureUtil {
         ContentResolver resolver = CoreService.getInstance().getRuntime().getContextProxy().getResolver();
         resolver.insert(Uri.parse(ICNotificationProvider.NOTIFICATIONS), contentValues);
         updateSettingsValue(resolver);
+
+        ContentValues warningMsgValues = new ContentValues();
+        //设置数据
+        warningMsgValues.put(ICDatabaseHelper.warning_msg_type, Constants.WARNING_MSG_TYPE_BODY_TEMP);
+        warningMsgValues.put(ICDatabaseHelper.warning_msg_title, title);
+        warningMsgValues.put(ICDatabaseHelper.warning_msg_has_read, 1);
+        warningMsgValues.put(ICDatabaseHelper.warning_msg_create_time, System.currentTimeMillis());
+        resolver.insert(Uri.parse(WarningItemProvider.WARNING_MSG), warningMsgValues);
     }
 
     private void updateSettingsValue(ContentResolver resolver) {
index c063f15..d9abdee 100644 (file)
@@ -1203,8 +1203,6 @@ public class protocol_s123 {
 
         String[] cmdlist = cmd.split(",");
         if (cmdlist.length == 4) {
-
-
             log("com.ic.work mode " + cmdlist[3]);
             try {
                 int mod = Integer.parseInt(cmdlist[3]);
index e4efc02..0bc7182 100644 (file)
     <string name="body_temperature_exception_tips_text">体温异常(</string>\r
     <string name="web_sms_title_text">Web短信提醒</string>\r
     <string name="close_tips_text">关闭</string>\r
+    <string name="low_power_warning_text">低电量报警</string>\r
+    <string name="sos_warning_msg_text">SOS紧急报警</string>\r
     <!--    法语,德语,意大利-->\r
 </resources>\r
index e4efc02..0bc7182 100644 (file)
     <string name="body_temperature_exception_tips_text">体温异常(</string>\r
     <string name="web_sms_title_text">Web短信提醒</string>\r
     <string name="close_tips_text">关闭</string>\r
+    <string name="low_power_warning_text">低电量报警</string>\r
+    <string name="sos_warning_msg_text">SOS紧急报警</string>\r
     <!--    法语,德语,意大利-->\r
 </resources>\r
index e4efc02..0bc7182 100644 (file)
     <string name="body_temperature_exception_tips_text">体温异常(</string>\r
     <string name="web_sms_title_text">Web短信提醒</string>\r
     <string name="close_tips_text">关闭</string>\r
+    <string name="low_power_warning_text">低电量报警</string>\r
+    <string name="sos_warning_msg_text">SOS紧急报警</string>\r
     <!--    法语,德语,意大利-->\r
 </resources>\r
index fb3b8d8..129081b 100644 (file)
     <string name="body_temperature_exception_tips_text">体温異常(</string>
     <string name="web_sms_title_text">SMS通知</string>
     <string name="close_tips_text">シャットダウン</string>
+    <string name="low_power_warning_text">低电量报警</string>
+    <string name="sos_warning_msg_text">SOS紧急报警</string>
 
 </resources>
index 23da7e5..5d6d0b2 100644 (file)
@@ -1,4 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
     <string name="close_tips_text">关闭</string>
+    <string name="low_power_warning_text">低电量报警</string>
+    <string name="sos_warning_msg_text">SOS紧急报警</string>
 </resources>
\ No newline at end of file
index 04dda76..e116a35 100644 (file)
     <string name="close_text">关闭</string>
     <string name="commit_text">确定</string>
     <string name="sport_aim_achieve_tips_text">运动达标!</string>
+    <string name="low_power_warning_text">低电量报警</string>
+    <string name="sos_warning_msg_text">SOS紧急报警</string>
 </resources>
index 29de5c0..25dc3c7 100644 (file)
     <string name="body_temperature_exception_tips_text">体温异常(</string>
     <string name="web_sms_title_text">Web短信提醒</string>
     <string name="close_tips_text">关闭</string>
+    <string name="low_power_warning_text">低电量报警</string>
+    <string name="sos_warning_msg_text">SOS紧急报警</string>
     <!--    法语,德语,意大利-->
 </resources>
index 47cfbac..f0b55e5 100644 (file)
@@ -1,2 +1,2 @@
-#Sat Jul 17 19:59:31 CST 2021\r
-VERSION_CODE=893\r
+#Mon Jul 19 20:45:07 CST 2021\r
+VERSION_CODE=894\r