import static com.enqualcomm.support.utils.Util.getSystemProperties;
public class Config {
- public static final boolean LOG_TOFILE=true;
- public static int antioff = 0;
- public static int heart_rate = 0;
- private static String json;
- public static int defaultHeartbeatCycle=5;
- public static int sw_release_no = -1;
-
-
- //如果重试都失败,则丢弃命令不进行盲点续传
- public static boolean discard_cmd_after_retryfailed=true;
-
- public static boolean forceMoveCheck=true;
- public static boolean forceWearCheck=true;
-
- private static final String KEYDurationOfVibration = "DurationVib";
- private static final String KeyMasterVolume = "MasterVolume";
-
- public static final String DefaultLogFtpServer="icfota.snicker.com.cn";
- public static final String DefaultLogFtpUser="ftpuser";
- public static final String DefaultLogFtpPWD="iclog";
-
-
- public static final String DefaultWiFiSSID="Xplay6";
- public static final String DefaultWiFiPWD="87654321";
- public static final String DefaultWiFiEncryptType="psk";
-
- public static final int GPSLocationTimeoutInSeconds=50;
- public static final int WiFiLocationTimeoutInSeconds=12;
+ public static final boolean LOG_TOFILE = true;
+ public static int antioff = 0;
+ public static int heart_rate = 0;
+ private static String json;
+ public static int defaultHeartbeatCycle = 5;
+ public static int sw_release_no = -1;
- public static final boolean sendSOSAtOnce=Util.getSystemProperties("persist.sys.sos_at_once","false").equals("true");
- public static String c43_branch_name="none";
- public static String custom_name="none";
- //配置是否广播提示框信息给外部应用显示
- public static boolean noBroadCastSMSNotify=false;
- public static boolean noBroadCastPushTxtNotify=false;
+ //如果重试都失败,则丢弃命令不进行盲点续传
+ public static boolean discard_cmd_after_retryfailed = true;
+ public static boolean forceMoveCheck = true;
+ public static boolean forceWearCheck = true;
- //protocol内部Dialog配置,true表示用外部提示窗,false表示用协议内部提示窗
- public static boolean noSMSNotifyDialog=false;
- public static boolean noPushTxtNotifyDialog=false;
- public static boolean noVoiceNotifyDialog=false;
+ private static final String KEYDurationOfVibration = "DurationVib";
+ private static final String KeyMasterVolume = "MasterVolume";
- //是否SOS拨号的开关,false表示只发送系统sosalarm,不发起SOS拨号
- public static boolean SOSNoNeedDial=false;
+ public static final String DefaultLogFtpServer = "icfota.snicker.com.cn";
+ public static final String DefaultLogFtpUser = "ftpuser";
+ public static final String DefaultLogFtpPWD = "iclog";
- //ic68只有体温没有腕温,它开启代表原来的腕温函数取出的就是体温,不需要再进行换算了。
- public static boolean disableWristTemp=false;
- //配置是否有温度传感器
- public static boolean noTempSensor=false;
- //配置是否有心率传感器
- public static boolean noPPGSensor=false;
- //配置脱腕报警是否需要弹出脱腕提示 默认关闭,所有项目目前都不希望显示弹窗
- public static boolean needBroadcastAntiAlarm=false;
- //配置脱腕报警是否需要弹出剪断提示 默认开启
- public static boolean needBroadcastCutoffAlarm=true;
+ public static final String DefaultWiFiSSID = "Xplay6";
+ public static final String DefaultWiFiPWD = "87654321";
+ public static final String DefaultWiFiEncryptType = "psk";
- //定位是否使用wifi的配置。
- public static boolean disableWiFiScan=false;
+ public static final int GPSLocationTimeoutInSeconds = 50;
+ public static final int WiFiLocationTimeoutInSeconds = 12;
- public static int BLEScanProtocol=0; /** 0 代表扫描beacon后 自行判断是否在指定区域,需要协议绑定beacon地址。
- * 1 代表扫描beacon后,直接把扫描结果上报即可。
- **/
+ public static final boolean sendSOSAtOnce = Util.getSystemProperties("persist.sys.sos_at_once", "false").equals("true");
+ public static String c43_branch_name = "none";
+ public static String custom_name = "none";
- public static boolean UsePolingCheckWeared=false;
+ //配置是否广播提示框信息给外部应用显示
+ public static boolean noBroadCastSMSNotify = false;
+ public static boolean noBroadCastPushTxtNotify = false;
- static {
- disableWiFiScan=Util.getSystemProperties("persist.sys.disableWiFiLocation","false").equals("true");
- disableWristTemp=Util.getSystemProperties("persist.sys.disableWristTemp","false").equals("true");
- BLEScanProtocol=Util.getSystemPropertiesInt("persist.sys.BLEScanProtocol",0);
- UsePolingCheckWeared=Util.getSystemProperties("persist.sys.PolingCheckAnti","false").equals("true");
- }
-
- private static String make() {
- try {
- return (new JSONStringer()).object()
- .key("cmd").value("Init")
- .key("sw_version").value("eiot_V1.0.0")
- .key("protocol_version").value("2.0")
- .key("product").value(2L)
- .key("swReleaseNo").value(sw_release_no)
- .endObject().toString();
- } catch (JSONException jSONException) {
- jSONException.printStackTrace();
- return "";
- }
- }
-
- public static String toJson() {
- if (TextUtils.isEmpty(json))
- json = make();
- return json;
- }
+ //protocol内部Dialog配置,true表示用外部提示窗,false表示用协议内部提示窗
+ public static boolean noSMSNotifyDialog = false;
+ public static boolean noPushTxtNotifyDialog = false;
+ public static boolean noVoiceNotifyDialog = false;
- public final static boolean isL03Tracker=getIsL03tracker();
- public final static boolean upload_logs_via_ftp=false;
- final static String KeyProtocolServerIP="ProtocolServerIP";
- final static String KeyProtocolServerHOST="ProtocolServerHOST";
- final static String KeyProtocolServerPort="ProtoclServerPort";;
- final static String KeyLogServerIP="LogServerIP";
- final static String KeyLogServerPort="LogServerPort";
- final static String KeyFotaServerUrl="FotaServerUrl";
+ //是否SOS拨号的开关,false表示只发送系统sosalarm,不发起SOS拨号
+ public static boolean SOSNoNeedDial = false;
+ //ic68只有体温没有腕温,它开启代表原来的腕温函数取出的就是体温,不需要再进行换算了。
+ public static boolean disableWristTemp = false;
+ //配置是否有温度传感器
+ public static boolean noTempSensor = false;
+ //配置是否有心率传感器
+ public static boolean noPPGSensor = false;
+ //配置脱腕报警是否需要弹出脱腕提示 默认关闭,所有项目目前都不希望显示弹窗
+ public static boolean needBroadcastAntiAlarm = false;
+ //配置脱腕报警是否需要弹出剪断提示 默认开启
+ public static boolean needBroadcastCutoffAlarm = true;
- final static String KeyPpgTestCycle="PPGTestCycle";
- final static String KeyLocationCycle="LocationCycle";
- final static String KeyLocationMode="LocationMode";;
- final static String KeyAlarmCycle="HeartBeatCycle";
+ //定位是否使用wifi的配置。
+ public static boolean disableWiFiScan = false;
- final static String KeyContactsList="ContactsList";
- final static String KeySOSNumbersList="SOSNumbersList";
+ public static int BLEScanProtocol = 0;
+ /**
+ * 0 代表扫描beacon后 自行判断是否在指定区域,需要协议绑定beacon地址。
+ * 1 代表扫描beacon后,直接把扫描结果上报即可。
+ **/
- final static String KeyIMEI = "persist.sys.protocol_IMEI";
- public final static String KeyQRURIFILE = "persist.sys.qrUriFile";
+ public static boolean UsePolingCheckWeared = false;
- final static String KeyPractiseState = "persist.sys.practising";
+ static {
+ disableWiFiScan = Util.getSystemProperties("persist.sys.disableWiFiLocation", "false").equals("true");
+ disableWristTemp = Util.getSystemProperties("persist.sys.disableWristTemp", "false").equals("true");
+ BLEScanProtocol = Util.getSystemPropertiesInt("persist.sys.BLEScanProtocol", 0);
+ UsePolingCheckWeared = Util.getSystemProperties("persist.sys.PolingCheckAnti", "false").equals("true");
+ }
+
+ private static String make() {
+ try {
+ return (new JSONStringer()).object()
+ .key("cmd").value("Init")
+ .key("sw_version").value("eiot_V1.0.0")
+ .key("protocol_version").value("2.0")
+ .key("product").value(2L)
+ .key("swReleaseNo").value(sw_release_no)
+ .endObject().toString();
+ } catch (JSONException jSONException) {
+ jSONException.printStackTrace();
+ return "";
+ }
+ }
+
+ public static String toJson() {
+ if (TextUtils.isEmpty(json))
+ json = make();
+ return json;
+ }
- final static String KeyHeartBeatCycle="ServerHeartBeatCycle";
+ public final static boolean isL03Tracker = getIsL03tracker();
+ public final static boolean upload_logs_via_ftp = false;
+ final static String KeyProtocolServerIP = "ProtocolServerIP";
+ final static String KeyProtocolServerHOST = "ProtocolServerHOST";
+ final static String KeyProtocolServerPort = "ProtoclServerPort";
+ ;
+ final static String KeyLogServerIP = "LogServerIP";
+ final static String KeyLogServerPort = "LogServerPort";
+ final static String KeyFotaServerUrl = "FotaServerUrl";
- final static String KeyLogFtpServer="FtpServerHost";
- final static String KeyLogFtpUser="FtpServerUser";
- final static String KeyLogFtpPWD="FtpServerPWD";
+ final static String KeyPpgTestCycle = "PPGTestCycle";
+ final static String KeyLocationCycle = "LocationCycle";
+ final static String KeyLocationMode = "LocationMode";
+ ;
- final static String KeyWiFiSSID="WiFiSSID";
- final static String KeyWiFiPasswd="WiFiPWD";
- final static String KeyWiFiEncyptType="WiFiEncryptType";
+ final static String KeyAlarmCycle = "HeartBeatCycle";
- final static String KeySMSPassword="SMSPWD";
- final static String DefaultSMSPassword="non";
+ final static String KeyContactsList = "ContactsList";
+ final static String KeySOSNumbersList = "SOSNumbersList";
- final static String KeyTempTestCycle="TempTestCycle";
+ final static String KeyIMEI = "persist.sys.protocol_IMEI";
+ public final static String KeyQRURIFILE = "persist.sys.qrUriFile";
+ final static String KeyPractiseState = "persist.sys.practising";
- final static String KeyPPGadust="KeyPPGAdjust";
- final static String KeyBPHadust="KeyBPHAdjust";
- final static String KeyBPLadust="KeyBPLAdjust";
- final static String KeySPo2adust="KeySPo2Adjust";
+ final static String KeyHeartBeatCycle = "ServerHeartBeatCycle";
- final static String KeyBleScanCycle="BleScanCycle";
- final static String KeyLastUnReadMessage="UnreadMsg";
-
-
- public static void setDurationOfVibration(Context context, int cycle){
- SharPreferenceUtil.setPrefInt(context,KEYDurationOfVibration,cycle);
- }
+ final static String KeyLogFtpServer = "FtpServerHost";
+ final static String KeyLogFtpUser = "FtpServerUser";
+ final static String KeyLogFtpPWD = "FtpServerPWD";
- public static int getDurationOfVibration(Context context){
- return SharPreferenceUtil.getPrefInt(context,KEYDurationOfVibration,1);
- }
- public static void setMasterVolume(Context context, int cycle){
- SharPreferenceUtil.setPrefInt(context,KeyMasterVolume,cycle);
- }
+ final static String KeyWiFiSSID = "WiFiSSID";
+ final static String KeyWiFiPasswd = "WiFiPWD";
+ final static String KeyWiFiEncyptType = "WiFiEncryptType";
- public static int getMasterVolume(Context context){
- return SharPreferenceUtil.getPrefInt(context,KeyMasterVolume,15);
- }
+ final static String KeySMSPassword = "SMSPWD";
+ final static String DefaultSMSPassword = "non";
- public static void setBleScanCycle(Context context, int cycle){
- SharPreferenceUtil.setPrefInt(context,KeyBleScanCycle,cycle);
- }
-
- public static int getBleScanCycle(Context context){
- return SharPreferenceUtil.getPrefInt(context,KeyBleScanCycle,0);
- }
+ final static String KeyTempTestCycle = "TempTestCycle";
- public static String getLastUnReadMessage(Context context){
- return SharPreferenceUtil.getPrefString(context,KeyLastUnReadMessage,"");
- }
- public static void setLastUnReadMessage(Context context,String smsPWD){
- SharPreferenceUtil.setPrefString(context,KeyLastUnReadMessage,smsPWD);
- }
+ final static String KeyPPGadust = "KeyPPGAdjust";
+ final static String KeyBPHadust = "KeyBPHAdjust";
+ final static String KeyBPLadust = "KeyBPLAdjust";
+ final static String KeySPo2adust = "KeySPo2Adjust";
+
+ final static String KeyBleScanCycle = "BleScanCycle";
+
+ final static String KeyLastUnReadMessage = "UnreadMsg";
+
+
+ public static void setDurationOfVibration(Context context, int cycle) {
+ SharPreferenceUtil.setPrefInt(context, KEYDurationOfVibration, cycle);
+ }
- public static String getSMSPwd(Context context){
- return SharPreferenceUtil.getPrefString(context,KeySMSPassword,DefaultSMSPassword);
- }
+ public static int getDurationOfVibration(Context context) {
+ return SharPreferenceUtil.getPrefInt(context, KEYDurationOfVibration, 1);
+ }
- public static void setSMSPwd(Context context,String smsPWD){
- SharPreferenceUtil.setPrefString(context,KeySMSPassword,smsPWD);
- }
- public static boolean getIsL03tracker(){
- boolean ret=getSystemProperties("persist.sys.isL03tracker").toLowerCase().equals("true");
- return ret;
- }
- public static String getWiFiSSID(Context context){
- return SharPreferenceUtil.getPrefString(context,KeyWiFiSSID,DefaultWiFiSSID);
- }
+ public static void setMasterVolume(Context context, int cycle) {
+ SharPreferenceUtil.setPrefInt(context, KeyMasterVolume, cycle);
+ }
- public static void setWiFiSSID(Context context,String ssid){
- SharPreferenceUtil.setPrefString(context,KeyWiFiSSID,ssid);
- }
+ public static int getMasterVolume(Context context) {
+ return SharPreferenceUtil.getPrefInt(context, KeyMasterVolume, 15);
+ }
- public static String getWiFiPasswd(Context context){
- return SharPreferenceUtil.getPrefString(context,KeyWiFiPasswd,DefaultWiFiPWD);
- }
+ public static void setBleScanCycle(Context context, int cycle) {
+ SharPreferenceUtil.setPrefInt(context, KeyBleScanCycle, cycle);
+ }
- public static void setWiFiPasswd(Context context,String pwd){
- SharPreferenceUtil.setPrefString(context,KeyWiFiPasswd,pwd);
- }
+ public static int getBleScanCycle(Context context) {
+ return SharPreferenceUtil.getPrefInt(context, KeyBleScanCycle, 0);
+ }
- public static String getWiFiEncryptType(Context context){
- return SharPreferenceUtil.getPrefString(context,KeyWiFiEncyptType,DefaultWiFiEncryptType);
+ public static String getLastUnReadMessage(Context context) {
+ return SharPreferenceUtil.getPrefString(context, KeyLastUnReadMessage, "");
}
- public static void setWiFiEncryptType(Context context,String type){
- SharPreferenceUtil.setPrefString(context,KeyWiFiEncyptType,type);
+ public static void setLastUnReadMessage(Context context, String smsPWD) {
+ SharPreferenceUtil.setPrefString(context, KeyLastUnReadMessage, smsPWD);
}
- public static String getFotaServerUrl(Context context){
- return SharPreferenceUtil.getPrefString(context,KeyFotaServerUrl,"");
- }
+ public static String getSMSPwd(Context context) {
+ return SharPreferenceUtil.getPrefString(context, KeySMSPassword, DefaultSMSPassword);
+ }
- public static void setFotaServerUrl(Context context,String url){
- SharPreferenceUtil.setPrefString(context,KeyFotaServerUrl,url);
- }
- public static String getFtpUser(Context context){
- return SharPreferenceUtil.getPrefString(context,KeyLogFtpUser,DefaultLogFtpUser);
- }
+ public static void setSMSPwd(Context context, String smsPWD) {
+ SharPreferenceUtil.setPrefString(context, KeySMSPassword, smsPWD);
+ }
- public static void setFtpUser(Context context,String user){
- SharPreferenceUtil.setPrefString(context,KeyLogFtpUser,user);
- }
+ public static boolean getIsL03tracker() {
+ boolean ret = getSystemProperties("persist.sys.isL03tracker").toLowerCase().equals("true");
+ return ret;
+ }
- public static String getFtpServer(Context context){
- return SharPreferenceUtil.getPrefString(context,KeyLogFtpServer,DefaultLogFtpServer);
- }
+ public static String getWiFiSSID(Context context) {
+ return SharPreferenceUtil.getPrefString(context, KeyWiFiSSID, DefaultWiFiSSID);
+ }
- public static void setFtpServer(Context context,String host){
- SharPreferenceUtil.setPrefString(context,KeyLogFtpServer,host);
- }
+ public static void setWiFiSSID(Context context, String ssid) {
+ SharPreferenceUtil.setPrefString(context, KeyWiFiSSID, ssid);
+ }
- public static String getFtpPWD(Context context){
- return SharPreferenceUtil.getPrefString(context,KeyLogFtpPWD,DefaultLogFtpPWD);
- }
- public static void setFtpPWD(Context context,String PWD){
- SharPreferenceUtil.setPrefString(context,KeyLogFtpPWD,PWD);
- }
+ public static String getWiFiPasswd(Context context) {
+ return SharPreferenceUtil.getPrefString(context, KeyWiFiPasswd, DefaultWiFiPWD);
+ }
- public static void setAlarmCycle(Context context, int cycle){
- SharPreferenceUtil.setPrefInt(context,KeyAlarmCycle,cycle);
- }
-
- //默认3分钟,刚刚wakeup的时候1分钟
- public static int getAlarmCycle(Context context){
- return SharPreferenceUtil.getPrefInt(context,KeyAlarmCycle,3);
- }
-
- public static void setProtocolServerPort(Context context, int serverPort){
+ public static void setWiFiPasswd(Context context, String pwd) {
+ SharPreferenceUtil.setPrefString(context, KeyWiFiPasswd, pwd);
+ }
+
+ public static String getWiFiEncryptType(Context context) {
+ return SharPreferenceUtil.getPrefString(context, KeyWiFiEncyptType, DefaultWiFiEncryptType);
+ }
+
+ public static void setWiFiEncryptType(Context context, String type) {
+ SharPreferenceUtil.setPrefString(context, KeyWiFiEncyptType, type);
+ }
+
+ public static String getFotaServerUrl(Context context) {
+ return SharPreferenceUtil.getPrefString(context, KeyFotaServerUrl, "");
+ }
+
+ public static void setFotaServerUrl(Context context, String url) {
+ SharPreferenceUtil.setPrefString(context, KeyFotaServerUrl, url);
+ }
+
+ public static String getFtpUser(Context context) {
+ return SharPreferenceUtil.getPrefString(context, KeyLogFtpUser, DefaultLogFtpUser);
+ }
+
+ public static void setFtpUser(Context context, String user) {
+ SharPreferenceUtil.setPrefString(context, KeyLogFtpUser, user);
+ }
+
+ public static String getFtpServer(Context context) {
+ return SharPreferenceUtil.getPrefString(context, KeyLogFtpServer, DefaultLogFtpServer);
+ }
+
+ public static void setFtpServer(Context context, String host) {
+ SharPreferenceUtil.setPrefString(context, KeyLogFtpServer, host);
+ }
+
+ public static String getFtpPWD(Context context) {
+ return SharPreferenceUtil.getPrefString(context, KeyLogFtpPWD, DefaultLogFtpPWD);
+ }
+
+ public static void setFtpPWD(Context context, String PWD) {
+ SharPreferenceUtil.setPrefString(context, KeyLogFtpPWD, PWD);
+ }
+
+ public static void setAlarmCycle(Context context, int cycle) {
+ SharPreferenceUtil.setPrefInt(context, KeyAlarmCycle, cycle);
+ }
+
+ //默认3分钟,刚刚wakeup的时候1分钟
+ public static int getAlarmCycle(Context context) {
+ return SharPreferenceUtil.getPrefInt(context, KeyAlarmCycle, 3);
+ }
+
+ public static void setProtocolServerPort(Context context, int serverPort) {
// SharPreferenceUtil.setPrefString(context,KeyProtocolServerIP,serverIP);
- SharPreferenceUtil.setPrefInt(context,KeyProtocolServerPort,serverPort);
- }
-
- public static void setProtocolServerHost(Context context,String host){
- SharPreferenceUtil.setPrefString(context,KeyProtocolServerHOST,host);
- }
- //public static String getProtocolServerIP(Context context){
- // return SharPreferenceUtil.getPrefString(context,KeyProtocolServerIP,"118.178.155.223");
- // }
+ SharPreferenceUtil.setPrefInt(context, KeyProtocolServerPort, serverPort);
+ }
- public static void loadModCycleSettings(Runtime runtime){
- Context context=runtime.getContextProxy().context;
- ICLogger.i("current Cycles PPG "+ runtime.getPpgTestCycle()+" , LocationCycle "+runtime.getLocationInstance().getLocation_cycle()+" LocationMode "+runtime.getLocationInstance().getWorkingMod());
- runtime.setPpgTestCycle(Config.getPPGTestCycle(context));
- runtime.getLocationInstance().setLocation_cycle(Config.getLocationCycle(context));
- runtime.getLocationInstance().setWorkingMod(Config.getLocationMode(context));
- ICLogger.i("current Cycles PPG "+ runtime.getPpgTestCycle()+" , LocationCycle "+runtime.getLocationInstance().getLocation_cycle()+" LocationMode "+runtime.getLocationInstance().getWorkingMod());
+ public static void setProtocolServerHost(Context context, String host) {
+ SharPreferenceUtil.setPrefString(context, KeyProtocolServerHOST, host);
+ }
+ //public static String getProtocolServerIP(Context context){
+ // return SharPreferenceUtil.getPrefString(context,KeyProtocolServerIP,"118.178.155.223");
+ // }
- int mastervolume = getMasterVolume(context);
- ICAudioManager.setMasterVolumn(context,mastervolume);
+ public static void loadModCycleSettings(Runtime runtime) {
+ Context context = runtime.getContextProxy().context;
+ ICLogger.i("current Cycles PPG " + runtime.getPpgTestCycle() + " , LocationCycle " + runtime.getLocationInstance().getLocation_cycle() + " LocationMode " + runtime.getLocationInstance().getWorkingMod());
+ runtime.setPpgTestCycle(Config.getPPGTestCycle(context));
+ runtime.getLocationInstance().setLocation_cycle(Config.getLocationCycle(context));
+ runtime.getLocationInstance().setWorkingMod(Config.getLocationMode(context));
+ ICLogger.i("current Cycles PPG " + runtime.getPpgTestCycle() + " , LocationCycle " + runtime.getLocationInstance().getLocation_cycle() + " LocationMode " + runtime.getLocationInstance().getWorkingMod());
- int duration= getDurationOfVibration(context);
- VibrateUtil.setVibPattern(duration*1000);
+ int mastervolume = getMasterVolume(context);
+ ICAudioManager.setMasterVolumn(context, mastervolume);
- }
+ int duration = getDurationOfVibration(context);
+ VibrateUtil.setVibPattern(duration * 1000);
- public static void loadHearBeatSetting(Runtime runtime){
- runtime.setHeartBeatCycle(Config.getHeartBeatCycle(runtime.getContextProxy().context));
- }
- public static void loadServerSettings(Runtime runtime){
- runtime.setHostAndPort(Config.getProtocolServerHost(runtime.getContextProxy().context),Config.getProtocolServerPort(runtime.getContextProxy().context));
- }
+ }
- public static void setIMEI(Context context, String imei){
- Util.setSystemProperties(KeyIMEI,imei);
- }
+ public static void loadHearBeatSetting(Runtime runtime) {
+ runtime.setHeartBeatCycle(Config.getHeartBeatCycle(runtime.getContextProxy().context));
+ }
- public static String getIMEI(Context context){
- return Util.getSystemProperties(KeyIMEI,"");
- }
+ public static void loadServerSettings(Runtime runtime) {
+ runtime.setHostAndPort(Config.getProtocolServerHost(runtime.getContextProxy().context), Config.getProtocolServerPort(runtime.getContextProxy().context));
+ }
- public static String getProtocolServerHost(Context context){
- String host;
- host= SharPreferenceUtil.getPrefString(context,KeyProtocolServerHOST,protocolAPIHelper.getDefaultServerIP());
- return host;
- }
+ public static void setIMEI(Context context, String imei) {
+ Util.setSystemProperties(KeyIMEI, imei);
+ }
+ public static String getIMEI(Context context) {
+ return Util.getSystemProperties(KeyIMEI, "");
+ }
+
+ public static String getProtocolServerHost(Context context) {
+ String host;
+ host = SharPreferenceUtil.getPrefString(context, KeyProtocolServerHOST, protocolAPIHelper.getDefaultServerIP());
+ return host;
+ }
+
+
+ public static int getProtocolServerPort(Context context) {
+ int port;
+ port = SharPreferenceUtil.getPrefInt(context, KeyProtocolServerPort, protocolAPIHelper.getDefaultServerPort());
+ return port;
+ }
+
+ public static void setConfigInitFlag(Context context, int flag) {
+ SharPreferenceUtil.setPrefInt(context, "ConfigInitFlag", flag);
+ }
+
+ public static int getConfigInitFlag(Context context) {
+ return SharPreferenceUtil.getPrefInt(context, "ConfigInitFlag", 0);
+ }
- public static int getProtocolServerPort(Context context){
- int port;
- port= SharPreferenceUtil.getPrefInt(context,KeyProtocolServerPort,protocolAPIHelper.getDefaultServerPort());
- return port;
- }
+ public static void setLogServerIP(Context context, String serverIP, int serverPort) {
- public static void setConfigInitFlag(Context context,int flag){
- SharPreferenceUtil.setPrefInt(context,"ConfigInitFlag",flag);
- }
+ SharPreferenceUtil.setPrefString(context, KeyLogServerIP, serverIP);
+ SharPreferenceUtil.setPrefInt(context, KeyLogServerPort, serverPort);
- public static int getConfigInitFlag(Context context){
- return SharPreferenceUtil.getPrefInt(context,"ConfigInitFlag",0);
- }
- public static void setLogServerIP(Context context,String serverIP,int serverPort){
+ }
- SharPreferenceUtil.setPrefString(context,KeyLogServerIP,serverIP);
- SharPreferenceUtil.setPrefInt(context,KeyLogServerPort,serverPort);
+ public static String getLogServerIP(Context context) {
+ return SharPreferenceUtil.getPrefString(context, KeyLogServerIP, "http://icfota.snicker.com.cn:8089/UploadFile.jsp");
+ }
- }
- public static String getLogServerIP(Context context){
- return SharPreferenceUtil.getPrefString(context,KeyLogServerIP,"http://icfota.snicker.com.cn:8089/UploadFile.jsp");
- }
+ public static int getLogServerPort(Context context) {
+ return SharPreferenceUtil.getPrefInt(context, KeyLogServerPort, 8089);
+ }
- public static int getLogServerPort(Context context){
- return SharPreferenceUtil.getPrefInt(context,KeyLogServerPort,8089);
- }
+ public static void setPPGTestCycle(Context context, int cycle_ninutes) {
+ SharPreferenceUtil.setPrefInt(context, KeyPpgTestCycle, cycle_ninutes);
+ }
- public static void setPPGTestCycle(Context context,int cycle_ninutes){
- SharPreferenceUtil.setPrefInt(context,KeyPpgTestCycle,cycle_ninutes);
- }
+ public static int getPPGTestCycle(Context context) {
+ return SharPreferenceUtil.getPrefInt(context, KeyPpgTestCycle, 0);
+ }
- public static int getPPGTestCycle(Context context){
- return SharPreferenceUtil.getPrefInt(context,KeyPpgTestCycle,0);
- }
+ public static int getHeartBeatCycle(Context context) {
+ return SharPreferenceUtil.getPrefInt(context, KeyHeartBeatCycle, 5);
+ }
- public static int getHeartBeatCycle(Context context){
- return SharPreferenceUtil.getPrefInt(context,KeyHeartBeatCycle,5);
- }
+ public static void setHeartBeatCycle(Context context, int cycle) {
+ SharPreferenceUtil.setPrefInt(context, KeyHeartBeatCycle, cycle);
+ }
- public static void setHeartBeatCycle(Context context,int cycle){
- SharPreferenceUtil.setPrefInt(context,KeyHeartBeatCycle,cycle);
- }
- public static void setLocationCycle(Context context,int cycle_second){
- SharPreferenceUtil.setPrefInt(context,KeyLocationCycle,cycle_second);
- }
+ public static void setLocationCycle(Context context, int cycle_second) {
+ SharPreferenceUtil.setPrefInt(context, KeyLocationCycle, cycle_second);
+ }
- public static int getLocationCycle(Context context){
- return SharPreferenceUtil.getPrefInt(context,KeyLocationCycle,900);
- }
+ public static int getLocationCycle(Context context) {
+ return SharPreferenceUtil.getPrefInt(context, KeyLocationCycle, 900);
+ }
- public static void setLocationMode(Context context,int mode){
- ICLogger.i("setLocationMode "+mode);
- SharPreferenceUtil.setPrefInt(context,KeyLocationMode,mode);
- }
+ public static void setLocationMode(Context context, int mode) {
+ ICLogger.i("setLocationMode " + mode);
+ SharPreferenceUtil.setPrefInt(context, KeyLocationMode, mode);
+ }
- public static int getLocationMode(Context context){
- return SharPreferenceUtil.getPrefInt(context,KeyLocationMode, ICLocation.NORMAL_MOD);
- }
+ public static int getLocationMode(Context context) {
+ return SharPreferenceUtil.getPrefInt(context, KeyLocationMode, ICLocation.NORMAL_MOD);
+ }
private static final String KeyBootUpDate = "bootupdate";
- public static boolean logBootDate(Context context){
- //如果时间和最后一次时间不同,则重置,否则启动次数+1
- if (isFirstBootToday(context)) {
- SharPreferenceUtil.setPrefString(context, KeyBootUpDate, TimeUtil.getSystemTime4());
- return true;
- }else{
- return false;
- }
- }
-
- private static String getLastBootupDate(Context context){
- return SharPreferenceUtil.getPrefString(context,KeyBootUpDate,"");
- }
- private static boolean isFirstBootToday(Context context){
- //第一次启动记录的日期,当前日期只要相同,就认为有启动过。
- //如果手表一直没有重启过,则每次resetStepCount的时候把启动时间更新到当天,
- //从而解决第二天重启就会被重置的问题!
- String currentDate=TimeUtil.getSystemTime4();
- String lastDate=getLastBootupDate(context);
- boolean ret=false;
- if (currentDate.equals(lastDate)) {
- ret= false;
- }else
- {
- ret= true;
- }
- ICLogger.i("Current BootDate="+currentDate+", Last BootDate="+lastDate+", ret="+ret);
- return ret;
- }
-
- //收到语音微聊广播消息给外部窗口
- public static boolean do_broadCast_message=false;
-
- //每次心跳时都检测逃逸并报警
- public static boolean needAllwaysAlarmFenceOut=false;
- //每次心跳时都检测剪断并报警,只报警
- public static boolean needAllwaysAlarmCutOff=false;
-
- //体温非正常报警
- public static boolean needTemperature_abnormal_alarm=false;
- public static boolean A9_noBroadCastActionStrip=false;
- public static boolean C5_noBroadCastActionStrip=false;
- public static boolean L004_BroadCastActionStrip=false;
-
- //停止系统NTP时钟同步标志
- public static boolean disable_ntp_server=false;
-
- //需要系统发送已阅读消息的标志
- public static boolean noPushTxtReadReply=true;
- //蓝牙定位扫描 协议0模式,扫到beacon信标时,如果属于第一次扫到的进入状态(解除逃逸状态),发送服务器的标志位,主要由于C5客户只要逃逸,不要解除逃逸消息。
- public static boolean noBLE_RelaseEscapeAlarm=true;
-
- public static void enable_NTP_Server(Context context,boolean enable){
- try {
- int autotime = Settings.Global.getInt(context.getContentResolver(),Settings.Global.AUTO_TIME);
- int autotimezone = Settings.Global.getInt(context.getContentResolver(),Settings.Global.AUTO_TIME_ZONE);
-
- ICLogger.i("get NTP Settings AutoTime "+autotime+" AutoTimeZone "+autotimezone);
-
- if(enable)
- {
- Settings.Global.putInt(context.getContentResolver(), Settings.Global.AUTO_TIME_ZONE, 1);
- Settings.Global.putInt(context.getContentResolver(), Settings.Global.AUTO_TIME, 1);
- }else {
- Settings.Global.putInt(context.getContentResolver(), Settings.Global.AUTO_TIME_ZONE, 0);
- Settings.Global.putInt(context.getContentResolver(), Settings.Global.AUTO_TIME, 0);
- }
- autotime = Settings.Global.getInt(context.getContentResolver(),Settings.Global.AUTO_TIME);
- autotimezone = Settings.Global.getInt(context.getContentResolver(),Settings.Global.AUTO_TIME_ZONE);
- ICLogger.i("get NTP Settings AutoTime "+autotime+" AutoTimeZone "+autotimezone);
- } catch (Settings.SettingNotFoundException e) {
- e.printStackTrace();
- ICLogger.e(e.getMessage(),e);
- }
- }
- public static void LoadMessageConfigs(){
-
- String tmp=Util.getSystemProperties("persist.sys.doBroadcastMSG");
- boolean ret=false;
- if (tmp.equals("true"))
- ret=true;
-
- do_broadCast_message = ret;
-
- noPPGSensor=(ICJniUtils.isPPGavailable()==0);
- noTempSensor=(ICJniUtils.isTemperatureDevAvailable()==0);
-
- //默认关闭NTP
- disable_ntp_server=Util.getSystemProperties("persist.sys.disableNTP","false").equals("true");
-
- c43_branch_name=Util.getSystemProperties("persist.sys.c43.branch");
-
- if ((c43_branch_name.equals("l03")) ||(c43_branch_name.equals("l05"))){
- noPushTxtNotifyDialog=true;
- noSMSNotifyDialog=true;
- noVoiceNotifyDialog=true;
- noTempSensor=true;
- if (c43_branch_name.equals("l05")) {
- SOSNoNeedDial=true;//采用新写的SOS,协议只需要发送消息,无需控制拨号。
- noPPGSensor=false;
- }else{
- noPPGSensor=true;
+
+ public static boolean logBootDate(Context context) {
+ //如果时间和最后一次时间不同,则重置,否则启动次数+1
+ if (isFirstBootToday(context)) {
+ SharPreferenceUtil.setPrefString(context, KeyBootUpDate, TimeUtil.getSystemTime4());
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private static String getLastBootupDate(Context context) {
+ return SharPreferenceUtil.getPrefString(context, KeyBootUpDate, "");
+ }
+
+ private static boolean isFirstBootToday(Context context) {
+ //第一次启动记录的日期,当前日期只要相同,就认为有启动过。
+ //如果手表一直没有重启过,则每次resetStepCount的时候把启动时间更新到当天,
+ //从而解决第二天重启就会被重置的问题!
+ String currentDate = TimeUtil.getSystemTime4();
+ String lastDate = getLastBootupDate(context);
+ boolean ret = false;
+ if (currentDate.equals(lastDate)) {
+ ret = false;
+ } else {
+ ret = true;
+ }
+ ICLogger.i("Current BootDate=" + currentDate + ", Last BootDate=" + lastDate + ", ret=" + ret);
+ return ret;
+ }
+
+ //收到语音微聊广播消息给外部窗口
+ public static boolean do_broadCast_message = false;
+
+ //每次心跳时都检测逃逸并报警
+ public static boolean needAllwaysAlarmFenceOut = false;
+ //每次心跳时都检测剪断并报警,只报警
+ public static boolean needAllwaysAlarmCutOff = false;
+
+ //体温非正常报警
+ public static boolean needTemperature_abnormal_alarm = false;
+ public static boolean A9_noBroadCastActionStrip = false;
+ public static boolean C5_noBroadCastActionStrip = false;
+ public static boolean L004_BroadCastActionStrip = false;
+
+ //停止系统NTP时钟同步标志
+ public static boolean disable_ntp_server = false;
+
+ //需要系统发送已阅读消息的标志
+ public static boolean noPushTxtReadReply = true;
+ //蓝牙定位扫描 协议0模式,扫到beacon信标时,如果属于第一次扫到的进入状态(解除逃逸状态),发送服务器的标志位,主要由于C5客户只要逃逸,不要解除逃逸消息。
+ public static boolean noBLE_RelaseEscapeAlarm = true;
+
+ public static void enable_NTP_Server(Context context, boolean enable) {
+ try {
+ int autotime = Settings.Global.getInt(context.getContentResolver(), Settings.Global.AUTO_TIME);
+ int autotimezone = Settings.Global.getInt(context.getContentResolver(), Settings.Global.AUTO_TIME_ZONE);
+
+ ICLogger.i("get NTP Settings AutoTime " + autotime + " AutoTimeZone " + autotimezone);
+
+ if (enable) {
+ Settings.Global.putInt(context.getContentResolver(), Settings.Global.AUTO_TIME_ZONE, 1);
+ Settings.Global.putInt(context.getContentResolver(), Settings.Global.AUTO_TIME, 1);
+ } else {
+ Settings.Global.putInt(context.getContentResolver(), Settings.Global.AUTO_TIME_ZONE, 0);
+ Settings.Global.putInt(context.getContentResolver(), Settings.Global.AUTO_TIME, 0);
+ }
+ autotime = Settings.Global.getInt(context.getContentResolver(), Settings.Global.AUTO_TIME);
+ autotimezone = Settings.Global.getInt(context.getContentResolver(), Settings.Global.AUTO_TIME_ZONE);
+ ICLogger.i("get NTP Settings AutoTime " + autotime + " AutoTimeZone " + autotimezone);
+ } catch (Settings.SettingNotFoundException e) {
+ e.printStackTrace();
+ ICLogger.e(e.getMessage(), e);
+ }
+ }
+
+ public static void LoadMessageConfigs() {
+
+ String tmp = Util.getSystemProperties("persist.sys.doBroadcastMSG");
+ boolean ret = false;
+ if (tmp.equals("true"))
+ ret = true;
+
+ do_broadCast_message = ret;
+
+ noPPGSensor = (ICJniUtils.isPPGavailable() == 0);
+ noTempSensor = (ICJniUtils.isTemperatureDevAvailable() == 0);
+
+ //默认关闭NTP
+ disable_ntp_server = Util.getSystemProperties("persist.sys.disableNTP", "false").equals("true");
+
+ c43_branch_name = Util.getSystemProperties("persist.sys.c43.branch");
+
+ if ((c43_branch_name.equals("l03")) || (c43_branch_name.equals("l05"))) {
+ noPushTxtNotifyDialog = true;
+ noSMSNotifyDialog = true;
+ noVoiceNotifyDialog = true;
+ noTempSensor = true;
+ if (c43_branch_name.equals("l05")) {
+ SOSNoNeedDial = true;//采用新写的SOS,协议只需要发送消息,无需控制拨号。
+ noPPGSensor = false;
+ } else {
+ noPPGSensor = true;
+ }
+ }
+ custom_name = Util.getSystemProperties("persist.sys.customname");
+ ICLogger.i("get CUSTOMNAME " + custom_name);
+ if (custom_name.equals("H88") || custom_name.equals("H88A")) {
+ noPushTxtNotifyDialog = true;
+ noSMSNotifyDialog = false;
+ noVoiceNotifyDialog = false;
+ noPPGSensor = false;
+ noTempSensor = false;
+ needBroadcastAntiAlarm = false;
+ } else if ((custom_name.equals("AK"))) {
+ noPushTxtNotifyDialog = true;
+ noSMSNotifyDialog = true;
+ noVoiceNotifyDialog = true;
+ noPPGSensor = false;
+ noTempSensor = true;
+ SOSNoNeedDial = true; //采用新写的SOS,协议只需要发送消息,无需控制拨号。
+ } else if ((custom_name.equals("YT"))) {
+ noPushTxtNotifyDialog = false;
+ noSMSNotifyDialog = false;
+ noVoiceNotifyDialog = false;
+ noPPGSensor = false;
+ noTempSensor = true;
+ } else if ((custom_name.equals("l004"))) {
+ noPushTxtNotifyDialog = true;
+ noSMSNotifyDialog = true;
+ noVoiceNotifyDialog = true;
+ needBroadcastAntiAlarm = false;
+ needBroadcastCutoffAlarm = true;
+ needAllwaysAlarmCutOff = false;
+ needAllwaysAlarmFenceOut = false;
+ needTemperature_abnormal_alarm = false;
+ noPPGSensor = false;
+ noTempSensor = false;
+ L004_BroadCastActionStrip = true;
+ } else if (custom_name.equals("YQ") || custom_name.equals("YQ_EN")) { //A9-YQ
+ noPushTxtNotifyDialog = false;
+ noSMSNotifyDialog = true;
+ noVoiceNotifyDialog = true;
+ noBroadCastPushTxtNotify = true;
+ noBroadCastSMSNotify = true;
+ needBroadcastAntiAlarm = false;
+ needBroadcastCutoffAlarm = true;
+ needAllwaysAlarmCutOff = true;
+ needAllwaysAlarmFenceOut = true;
+ needTemperature_abnormal_alarm = true;
+ noPushTxtReadReply = false;//A9需要阅读反馈
+ noPPGSensor = false;
+ noTempSensor = false;
+ A9_noBroadCastActionStrip = true;
+ } else if (custom_name.equals("SGL")) {
+ noPushTxtNotifyDialog = false;
+ noSMSNotifyDialog = false;
+ noVoiceNotifyDialog = true;
+ needBroadcastAntiAlarm = false;
+ needBroadcastCutoffAlarm = true;
+ needAllwaysAlarmCutOff = true;
+ needAllwaysAlarmFenceOut = false;
+ needTemperature_abnormal_alarm = false;
+ noPPGSensor = false;
+ noTempSensor = false;
+ C5_noBroadCastActionStrip = true;
+ } else if (custom_name.equals("L02")) {
+ noPushTxtReadReply = false;//即爱需要阅读反馈
+ } else {
+ noBroadCastPushTxtNotify = true;
}
+
+
+ }
+
+ public static void loadTemperatureSettings(Runtime runtime) {
+ runtime.temp_test_Cycle_Seconds = SharPreferenceUtil.getPrefInt(runtime.getContextProxy().context, KeyTempTestCycle, 60 * 60);
+ }
+
+ public static void setTemperatureTestCycle(Runtime runtime, int cycle_seconds) {
+ SharPreferenceUtil.setPrefInt(runtime.getContextProxy().context, KeyTempTestCycle, cycle_seconds);
+ loadTemperatureSettings(runtime);
+ }
+
+ public static boolean isUsingCustomServer = false;
+
+ public static void setCustomServer(Context context, boolean isusingCutomerServer, String serverip, int serverport) {
+
+ if (isusingCutomerServer)
+ Util.setSystemProperties("persist.sys.UsingCustomServer", "true");
+ else
+ Util.setSystemProperties("persist.sys.UsingCustomServer", "false");
+
+
+ Util.setSystemProperties("persist.sys.customserverip", serverip);
+ Util.setSystemProperties("persist.sys.customserverport", String.valueOf(serverport));
+ setProtocolServerHost(context, serverip);
+ setProtocolServerPort(context, serverport);
+
+ loadCustomServerAddr(context);
+
+ }
+
+ public static void loadCustomServerAddr(Context context) {
+ String tmp = Util.getSystemProperties("persist.sys.UsingCustomServer");
+ ICLogger.d("UsingCustomServer == > " + tmp);
+ boolean ret = false;
+ if (tmp.equals("true")) {
+ ret = true;
+ }
+
+ isUsingCustomServer = ret;
+
+ String serverip = "";
+ int serverport = 0;
+ if (isUsingCustomServer) {
+ serverip = Util.getSystemProperties("persist.sys.customserverip");
+ serverport = Integer.valueOf(Util.getSystemProperties("persist.sys.customserverport"));
+ setProtocolServerHost(context, serverip);
+ setProtocolServerPort(context, serverport);
+ } else {
+ setProtocolServerHost(context, protocolAPIHelper.getDefaultServerIP());
+ setProtocolServerPort(context, protocolAPIHelper.getDefaultServerPort());
+ }
+ ICLogger.i("current protocol_no=" + protocol_no + " , isUsingCustomServier=" + isUsingCustomServer + ", server host=" +
+ getProtocolServerHost(context) + ", server port=" + getProtocolServerPort(context));
+ }
+
+ public static boolean noLocationCycle = getNoLocationCycleFlag();
+
+ public static boolean getNoLocationCycleFlag() {
+ String tmp = Util.getSystemProperties("persist.sys.NoLocationCycle");
+ boolean ret = false;
+ if (tmp.equals("true"))
+ ret = true;
+
+ noLocationCycle = ret;
+ return ret;
+ }
+
+ public static final int PROTOCOL_JIAI = 0;
+ public static final int PROTOCOL_BEEHOME = 1;
+ public static final int PROTOCOL_IC = 2;
+ public static final int PROTOCOL_FZD = 3;
+ public static final int PROTOCOL_MQTT = 4;
+
+ public static int protocol_no = getProtocolNumber();
+
+ public static int getProtocolNumber() {
+ String tmp = Util.getSystemProperties("persist.sys.protocol_no");
+ int ret = 0;
+ if (tmp != null && !tmp.isEmpty() && Util.isNumeric(tmp)) {
+ ret = Integer.parseInt(tmp);
+ switch (ret) {
+ case PROTOCOL_JIAI:
+ ICLogger.i("协议 JIAI");
+ break;
+ case PROTOCOL_BEEHOME:
+ ICLogger.i("协议 BEEHOME");
+ break;
+ case PROTOCOL_IC:
+ ICLogger.i("协议 IC");
+ break;
+ case PROTOCOL_FZD:
+ ICLogger.i("协议 FZD");
+ break;
+ case PROTOCOL_MQTT:
+ ICLogger.i("协议 MQTT");
+ break;
+ default:
+ ICLogger.i("协议版本 目前支持0,1,2,3,4 。");
+ break;
+ }
+ } else {
+ ICLogger.i("协议版本要是数字,目前支持0,1,2,3,4 。");
+ }
+ protocol_no = ret;
+ return ret;
+ }
+
+
+ public static void setPPGAdjust(Context context, int adjust) {
+ SharPreferenceUtil.setPrefInt(context, KeyPPGadust, adjust);
+ }
+
+
+ public static int getPPGAdjust(Context context) {
+ return SharPreferenceUtil.getPrefInt(context, KeyPPGadust, 0);
+ }
+
+ public static void setBPHAdjust(Context context, int adjust) {
+ SharPreferenceUtil.setPrefInt(context, KeyBPHadust, adjust);
}
- custom_name=Util.getSystemProperties("persist.sys.customname");
- ICLogger.i("get CUSTOMNAME "+custom_name);
- if (custom_name.equals("H88")||custom_name.equals("H88A") ){
- noPushTxtNotifyDialog=true;
- noSMSNotifyDialog=false;
- noVoiceNotifyDialog=false;
- noPPGSensor=false;
- noTempSensor=false;
- needBroadcastAntiAlarm=false;
- }else if ((custom_name.equals("AK")) ){
- noPushTxtNotifyDialog=true;
- noSMSNotifyDialog=true;
- noVoiceNotifyDialog=true;
- noPPGSensor=false;
- noTempSensor=true;
- SOSNoNeedDial=true; //采用新写的SOS,协议只需要发送消息,无需控制拨号。
- }else if ((custom_name.equals("YT")) ){
- noPushTxtNotifyDialog=false;
- noSMSNotifyDialog=false;
- noVoiceNotifyDialog=false;
- noPPGSensor=false;
- noTempSensor=true;
- }else if ((custom_name.equals("l004")) ) {
- noPushTxtNotifyDialog=true;
- noSMSNotifyDialog=true;
- noVoiceNotifyDialog=true;
- needBroadcastAntiAlarm=false;
- needBroadcastCutoffAlarm=true;
- needAllwaysAlarmCutOff=false;
- needAllwaysAlarmFenceOut=false;
- needTemperature_abnormal_alarm=false;
- noPPGSensor=false;
- noTempSensor=false;
- L004_BroadCastActionStrip=true;
- }else if (custom_name.equals("YQ") ||custom_name.equals("YQ_EN") ) { //A9-YQ
- noPushTxtNotifyDialog=false;
- noSMSNotifyDialog=true;
- noVoiceNotifyDialog=true;
- noBroadCastPushTxtNotify=true;
- noBroadCastSMSNotify=true;
- needBroadcastAntiAlarm=false;
- needBroadcastCutoffAlarm=true;
- needAllwaysAlarmCutOff=true;
- needAllwaysAlarmFenceOut=true;
- needTemperature_abnormal_alarm=true;
- noPushTxtReadReply=false;//A9需要阅读反馈
- noPPGSensor=false;
- noTempSensor=false;
- A9_noBroadCastActionStrip=true;
- }else if (custom_name.equals("SGL"))
- {
- noPushTxtNotifyDialog=false;
- noSMSNotifyDialog=false;
- noVoiceNotifyDialog=true;
- needBroadcastAntiAlarm=false;
- needBroadcastCutoffAlarm=true;
- needAllwaysAlarmCutOff=true;
- needAllwaysAlarmFenceOut=false;
- needTemperature_abnormal_alarm=false;
- noPPGSensor=false;
- noTempSensor=false;
- C5_noBroadCastActionStrip=true;
- }else if(custom_name.equals("L02")){
- noPushTxtReadReply=false;//即爱需要阅读反馈
- }else{
- noBroadCastPushTxtNotify=true;
- }
-
-
- }
-
- public static void loadTemperatureSettings(Runtime runtime){
- runtime.temp_test_Cycle_Seconds = SharPreferenceUtil.getPrefInt(runtime.getContextProxy().context, KeyTempTestCycle, 60*60);
- }
-
- public static void setTemperatureTestCycle(Runtime runtime,int cycle_seconds) {
- SharPreferenceUtil.setPrefInt(runtime.getContextProxy().context,KeyTempTestCycle,cycle_seconds);
- loadTemperatureSettings(runtime);
- }
- public static boolean isUsingCustomServer=false;
-
- public static void setCustomServer(Context context,boolean isusingCutomerServer,String serverip,int serverport) {
-
- if (isusingCutomerServer)
- Util.setSystemProperties("persist.sys.UsingCustomServer","true");
- else
- Util.setSystemProperties("persist.sys.UsingCustomServer","false");
-
-
- Util.setSystemProperties("persist.sys.customserverip",serverip);
- Util.setSystemProperties("persist.sys.customserverport",String.valueOf(serverport));
- setProtocolServerHost(context,serverip);
- setProtocolServerPort(context,serverport);
-
- loadCustomServerAddr(context);
-
- }
- public static void loadCustomServerAddr(Context context){
- String tmp=Util.getSystemProperties("persist.sys.UsingCustomServer");
- boolean ret=false;
- if (tmp.equals("true"))
- ret=true;
-
- isUsingCustomServer=ret;
-
- String serverip="";
- int serverport=0;
- if(isUsingCustomServer){
- serverip= Util.getSystemProperties("persist.sys.customserverip");
- serverport= Integer.valueOf(Util.getSystemProperties("persist.sys.customserverport"));
- setProtocolServerHost(context,serverip);
- setProtocolServerPort(context,serverport);
-
- }else{
- setProtocolServerHost(context, protocolAPIHelper.getDefaultServerIP());
- setProtocolServerPort(context,protocolAPIHelper.getDefaultServerPort());
- }
- ICLogger.i("current protocol_no="+protocol_no+" , isUsingCustomServier="+isUsingCustomServer+", server host="+
- getProtocolServerHost(context)+", server port="+getProtocolServerPort(context));
- }
-
- public static boolean noLocationCycle=getNoLocationCycleFlag();
- public static boolean getNoLocationCycleFlag(){
- String tmp=Util.getSystemProperties("persist.sys.NoLocationCycle");
- boolean ret=false;
- if (tmp.equals("true"))
- ret=true;
-
- noLocationCycle=ret;
- return ret;
- }
-
- public static final int PROTOCOL_JIAI=0;
- public static final int PROTOCOL_BEEHOME=1;
- public static final int PROTOCOL_IC=2;
- public static final int PROTOCOL_FZD=3;
- public static final int PROTOCOL_MQTT=4;
-
- public static int protocol_no=getProtocolNumber();
- public static int getProtocolNumber(){
- String tmp=Util.getSystemProperties("persist.sys.protocol_no");
- int ret=0;
- if (tmp!=null && !tmp.isEmpty()&& Util.isNumeric(tmp)) {
- ret = Integer.parseInt(tmp);
- switch(ret){
- case PROTOCOL_JIAI:
- ICLogger.i("协议 JIAI");
- break;
- case PROTOCOL_BEEHOME:
- ICLogger.i("协议 BEEHOME");
- break;
- case PROTOCOL_IC:
- ICLogger.i("协议 IC");
- break;
- case PROTOCOL_FZD:
- ICLogger.i("协议 FZD");
- break;
- case PROTOCOL_MQTT:
- ICLogger.i("协议 MQTT");
- break;
- default:
- ICLogger.i("协议版本 目前支持0,1,2,3,4 。");
- break;
- }
- }else{
- ICLogger.i("协议版本要是数字,目前支持0,1,2,3,4 。");
- }
- protocol_no=ret;
- return ret;
- }
-
-
- public static void setPPGAdjust(Context context,int adjust){
- SharPreferenceUtil.setPrefInt(context,KeyPPGadust,adjust);
- }
-
-
- public static int getPPGAdjust(Context context){
- return SharPreferenceUtil.getPrefInt(context,KeyPPGadust, 0);
- }
-
- public static void setBPHAdjust(Context context,int adjust){
- SharPreferenceUtil.setPrefInt(context,KeyBPHadust,adjust);
- }
-
-
- public static int getBPHAdjust(Context context){
- return SharPreferenceUtil.getPrefInt(context,KeyBPHadust, 0);
- }
-
-
-
- public static int getBPLAdjust(Context context){
- return SharPreferenceUtil.getPrefInt(context,KeyBPLadust, 0);
- }
-
- public static void setBPLAdjust(Context context,int adjust){
- SharPreferenceUtil.setPrefInt(context,KeyBPLadust,adjust);
- }
-
- public static void setSPo2Adjust(Context context,int adjust){
- SharPreferenceUtil.setPrefInt(context,KeySPo2adust,adjust);
- }
-
- public static int getSPo2Adjust(Context context){
- return SharPreferenceUtil.getPrefInt(context,KeySPo2adust, 0);
- }
-
- public static void loadPPG_BPH_BPL_SPO2_adjustvalue(Context context,Runtime runtime){
- int ppgadj,bphadj,bpladj,spo2adj;
- ppgadj=getPPGAdjust(context);
- bphadj=getBPHAdjust(context);
- bpladj=getBPLAdjust(context);
- spo2adj=getSPo2Adjust(context);
- runtime.getHRS().setAdjust(ppgadj,bphadj,bpladj,spo2adj);
- ICLogger.i("Load Health adjust value ppg "+ppgadj+", bph "+bphadj+", bpl "+bpladj+", spo2 "+spo2adj);
- }
-
-
-
- //心率血压血氧校准值
- public static String getPPG_ECG_adjustValue(){
- return Util.getSystemProperties("persist.sys."+Constants.SHAREKEY_SETTING_PPG_ECG_ADJUST,"0,0,0,0");
- }
-
- public static void setPPG_ECG_adjustValue(String adjvalue){
- Util.setSystemProperties("persist.sys."+Constants.SHAREKEY_SETTING_PPG_ECG_ADJUST,adjvalue);
- }
-
- //久坐时间获取
- public static int getKeepSitRangeInMinutes(Context context ){
- return Util.getSystemPropertiesInt("persist.sys."+Constants.SHAREKEY_SETTING_SIT_ALARM_RANGE_IN_MINUTES,0);
+
+
+ public static int getBPHAdjust(Context context) {
+ return SharPreferenceUtil.getPrefInt(context, KeyBPHadust, 0);
+ }
+
+
+ public static int getBPLAdjust(Context context) {
+ return SharPreferenceUtil.getPrefInt(context, KeyBPLadust, 0);
+ }
+
+ public static void setBPLAdjust(Context context, int adjust) {
+ SharPreferenceUtil.setPrefInt(context, KeyBPLadust, adjust);
+ }
+
+ public static void setSPo2Adjust(Context context, int adjust) {
+ SharPreferenceUtil.setPrefInt(context, KeySPo2adust, adjust);
+ }
+
+ public static int getSPo2Adjust(Context context) {
+ return SharPreferenceUtil.getPrefInt(context, KeySPo2adust, 0);
+ }
+
+ public static void loadPPG_BPH_BPL_SPO2_adjustvalue(Context context, Runtime runtime) {
+ int ppgadj, bphadj, bpladj, spo2adj;
+ ppgadj = getPPGAdjust(context);
+ bphadj = getBPHAdjust(context);
+ bpladj = getBPLAdjust(context);
+ spo2adj = getSPo2Adjust(context);
+ runtime.getHRS().setAdjust(ppgadj, bphadj, bpladj, spo2adj);
+ ICLogger.i("Load Health adjust value ppg " + ppgadj + ", bph " + bphadj + ", bpl " + bpladj + ", spo2 " + spo2adj);
+ }
+
+
+ //心率血压血氧校准值
+ public static String getPPG_ECG_adjustValue() {
+ return Util.getSystemProperties("persist.sys." + Constants.SHAREKEY_SETTING_PPG_ECG_ADJUST, "0,0,0,0");
+ }
+
+ public static void setPPG_ECG_adjustValue(String adjvalue) {
+ Util.setSystemProperties("persist.sys." + Constants.SHAREKEY_SETTING_PPG_ECG_ADJUST, adjvalue);
+ }
+
+ //久坐时间获取
+ public static int getKeepSitRangeInMinutes(Context context) {
+ return Util.getSystemPropertiesInt("persist.sys." + Constants.SHAREKEY_SETTING_SIT_ALARM_RANGE_IN_MINUTES, 0);
// return SharPreferenceUtil.getPrefIntPublic(context,Constants.SHAREKEY_SETTING_SIT_ALARM_RANGE_IN_MINUTES,0);
- }
+ }
- //久坐时间设置
- public static void setKeepSitRangeInMinutes(Context context, int RangeInMinutes){
- Util.setSystemProperties("persist.sys."+Constants.SHAREKEY_SETTING_SIT_ALARM_RANGE_IN_MINUTES,RangeInMinutes);
+ //久坐时间设置
+ public static void setKeepSitRangeInMinutes(Context context, int RangeInMinutes) {
+ Util.setSystemProperties("persist.sys." + Constants.SHAREKEY_SETTING_SIT_ALARM_RANGE_IN_MINUTES, RangeInMinutes);
// SharPreferenceUtil.setPrefIntPublic(context,Constants.SHAREKEY_SETTING_SIT_ALARM_RANGE_IN_MINUTES,RangeInMinutes);
- }
+ }
- public static void setSleepDate(Context context,String dateyyyyMMddHHmmss){
- Util.setSystemProperties("persist.sys."+Constants.SHAREKEY_SETTING_SLEEP_SCORE_DATE,dateyyyyMMddHHmmss);
+ public static void setSleepDate(Context context, String dateyyyyMMddHHmmss) {
+ Util.setSystemProperties("persist.sys." + Constants.SHAREKEY_SETTING_SLEEP_SCORE_DATE, dateyyyyMMddHHmmss);
// SharPreferenceUtil.setPrefStringPublic(context,Constants.SHAREKEY_SETTING_SLEEP_SCORE_DATE,dateyyyyMMddHHmmss);
- }
+ }
- public static void setSleepScore(Context context,int score){
+ public static void setSleepScore(Context context, int score) {
// SharPreferenceUtil.setPrefIntPublic(context,Constants.SHAREKEY_SETTING_SLEEP_SCORE,score);
- Util.setSystemProperties("persist.sys."+Constants.SHAREKEY_SETTING_SLEEP_SCORE,score);
+ Util.setSystemProperties("persist.sys." + Constants.SHAREKEY_SETTING_SLEEP_SCORE, score);
- }
+ }
- public static String getSleepDate(Context context){
- return Util.getSystemProperties("persist.sys."+Constants.SHAREKEY_SETTING_SLEEP_SCORE_DATE,"");
+ public static String getSleepDate(Context context) {
+ return Util.getSystemProperties("persist.sys." + Constants.SHAREKEY_SETTING_SLEEP_SCORE_DATE, "");
}
- public static int getSleepScore(Context context){
+ public static int getSleepScore(Context context) {
- return Util.getSystemPropertiesInt("persist.sys."+Constants.SHAREKEY_SETTING_SLEEP_SCORE,0);
+ return Util.getSystemPropertiesInt("persist.sys." + Constants.SHAREKEY_SETTING_SLEEP_SCORE, 0);
}
- public static void setNeedCutOff(Context context,boolean enAnti){
- SharPreferenceUtil.setPrefBoolean(context,"NeedCutOff",enAnti);
- }
- public static boolean getNeedCutOff(Context context){
- return SharPreferenceUtil.getPrefBoolean(context,"NeedCutOff", false);
- }
- public static void setNeedAntiOff(Context context,boolean enAnti){
- SharPreferenceUtil.setPrefBoolean(context,"NeedAntiOff",enAnti);
+ public static void setNeedCutOff(Context context, boolean enAnti) {
+ SharPreferenceUtil.setPrefBoolean(context, "NeedCutOff", enAnti);
}
- public static boolean getNeedAntiOff(Context context){
- return SharPreferenceUtil.getPrefBoolean(context,"NeedAntiOff", false);
+ public static boolean getNeedCutOff(Context context) {
+ return SharPreferenceUtil.getPrefBoolean(context, "NeedCutOff", false);
}
- public static boolean enableSleep=false;
- /**
- * 参考数据,平均每分钟步数来判断,大于 KeepSitJudgementRefValue 认为没有坐着。小于等于这个值认为坐着。
- */
- public static int KeepSitJudgementRefValue=30;
- /***
- * persist.sys.alarmConfig=ALARM_SOS,ALARM_LOWBATTERY,ALARM_ANTIOFF,ALARM_WEARED,ALARM_CUTOFF,ALARM_FALL,ALARM_ABNORMAL_HEART_RATE,ALARM_HEART_RATE_HIGH,ALARM_HEART_RATE_LOW,ALARM_BPH_HIGH,ALARM_BPH_LOW,ALARM_BPL_HIGH,ALARM_BPL_LOW,ALARM_SEDENTARY,ALARM_ILLEGAL_CUTOFF,ALARM_LOCK_WATCH,ALARM_TEMP_HIGH,ALARM_TEMP_LOW,ALARM_POWER_OFF,ALARM_ESCAPE,ALARM_NONE
- * 配在里面的表示开启,没配的表示关闭。 默认ALARM_SOS,ALARM_LOWBATTERY,ALARM_POWER_OFF开启
- * ALARM_ILLEGAL_CUTOFF,ALARM_FALL,ALARM_ABNORMAL_HEART_RATE 没有使用,设置了也没有用
- */
- public static void loadAlarmConfig(){
- String configvalues=Util.getSystemProperties("persist.sys.alarmConfig","");
- String[] values=configvalues.split(",");
- if (values.length>0){
- for (int i=0; i< values.length;i++)
- {
- for (Runtime.AlarmType at: Runtime.AlarmType.values()) {
- if (values[i].trim().equals(at.name())){
- ConfigAlarm(at,true);
- break;
- }
+ public static void setNeedAntiOff(Context context, boolean enAnti) {
+ SharPreferenceUtil.setPrefBoolean(context, "NeedAntiOff", enAnti);
+ }
+
+ public static boolean getNeedAntiOff(Context context) {
+ return SharPreferenceUtil.getPrefBoolean(context, "NeedAntiOff", false);
+ }
+
+ public static boolean enableSleep = false;
+ /**
+ * 参考数据,平均每分钟步数来判断,大于 KeepSitJudgementRefValue 认为没有坐着。小于等于这个值认为坐着。
+ */
+ public static int KeepSitJudgementRefValue = 30;
+
+ /***
+ * persist.sys.alarmConfig=ALARM_SOS,ALARM_LOWBATTERY,ALARM_ANTIOFF,ALARM_WEARED,ALARM_CUTOFF,ALARM_FALL,ALARM_ABNORMAL_HEART_RATE,ALARM_HEART_RATE_HIGH,ALARM_HEART_RATE_LOW,ALARM_BPH_HIGH,ALARM_BPH_LOW,ALARM_BPL_HIGH,ALARM_BPL_LOW,ALARM_SEDENTARY,ALARM_ILLEGAL_CUTOFF,ALARM_LOCK_WATCH,ALARM_TEMP_HIGH,ALARM_TEMP_LOW,ALARM_POWER_OFF,ALARM_ESCAPE,ALARM_NONE
+ * 配在里面的表示开启,没配的表示关闭。 默认ALARM_SOS,ALARM_LOWBATTERY,ALARM_POWER_OFF开启
+ * ALARM_ILLEGAL_CUTOFF,ALARM_FALL,ALARM_ABNORMAL_HEART_RATE 没有使用,设置了也没有用
+ */
+ public static void loadAlarmConfig() {
+ String configvalues = Util.getSystemProperties("persist.sys.alarmConfig", "");
+ String[] values = configvalues.split(",");
+ if (values.length > 0) {
+ for (int i = 0; i < values.length; i++) {
+ for (Runtime.AlarmType at : Runtime.AlarmType.values()) {
+ if (values[i].trim().equals(at.name())) {
+ ConfigAlarm(at, true);
+ break;
+ }
+ }
+ }
}
- }
- }
- dumpAlarmConfig();
- }
-
- public static void ConfigAlarm(Runtime.AlarmType alarmType,boolean enabled){
- AlarmConfiglist.put(alarmType.ordinal(),enabled);
- }
- public static void dumpAlarmConfig(){
- for (int i=0;i<AlarmConfiglist.size();i++) {
- ICLogger.i(Runtime.AlarmType.values()[i].name()+" "+AlarmConfiglist.get(i));
- }
- }
- private static HashMap<Integer,Boolean> AlarmConfiglist;
- static {
- AlarmConfiglist=new HashMap<Integer,Boolean>();
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_SOS.ordinal(),true);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_LOWBATTERY.ordinal(),true);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_ANTIOFF.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_WEARED.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_CUTOFF.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_FALL.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_ABNORMAL_HEART_RATE.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_HEART_RATE_HIGH.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_HEART_RATE_LOW.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_BPH_HIGH.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_BPH_LOW.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_BPL_HIGH.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_BPL_LOW.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_SEDENTARY.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_ILLEGAL_CUTOFF.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_LOCK_WATCH.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_TEMP_HIGH.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_TEMP_LOW.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_POWER_OFF.ordinal(),true);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_ESCAPE.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_NONE.ordinal(),false);
- AlarmConfiglist.put(Runtime.AlarmType.ALARM_REMOVE_SOS.ordinal(),true);
- }
-
- public static boolean isAlarmTypeEnabled(Runtime.AlarmType alarmType){
-
- boolean en=false;
- if (AlarmConfiglist.containsKey(alarmType.ordinal())){
- en=AlarmConfiglist.get(alarmType.ordinal());
- }
- return en;
- }
- public static boolean needWaterMark(){
- String customname=getSystemProperties("persist.sys.needWaterMark","true");
- if(customname.trim().equals("true")){
- return true;
- }else
- return false;
- }
+ dumpAlarmConfig();
+ }
+
+ public static void ConfigAlarm(Runtime.AlarmType alarmType, boolean enabled) {
+ AlarmConfiglist.put(alarmType.ordinal(), enabled);
+ }
+
+ public static void dumpAlarmConfig() {
+ for (int i = 0; i < AlarmConfiglist.size(); i++) {
+ ICLogger.i(Runtime.AlarmType.values()[i].name() + " " + AlarmConfiglist.get(i));
+ }
+ }
+
+ private static HashMap<Integer, Boolean> AlarmConfiglist;
+
+ static {
+ AlarmConfiglist = new HashMap<Integer, Boolean>();
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_SOS.ordinal(), true);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_LOWBATTERY.ordinal(), true);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_ANTIOFF.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_WEARED.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_CUTOFF.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_FALL.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_ABNORMAL_HEART_RATE.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_HEART_RATE_HIGH.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_HEART_RATE_LOW.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_BPH_HIGH.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_BPH_LOW.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_BPL_HIGH.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_BPL_LOW.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_SEDENTARY.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_ILLEGAL_CUTOFF.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_LOCK_WATCH.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_TEMP_HIGH.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_TEMP_LOW.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_POWER_OFF.ordinal(), true);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_ESCAPE.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_NONE.ordinal(), false);
+ AlarmConfiglist.put(Runtime.AlarmType.ALARM_REMOVE_SOS.ordinal(), true);
+ }
+
+ public static boolean isAlarmTypeEnabled(Runtime.AlarmType alarmType) {
+
+ boolean en = false;
+ if (AlarmConfiglist.containsKey(alarmType.ordinal())) {
+ en = AlarmConfiglist.get(alarmType.ordinal());
+ }
+ return en;
+ }
+
+ public static boolean needWaterMark() {
+ String customname = getSystemProperties("persist.sys.needWaterMark", "true");
+ if (customname.trim().equals("true")) {
+ return true;
+ } else
+ return false;
+ }
}