//如果重试都失败,则丢弃命令不进行盲点续传
public static boolean discard_cmd_after_retryfailed = true;
- public static boolean enableDataRoaming=false;
+ public static boolean enableDataRoaming = false;
public static boolean forceMoveCheck = true;
public static boolean forceWearCheck = true;
public static boolean needBroadcastCutoffAlarm = true;
+ //add by TrillGates=================start
+ //各种阀值:血压,血氧,心率,体温
+ //以下值的赋值时机:
+ //1、服务起来的时候,从数据库中读取记录阀值
+ //2、当阀值更新的时候,更新数据的同时,也更新以下的值
+ //保存到这里来,方便使用,不需要每次去查询
+ public static int LIMIT_VALUE_PPGH = 0;
+ public static int LIMIT_VALUE_PPGL = 0;
+ public static int LIMIT_VALUE_BPH_H = 0;
+ public static int LIMIT_VALUE_BPH_L = 0;
+ public static int LIMIT_VALUE_BPL_H = 0;
+ public static int LIMIT_VALUE_BPL_L = 0;
+ public static int LIMIT_VALUE_OXYGEN = 0;
+ //add by TrillGates=================end
+
+
//定位是否使用wifi的配置。
public static boolean disableWiFiScan = false;
}
public static void loadHearBeatSetting(Runtime runtime) {
- if(Config.protocol_no == Config.PROTOCOL_UNKNOWN){
+ if (Config.protocol_no == Config.PROTOCOL_UNKNOWN) {
Config.HeartBeatAlarmCycle = 65535; //不识别的协议,就设置一个很大的数据相当于没有心跳,这样更省电
}
runtime.setHeartBeatCycle(Config.getHeartBeatCycle(runtime.getContextProxy().context));
break;
default:
ICLogger.i("协议版本 目前支持0,1,2,3,4,5,6,7");
- ret=PROTOCOL_UNKNOWN;
+ ret = PROTOCOL_UNKNOWN;
break;
}
} else {
public static int getSleepScore(Context context) {
-
return Util.getSystemPropertiesInt("persist.sys." + Constants.SHAREKEY_SETTING_SLEEP_SCORE, 0);
}
noPPGSensor = false;
noTempSensor = false;
L004_BroadCastActionStrip = true;
- enableDataRoaming=true;
+ enableDataRoaming = true;
Config.forceMoveCheck = false; //即爱对gps不进行运动检测,此变量专门为了给其他协议进行强制运动检测用的。
} else if (Config.custom_name.equals("l005")) {
noPPGSensor = true;
noTempSensor = true;
L004_BroadCastActionStrip = true;
- enableDataRoaming=true;
+ enableDataRoaming = true;
forceMoveCheck = false; //即爱对gps不进行运动检测,此变量专门为了给其他协议进行强制运动检测用的。
} else if (custom_name.equals("YQ") || custom_name.equals("YQ_EN")) {
ConfigAlarm(Runtime.AlarmType.ALARM_CUTOFF, true);
import android.os.PowerManager;
import android.os.SystemClock;
import android.support.annotation.Nullable;
+import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
import com.enqualcomm.support.bean.heartRateStatus;
import com.enqualcomm.support.provider.ICDatabaseHelper;
import com.enqualcomm.support.provider.WeTalkMessageProvider;
-import com.enqualcomm.support.provider.ICGlobalSettingsProvider;
import com.enqualcomm.support.service.AntiMonitorService;
import com.enqualcomm.support.service.CheckSIM;
import com.enqualcomm.support.service.Deliver;
import static com.enqualcomm.support.bean.ICLocation.LOWPOWER_MOD;
import static com.enqualcomm.support.bean.ICLocation.NORMAL_MOD;
import static com.enqualcomm.support.bean.ICLocation.REALTIME_MOD;
+import static com.enqualcomm.support.provider.ICGlobalSettingsProvider.SETTINGS;
public class CoreService extends Service {
handlerThread.start();
mHandler = new Handler(handlerThread.getLooper());
}
+ //add by TrillGates =====start
+ // 加载阀值,异步加载即可
+ mHandler.post(() -> {
+ ICLogger.d("loadLimitValue...");
+ loadLimitValue();
+ });
+ //add by TrillGates =====end
server_starting = true;
String curProcessName = getProcessName(this, android.os.Process.myPid());
Log.d(TAG, "---> onCreate....");
Deliver.resetCMDReocrdsDB();
- if(Config.custom_name.equals("l004pt")||Config.custom_name.equals("l004")||Config.custom_name.equals("l005"))
- {
+ if (Config.custom_name.equals("l004pt") || Config.custom_name.equals("l004") || Config.custom_name.equals("l005")) {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
//L004PT ,L005 默认开启roaming以及默认使用以下apn
- APNUtil.selectAPN("240","07","NXT17.NET",CoreService.getInstance());
+ APNUtil.selectAPN("240", "07", "NXT17.NET", CoreService.getInstance());
}
- },5000);
+ }, 5000);
}
ReConnectToServer();
}
+ /**
+ * 异步执行
+ * 服务创建的时候,加载各种阀值:温度,心率,血氧,血压
+ * 值保存到config里去
+ */
+ private void loadLimitValue() {
+ String heartRateBottomLimitValue =
+ getICSettingsValue("heart_rate_bottom_limit_value");
+ ICLogger.d("heartRateBottomLimitValue == > "
+ + heartRateBottomLimitValue);
+ if (!TextUtils.isEmpty(heartRateBottomLimitValue)) {
+ Config.LIMIT_VALUE_PPGH = Integer.parseInt(heartRateBottomLimitValue);
+ }
+ String heartRateTopLimitValue =
+ getICSettingsValue("heart_rate_top_limit_value");
+ ICLogger.d("heartRateTopLimitValue == > " + heartRateTopLimitValue);
+ if (!TextUtils.isEmpty(heartRateTopLimitValue)) {
+ Config.LIMIT_VALUE_PPGL = Integer.parseInt(heartRateTopLimitValue);
+ }
+ String bloodPressureHighTopLimitValue =
+ getICSettingsValue("blood_pressure_high_top_limit_value");
+ ICLogger.d("bloodPressureHighTopLimitValue == > "
+ + bloodPressureHighTopLimitValue);
+ if (!TextUtils.isEmpty(bloodPressureHighTopLimitValue)) {
+ Config.LIMIT_VALUE_BPH_H = Integer.parseInt(bloodPressureHighTopLimitValue);
+ }
+ String bloodPressureHighBottomLimitValue =
+ getICSettingsValue("blood_pressure_high_bottom_limit_value");
+ ICLogger.d("bloodPressureHighBottomLimitValue == > "
+ + bloodPressureHighBottomLimitValue);
+ if (!TextUtils.isEmpty(bloodPressureHighBottomLimitValue)) {
+ Config.LIMIT_VALUE_BPH_L = Integer.parseInt(bloodPressureHighBottomLimitValue);
+ }
+ String bloodPressureLowTopLimitValue =
+ getICSettingsValue("blood_pressure_low_top_limit_value");
+ ICLogger.d("bloodPressureLowTopLimitValue == > "
+ + bloodPressureLowTopLimitValue);
+ if (!TextUtils.isEmpty(bloodPressureLowTopLimitValue)) {
+ Config.LIMIT_VALUE_BPL_H = Integer.parseInt(bloodPressureLowTopLimitValue);
+ }
+ String bloodPressureLowBottomLimitValue =
+ getICSettingsValue("blood_pressure_low_bottom_limit_value");
+ ICLogger.d("bloodPressureLowBottomLimitValue == > "
+ + bloodPressureLowBottomLimitValue);
+ if (!TextUtils.isEmpty(bloodPressureLowBottomLimitValue)) {
+ Config.LIMIT_VALUE_BPL_L = Integer.parseInt(bloodPressureLowBottomLimitValue);
+ }
+ String bloodOxygenLimitValue =
+ getICSettingsValue("blood_oxygen_limit_value");
+ ICLogger.d("bloodOxygenLimitValue == > " + bloodOxygenLimitValue);
+ if (!TextUtils.isEmpty(bloodOxygenLimitValue)) {
+ Config.LIMIT_VALUE_OXYGEN = Integer.parseInt(bloodOxygenLimitValue);
+ }
+ }
+
+ private String getICSettingsValue(String key) {
+ ContentResolver contentResolver = getContentResolver();
+ Cursor query = contentResolver.query(Uri.parse(SETTINGS),
+ new String[]{ICDatabaseHelper.sValue},
+ ICDatabaseHelper.sKey + "=?",
+ new String[]{key},
+ null);
+ if (query != null) {
+ if (query.moveToNext()) {
+ String value = query.getString(0);
+ ICLogger.d("value is == > " + value);
+ return value;
+ }
+ query.close();
+ }
+ return null;
+ }
+
private void test() {
ICLogger.i("周一清除所有睡眠数据Record");
runtime.getDbHelper().deleteSleepData();
} else if (ACTION_LOCATION_ALARM.equals(paramIntent.getAction())) {
ICLogger.d("收到定位闹钟...");
//如果设置项是关的,那么就return掉,如果设置项开了,直接去设置闹钟
- Cursor query = runtime.getContextProxy().getResolver().query(Uri.parse(ICGlobalSettingsProvider.SETTINGS),
+ Cursor query = runtime.getContextProxy().getResolver().query(Uri.parse(SETTINGS),
new String[]{ICDatabaseHelper.sValue},
ICDatabaseHelper.sKey + "=?",
new String[]{"BPSW"}, null);
public void getContacts() {
//获取联系人
StringMessage cmdmMembers = protocolAPIHelper.requestVideoCallContact(runtime);
- //获取佰锐ID
+ //获取佰锐ID
connection.send(cmdmMembers);
ICLogger.d("get contacts...");
}
@Override
public void rejectCallInCome(String remoteId, int type) {
//拒绝来电
- StringMessage rejectMsg = protocolAPIHelper.rejectVideoCall(runtime,remoteId, type);
+ StringMessage rejectMsg = protocolAPIHelper.rejectVideoCall(runtime, remoteId, type);
connection.send(rejectMsg);
ICLogger.d("reject remote call request..." + remoteId + "..." + type);
}
@Override
public void requireCall(int type, int remoteUserId) {
//请求与对方通话
- StringMessage talk = protocolAPIHelper.dialVideoCall(runtime,type, remoteUserId);
+ StringMessage talk = protocolAPIHelper.dialVideoCall(runtime, type, remoteUserId);
connection.send(talk);
ICLogger.d("require call == > type is " + type + " remote user id is == > " + remoteUserId);
}
public void setUpEnvState(int state) {
ICLogger.d("update bairui env state..." + state);
- protocolAPIHelper.updateEnvState(runtime,state);
+ protocolAPIHelper.updateEnvState(runtime, state);
}
@Override
public void unbindFriends(String remoteFriendId) {
ICLogger.d("unbindFriends == > " + remoteFriendId);
- StringMessage ppr = protocolAPIHelper.unbindFriends(runtime,remoteFriendId);
+ StringMessage ppr = protocolAPIHelper.unbindFriends(runtime, remoteFriendId);
//解除朋友
connection.send(ppr);
}