}
}
- public static void LoadMessageConfigs() {
-
-
- }
-
public static void loadTemperatureSettings(Runtime runtime) {
runtime.temp_test_Cycle_Seconds = SharePreferenceUtil.getPrefInt(runtime.getContextProxy().context, KeyTempTestCycle, 60 * 60);
}
noTempSensor = false;
C5_noBroadCastActionStrip = true;
- } else if (Config.custom_name.equals("L02") || Config.custom_name.equals("L03") || Config.custom_name.equals("L05")) { //L02
+ } else if (Config.custom_name.equals("L02") ||
+ Config.custom_name.equals("L03") ||
+ Config.custom_name.equals("L05")) { //L02
Config.forceMoveCheck = false; //即爱对gps不进行运动检测,此变量专门为了给其他协议进行强制运动检测用的。
DefaultLocationMode = NORMAL_MOD;
DefaultLocationCycle = 900;
String forceReadMsg = Util.getSystemProperties("persist.sys.forcereadmsg");
ICLogger.d("forceReadMsg == > " + forceReadMsg);
if (handleSMS_CMD(from, message) == false) {
-
//说明不是sms命令,提示短信接收。
if (!TextUtils.isEmpty(forceReadMsg)) {
-
WakeLockUtil.ScreenOnWakeLockTemperary(context);
ContextProxy.play_waning_notify(context);
VibrateUtil.getInstance(context).VibrateOnOnce(true);
Util.mSleep(2000);
-
MsgMustReadDialog instance = MsgMustReadDialog.getInstance();
instance.showMsgDialog();
List<String> list = new ArrayList<>();
public static final String warning_msg_has_read = "has_read";
public static final String warning_msg_create_time = "create_time";
-
//通知数据库
public static final String tb_notification = "notification";
public static final String notification_id = "_id";
Intent intent = new Intent();
intent.setAction(ActionReceivePushTxt);
intent.putExtra("txtMsg", msg);
- intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
this.context.sendBroadcast(intent);
}
package com.enqualcomm.support.utils;
import android.content.ComponentName;
+import android.content.ContentResolver;
+import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
+import android.net.Uri;
import android.os.IBinder;
import com.enqualcomm.support.Config;
import com.enqualcomm.support.CoreService;
import com.enqualcomm.support.ICApplication;
import com.enqualcomm.support.LocationClient;
+import com.enqualcomm.support.R;
import com.enqualcomm.support.bean.Runtime;
import com.enqualcomm.support.bean.StringMessage;
+import com.enqualcomm.support.provider.ICDatabaseHelper;
+import com.enqualcomm.support.provider.ICNotificationProvider;
import com.enqualcomm.support.service.Deliver;
import com.ic.protocols.protocolAPIHelper;
import com.ic.work.ITempSensorCallback;
if (temperature == null) {
return;
}
+
//结果处理
if (Runtime.practising) {
ICLogger.i("自由锻炼中,设置测量体温!" + String.format("%.1f", temperature.getBodyTemp()));
runtime.tempInfo.setTemp(temperature.getBodyTemp(),
temperature.getWristTemp(),
temperature.getEnvTemp());
-
-
//体温异常报警检测开启的会进行异常报警
if (Config.needTemperature_abnormal_alarm) {
- switch (runtime.tempInfo.isBodyTempAbnormal()) {
- case 0:
- break;
- case 1:
+ int resultCode = runtime.tempInfo.isBodyTempAbnormal();
+ switch (resultCode) {
+ case 1://温度过高
if (runtime.setAlarmType(Runtime.AlarmType.ALARM_TEMP_HIGH)) {
//trigger AP10 报警定位
ICLogger.i("triggerSOSLocationProcess ");
LocationClient.getInstance().triggerSOSLocationProcess();
}
break;
- case 2:
+ case 2://温度过低
if (runtime.setAlarmType(Runtime.AlarmType.ALARM_TEMP_LOW)) {
//trigger AP10 报警定位
ICLogger.i("triggerSOSLocationProcess ");
}
break;
}
+ if (resultCode == 1 || resultCode == 2) {
+ //创建警告信息
+ createWarningNotification(
+ CoreService.getInstance().getRuntime().getContextProxy().context
+ .getString(R.string.body_temperature_exception_tips_text)
+ + temperature.getBodyTemp() + "℃)", "body_temperature");
+ }
}
}
+ private void createWarningNotification(String title, String type) {
+ ContentValues contentValues = new ContentValues();
+ //分类是心率的包名
+ contentValues.put(ICDatabaseHelper.notification_category, "com.ic.temperature");
+ contentValues.put(ICDatabaseHelper.notification_title, title);
+ contentValues.put(ICDatabaseHelper.notification_type, type);
+ contentValues.put(ICDatabaseHelper.notification_date, System.currentTimeMillis());
+ contentValues.put(ICDatabaseHelper.notification_order, 0);
+ contentValues.put(ICDatabaseHelper.notification_create_time, System.currentTimeMillis());
+ ContentResolver resolver = CoreService.getInstance().getRuntime().getContextProxy().getResolver();
+ resolver.insert(Uri.parse(ICNotificationProvider.NOTIFICATIONS), contentValues);
+ }
+
+
private static TemperatureUtil sInstance = null;
public static TemperatureUtil getInstance() {
import com.enqualcomm.support.provider.ICDatabaseHelper;
import com.enqualcomm.support.provider.ICGlobalSettingsProvider;
import com.enqualcomm.support.provider.ICMembersProvider;
+import com.enqualcomm.support.provider.WebSmsProvider;
import com.enqualcomm.support.service.HeartRateManager;
import com.enqualcomm.support.utils.CameraUtil;
import com.enqualcomm.support.utils.Connection;
import static com.enqualcomm.support.LocationClient.LOCATION_MODE;
import static com.enqualcomm.support.bean.Contact.GROUP_ALL;
import static java.lang.Math.abs;
-import static java.lang.Math.max;
-import static java.lang.Math.min;
/**
* IC协议
Config.setLastUnReadMessage(runtime.getContextProxy().context, sb.toString());
runtime.getContextProxy().sendMsgBroadcast(txtmsg, 3);//msgType 3需要回复,0不需要回复
} else {
- //判断产品类型,如果是S123的,那么就不发广播了
- //读取一个变量值,判断是否弹窗
+ //读取一个变量值,判断是否强制弹窗
String forceReadMsg = Util.getSystemProperties("persist.sys.forcereadmsg");
ICLogger.d("forceReadMsg == > " + forceReadMsg);
if (!TextUtils.isEmpty(forceReadMsg)) {
+ //强制阅读的话,弹窗显示
MsgMustReadDialog instance = MsgMustReadDialog.getInstance();
instance.showMsgDialog();
List<String> list = new ArrayList<>();
list.add(txtmsg);
instance.addData(list);
} else {
- runtime.getContextProxy().sendMsgBroadcast(txtmsg, 0);//msgType 3需要回复,0不需要回复
+ //msgType 3需要回复,0不需要回复
+ runtime.getContextProxy().sendMsgBroadcast(txtmsg, 0);
}
}
- //保存到数据库里
- runtime.getContextProxy().saveMstToSMSDB(txtmsg);
+ //保存到云短信的库里
+ ContentResolver resolver = runtime.getContextProxy().getResolver();
+ ContentValues contentValues = new ContentValues();
+ contentValues.put(ICDatabaseHelper.web_sms_content, txtmsg);
+ //弹窗表示已阅读了
+ contentValues.put(ICDatabaseHelper.web_sms_has_read, 1);
+ contentValues.put(ICDatabaseHelper.web_sms_create_time, System.currentTimeMillis());
+ resolver.insert(Uri.parse(WebSmsProvider.WEB_MSG), contentValues);
+ //保存到数据库里,以下是原来的做法
+ //runtime.getContextProxy().saveMstToSMSDB(txtmsg);
} else {
ICLogger.i("BP40 format error!");
}
android:shape="rectangle">
<solid android:color="#fff" />
- <corners android:radius="10dp" />
+ <corners
+ android:bottomLeftRadius="10dp"
+ android:bottomRightRadius="10dp" />
</shape>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+
+ <solid android:color="#117CFD" />
+ <corners
+ android:topLeftRadius="10dp"
+ android:topRightRadius="10dp" />
+
+</shape>
\ No newline at end of file
android:width="100dp"
android:height="60dp" />
- <solid android:color="#62CB34" />
+ <solid android:color="#117CFD" />
</shape>
\ No newline at end of file
android:width="100dp"
android:height="60dp" />
- <solid android:color="#56A832" />
+ <solid android:color="#0F5DBC" />
</shape>
\ No newline at end of file
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@drawable/shape_dialog_bg">
-
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="70dp"
- android:text="@string/read_end_tips_text"
- android:textColor="#000"
- android:textSize="28sp"
- app:layout_constraintLeft_toLeftOf="parent"
- app:layout_constraintRight_toRightOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
-
- <TextView
- android:id="@+id/end_page_btn"
+ android:layout_height="match_parent">
+
+
+ <LinearLayout
+ android:id="@+id/container"
android:layout_width="match_parent"
- android:layout_height="70dp"
- android:layout_alignParentBottom="true"
- android:layout_margin="20dp"
- android:layout_marginTop="40dp"
- android:background="@drawable/selector_next_step"
- android:gravity="center"
- android:text="@string/read_end_tips_text"
- android:textColor="#fff"
+ android:layout_height="match_parent"
+ android:background="#ffffff"
+ android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
- app:layout_constraintLeft_toLeftOf="parent"
- app:layout_constraintRight_toRightOf="parent" />
+ app:layout_constraintTop_toTopOf="parent">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="#117CFD"
+ android:gravity="center_horizontal"
+ android:padding="10dp"
+ android:text="@string/web_sms_title_text"
+ android:textColor="@android:color/black"
+ android:textSize="20sp"
+ app:layout_constraintBottom_toTopOf="@id/container" />
+
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="0dp"
+ android:layout_gravity="center_horizontal"
+ android:layout_marginTop="20dp"
+ android:layout_marginBottom="20dp"
+ android:layout_weight="1"
+ android:gravity="center"
+ android:text="@string/read_end_tips_text"
+ android:textColor="#000"
+ android:textSize="38sp"
+ app:layout_constraintLeft_toLeftOf="parent"
+ app:layout_constraintRight_toRightOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ <TextView
+ android:id="@+id/end_page_btn"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:layout_margin="10dp"
+ android:background="@drawable/selector_next_step"
+ android:gravity="center"
+ android:text="@string/close_tips_text"
+ android:textColor="#fff"
+ android:textSize="20sp"
+ android:textStyle="bold" />
+
+ </LinearLayout>
+
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
-<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@drawable/shape_dialog_bg">
+ android:orientation="vertical">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="#117CFD"
+ android:gravity="center_horizontal"
+ android:paddingTop="10dp"
+ android:paddingBottom="10dp"
+ android:text="@string/web_sms_title_text"
+ android:textColor="@android:color/black"
+ android:textSize="20sp"
+ app:layout_constraintTop_toTopOf="parent" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:background="@drawable/shape_dialog_bg"
android:fillViewport="true"
android:orientation="vertical"
android:overScrollMode="never"
- android:padding="20dp"
android:scrollbars="none">
- <RelativeLayout
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/msg_text_tv"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginBottom="80dp"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:padding="10dp"
android:textColor="#000"
android:textSize="22sp" />
<TextView
android:id="@+id/next_btn"
android:layout_width="match_parent"
- android:layout_height="70dp"
+ android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
+ android:layout_margin="10dp"
android:background="@drawable/selector_next_step"
android:gravity="center"
+ android:padding="10dp"
android:text="@string/next_msg_tips_text"
- android:textColor="#fff" />
+ android:textColor="#fff"
+ android:textSize="20sp"
+ android:textStyle="bold" />
- </RelativeLayout>
+ </LinearLayout>
</ScrollView>
-</android.support.constraint.ConstraintLayout>
\ No newline at end of file
+</LinearLayout>
\ No newline at end of file
<string name="oxygen_exception_tips_text">血氧异常(</string>\r
<string name="heart_rate_exception_tips_text">心率异常(BPM</string>\r
<string name="blood_presure_exception_tips_text">血压异常(</string>\r
+ <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
<!-- 法语,德语,意大利-->\r
</resources>\r
<string name="oxygen_exception_tips_text">血氧异常(</string>\r
<string name="heart_rate_exception_tips_text">心率异常(BPM</string>\r
<string name="blood_presure_exception_tips_text">血压异常(</string>\r
+ <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
<!-- 法语,德语,意大利-->\r
</resources>\r
<string name="oxygen_exception_tips_text">血氧异常(</string>\r
<string name="heart_rate_exception_tips_text">心率异常(BPM</string>\r
<string name="blood_presure_exception_tips_text">血压异常(</string>\r
+ <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
<!-- 法语,德语,意大利-->\r
</resources>\r
<string name="sedentary_msg">久坐提醒</string>
-
<string name="en">English</string>
<string name="ja">日本語</string>
<string name="th">ภาษาไทย</string>
<string name="oxygen_exception_tips_text">血氧异常(</string>
<string name="heart_rate_exception_tips_text">心率异常(BPM</string>
<string name="blood_presure_exception_tips_text">血压异常(</string>
+ <string name="body_temperature_exception_tips_text">体温异常(</string>
+ <string name="web_sms_title_text">Web短信提醒</string>
+ <string name="close_tips_text">关闭</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="oxygen_exception_tips_text">血氧异常(</string>
- <string name="heart_rate_exception_tips_text">心率异常(BPM</string>
- <string name="blood_presure_exception_tips_text">血压异常(</string>
+ <string name="close_tips_text">关闭</string>
</resources>
\ No newline at end of file
<string name="oxygen_exception_tips_text">血氧异常(</string>
<string name="heart_rate_exception_tips_text">心率异常(BPM</string>
<string name="blood_presure_exception_tips_text">血压异常(</string>
+ <string name="body_temperature_exception_tips_text">体温异常(</string>
+ <string name="web_sms_title_text">Web短信提醒</string>
+ <string name="close_tips_text">关闭</string>
</resources>
<string name="sedentary_msg">Sedentary reminder !</string>
<string name="next_msg_tips_text">Next</string>
- <string name="read_end_tips_text">Done</string>
+ <string name="read_end_tips_text">That is all!</string>
<string name="en">English</string>
<string name="ja">日本語</string>
<string name="oxygen_exception_tips_text">血氧异常(</string>
<string name="heart_rate_exception_tips_text">心率异常(BPM</string>
<string name="blood_presure_exception_tips_text">血压异常(</string>
+ <string name="body_temperature_exception_tips_text">体温异常(</string>
+ <string name="web_sms_title_text">Web短信提醒</string>
+ <string name="close_tips_text">关闭</string>
<!-- 法语,德语,意大利-->
</resources>