add aidl for weather.
authorTrillGates <williamtrillgates@gmail.com>
Thu, 15 Apr 2021 13:07:54 +0000 (21:07 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Thu, 15 Apr 2021 13:07:54 +0000 (21:07 +0800)
16 files changed:
app/build.gradle
app/release/ICSer_V776_2104151936_release_test_server.apk [moved from app/release/ICSer_V756_2102011624_release.apk with 75% similarity]
app/release/output.json
app/src/main/aidl/com/ic/fzd/weather/FZDWeatherInfo.aidl [new file with mode: 0644]
app/src/main/aidl/com/ic/fzd/weather/IFZDWeatherCallback.aidl [new file with mode: 0644]
app/src/main/aidl/com/ic/fzd/weather/IFZDWeatherService.aidl [new file with mode: 0644]
app/src/main/java/com/enqualcomm/support/Config.java
app/src/main/java/com/enqualcomm/support/provider/FZDDatabaseHelper.java
app/src/main/java/com/enqualcomm/support/utils/DBHelper.java
app/src/main/java/com/enqualcomm/support/utils/ProfileManager.java
app/src/main/java/com/enqualcomm/support/utils/Util.java
app/src/main/java/com/ic/fzd/weather/FZDWeatherInfo.java [new file with mode: 0644]
app/src/main/java/com/ic/protocols/protocolAPIHelper.java
app/src/main/java/com/ic/protocols/protocol_fzd.java
app/src/main/java/com/ic/protocols/protocol_mqtt.java
app/version_code.properties

index a577254..10dc605 100644 (file)
@@ -18,13 +18,10 @@ android {
         versionCode currentVersionCode
         versionName "${currentVersionName}"
         multiDexEnabled true
-
 //        buildConfigField "boolean", "DEBUG_MODE", "true"        // 调试版本
         buildConfigField "boolean", "DEBUG_MODE", "false"
         // 正式版本
-
         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
-
     }
     lintOptions {
         checkReleaseBuilds false
@@ -86,9 +83,9 @@ android {
 //    }
 }
 dependencies {
-    compileOnly files ('libs/telephony-common-full-debug.jar')
-    compileOnly files ('libs/frameworks-full-debug.jar')
-    compileOnly files ('libs/frameworks-2-full-debug.jar')
+    compileOnly files('libs/telephony-common-full-debug.jar')
+    compileOnly files('libs/frameworks-full-debug.jar')
+    compileOnly files('libs/frameworks-2-full-debug.jar')
 
     implementation 'com.android.support.constraint:constraint-layout:1.1.3'
     //compile fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
@@ -99,9 +96,9 @@ dependencies {
     implementation 'com.github.ChestnutPlus:TestModules:v1.0.16'
     testImplementation 'junit:junit:4.12'
     implementation 'com.android.support:recyclerview-v7:25.1.0'
-    implementation files ('libs/android-logging-log4j-1.0.3.jar','libs/ftp4j-1.7.2.jar','libs/log4j-1.2.17.jar','libs/okio-2.4.3.jar' )
-    implementation files ('libs/mail.jar' )
-    implementation files ('libs/activation.jar','libs/additionnal.jar' )
+    implementation files('libs/android-logging-log4j-1.0.3.jar', 'libs/ftp4j-1.7.2.jar', 'libs/log4j-1.2.17.jar', 'libs/okio-2.4.3.jar')
+    implementation files('libs/mail.jar')
+    implementation files('libs/activation.jar', 'libs/additionnal.jar')
     implementation project(path: ':dNSCache')
     implementation project(path: ':core')
 
@@ -133,10 +130,11 @@ def releaseTime() {
     return new Date().format("yyMMddHHmm", TimeZone.getTimeZone("GMT+08:00"))
 
 }
+
 preBuild {
 
     doLast {
-        def imlFile = file( project.name + ".iml")
+        def imlFile = file(project.name + ".iml")
         println 'Change ' + project.name + '.iml order'
         try {
             def parsedXml = (new XmlParser()).parse(imlFile)
similarity index 75%
rename from app/release/ICSer_V756_2102011624_release.apk
rename to app/release/ICSer_V776_2104151936_release_test_server.apk
index e1fc89b..8919510 100644 (file)
Binary files a/app/release/ICSer_V756_2102011624_release.apk and b/app/release/ICSer_V776_2104151936_release_test_server.apk differ
index b7f13cb..4370e5d 100644 (file)
@@ -1 +1 @@
-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":773,"versionName":"2104021759","enabled":true,"outputFile":"ICSer_V773_2104021759_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V773_2104021759_release.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":776,"versionName":"2104151936","enabled":true,"outputFile":"ICSer_V776_2104151936_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V776_2104151936_release.apk","properties":{}}]
\ No newline at end of file
diff --git a/app/src/main/aidl/com/ic/fzd/weather/FZDWeatherInfo.aidl b/app/src/main/aidl/com/ic/fzd/weather/FZDWeatherInfo.aidl
new file mode 100644 (file)
index 0000000..4a6e864
--- /dev/null
@@ -0,0 +1,4 @@
+
+package com.ic.fzd.weather;
+
+parcelable FZDWeatherInfo;
\ No newline at end of file
diff --git a/app/src/main/aidl/com/ic/fzd/weather/IFZDWeatherCallback.aidl b/app/src/main/aidl/com/ic/fzd/weather/IFZDWeatherCallback.aidl
new file mode 100644 (file)
index 0000000..56cf468
--- /dev/null
@@ -0,0 +1,6 @@
+
+package com.ic.fzd.weather;
+
+interface IFZDWeatherCallback {
+    void onWeatherInfoLoaded();
+}
\ No newline at end of file
diff --git a/app/src/main/aidl/com/ic/fzd/weather/IFZDWeatherService.aidl b/app/src/main/aidl/com/ic/fzd/weather/IFZDWeatherService.aidl
new file mode 100644 (file)
index 0000000..8ceac13
--- /dev/null
@@ -0,0 +1,8 @@
+
+package com.ic.fzd.weather;
+
+interface IFZDWeatherService {
+    void registerCallback();
+    void unRegisterCallback();
+    void loadWeahterInfo();
+}
\ No newline at end of file
index 583349e..8e3ae5c 100644 (file)
@@ -589,19 +589,21 @@ public class Config {
 
     public static boolean isUsingCustomServer = false;
 
-    public static void setCustomServer(Context context, boolean isusingCutomerServer, String serverip, int serverport) {
+    public static void setCustomServer(Context context,
+                                       boolean isusingCutomerServer,
+                                       String serverip,
+                                       int serverport) {
 
-        if (isusingCutomerServer)
+        if (isusingCutomerServer) {
             Util.setSystemProperties("persist.sys.UsingCustomServer", "true");
-        else
+        } 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);
 
     }
@@ -613,10 +615,7 @@ public class Config {
         if (tmp.equals("true")) {
             ret = true;
         }
-
-        //isUsingCustomServer = ret;
-        isUsingCustomServer = false;
-
+        isUsingCustomServer = ret;
         String serverip = "";
         int serverport = 0;
         if (isUsingCustomServer) {
index 2fc4aec..4f75feb 100644 (file)
@@ -30,8 +30,14 @@ public class FZDDatabaseHelper extends SQLiteOpenHelper {
 
 
     public interface MemberType {
+        //可以微聊,打电话
         int FRIEND = 1;
+        //Members联系人,可以视频/语音聊天/拨打电话,可以微聊
         int CONTACT = 2;
+        //白名单,可以拨打电话
+        int WHITE_LIST = 3;
+        //sos通讯录
+        int SOS = 4;
     }
 
     public interface MessageType {
index 5d34eaa..ff09820 100644 (file)
@@ -772,7 +772,8 @@ public class DBHelper {
         String current_sys_status;
         if (cursor != null) {
             //获取silent免打扰状态 ON/OFF
-            for (current_sys_status = null; cursor.moveToNext(); current_sys_status = cursor.getString(5)) {
+            for (current_sys_status = null; cursor.moveToNext();
+                 current_sys_status = cursor.getString(5)) {
             }
 
             cursor.close();
@@ -794,8 +795,9 @@ public class DBHelper {
                 contentValues.put("WEEK", silent.week);
                 contentValues.put("STATUS", silent.status);
                 contentValues.put("CUR_SYS_STATUS", current_sys_status);
-                ICLogger.i("add silience " + silent.start + "-" + silent.end + " " + silent.week + " " + silent.status + " " + current_sys_status);
-
+                ICLogger.i("add silience " + silent.start + "-" + silent.end
+                        + " " + silent.week + " "
+                        + silent.status + " " + current_sys_status);
             }
 
             this.cr.bulkInsert(ICContentProvider.SILENT_URI, contentValueslist);
index f4cb8ff..438bafe 100644 (file)
@@ -4,7 +4,7 @@ import android.media.AudioManager;
 
 public class ProfileManager {
 
-    //只声音,无振动
+    //只声音,无振动(可用)
     public static void ringModel(AudioManager audio) {
         audio.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
         audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,
@@ -13,7 +13,7 @@ public class ProfileManager {
                 AudioManager.VIBRATE_SETTING_OFF);
     }
 
-    //即有声音也有振动
+    //即有声音也有振动(可用)
     public static void ringAndVibrate(AudioManager audio) {
         audio.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
         audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,
@@ -22,7 +22,7 @@ public class ProfileManager {
                 AudioManager.VIBRATE_SETTING_ON);
     }
 
-    //只能振动
+    //只能振动(可用)
     public static void vibrate(AudioManager audio) {
         audio.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
         audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,
index ccbdd58..8d2be71 100644 (file)
@@ -324,7 +324,7 @@ public class Util {
     public static String getSystemProperties(String prop) {
 
         String str = "";
-        Class clazz = null;
+        Class clazz;
         try {
             clazz = Class.forName("android.os.SystemProperties");
             Method get = clazz.getMethod("get", new Class[]{String.class});
diff --git a/app/src/main/java/com/ic/fzd/weather/FZDWeatherInfo.java b/app/src/main/java/com/ic/fzd/weather/FZDWeatherInfo.java
new file mode 100644 (file)
index 0000000..798b95b
--- /dev/null
@@ -0,0 +1,146 @@
+package com.ic.fzd.weather;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * 数据有:
+ * 时间,天气描述,天气编号,当前温度,最低温度,最高温度,城市名称,风向,风多少级
+ */
+public class FZDWeatherInfo implements Parcelable {
+    private String weatherText;
+    //0表示晴,1表示阴,2表示雨,3表示雪
+    private int code;
+    //当前温度
+    private int currentTempe;
+    //
+    private int lowTemp;
+    //
+    private int highTemp;
+    //城市名称
+    private String cityName;
+    //风向
+    private String windDirection;
+    //风多少级
+    private String windLev;
+    //时间
+    private String dateTime;
+
+    public String getWeatherText() {
+        return weatherText;
+    }
+
+    public void setWeatherText(String weatherText) {
+        this.weatherText = weatherText;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public void setCode(int code) {
+        this.code = code;
+    }
+
+    public int getCurrentTempe() {
+        return currentTempe;
+    }
+
+    public void setCurrentTempe(int currentTempe) {
+        this.currentTempe = currentTempe;
+    }
+
+    public int getLowTemp() {
+        return lowTemp;
+    }
+
+    public void setLowTemp(int lowTemp) {
+        this.lowTemp = lowTemp;
+    }
+
+    public int getHighTemp() {
+        return highTemp;
+    }
+
+    public void setHighTemp(int highTemp) {
+        this.highTemp = highTemp;
+    }
+
+    public String getCityName() {
+        return cityName;
+    }
+
+    public void setCityName(String cityName) {
+        this.cityName = cityName;
+    }
+
+    public String getWindDirection() {
+        return windDirection;
+    }
+
+    public void setWindDirection(String windDirection) {
+        this.windDirection = windDirection;
+    }
+
+    public String getWindLev() {
+        return windLev;
+    }
+
+    public void setWindLev(String windLev) {
+        this.windLev = windLev;
+    }
+
+    public String getDateTime() {
+        return dateTime;
+    }
+
+    public void setDateTime(String dateTime) {
+        this.dateTime = dateTime;
+    }
+
+    public static Creator<FZDWeatherInfo> getCREATOR() {
+        return CREATOR;
+    }
+
+    protected FZDWeatherInfo(Parcel in) {
+        weatherText = in.readString();
+        code = in.readInt();
+        currentTempe = in.readInt();
+        lowTemp = in.readInt();
+        highTemp = in.readInt();
+        cityName = in.readString();
+        windDirection = in.readString();
+        windLev = in.readString();
+        dateTime = in.readString();
+    }
+
+    public static final Creator<FZDWeatherInfo> CREATOR = new Creator<FZDWeatherInfo>() {
+        @Override
+        public FZDWeatherInfo createFromParcel(Parcel in) {
+            return new FZDWeatherInfo(in);
+        }
+
+        @Override
+        public FZDWeatherInfo[] newArray(int size) {
+            return new FZDWeatherInfo[size];
+        }
+    };
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeString(weatherText);
+        dest.writeInt(code);
+        dest.writeInt(currentTempe);
+        dest.writeInt(lowTemp);
+        dest.writeInt(highTemp);
+        dest.writeString(cityName);
+        dest.writeString(windDirection);
+        dest.writeString(windLev);
+        dest.writeString(dateTime);
+    }
+}
index 421b87e..ec5318a 100644 (file)
@@ -574,6 +574,7 @@ public class protocolAPIHelper {
                 ret = protocol_mqtt.defaultServerIP;
                 break;
         }
+        ICLogger.d("ip ==> " + ret);
         return ret;
     }
 
@@ -701,7 +702,7 @@ public class protocolAPIHelper {
         return ret;
     }
 
-    public static StringMessage genMissedUD2Msg(StringMessage msg){
+    public static StringMessage genMissedUD2Msg(StringMessage msg) {
         if (is_protocol_not_Initialled()) return null;
         StringMessage ret = null;
         switch (Config.protocol_no) {
index 8fe0b65..76b4351 100644 (file)
@@ -93,7 +93,7 @@ public class protocol_fzd {
     private static final String CMDHEADERSPLIT = "*";
     private static final String CMDSPLIT = ",";
     private static final boolean doEncryption = Util.getSystemProperties("persist.sys.encrypt_fzd", "true").equals("true");
-    public static final String defaultServerIP = "api.xcloudtech.com";
+    public static final String defaultServerIP = "fzd.xcloudtech.com";
     public static final int defaultServerPort = 9000;
     private final SharedPreferences sharedPreferences;
     private final Handler mHandler;
@@ -1038,16 +1038,11 @@ public class protocol_fzd {
         return genFZDCMD(cmd, sb.toString());
     }
 
-
-    public void handleKA(Runtime runtime, String data) {
-
-    }
-
-    public void handleCENTER(String cmd, String data, Runtime mRuntime) {
+    public void handleCENTER(CMD_TYPE cmd, String data, Runtime mRuntime) {
         //把中心号码插入到手中机
         ICLogger.d("phoneNum == > " + data);
         ContentValues contentValues = new ContentValues();
-        contentValues.put(FZDDatabaseHelper.sKey, cmd);
+        contentValues.put(FZDDatabaseHelper.sKey, cmdMap.get(cmd));
         contentValues.put(FZDDatabaseHelper.sValue, data);
         mRuntime.getContextProxy().getResolver().insert(
                 Uri.parse(FZDSettingsProvider.SETTINGS),
@@ -1306,6 +1301,7 @@ public class protocol_fzd {
         connection.send(wdstart());
         try {
             int freq = Integer.parseInt(data);
+            ICLogger.d("freq == > " + freq);
             Config.setTemperatureTestCycle(runtime, freq);
             CoreService.getInstance().setTempAlarm(true);
         } catch (Exception e) {
@@ -1336,29 +1332,36 @@ public class protocol_fzd {
 
 
     public void handleSOS(Connection connection, Runtime runtime, String cmd, String data) {
-
         connection.send(SOS());
+        //TODO:保存到fzd的联系人里,类型为SOS
         if (data != null && data.length() > 0) {
-            String list[] = data.split(CMDSPLIT);
+            String[] list = data.split(CMDSPLIT);
+            ArrayList<Contact> contactArray = new ArrayList<Contact>();
+            ContentValues contentValues = new ContentValues();
+            contentValues.put(FZDDatabaseHelper.fType, FZDDatabaseHelper.MemberType.SOS);
             if (list.length == 1) {
-                ArrayList<Contact> contactArray = new ArrayList<Contact>();
                 if (regexUtil.isMobileNumber(list[0]) || regexUtil.isPhoneNumber(list[0])) {
                     contactArray.add(new Contact(Contact.CATEGORY_SOS, "sos1", list[0]));
                     ICLogger.i("find SOS1 number " + list[0]);
+                    contentValues.put(FZDDatabaseHelper.fUserName, "sos1");
+                    contentValues.put(FZDDatabaseHelper.fPhoneNum, list[0]);
                 }
             } else if (list.length == 2) {
-                ArrayList<Contact> contactArray = new ArrayList<Contact>();
                 if (regexUtil.isMobileNumber(list[0]) || regexUtil.isPhoneNumber(list[0])) {
                     contactArray.add(new Contact(Contact.CATEGORY_SOS, "sos1", list[0]));
                     ICLogger.i("find SOS1 number " + list[0]);
+                    contentValues.put(FZDDatabaseHelper.fUserName, "sos1");
+                    contentValues.put(FZDDatabaseHelper.fPhoneNum, list[0]);
                 }
                 if (regexUtil.isMobileNumber(list[1]) || regexUtil.isPhoneNumber(list[1])) {
                     contactArray.add(new Contact(Contact.CATEGORY_SOS, "sos2", list[1]));
                     ICLogger.i("find SOS2 number " + list[1]);
+                    contentValues.put(FZDDatabaseHelper.fUserName, "sos2");
+                    contentValues.put(FZDDatabaseHelper.fPhoneNum, list[1]);
                 }
-                runtime.getDbHelper().saveContacts(contactArray, false, false, false, false, false, true);
-
             }
+            runtime.getDbHelper().saveContacts(contactArray, false, false, false, false, false, true);
+            runtime.getContextProxy().getResolver().insert(Uri.parse(FZDMembersProvider.MEMBERS), contentValues);
         }
 
 
@@ -1403,17 +1406,30 @@ public class protocol_fzd {
      */
     public void handlePHL(Connection connection, Runtime runtime, String cmd, String data) {
         String list[] = data.split(CMDSPLIT);
-        int listlen = list.length;
-        boolean ispared = ((listlen >= 0) && (listlen % 2 == 0));
-        if (ispared) {
+        int listLen = list.length;
+        boolean isPared = ((listLen >= 0) && (listLen % 2 == 0));
+        if (isPared) {
             ArrayList<Contact> contactArray = new ArrayList<Contact>();
-            for (int i = 0; i < listlen; i += 2) {
-                String phonem = list[i];
+            ContentValues contentValues = new ContentValues();
+            for (int i = 0; i < listLen; i += 2) {
+                String phoneNum = list[i];
                 String name = Util.decodeUnicode2Utf8(list[i + 1]);
-                ICLogger.i(i / 2 + " 姓名 " + name + ", 电话 " + phonem);
-                contactArray.add(new Contact(Contact.CATEGORY_CALL, name, phonem));
+                ICLogger.i(i / 2 + " 姓名 " + name + ", 电话 " + phoneNum);
+                contactArray.add(new Contact(Contact.CATEGORY_CALL, name, phoneNum));
+                contentValues.put(FZDDatabaseHelper.fType, FZDDatabaseHelper.MemberType.WHITE_LIST);
+                contentValues.put(FZDDatabaseHelper.fPhoneNum, phoneNum);
+                contentValues.put(FZDDatabaseHelper.fID, phoneNum);
+                contentValues.put(FZDDatabaseHelper.fUserName, name);
+                contentValues.put(FZDDatabaseHelper.fCreateTime, System.currentTimeMillis());
+                contentValues.put(FZDDatabaseHelper.fUpdateTime, System.currentTimeMillis());
             }
+            //TODO:保存到fzd的联系人列表,类型为白名单
             runtime.getDbHelper().saveContacts(contactArray, false, false, true, false, false, false);
+            //保存到新的数据库中,为了防止问题,先兼容原来的库
+            //后面所有地方都切换到新库了,才删除上面的代码
+            // TODO:需要修改白名单拦截的地方.
+            ContentResolver resolver = runtime.getContextProxy().getResolver();
+            resolver.insert(Uri.parse(FZDMembersProvider.MEMBERS), contentValues);
         } else {
             ICLogger.i("没有电话本!执行清除操作!");
         }
@@ -1581,7 +1597,7 @@ public class protocol_fzd {
                 break;
             case CENTER:
                 ICLogger.d("收到中心号码设置--> " + data);
-                handleCENTER(cmd, data, mRuntime);
+                handleCENTER(type, data, mRuntime);
                 mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.CENTER)));
                 break;
             case SILENCETIME2:
@@ -1644,42 +1660,42 @@ public class protocol_fzd {
                 break;
             case LOWBAT:
                 ICLogger.d("收到低电量警报的开关设置");
-                handleSettings(cmd, data, mRuntime);
+                handleSettings(type, data, mRuntime);
                 mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.LOWBAT)));
                 break;
             case SOSSMS:
                 ICLogger.d("收到SOS短信警报开关设置");
-                handleSettings(cmd, data, mRuntime);
+                handleSettings(type, data, mRuntime);
                 mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.SOSSMS)));
                 break;
             case REMOVE:
                 ICLogger.d("收到表带的警报开关设置");
-                handleSettings(cmd, data, mRuntime);
+                handleSettings(type, data, mRuntime);
                 mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.REMOVE)));
                 break;
             case WLKEY:
                 ICLogger.d("收到白名单功能开关设置");
-                handleSettings(cmd, data, mRuntime);
+                handleSettings(type, data, mRuntime);
                 mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.WLKEY)));
                 break;
             case KEYBRD:
                 ICLogger.d("收到拨号盘开关设置");
-                handleSettings(cmd, data, mRuntime);
+                handleSettings(type, data, mRuntime);
                 mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.KEYBRD)));
                 break;
             case FALLDOWN:
                 ICLogger.d("收到跌倒报警开关设置");
-                handleSettings(cmd, data, mRuntime);
+                handleSettings(type, data, mRuntime);
                 mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.FALLDOWN)));
                 break;
             case SHAKE:
                 ICLogger.d("收到震动提醒开关设置");
-                handleSettings(cmd, data, mRuntime);
+                handleSettings(type, data, mRuntime);
                 mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.SHAKE)));
                 break;
             case PEDO:
                 ICLogger.d("收到计步功能开关设置");
-                handleSettings(cmd, data, mRuntime);
+                handleSettings(type, data, mRuntime);
                 mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.PEDO)));
                 break;
             case FACTORY:
@@ -1689,7 +1705,7 @@ public class protocol_fzd {
                 break;
             case SLEEPTIME:
                 ICLogger.d("收到服务器发来的翻转检测时间设置");
-                handleSLEEPTIME(cmd, data, mRuntime);
+                handleSLEEPTIME(type, data, mRuntime);
                 mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.SLEEPTIME)));
                 break;
             case REMIND:
@@ -1699,7 +1715,7 @@ public class protocol_fzd {
                 break;
             case profile:
                 ICLogger.d("收到情景模式设置指令");
-                handleProfile(cmd, data, mRuntime);
+                handleProfile(type, data, mRuntime);
                 mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.profile)));
                 break;
             case BOOTOFF:
@@ -2014,7 +2030,7 @@ public class protocol_fzd {
      * @param data
      * @param mRuntime
      */
-    private void handleProfile(String cmd, String data, Runtime mRuntime) {
+    private void handleProfile(CMD_TYPE cmd, String data, Runtime mRuntime) {
         ICLogger.d("profile data == > " + data);
         //保存一份到设置里
         handleSettings(cmd, data, mRuntime);
@@ -2026,6 +2042,7 @@ public class protocol_fzd {
             ICLogger.d("audioManager == > is null");
             return;
         }
+        Context context = mRuntime.getContextProxy().context;
         //对data进行判断
         try {
             int type = Integer.parseInt(data);
@@ -2121,7 +2138,7 @@ public class protocol_fzd {
      * @param data
      * @param mRuntime
      */
-    private void handleSLEEPTIME(String cmd, String data, Runtime mRuntime) {
+    private void handleSLEEPTIME(CMD_TYPE cmd, String data, Runtime mRuntime) {
         //数据解析,有可能为空的
         ICLogger.d("sleep_time == > " + data);
         handleSettings(cmd, data, mRuntime);
@@ -2144,11 +2161,11 @@ public class protocol_fzd {
      * @param data
      * @param mRuntime
      */
-    private void handleSettings(String cmd, String data, Runtime mRuntime) {
+    private void handleSettings(CMD_TYPE cmd, String data, Runtime mRuntime) {
         ICLogger.d(cmd + " trigger setting --> " + data);
         ContentResolver resolver = mRuntime.getContextProxy().getResolver();
         ContentValues values = new ContentValues();
-        values.put(FZDDatabaseHelper.sKey, cmd);
+        values.put(FZDDatabaseHelper.sKey, cmdMap.get(cmd));
         values.put(FZDDatabaseHelper.sValue, data);
         resolver.insert(Uri.parse(FZDSettingsProvider.SETTINGS), values);
     }
index d4145d3..97371de 100644 (file)
@@ -20,7 +20,6 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 
-import static com.enqualcomm.support.Constants.ACTION_HEATR_RATE_START;
 import static com.enqualcomm.support.Constants.FROM_SERVER;
 import static com.enqualcomm.support.LocationClient.LOCATION_MODE;
 import static java.lang.Math.abs;
@@ -399,10 +398,10 @@ public class protocol_mqtt {
 
             if (datetime != null) {
                 ICLogger.i("===" + timezone + " " + TimeUtil.getDefaultTimeZone());
-                TimeUtil.setTimeZone(runtime.getContextProxy().context,timezone);
+                TimeUtil.setTimeZone(runtime.getContextProxy().context, timezone);
 
                 ICLogger.i("===" + TimeUtil.getDefaultTimeZone());
-                TimeUtil.setSysDateTime(runtime.getContextProxy().context, datetime, timezone,false);
+                TimeUtil.setSysDateTime(runtime.getContextProxy().context, datetime, timezone, false);
                 ICLogger.i("===" + TimeUtil.getDefaultTimeZone());
 
             }
@@ -613,7 +612,7 @@ public class protocol_mqtt {
                 try {
                     int cycle_int = Integer.parseInt(cycle.trim());
                     ICLogger.i("收到服务器指令:设置心率血压周期 " + cycle + "秒" + cycle_int / 60 + "分钟");
-                    CoreService.getInstance().setHeartRateDetectAlarm(cycle_int/60);
+                    CoreService.getInstance().setHeartRateDetectAlarm(cycle_int / 60);
                     //发送重置PPGCycle的广播,会在CoreServer里面执行
 //                    Intent intent = new Intent();
 //                    intent.putExtra("PPGTestCycle", cycle_int / 60);
@@ -895,28 +894,29 @@ public class protocol_mqtt {
             case UD:
                 mConnection.DeliverCMDMessageToSystem("UD", cmd);//通知下面线程状态变化,用Deliver发送的话必须发,表示服务器响应了
                 break;
-
             case AL:
                 mConnection.DeliverCMDMessageToSystem("AL", cmd);//通知下面线程状态变化,用Deliver发送的话必须发,表示服务器响应了
                 break;
-
             case PEDO:
                 handlePEDO(mConnection, mRuntime, cmd, data);
-                mConnection.DeliverCMDMessageToSystem("PEDO", cmd);//通知下面线程状态变化,用Deliver发送的话必须发,表示服务器响应了
+                //通知下面线程状态变化,用Deliver发送的话必须发,
+                // 表示服务器响应了
+                mConnection.DeliverCMDMessageToSystem("PEDO", cmd);
                 break;
-
             case REMOVE:
                 handleREMOVE(mConnection, mRuntime, cmd, data);
-                mConnection.DeliverCMDMessageToSystem("REMOVE", cmd);//通知下面线程状态变化
+                //通知下面线程状态变化
+                mConnection.DeliverCMDMessageToSystem("REMOVE", cmd);
                 break;
             case CENTER:
                 handleCENTER(mConnection, mRuntime, cmd, data);
-                mConnection.DeliverCMDMessageToSystem("CENTER", cmd);//通知下面线程状态变化
-
+                //通知下面线程状态变化
+                mConnection.DeliverCMDMessageToSystem("CENTER", cmd);
                 break;
             case MONITOR:
                 handleMONITOR(mConnection, mRuntime, cmd, data);
-                mConnection.DeliverCMDMessageToSystem("MONITOR", cmd);//通知下面线程状态变化
+                //通知下面线程状态变化
+                mConnection.DeliverCMDMessageToSystem("MONITOR", cmd);
 
                 break;
 //            case CR:
index 51ebd3f..9e9dcc9 100644 (file)
@@ -1,2 +1,2 @@
-#Fri Apr 02 17:59:55 CST 2021
-VERSION_CODE=773
+#Thu Apr 15 19:36:29 CST 2021
+VERSION_CODE=776