release V455
authorsnickersun <scy@incartech.cn>
Mon, 20 Jul 2020 12:09:03 +0000 (20:09 +0800)
committersnickersun <scy@incartech.cn>
Mon, 20 Jul 2020 12:09:03 +0000 (20:09 +0800)
1、添加Fota升级服务器host2,SMS短信更改功能
2、心跳时间6分钟
release V458
3、添加脱腕 震动
4、心跳时间改回5分钟。

app/release/ICSer_V458_2007202005_release.apk [moved from app/release/ICSer_V453_2007171308_release.apk with 79% similarity]
app/src/main/java/com/enqualcomm/support/Config.java
app/src/main/java/com/enqualcomm/support/Constants.java
app/src/main/java/com/enqualcomm/support/ICSmsManager.java
app/src/main/java/com/enqualcomm/support/bean/SleepInfo.java [new file with mode: 0644]
app/src/main/java/com/enqualcomm/support/service/AntiMonitorService.java
app/src/main/java/com/enqualcomm/support/service/SleepManager.java [new file with mode: 0644]
app/src/main/java/com/enqualcomm/support/utils/ICHttpUtil.java
app/src/main/java/com/ic/protocols/protocol_jiai.java
app/version_code.properties

similarity index 79%
rename from app/release/ICSer_V453_2007171308_release.apk
rename to app/release/ICSer_V458_2007202005_release.apk
index aa389a8..3ffff84 100644 (file)
Binary files a/app/release/ICSer_V453_2007171308_release.apk and b/app/release/ICSer_V458_2007202005_release.apk differ
index 6548d13..d1d2dda 100644 (file)
@@ -89,8 +89,10 @@ public class Config {
   final static String KeyProtocolServerIP="ProtocolServerIP";\r
   final static String KeyProtocolServerHOST="ProtocolServerHOST";\r
   final static String KeyProtocolServerPort="ProtoclServerPort";;\r
-  final static String KeyFotaServerIP="FotaServerIP";\r
-  final static String KeyFotaServerPort="FotaServerPort";\r
+  final static String KeyLogServerIP="LogServerIP";\r
+  final static String KeyLogServerPort="LogServerPort";\r
+  final static String KeyFotaServerUrl="FotaServerUrl";\r
+\r
 \r
   final static String KeyPpgTestCycle="PPGTestCycle";\r
   final static String KeyLocationCycle="LocationCycle";\r
@@ -178,7 +180,13 @@ public class Config {
         SharPreferenceUtil.setPrefString(context,KeyWiFiEncyptType,type);\r
     }\r
 \r
+  public static String getFotaServerUrl(Context context){\r
+    return SharPreferenceUtil.getPrefString(context,KeyFotaServerUrl,"");\r
+  }\r
 \r
+  public static void setFotaServerUrl(Context context,String url){\r
+    SharPreferenceUtil.setPrefString(context,KeyFotaServerUrl,url);\r
+  }\r
     public static String getFtpUser(Context context){\r
     return SharPreferenceUtil.getPrefString(context,KeyLogFtpUser,DefaultLogFtpUser);\r
   }\r
@@ -286,18 +294,18 @@ public class Config {
   public static int getH88InitFlag(Context context){\r
     return SharPreferenceUtil.getPrefInt(context,"H88InitFlag",0);\r
   }\r
-  public static void setFotaServerIP(Context context,String serverIP,int serverPort){\r
+  public static void setLogServerIP(Context context,String serverIP,int serverPort){\r
 \r
-    SharPreferenceUtil.setPrefString(context,KeyFotaServerIP,serverIP);\r
-    SharPreferenceUtil.setPrefInt(context,KeyFotaServerPort,serverPort);\r
+    SharPreferenceUtil.setPrefString(context,KeyLogServerIP,serverIP);\r
+    SharPreferenceUtil.setPrefInt(context,KeyLogServerPort,serverPort);\r
 \r
   }\r
-  public static String getFotaServerIP(Context context){\r
-    return SharPreferenceUtil.getPrefString(context,KeyFotaServerIP,"icfota.snicker.com.cn");\r
+  public static String getLogServerIP(Context context){\r
+    return SharPreferenceUtil.getPrefString(context,KeyLogServerIP,"http://icfota.snicker.com.cn:8089/UploadFile.jsp");\r
   }\r
 \r
-  public static int getFotaServerPort(Context context){\r
-    return SharPreferenceUtil.getPrefInt(context,KeyFotaServerPort,8089);\r
+  public static int getLogServerPort(Context context){\r
+    return SharPreferenceUtil.getPrefInt(context,KeyLogServerPort,8089);\r
   }\r
 \r
 \r
index 9466980..fd924ad 100644 (file)
@@ -316,5 +316,8 @@ public interface Constants {
   public static String KEY_BATTERY_EVENT="eventID"; //integer  eventID =1 battery low, eventID =0 解除\r
 \r
 \r
+\r
+  public static String PersistFotaServer2Url="persist.sys.ota.host2";\r
+\r
 }\r
 \r
index 654f5c2..ab4ceb5 100644 (file)
@@ -808,7 +808,41 @@ public class ICSmsManager  extends BroadcastReceiver{
                     locationClient.setLocationResponse(replayLocation);\r
                     locationClient.triggerLocationProcess();\r
                 }\r
+            }else if (sms.startsWith(ENCRYPED_HEADER+"#setLogSrv#=")&& sms.endsWith("#")) {\r
+                String tmp[] = sms.split("=");\r
+                if (tmp.length == 2) {\r
+                    String strtmp=tmp[1].replace("#","");\r
+\r
+                    if (strtmp.contains("/")){\r
+                        /* #setLogSrv#=http://icfota.snicker.com.cn:8089/UploadFile.jsp*/\r
+                        Config.setLogServerIP(mContext,strtmp,8089);\r
+                        sendSMS(phonenumber, "set setLogSrv to "+strtmp+"!");\r
+                    }else {\r
+                        /* #setLogSrv#=icfota.snicker.com.cn:8089 */\r
+                         String[] ipstr = strtmp.split(":");\r
+                        if (ipstr.length == 2) {\r
+                            String ip = ipstr[0];\r
+                            int port = Integer.valueOf(ipstr[1].replace("#", ""));\r
+                            Config.setLogServerIP(mContext,ip,port);\r
+                            sendSMS(phonenumber, "set setLogSrv to "+strtmp+"!");\r
+                        } else {\r
+                            sendSMS(phonenumber, " setLogSrv cmd Format error!");\r
+                        }\r
+                    }\r
 \r
+                } else {\r
+                    sendSMS(phonenumber, " setLogSrv cmd Format error!");\r
+                }\r
+            }else if (sms.startsWith(ENCRYPED_HEADER+"#setFotaSrv#=")&& sms.endsWith("#")) {\r
+                String tmp[] = sms.split("=");\r
+                if (tmp.length == 2) {\r
+                    String strtmp=tmp[1].replace("#","");\r
+                    Config.setFotaServerUrl(mContext,strtmp);\r
+                    Util.setSystemProperties(Constants.PersistFotaServer2Url,strtmp);\r
+                    sendSMS(phonenumber, "set setFotaSrv2 to "+strtmp+"!");\r
+                } else {\r
+                    sendSMS(phonenumber, " setFotaSrv cmd Format error!");\r
+                }\r
             } else if (sms.equals(ENCRYPED_HEADER+"#FotaUpdate#")) {\r
 \r
                 cell_number_to_reply=phonenumber;\r
diff --git a/app/src/main/java/com/enqualcomm/support/bean/SleepInfo.java b/app/src/main/java/com/enqualcomm/support/bean/SleepInfo.java
new file mode 100644 (file)
index 0000000..3176b15
--- /dev/null
@@ -0,0 +1,75 @@
+package com.enqualcomm.support.bean;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Date;\r
+\r
+public class SleepInfo {\r
+    private Date currentDate;\r
+    private Date sleep_start;\r
+    private Date sleep_end;\r
+    private int deepsleep_minutes;\r
+    private int lightsleep_minutes;\r
+    private ArrayList<Integer> turnovertimesArray ;\r
+\r
+    private int DEEP_TURN_LEVEL=0;\r
+    private int LIGHT_TURN_LEVEL=25;\r
+\r
+    private int step_for_each_record_in_minutes;\r
+\r
+    public Date getCurrentDate()\r
+    {\r
+        return currentDate;\r
+    }\r
+    public Date getSleep_start()\r
+    {\r
+        return sleep_start;\r
+    }\r
+    public Date getSleep_end()\r
+    {\r
+        return sleep_end;\r
+    }\r
+\r
+    /***\r
+     *根据参数创建睡眠检测记录,\r
+     * @param datevalue\r
+     *当前测试的 日期\r
+     * @param sleepstart\r
+     * 系统设置的 睡眠开始监测时间 例如晚上9点开始\r
+     * @param sleepend\r
+     * 系统设置的 睡眠停止监测时间 例如第二天早9点\r
+     * @param step_in_minutes\r
+     * 系统当前的 心跳间隔时间,单位分钟\r
+     */\r
+    public SleepInfo(Date datevalue , Date sleepstart,Date sleepend,int step_in_minutes){\r
+        currentDate=datevalue;\r
+        sleep_start=sleepstart;\r
+        sleep_end=sleepend;\r
+        turnovertimesArray=new ArrayList<>();\r
+        step_for_each_record_in_minutes=step_in_minutes;\r
+    }\r
+\r
+    /***\r
+     *  每次加入的turnovertime 是一个计量周期(心跳周期)内翻滚的次数(此处暂时用计步数据进行代替)\r
+     *  翻滚次数小于最低阈值DEEP_TURN_LEVEL 认为是深度睡眠\r
+     *  翻滚次数在最低阈值DEEP_TURN_LEVEL 和最高阈值 LIGHT_TURN_LEVEL 之间认为是浅度睡眠,\r
+     *  翻滚次数大于最高阈值认为没有睡眠。\r
+     *\r
+     * @param turnovertime\r
+     */\r
+    public void append_sleep_check_item(int turnovertime){\r
+\r
+        turnovertimesArray.add(turnovertime);\r
+    }\r
+\r
+\r
+    public int getDeepsleep_minutes(){\r
+        return deepsleep_minutes;\r
+    }\r
+\r
+    public int getLightsleep_minutes(){\r
+        return lightsleep_minutes;\r
+    }\r
+\r
+\r
+\r
+}\r
index 9f4a5bb..af2d492 100644 (file)
@@ -18,6 +18,7 @@ import com.enqualcomm.support.service.base.AbstractInvokeHandlerService;
 import com.enqualcomm.support.utils.Connection;\r
 import com.enqualcomm.support.utils.ICLogger;\r
 \r
+import com.enqualcomm.support.utils.VibrateUtil;\r
 import com.ic.protocols.protocolAPIHelper;\r
 \r
 import static com.enqualcomm.support.Constants.ACTION_ANTI_OFF;\r
@@ -99,6 +100,7 @@ public class AntiMonitorService extends AbstractInvokeHandlerService {
              //脱腕\r
              if(Config.needBroadcastAntiAlarm) {\r
                  play_notify();\r
+                 VibrateUtil.getInstance(mContext).VibrateOnOnce(true);\r
                  screen_on();\r
                 try {\r
                     sleep(1000);\r
diff --git a/app/src/main/java/com/enqualcomm/support/service/SleepManager.java b/app/src/main/java/com/enqualcomm/support/service/SleepManager.java
new file mode 100644 (file)
index 0000000..9947d8b
--- /dev/null
@@ -0,0 +1,4 @@
+package com.enqualcomm.support.service;\r
+\r
+public class SleepManager {\r
+}\r
index 09247f5..8d1114d 100644 (file)
@@ -42,12 +42,19 @@ public class ICHttpUtil {
             compressSuccess=false;\r
         }\r
         if (compressSuccess==false) return false;\r
-        String server= Config.getFotaServerIP(runtime.getContextProxy().context);\r
-        int port= Config.getFotaServerPort(runtime.getContextProxy().context);\r
+        String server= Config.getLogServerIP(runtime.getContextProxy().context);\r
+        int port= Config.getLogServerPort(runtime.getContextProxy().context);\r
         String product=DeviceInfoUtil.getModule();\r
         String pkgver=DeviceInfoUtil.getSWVersionDisplayName();\r
         String imei=runtime.IMEI();\r
+        if (server.startsWith("http://")){\r
+            server=server.replace("http://","");\r
+        }\r
+        //为了兼容之前的只设置ip和端口的设置方式\r
         String actionUrl = "http://"+server+":"+port + "/UploadFile.jsp?product=" + product + "&pkgver="+ pkgver + "&imei="+ imei+"&logtime="+logtime;\r
+        if (server.contains("/")){ //此时说明不是ip地址,而是个url\r
+                actionUrl= "http://"+server+"?product=" + product + "&pkgver="+ pkgver + "&imei="+ imei+"&logtime="+logtime;\r
+        }\r
 \r
         ICLogger.i("url="+actionUrl+"\nfile="+zipfile);\r
         return upLoadFile(actionUrl, new File(zipfile));\r
index 9cabfb9..373a580 100644 (file)
@@ -349,13 +349,25 @@ public class protocol_jiai {
     public static String AP10(Runtime ds){\r
 \r
         /**\r
-         * IWAP10080524A2232.9806N11404.9355E000.1061830323.8706000908000502,\r
+         * IWAP10080524A2232.9806N11404.9355E000.1  061830  323.87  060 009 080 0 05 02,\r
          * 460,0,9520,3671,\r
          * 00,zh-cn,00,\r
          * 00为报警状态,00为无任何报警(01:SOS,02:低电,03:脱落报警,04:佩戴提醒,05/06:跌倒报警))\r
          * zh-cn:设备语言\r
          * 00:第一个0:是否需要回复地址信息,0:不回复,1回复.\r
          * HOME|74-DE-2B-44-88-8C|97&HOME1|74-DE-2B-44-88-8C|97&HOME2|74-DE-2B-44-88-8C|97&HOME3|74-DE-2B-44-88-8C|97#\r
+         * IW标识符\r
+         * AP10:命令字\r
+         * 080524: 2008 年05 月24\r
+         * A:“A”表示数据有效,”V”无效,如为V则取LBS数据\r
+         * 2232.9806N11404.9355E000.1: 北纬22度32.9806分,东经114度04.9355分,速度为000.1 km/h,如经纬度无效,可默认全为0,如0000.0000N00000.0000E\r
+         * 061830: 格林尼治时间06 点18 分30 秒\r
+         * 323.87:方向角323.87°\r
+         * 06000908000102:060为GSM信号,009为参与定位的卫星数,080为电池电量,0,保留位,01为设防状态,02为工作模式 ,(设防,工作模式如果为00,则代表无或未设置)\r
+         * 460,0,9520,3671 : LBS基站数据,MCC国家码,460为中国,0:MNC,0为移动,9520:LAC,十进制,3671,CID,十进制\r
+         * 00为报警状态,00为无任何报警(01:SOS,02:低电,03:脱落报警,04:佩戴提醒,05:剪断报警,06:跌倒报警,07:心率异常, 08:心率过高, 09:心率过低,10:收缩压过高,11:收缩压过低,12:舒张压过高,13:舒张压过低,14:久坐提醒,15:非法解锁(剪断报警),16:锁定提醒(佩戴提醒),17:体温过高,18体温过低)\r
+         * zh-cn:设备语言\r
+         * 00:第一个0:是否需要回复地址信息,0:不回复,1回复.\r
          */\r
         return new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.AP10)).append(TimeUtil.getShortDate())\r
                 .append(ds.getGPSData()).append(TimeUtil.getShortTime()).append(ds.getGPSHeading()).append(String.format("%03d",abs(ds.getSignalStrength())))\r
index 490f599..4ded883 100644 (file)
@@ -1,2 +1,2 @@
-#Fri Jul 17 13:08:38 CST 2020\r
-VERSION_CODE=453\r
+#Mon Jul 20 20:05:15 CST 2020\r
+VERSION_CODE=458\r