修改了低电震动的策略,以及发布了ICSer_V914_2110201057_release
authorTrillGates <williamtrillgates@gmail.com>
Wed, 20 Oct 2021 03:39:16 +0000 (11:39 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Wed, 20 Oct 2021 03:39:16 +0000 (11:39 +0800)
app/release/ICSer_V914_2110201057_release.apk [moved from app/release/ICSer_V907_2110191550_release.apk with 77% similarity]
app/release/output.json
app/src/main/java/com/enqualcomm/support/bean/Runtime.java
app/src/main/java/com/enqualcomm/support/service/Deliver.java
app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java
app/src/main/java/com/enqualcomm/support/utils/Util.java
app/src/main/java/com/enqualcomm/support/utils/VibrateUtil.java
app/src/main/java/com/ic/protocols/protocol_beehome.java
app/version_code.properties

similarity index 77%
rename from app/release/ICSer_V907_2110191550_release.apk
rename to app/release/ICSer_V914_2110201057_release.apk
index bfd06ee..9340992 100644 (file)
Binary files a/app/release/ICSer_V907_2110191550_release.apk and b/app/release/ICSer_V914_2110201057_release.apk differ
index 39ce402..e683cbc 100644 (file)
@@ -1 +1 @@
-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":907,"versionName":"2110191550","enabled":true,"outputFile":"ICSer_V907_2110191550_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V907_2110191550_release.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":914,"versionName":"2110201057","enabled":true,"outputFile":"ICSer_V914_2110201057_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V914_2110201057_release.apk","properties":{}}]
\ No newline at end of file
index f177b91..fe2e51e 100644 (file)
@@ -1151,17 +1151,16 @@ public class Runtime {
     }
 
     public String getMqttGPSData() {
-
-/***
- * A,22.570733,N,113.8626083,E,0.00,249.5,0.0,6
- * A,gps 定位有效
- * 22.570733,纬度 N,
- * 113.8626083,经度 E,
- * 0.00,速度
- * 249.5,方向
- * 0.0,海拔
- * 6,卫星个数
- */
+        /***
+         * A,22.570733,N,113.8626083,E,0.00,249.5,0.0,6
+         * A,gps 定位有效
+         * 22.570733,纬度 N,
+         * 113.8626083,经度 E,
+         * 0.00,速度
+         * 249.5,方向
+         * 0.0,海拔
+         * 6,卫星个数
+         */
         StringBuilder sb = new StringBuilder();
         int speedi = (int) gpsp.getLocation().speed;
         int speedl = (int) ((gpsp.getLocation().speed - speedi) * 100);
@@ -1171,7 +1170,7 @@ public class Runtime {
         String latname = gpsp.getLocation().lat_name;
         String lonname = gpsp.getLocation().lon_name;
         ICLogger.i(" UD isfixed " + isGPSFixed() + " is in area " + bleInfo.is_in_area);
-        if (bleInfo.is_in_area == true) {
+        if (bleInfo.is_in_area) {
             latStr = bleInfo.gps_n;
             lonStr = bleInfo.gps_e;
             latname = (latStr.trim().startsWith("-")) ? "S" : "N";
@@ -1195,16 +1194,16 @@ public class Runtime {
 
     public String getFZDGPSData() {
 
-/***
- * A,22.570733,N,113.8626083,E,0.00,249.5,0.0,6
- * A,gps 定位有效
- * 22.570733,纬度 N,
- * 113.8626083,经度 E,
- * 0.00,速度
- * 249.5,方向
- * 0.0,海拔
- * 6,卫星个数
- */
+        /***
+         * A,22.570733,N,113.8626083,E,0.00,249.5,0.0,6
+         * A,gps 定位有效
+         * 22.570733,纬度 N,
+         * 113.8626083,经度 E,
+         * 0.00,速度
+         * 249.5,方向
+         * 0.0,海拔
+         * 6,卫星个数
+         */
         StringBuilder sb = new StringBuilder();
         int speedi = (int) gpsp.getLocation().speed;
         int speedl = (int) ((gpsp.getLocation().speed - speedi) * 100);
@@ -1217,13 +1216,10 @@ public class Runtime {
         if (isGPSFixed()) {
             String gpsStr = String.format(",%s,%s,%s,%s,%d.%02d,%s,0.0,%d", latStr, latname, lonStr, lonname, speedi, speedl, heading, starcount);
             sb.append("A").append(gpsStr);
-
         } else {
             String gpsStr = String.format(",0.000,N,0.000,E,0.0,0.0,0.0,0");
             sb.append("V").append(gpsStr);
         }
-
-
         return sb.toString();
     }
 
index f66743c..001b75c 100644 (file)
@@ -474,14 +474,12 @@ public class Deliver extends AbstractConnectionService {
                     if (mRuntime.check_stat_do_temp_test()) {
                         TemperatureUtil.getInstance().DoTempTest(FROM_SERVER);
                     }
-
                     Util.mSleep(5000);
                     //开启测量PPG
                     if (mRuntime.check_stat_do_ppg_test()) {
                         HeartRateManager.getInstance().triggerPPGTest(FROM_SERVER);
                     }
                 }
-
                 CoreService.getInstance().getConnection().DeliverCMDMessageToSystem("SentVoicePacket", "");
             }
             return true;
@@ -495,13 +493,8 @@ public class Deliver extends AbstractConnectionService {
                 Util.ShowToast(paramRuntime, "Do poweroff!");
             }
             VibrateUtil.getInstance(paramRuntime.getContextProxy().context).
-                    vibrate(new long[]{1000, 500, 1000, 500, 1000}, -1);
-            mSendMSGHandler.postDelayed(new Runnable() {
-                @Override
-                public void run() {
-                    Util.shutdown();
-                }
-            }, 2000);
+                    vibrate(new long[]{0, 1000, 500, 1000}, -1);
+            mSendMSGHandler.postDelayed(Util::shutdown, 500);
             return true;
         } else if ("FactoryResetCheckSim".equals(paramStringMessage.cmd())) {
 
index be61ba7..1cecde4 100644 (file)
@@ -36,6 +36,9 @@ import static com.enqualcomm.support.Constants.KEY_BATTERY_EVENT;
 public class BatteryUtil {
     private BroadcastReceiver batteryChangedReceiver = new BroadcastReceiver() {
         public void onReceive(Context param1Context, Intent intent) {
+            int batLevel = intent.getIntExtra(EXTRA_LEVEL, 0) * 100 / intent.getIntExtra(EXTRA_SCALE, 100);
+            // 当前电池电压
+            handleBatteryLevelVibrate(batLevel);
             if (Intent.ACTION_BATTERY_CHANGED.equals(intent.getAction())) {
                 int extra_status = intent.getIntExtra(EXTRA_STATUS, BATTERY_STATUS_UNKNOWN);
                 StringBuilder msg = new StringBuilder("EXTRA_STATUS = ");
@@ -59,7 +62,6 @@ public class BatteryUtil {
                     case BATTERY_STATUS_NOT_CHARGING:
                         msg.append("BATTERY_STATUS_NOT_CHARGING ");
                         break;
-
                 }
                 msg.append("; ");
                 if (extra_status == BATTERY_STATUS_CHARGING) {
@@ -77,8 +79,6 @@ public class BatteryUtil {
                     }
                     mRuntime.setBatterychanging(false);
                 }
-                int batLevel = intent.getIntExtra(EXTRA_LEVEL, 0) * 100 / intent.getIntExtra(EXTRA_SCALE, 100);
-                // 当前电池电压
                 int batteryVolt = intent.getIntExtra(EXTRA_VOLTAGE, -1);
                 mRuntime.setBatteryVoltage(batteryVolt);
                 msg.append("BatteryLevel " + batLevel + " BatteryVotage " + batteryVolt + "; ");
@@ -86,14 +86,12 @@ public class BatteryUtil {
                 ICLogger.i(msg.toString());
                 //处理电压
                 process_battery_level(param1Context, batLevel);
-
             } else if (Intent.ACTION_BATTERY_LOW.equals(intent.getAction())) {
                 //  mRuntime.setBatteryLow(true);
                 //   if (Config.LOG_TOFILE) ICLogger.logToFile("Battery","BatteryLow !");
                 //  mRuntime.setAlarmType(false,mRuntime.getBatteryLow(),false,false);
                 //trigger AP10 报警定位
                 //   connection.send(protocolAPIHelper.genStringMessage("AP10",protocolAPIHelper.getWarningMSG(mRuntime)));
-
             } else if (Intent.ACTION_BATTERY_OKAY.equals(intent.getAction())) {
                 ICLogger.i("Battery OKAY !");
                 if (Config.LOG_TOFILE) ICLogger.logToFile("Battery", "Battery OKAY !");
@@ -105,12 +103,10 @@ public class BatteryUtil {
                 if (Config.isL03Tracker) {
                     LedUtil.setRedLedOn(true);
                 }
-
             } else if (Intent.ACTION_POWER_DISCONNECTED.equals(intent.getAction())) {
                 ICLogger.i("ACTION_POWER_DISCONNECTED!");
                 mRuntime.setPowerConnected(false);
                 if (Config.LOG_TOFILE) ICLogger.logToFile("Battery", "ACTION_POWER_DISCONNECTED !");
-
                 if (Config.isL03Tracker) {
                     LedUtil.setRedLedOn(false);
                 }
@@ -288,12 +284,18 @@ public class BatteryUtil {
     private int lowBatteryWarningFlag = 1;
 
     private void handleBatteryLevelVibrate(int lev) {
+        if (lev == 0) {
+            return;
+        }
         boolean haveBatteryChange = isPowerConnected(mRuntime.getContextProxy().context);
         ICLogger.d("haveBatteryChange ==> " + haveBatteryChange);
         if (haveBatteryChange) {
             lowBatteryWarningFlag = 0;
+            VibrateUtil.getInstance(mRuntime.getContextProxy().context).vibrateOn(false);
             return;
         }
+        ICLogger.d("lowBatteryWarningFlag ==>  " + lowBatteryWarningFlag);
+        ICLogger.d("lev ==>  " + lev);
         boolean shouldVibrate = false;
         if (lev <= 30 && lev > 20) {
             //不为4表示这个段不有震动
@@ -306,6 +308,7 @@ public class BatteryUtil {
             shouldVibrate = lowBatteryWarningFlag != 1;
             lowBatteryWarningFlag = 1;
         }
+        ICLogger.d("shouldVibrate==> " + shouldVibrate);
         //1515 添加低电震动提醒
         //百分之30的时候会震动(没有charge的时候)
         //百分之20的时候会震动(没有charge的时候)
index 5f35011..3a71456 100644 (file)
@@ -1163,16 +1163,12 @@ public class Util {
             //获得ServiceManager类
             Class ServiceManager = Class
                     .forName("android.os.ServiceManager");
-
             //获得ServiceManager的getService方法
             Method getService = ServiceManager.getMethod("getService", java.lang.String.class);
-
             //调用getService获取RemoteService
             Object oRemoteService = getService.invoke(null, Context.POWER_SERVICE);
-
             //获得IPowerManager.Stub类
-            Class cStub = Class
-                    .forName("android.os.IPowerManager$Stub");
+            Class cStub = Class.forName("android.os.IPowerManager$Stub");
             //获得asInterface方法
             Method asInterface = cStub.getMethod("asInterface", android.os.IBinder.class);
             //调用asInterface方法获取IPowerManager对象
@@ -1181,7 +1177,6 @@ public class Util {
             Method shutdown = oIPowerManager.getClass().getMethod("shutdown", boolean.class, boolean.class);
             //调用shutdown()方法
             shutdown.invoke(oIPowerManager, false, true);
-
         } catch (Exception e) {
             e.printStackTrace();
             ICLogger.e(e.getMessage(), e);
index 6f53f3e..2d67c9c 100644 (file)
@@ -11,14 +11,33 @@ import static android.content.Context.VIBRATOR_SERVICE;
 \r
 public class VibrateUtil {\r
 \r
+    private VibrateUtil() {\r
+        //设置监听\r
+        IntentFilter intentFilter = new IntentFilter();\r
+        intentFilter.addAction("com.ic.action.POWER_CLICK");\r
+        BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {\r
+            @Override\r
+            public void onReceive(Context context, Intent intent) {\r
+                String action = intent.getAction();\r
+                ICLogger.d("action is ==> " + action + " cancel vibrate...");\r
+                vibrator.cancel();\r
+            }\r
+        };\r
+        mContext.registerReceiver(broadcastReceiver, intentFilter);\r
+    }\r
+\r
     private static Context mContext = null;\r
 \r
     public static VibrateUtil getInstance(Context context) {\r
-        if (mContext == null)\r
+        if (mContext == null) {\r
             mContext = context;\r
-        if (vibrator == null)\r
+        }\r
+        if (vibrator == null) {\r
             vibrator = (Vibrator) mContext.getSystemService(VIBRATOR_SERVICE);\r
-        vibrateUtil = new VibrateUtil();\r
+        }\r
+        if (vibrateUtil == null) {\r
+            vibrateUtil = new VibrateUtil();\r
+        }\r
         return vibrateUtil;\r
     }\r
 \r
@@ -39,24 +58,14 @@ public class VibrateUtil {
     }\r
 \r
     public void vibrateOnForBattery() {\r
+        ICLogger.d("vibrateOnForBattery...");\r
         //不断地震动,并且监听屏幕变化,当屏幕开,或者关的时候,停止震动,取消监听\r
-        //设置监听\r
-        IntentFilter intentFilter = new IntentFilter();\r
-        intentFilter.addAction(Intent.ACTION_SCREEN_ON);\r
-        intentFilter.addAction(Intent.ACTION_SCREEN_OFF);\r
-        mContext.registerReceiver(broadcastReceiver, intentFilter);\r
-        vibrator.vibrate(1000 * 60 * 60);//不循环\r
+        long[] pattern = {0, 1000};\r
+        vibrator.vibrate(pattern, 0);\r
     }\r
 \r
-    private final BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {\r
-        @Override\r
-        public void onReceive(Context context, Intent intent) {\r
-            vibrator.cancel();\r
-            mContext.unregisterReceiver(this);\r
-        }\r
-    };\r
-\r
     public void vibrateOn(boolean on) {\r
+        ICLogger.d("vibrateOn==> " + on);\r
         if (vibrator != null) {\r
             if (on)\r
                 vibrator.vibrate(1000);//不循环\r
index eafee89..009e63c 100644 (file)
@@ -484,8 +484,10 @@ public class protocol_beehome {
         // 460,0,9520,3671,
         // 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#
 //        IWAP01191230A2232.9807N11404.9355E000.1161320000.0006000910000000,460,00,9520,3671,#
-        return genStringMessage(cmdMap.get(CMD_TYPE.AP01), new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.AP01)).append(TimeUtil.getShortDate())
-                .append(ds.getGPSData()).append(TimeUtil.getShortTime()).append(ds.getGPSHeading()).append(String.format("%03d", abs(ds.getSignalStrength())))
+        return genStringMessage(cmdMap.get(CMD_TYPE.AP01),
+                new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.AP01)).append(TimeUtil.getShortDate())
+                .append(ds.getGPSData())
+                        .append(TimeUtil.getShortTime()).append(ds.getGPSHeading()).append(String.format("%03d", abs(ds.getSignalStrength())))
                 .append(ds.getGPSLocationStarNums()).append(ds.getBattery()).append("0")
                 .append(ds.getProtection()).append(ds.getWorkModeStr()).append(CMDSPLIT)
                 .append(ds.getLBSData()).append(CMDSPLIT).append(ds.getWifiInfo()).append(CMDEND).toString());
index cc5d5b0..e2462cd 100644 (file)
@@ -1,2 +1,2 @@
-#Tue Oct 19 15:50:37 CST 2021\r
-VERSION_CODE=907\r
+#Wed Oct 20 10:57:06 CST 2021\r
+VERSION_CODE=914\r