AA协议解决手环开机未上报充电、佩戴、WIFI等状态
authork.liang <liangkang648253071@126.com>
Thu, 7 Oct 2021 09:20:04 +0000 (17:20 +0800)
committerk.liang <liangkang648253071@126.com>
Thu, 7 Oct 2021 09:20:04 +0000 (17:20 +0800)
app/src/main/java/com/enqualcomm/support/CoreService.java
app/src/main/java/com/enqualcomm/support/service/AntiMonitorService.java
app/src/main/java/com/ic/protocols/protocol_anan.java
app/version_code.properties

index b39577d..f55382c 100644 (file)
@@ -94,6 +94,7 @@ import static android.app.PendingIntent.FLAG_UPDATE_CURRENT;
 import static com.enqualcomm.support.Constants.ACTION_ALARM_ADD_DATAPOINTS;
 import static com.enqualcomm.support.Constants.ACTION_ALARM_ALARM_CHANGE;
 import static com.enqualcomm.support.Constants.ACTION_ALARM_BLE_SCAN;
+import static com.enqualcomm.support.Constants.ACTION_ANTI_OFF0;
 import static com.enqualcomm.support.Constants.ACTION_CHECK_ANTIOFF_EVENT;
 import static com.enqualcomm.support.Constants.ACTION_CHECK_CUTOFF_EVENT;
 import static com.enqualcomm.support.Constants.ACTION_EQC_ALARM;
@@ -107,6 +108,7 @@ import static com.enqualcomm.support.Constants.ALARM_POWER_OFF;
 import static com.enqualcomm.support.Constants.FROM_ALARM;
 import static com.enqualcomm.support.Constants.FROM_SERVER;
 import static com.enqualcomm.support.Constants.HEARTBEAT_ALARM;
+import static com.enqualcomm.support.Constants.KEY_ANTI_EVENT;
 import static com.enqualcomm.support.Constants.KEY_SAVE_STEP_COUNT;
 import static com.enqualcomm.support.Constants.KEY_STEP_COUNT;
 import static com.enqualcomm.support.Constants.STEP_COUNT_ALARM_ACTION;
@@ -447,6 +449,7 @@ public class CoreService extends Service {
                 //如果防走丢的协议的话
                 ICLogger.d("getFZDWeatherInfo ... ");
                 coreService.getFZDWeatherInfo();
+                coreService.sendAntiStatus();
             }, 30 * 1000);
 
         }
@@ -1871,6 +1874,19 @@ public class CoreService extends Service {
         //定时,3个小时获取一次天气
     }
 
+    public void sendAntiStatus(){
+        if(Config.custom_name.equals("AA")) {
+            Intent intent = new Intent();
+            if (antiService.getCurrentAntiStatus()) {
+                intent.setAction(ACTION_ANTI_OFF0);
+                intent.putExtra(KEY_ANTI_EVENT, 0);
+            }else {
+                intent.setAction(ACTION_ANTI_OFF0);
+                intent.putExtra(KEY_ANTI_EVENT, 1);
+            }
+            sendBroadcast(intent);
+        }
+    }
 
     private final IFZDService.Stub mFZDService = new IFZDService.Stub() {
         @Override
index 49fa204..3c842b2 100644 (file)
@@ -654,4 +654,19 @@ public class AntiMonitorService extends AbstractInvokeHandlerService
     public void onDetach(Connection paramConnection, Runtime paramRuntime) {
         mSensorManager.unregisterListener(mSensorEventListener);
     }
+
+    public boolean getCurrentAntiStatus() {
+        //current_anti_status == 2 表示表带 锁定 , ==12 表示表带非法解锁
+        //current_anti_status == 0 表示佩戴       ==10 表示脱腕
+        switch (current_anti_status) {
+            //佩戴
+            case STATUS_WEARED:
+                return true;
+            case STATUS_ANTI_OFF:
+                return false;
+            default:
+                break;
+        }
+        return false;
+    }
 }
index b4921e9..f2520f6 100644 (file)
@@ -198,10 +198,10 @@ public class protocol_anan {
 
             if (state == STATE_ANTI_OFF) {
                 //没有穿戴
-                APWA("0");
+                mConnection.send(APWA("0"));
             } else if (state == STATE_ANTI_ON) {
                 //已经穿戴了
-                APWA("1");
+                mConnection.send(APWA("1"));
             }
         }
     };
@@ -465,7 +465,6 @@ public class protocol_anan {
                         .append(CMDEND).toString());
     }
 
-
     //佩戴状态上传,这个监听到广播以后,去上传即可
     //1表示佩戴
     //0表示未佩戴
index f8884e0..708ef16 100644 (file)
@@ -1,2 +1,2 @@
-#Sun Oct 03 18:26:30 CST 2021\r
-VERSION_CODE=966\r
+#Thu Oct 07 17:14:34 CST 2021\r
+VERSION_CODE=972\r