completed remote get version .
authorTrillGates <williamtrillgates@gmail.com>
Mon, 12 Apr 2021 04:02:19 +0000 (12:02 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Mon, 12 Apr 2021 04:02:19 +0000 (12:02 +0800)
app/src/main/AndroidManifest.xml
app/src/main/java/com/enqualcomm/support/utils/AlarmHelper.java
app/src/main/java/com/ic/protocols/protocol_fzd.java

index e092055..bf90595 100644 (file)
                 <action android:name="com.enqualcomm.support.OTHER_ALARM_END" />
                 <action android:name="com.enqualcomm.support.OTHER_ALARM_START" />
                 <action android:name="com.ic.action.VIDEO_CALL" />
+                <action android:name="com.ic.power.ACTION_ALARM_POWER_OFF" />
             </intent-filter>
         </service>
         <service android:name=".CoreService$InnerService" />
index 34527d4..a6bb83b 100644 (file)
@@ -125,7 +125,7 @@ public class AlarmHelper {
         if (l2 < l3)\r
             l1 = l2 + ONE_DAY;\r
         alarmManager.cancel(pendingIntent);\r
-        alarmManager.setExact(AlarmManager.RTC_WAKEUP, l1, pendingIntent);\r
+        alarmManager.set(AlarmManager.RTC_WAKEUP, l1, pendingIntent);\r
     }\r
 \r
 \r
@@ -142,7 +142,8 @@ public class AlarmHelper {
             l1 = l2 + ONE_DAY;\r
         alarmManager.cancel(pendingIntent);\r
         //设置闹钟\r
-        alarmManager.setExact(AlarmManager.RTC_WAKEUP, l1, pendingIntent);\r
+        ICLogger.d("target time == > " + l1);\r
+        alarmManager.set(AlarmManager.RTC_WAKEUP, l1, pendingIntent);\r
     }\r
 \r
 \r
index ab7dc64..bad4d9d 100644 (file)
@@ -52,6 +52,7 @@ import com.enqualcomm.support.utils.TimeUtil;
 import com.enqualcomm.support.utils.Util;
 import com.enqualcomm.support.utils.WifiSupport;
 import com.enqualcomm.support.utils.regexUtil;
+import com.sina.util.dnscache.AppConfigUtil;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -1690,11 +1691,28 @@ public class protocol_fzd {
                 mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.WIFISET)));
                 handleWIFISET(cmd, data, mRuntime);
                 break;
+            case VERNO:
+                ICLogger.d("收到服务器获取手表版本的指令...");
+                handleVERNO(mConnection, mRuntime);
+                break;
         }
         return ret;
 
     }
 
+    /**
+     * 处理服务器获取手表的版本指令
+     *
+     * @param mConnection
+     * @param mRuntime
+     */
+    private void handleVERNO(Connection mConnection, Runtime mRuntime) {
+        //获取到系统版本
+        String versionName = AppConfigUtil.getVersionName();
+        StringMessage stringMessage = genFZDCMD(cmdMap.get(CMD_TYPE.VERNO), versionName);
+        mConnection.send(stringMessage);
+    }
+
     /**
      * 设置wifi账号和密码
      *
@@ -1715,22 +1733,17 @@ public class protocol_fzd {
             String password = split[1];
             ICLogger.d("ssid = > " + ssid);
             ICLogger.d("password = > " + password);
-            WifiConfiguration tempConfig = WifiSupport.isExsits(ssid, context);
-            if (tempConfig == null) {
-                WifiConfiguration wifiConfigurationWep = WifiSupport.createWifiConfig(
-                        ssid, password, WifiSupport.WifiCipherType.WIFICIPHER_WEP);
-                WifiConfiguration wifiConfigurationWpa = WifiSupport.createWifiConfig(
-                        ssid, password, WifiSupport.WifiCipherType.WIFICIPHER_WPA);
-                boolean result = WifiSupport.addNetWork(wifiConfigurationWep, context);
-                ICLogger.d("result == > " + result);
-                boolean wpaResult = WifiSupport.addNetWork(wifiConfigurationWpa, context);
-                ICLogger.d("wpaResult == > " + wpaResult);
-            } else {
-                boolean b = WifiSupport.addNetWork(tempConfig, context);
-                ICLogger.d("old config add result..." + b);
-            }
+            //两种类型都添加吧,测试可行,就不耗时 去
+            WifiConfiguration wifiConfigurationWep = WifiSupport.createWifiConfig(
+                    ssid, password, WifiSupport.WifiCipherType.WIFICIPHER_WEP);
+            WifiConfiguration wifiConfigurationWpa = WifiSupport.createWifiConfig(
+                    ssid, password, WifiSupport.WifiCipherType.WIFICIPHER_WPA);
+            boolean result = WifiSupport.addNetWork(wifiConfigurationWep, context);
+            ICLogger.d("result == > " + result);
+            boolean wpaResult = WifiSupport.addNetWork(wifiConfigurationWpa, context);
+            ICLogger.d("wpaResult == > " + wpaResult);
         } else if (split.length == 1) {
-            //只有账号
+            //只有账号,没有密码
             String ssid = Util.decodeUnicode2Utf8(split[0]);
             ICLogger.d("ssid == > " + ssid);
             WifiConfiguration wifiConfiguration = WifiSupport.createWifiConfig(
@@ -1788,7 +1801,7 @@ public class protocol_fzd {
                 } else if (BOOT_OFF_ACTION_ON.equals(action)) {
                     String[] powerOffTimes = powerOffTime.split(":");
                     int hour = Integer.parseInt(powerOffTimes[0]);
-                    int min = Integer.parseInt(powerOffTimes[0]);
+                    int min = Integer.parseInt(powerOffTimes[1]);
                     intent.putExtra("hour", hour);
                     intent.putExtra("min", min);
                     AlarmHelper.setPowerOffAlarm(context, pendingIntent, hour, min);