From: snickersun Date: Fri, 16 Oct 2020 10:13:25 +0000 (+0800) Subject: release V661 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=5f662c3eb8bf223922829748df16839cab4f42ef;p=protocol_srv.git release V661 1、解决5分钟定位时,一直无法上报ud的问题(属于心跳的5分钟检测和定位的5分钟冲突问题) 2、去掉Deliver缓存3次发送会丢弃数据的逻辑,保存数据直到数据发送完毕。如果buffer满,目前的逻辑是丢弃新的数据包。 --- diff --git a/app/release/ICSer_V660_2010152053_release.apk b/app/release/ICSer_V661_2010161805_release.apk similarity index 78% rename from app/release/ICSer_V660_2010152053_release.apk rename to app/release/ICSer_V661_2010161805_release.apk index 46c2467e..65a6a8b6 100644 Binary files a/app/release/ICSer_V660_2010152053_release.apk and b/app/release/ICSer_V661_2010161805_release.apk differ diff --git a/app/release/output.json b/app/release/output.json index 90d083cd..53821ec3 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":660,"versionName":"2010152053","enabled":true,"outputFile":"ICSer_V660_2010152053_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V660_2010152053_release.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":661,"versionName":"2010161805","enabled":true,"outputFile":"ICSer_V661_2010161805_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V661_2010161805_release.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/java/com/enqualcomm/support/CoreService.java b/app/src/main/java/com/enqualcomm/support/CoreService.java index 65863d09..505db868 100644 --- a/app/src/main/java/com/enqualcomm/support/CoreService.java +++ b/app/src/main/java/com/enqualcomm/support/CoreService.java @@ -204,6 +204,7 @@ public class CoreService extends Service { } runtime.setAlarmType(Runtime.AlarmType.ALARM_SOS); //trigger AP10 报警定位 + ICLogger.i("triggerSOSLocationProcess "); LocationClient.getInstance().triggerSOSLocationProcess(); // Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime)); @@ -936,6 +937,7 @@ public class CoreService extends Service { if(Config.isAlarmTypeEnabled(Runtime.AlarmType.ALARM_SEDENTARY)){ runtime.setAlarmType(Runtime.AlarmType.ALARM_SEDENTARY); // Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime)); + ICLogger.i("triggerSOSLocationProcess "); locationClient.triggerSOSLocationProcess(); } }else{ @@ -1148,6 +1150,7 @@ public class CoreService extends Service { if (this.mKeepAlive != null) { if (connection.isServerConnected() && runtime.isServerProtocolConnected()) { this.mKeepAlive.onHeartAlarm(this.connection, this.runtime); + ICLogger.i("triggerBLEProcess "); locationClient.triggerBLEProcess();//每次心跳检测一次BLE } else { // if (this.mKeepAlive.is_retry_time_above_limit()) { @@ -1265,6 +1268,7 @@ public class CoreService extends Service { // ICLogger.i("自由锻炼中,跳过原有的循环定位!"); // return; // } + ICLogger.i("triggerLocationProcess "); locationClient.triggerLocationProcess(); } diff --git a/app/src/main/java/com/enqualcomm/support/ICSmsManager.java b/app/src/main/java/com/enqualcomm/support/ICSmsManager.java index 842094c0..6c6c2c1d 100644 --- a/app/src/main/java/com/enqualcomm/support/ICSmsManager.java +++ b/app/src/main/java/com/enqualcomm/support/ICSmsManager.java @@ -867,6 +867,7 @@ public class ICSmsManager extends BroadcastReceiver { LocationClient locationClient=LocationClient.getInstance(); if (locationClient!=null){ locationClient.setLocationResponse(replayLocation); + ICLogger.i("triggerLocationProcess "); locationClient.triggerLocationProcess(); } }else if (sms.startsWith(ENCRYPED_HEADER+"#setLogSrv#=")&& sms.endsWith("#")) { @@ -955,6 +956,7 @@ public class ICSmsManager extends BroadcastReceiver { sendSMS(phonenumber, "set noLocationCycle false! and trigger one Location"); LocationClient locationClient=LocationClient.getInstance(); if (locationClient!=null){ + ICLogger.i("triggerLocationProcess "); locationClient.triggerLocationProcess(); } }else if (strtmp.equalsIgnoreCase("true")){ diff --git a/app/src/main/java/com/enqualcomm/support/LocationClient.java b/app/src/main/java/com/enqualcomm/support/LocationClient.java index 2ef3f78b..2757e71f 100644 --- a/app/src/main/java/com/enqualcomm/support/LocationClient.java +++ b/app/src/main/java/com/enqualcomm/support/LocationClient.java @@ -143,7 +143,13 @@ public class LocationClient { public void OnScanFinished(ArrayList btPairedScanResult, ArrayList btNewScanResult) { if (btNewScanResult!=null && btNewScanResult.size() > 0) { - ICLogger.i("found bt mac " + btNewScanResult.size() + " btMacList " + runtime.bleInfo.btMacList.size()); + StringBuilder sb=new StringBuilder(); + sb.append("found bt mac ").append(btNewScanResult.size() ); + sb.append(" bounding BeaconMacList ").append(runtime.bleInfo.btMacList.size() ); + for(String mac:runtime.bleInfo.btMacList){ + sb.append(" ").append(mac); + } + ICLogger.i( sb.toString() ); boolean in_area = false; try { for (String mac : btNewScanResult) { @@ -188,11 +194,8 @@ public class LocationClient { //只有上一次在区域内,这次出区域才需要报警 ICLogger.i("BT 不在区域内,且上次在区域内,报警!"); //如果需要报警定位,则强制进行sos定位,不能通过triggerSOS,因为函数中调用了BLEScan会造成循环调用 - StringMessage AL_CMD = protocolAPIHelper.getWarningMSG(runtime); DeliverMessage(AL_CMD); - - } }else{ ICLogger.i("BT 在区域内!"); @@ -232,8 +235,10 @@ public class LocationClient { DeliverMessage(AP01_CMD); startSOSLocation=false; }else { - StringMessage AP01_CMD = protocolAPIHelper.getGPSLocationMSG(runtime); - DeliverMessage(AP01_CMD); + //已经通过蓝牙定位,则清除 forceLocation=0 + forceLocation=0; + StringMessage AP01_CMD = protocolAPIHelper.getGPSLocationMSG(runtime); + DeliverMessage(AP01_CMD); } } } @@ -321,11 +326,6 @@ public class LocationClient { public void triggerSOSLocationProcess(){ - - - - - mhandler.sendEmptyMessage(msgWhat_StartSOSLocationProcess); } @@ -426,9 +426,14 @@ public class LocationClient { }); }else if (msg.what == msgWhat_StartLocationProcess) { if (runtime.bleInfo.btMacList.size() > 0) { - //有蓝牙搜索要求则 先进行蓝牙扫描 - if (needLocationForBT()) - btHelper.scanBLE(); + if(scanBLEOnly && btHelper.isBtscanning()){ + //如果正在进行独立蓝牙扫描,则强制切换为正常扫描。 + scanBLEOnly=false; + }else { + //有蓝牙搜索要求则 先进行蓝牙扫描 + if (needLocationForBT()) + btHelper.scanBLE(); + } } else { //没有蓝牙搜索要求,就正常定位 startLocationProcess(runtime.getLocationInstance().getWorkingMod()); @@ -436,10 +441,13 @@ public class LocationClient { }else if (msg.what == msgWhat_StartBLEProcess){ if (runtime.bleInfo.btMacList.size() > 0) { //有蓝牙搜索要求则 先进行蓝牙扫描 - scanBLEOnly=true; - - if (needLocationForBT()) - btHelper.scanBLE(); + if (! btHelper.isBtscanning()) { + scanBLEOnly = true; + if (needLocationForBT()) + btHelper.scanBLE(); + }else{ + ICLogger.i("BT Scanning skip ScanBLE only!"); + } } }else if (msg.what == msgWhat_StartSOSLocationProcess){ @@ -449,11 +457,17 @@ public class LocationClient { CellInfoUtil.getCellInfo(runtime.getContextProxy().getTelephonyManager(),runtime); if (runtime.bleInfo.btMacList.size() > 0) { - //有蓝牙搜索要求则 先进行蓝牙扫描 - startSOSLocation=true;//启动SOS定位,为了快速响应,只要wifi定位即可。 - forceLocation=1; - if (needLocationForBT()) - btHelper.scanBLE(); + if(scanBLEOnly && btHelper.isBtscanning()) + { + //如果正在进行独立蓝牙扫描,则强制切换为正常扫描。 + scanBLEOnly = false; + }else { + //有蓝牙搜索要求则 先进行蓝牙扫描 + startSOSLocation = true;//启动SOS定位,为了快速响应,只要wifi定位即可。 + forceLocation = 1; + if (needLocationForBT()) + btHelper.scanBLE(); + } } else { try{ Thread.sleep(1000); @@ -823,6 +837,7 @@ public void updateCellInfo() { ICLogger.i("No Move ,skip BT location!"); return false; } + ICLogger.i("BT NoMoveTimeout "+NoMoveTimeout+", forceLocation="+forceLocation+", Config.forceMoveCheck="+Config.forceMoveCheck+", skipMoveCheck="+skipMoveCheck); return true; } public void startLocationProcess(int mod){ @@ -1026,6 +1041,7 @@ public void updateCellInfo() { runtime.setAlarmType(Runtime.AlarmType.ALARM_LOWBATTERY); //trigger AP10 报警低电 // connection.send(protocolAPIHelper.getWarningMSG(runtime)); + ICLogger.i("triggerSOSLocationProcess "); LocationClient.getInstance().triggerSOSLocationProcess(); } diff --git a/app/src/main/java/com/enqualcomm/support/adapter/BTHelper.java b/app/src/main/java/com/enqualcomm/support/adapter/BTHelper.java index af923d78..eb8146cc 100644 --- a/app/src/main/java/com/enqualcomm/support/adapter/BTHelper.java +++ b/app/src/main/java/com/enqualcomm/support/adapter/BTHelper.java @@ -159,6 +159,9 @@ public class BTHelper { // // } + public boolean isBtscanning(){ + return btscanning; + } //开始扫描BLE public void scanBLE() { ICLogger.i( "BT doDiscovery()"); diff --git a/app/src/main/java/com/enqualcomm/support/service/AntiMonitorService.java b/app/src/main/java/com/enqualcomm/support/service/AntiMonitorService.java index 5595cbbc..d70d0316 100644 --- a/app/src/main/java/com/enqualcomm/support/service/AntiMonitorService.java +++ b/app/src/main/java/com/enqualcomm/support/service/AntiMonitorService.java @@ -103,6 +103,7 @@ public class AntiMonitorService extends AbstractInvokeHandlerService { if(mRuntime.setAlarmType(Runtime.AlarmType.ALARM_LOCK_WATCH)) { // StringMessage msg = protocolAPIHelper.getWarningMSG(mRuntime); // Deliver.sendLocationMSG(msg); //消息很重要,所以利用带buffer的对列来发送! + ICLogger.i("triggerSOSLocationProcess "); LocationClient.getInstance().triggerSOSLocationProcess(); } @@ -122,6 +123,7 @@ public class AntiMonitorService extends AbstractInvokeHandlerService { } mRuntime.Cut_off_flag=1; if(mRuntime.setAlarmType(Runtime.AlarmType.ALARM_CUTOFF)) { + ICLogger.i("triggerSOSLocationProcess "); LocationClient.getInstance().triggerSOSLocationProcess(); // StringMessage msg = protocolAPIHelper.getWarningMSG(mRuntime); // Deliver.sendLocationMSG(msg); //消息很重要,所以利用带buffer的对列来发送! @@ -142,6 +144,7 @@ public class AntiMonitorService extends AbstractInvokeHandlerService { } mRuntime.Anti_off_flag = 0; if(mRuntime.setAlarmType(Runtime.AlarmType.ALARM_WEARED)) { + ICLogger.i("triggerSOSLocationProcess "); LocationClient.getInstance().triggerSOSLocationProcess(); // StringMessage msg = protocolAPIHelper.getWarningMSG(mRuntime); // Deliver.sendLocationMSG(msg); //消息很重要,所以利用带buffer的对列来发送! @@ -162,6 +165,7 @@ public class AntiMonitorService extends AbstractInvokeHandlerService { } mRuntime.Anti_off_flag=1; if(mRuntime.setAlarmType(Runtime.AlarmType.ALARM_ANTIOFF)) { + ICLogger.i("triggerSOSLocationProcess "); LocationClient.getInstance().triggerSOSLocationProcess(); // StringMessage msg = protocolAPIHelper.getWarningMSG(mRuntime); // Deliver.sendLocationMSG(msg); //消息很重要,所以利用带buffer的对列来发送! diff --git a/app/src/main/java/com/enqualcomm/support/service/Deliver.java b/app/src/main/java/com/enqualcomm/support/service/Deliver.java index 40981b04..e97f9d78 100644 --- a/app/src/main/java/com/enqualcomm/support/service/Deliver.java +++ b/app/src/main/java/com/enqualcomm/support/service/Deliver.java @@ -178,7 +178,8 @@ public class Deliver extends AbstractConnectionService { //如果需要,且没有服务器反馈 if (NeedCheckServerResponse==true && ServerResponsed==false){ //刚刚发送的包不为空,且检测次数小于3,则保留数据,进行下一次重试。 - if (needCheckResponseCMD!=null && CheckCount < 3) { +// if (needCheckResponseCMD!=null && CheckCount < 3) { + if (needCheckResponseCMD!=null ) { //一直检测 是否服务器收到。 //如果cmd有效,且尝试次数小于3, 没有收到反馈的情况下,可以重新插入queue进行下一次尝试! ICLogger.i("checkSrvResponse "+CheckCount+" times for "+needCheckResponseCMD.cmd()+ " "+needCheckResponseCMD.isFromCache()); if (!ServiceUtil.offerQueue(needCheckResponseCMD, true)) { diff --git a/app/src/main/java/com/enqualcomm/support/service/HeartRateManager.java b/app/src/main/java/com/enqualcomm/support/service/HeartRateManager.java index a691ef95..0a28a4cd 100644 --- a/app/src/main/java/com/enqualcomm/support/service/HeartRateManager.java +++ b/app/src/main/java/com/enqualcomm/support/service/HeartRateManager.java @@ -64,6 +64,7 @@ public class HeartRateManager extends AbstractInvokeHandlerService implements Se if(runtime.setAlarmType(Runtime.AlarmType.ALARM_HEART_RATE_HIGH)) { //trigger AP10 报警定位 // Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime)); + ICLogger.i("triggerSOSLocationProcess "); LocationClient.getInstance().triggerSOSLocationProcess(); } @@ -71,6 +72,7 @@ public class HeartRateManager extends AbstractInvokeHandlerService implements Se if( runtime.setAlarmType(Runtime.AlarmType.ALARM_HEART_RATE_LOW)) { //trigger AP10 报警定位 // Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime)); + ICLogger.i("triggerSOSLocationProcess "); LocationClient.getInstance().triggerSOSLocationProcess(); } } @@ -80,6 +82,7 @@ public class HeartRateManager extends AbstractInvokeHandlerService implements Se if(runtime.setAlarmType(Runtime.AlarmType.ALARM_BPH_HIGH)) { //trigger AP10 报警定位 + ICLogger.i("triggerSOSLocationProcess "); LocationClient.getInstance().triggerSOSLocationProcess(); // Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime)); } @@ -87,6 +90,7 @@ public class HeartRateManager extends AbstractInvokeHandlerService implements Se }else if ( runtime.getHRS().bph_threshold_min>0 && runtime.getHRS().getBPH()0 && runtime.getHRS().getBPL() 15% , 上次电池并且不是 电池低电状态,则报警 @@ -169,6 +170,7 @@ public class BatteryUtil { runtime.setAlarmType(Runtime.AlarmType.ALARM_LOWBATTERY); //trigger AP10 报警定位 // Deliver.sendLocationMSG( protocolAPIHelper.getWarningMSG(runtime)); + ICLogger.i("triggerSOSLocationProcess "); LocationClient.getInstance().triggerSOSLocationProcess(); } } diff --git a/app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java b/app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java index 7cad5e9e..6fa10836 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java @@ -125,6 +125,7 @@ public class TemperatureUtil { case 1: if(runtime.setAlarmType(Runtime.AlarmType.ALARM_TEMP_HIGH)) { //trigger AP10 报警定位 + ICLogger.i("triggerSOSLocationProcess "); LocationClient.getInstance().triggerSOSLocationProcess(); // Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime)); } @@ -132,6 +133,7 @@ public class TemperatureUtil { case 2: if(runtime.setAlarmType(Runtime.AlarmType.ALARM_TEMP_LOW)) { //trigger AP10 报警定位 + ICLogger.i("triggerSOSLocationProcess "); LocationClient.getInstance().triggerSOSLocationProcess(); // Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(runtime)); } diff --git a/app/version_code.properties b/app/version_code.properties index 85837ea3..5f4591c6 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Thu Oct 15 20:53:54 CST 2020 -VERSION_CODE=660 +#Fri Oct 16 18:05:48 CST 2020 +VERSION_CODE=661