From: snickersun Date: Wed, 8 Jan 2020 00:51:42 +0000 (+0800) Subject: update location X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=7196c7bfa33f63af7929107a5a527ae363698a90;p=icsupport.git update location --- diff --git a/.gradle/5.4.1/executionHistory/executionHistory.bin b/.gradle/5.4.1/executionHistory/executionHistory.bin index 4ce6dd44..dafd2011 100644 Binary files a/.gradle/5.4.1/executionHistory/executionHistory.bin and b/.gradle/5.4.1/executionHistory/executionHistory.bin differ diff --git a/.gradle/5.4.1/executionHistory/executionHistory.lock b/.gradle/5.4.1/executionHistory/executionHistory.lock index 93c34d8c..b35a9c5d 100644 Binary files a/.gradle/5.4.1/executionHistory/executionHistory.lock and b/.gradle/5.4.1/executionHistory/executionHistory.lock differ diff --git a/.gradle/5.4.1/fileHashes/fileHashes.bin b/.gradle/5.4.1/fileHashes/fileHashes.bin index 8fc3fdad..b9c16e04 100644 Binary files a/.gradle/5.4.1/fileHashes/fileHashes.bin and b/.gradle/5.4.1/fileHashes/fileHashes.bin differ diff --git a/.gradle/5.4.1/fileHashes/fileHashes.lock b/.gradle/5.4.1/fileHashes/fileHashes.lock index 5c88bef8..59e01421 100644 Binary files a/.gradle/5.4.1/fileHashes/fileHashes.lock and b/.gradle/5.4.1/fileHashes/fileHashes.lock differ diff --git a/.gradle/5.4.1/fileHashes/resourceHashesCache.bin b/.gradle/5.4.1/fileHashes/resourceHashesCache.bin index 4a918c3a..95890702 100644 Binary files a/.gradle/5.4.1/fileHashes/resourceHashesCache.bin and b/.gradle/5.4.1/fileHashes/resourceHashesCache.bin differ diff --git a/.gradle/5.4.1/javaCompile/classAnalysis.bin b/.gradle/5.4.1/javaCompile/classAnalysis.bin index 4d96557e..d5442d2a 100644 Binary files a/.gradle/5.4.1/javaCompile/classAnalysis.bin and b/.gradle/5.4.1/javaCompile/classAnalysis.bin differ diff --git a/.gradle/5.4.1/javaCompile/javaCompile.lock b/.gradle/5.4.1/javaCompile/javaCompile.lock index 173c6bc9..2ba95684 100644 Binary files a/.gradle/5.4.1/javaCompile/javaCompile.lock and b/.gradle/5.4.1/javaCompile/javaCompile.lock differ diff --git a/.gradle/5.4.1/javaCompile/taskHistory.bin b/.gradle/5.4.1/javaCompile/taskHistory.bin index 29689075..228a51ef 100644 Binary files a/.gradle/5.4.1/javaCompile/taskHistory.bin and b/.gradle/5.4.1/javaCompile/taskHistory.bin differ diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index da8a541b..d8b8b9b7 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin index 60bbd34d..e57da57b 100644 Binary files a/.gradle/buildOutputCleanup/outputFiles.bin and b/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 1b7e468c..e17750ad 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/.idea/caches/gradle_models.ser b/.idea/caches/gradle_models.ser index ea3b4314..424b0274 100644 Binary files a/.idea/caches/gradle_models.ser and b/.idea/caches/gradle_models.ser differ diff --git a/.idea/misc.xml b/.idea/misc.xml index 6fd9e2bb..6f32454d 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 587dbaf9..93d4eafd 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -10,8 +10,6 @@ - - @@ -27,24 +25,17 @@ - + + - - - - - - - - + - \ No newline at end of file diff --git a/app/app.iml b/app/app.iml index f9ea079a..95ac0dd5 100644 --- a/app/app.iml +++ b/app/app.iml @@ -103,8 +103,8 @@ - - + + diff --git a/app/debug/ICSer_V320_202001080850_debug.apk b/app/debug/ICSer_V320_202001080850_debug.apk new file mode 100644 index 00000000..ecea85ef Binary files /dev/null and b/app/debug/ICSer_V320_202001080850_debug.apk differ diff --git a/app/debug/output.json b/app/debug/output.json index adfa7cde..82a6f424 100644 --- a/app/debug/output.json +++ b/app/debug/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":113,"versionName":"202001080021","enabled":true,"outputFile":"ICSer_V113_202001080021_debug.apk","fullName":"debug","baseName":"debug"},"path":"ICSer_V113_202001080021_debug.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":320,"versionName":"202001080850","enabled":true,"outputFile":"ICSer_V320_202001080850_debug.apk","fullName":"debug","baseName":"debug"},"path":"ICSer_V320_202001080850_debug.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 381a5876..07c8168a 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -127,6 +127,9 @@ + + + diff --git a/app/src/main/java/com/ic/protocol/LocationClient.java b/app/src/main/java/com/ic/protocol/LocationClient.java index b4810ce6..c0fd7f9b 100644 --- a/app/src/main/java/com/ic/protocol/LocationClient.java +++ b/app/src/main/java/com/ic/protocol/LocationClient.java @@ -252,7 +252,7 @@ public class LocationClient { runtime.getLocationInstance().setCID(CellInfoUtil.getCELL_ID()); runtime.getLocationInstance().setMCC(String.valueOf(CellInfoUtil.getMCC())); runtime.getLocationInstance().setLAC(CellInfoUtil.getLAC()); - + runtime.preCellInfo = CellInfoUtil.getCellInfo(); sendBatteryNotification(); startGpsLocate(); } @@ -523,6 +523,7 @@ public class LocationClient { Logger.i("get wifi scan Callback " + param1String); LocationClient.mHasWifiResult=true; runtime.currentWifiInfo = param1String; + runtime.setWifiinfo(param1String); } }); @@ -555,9 +556,15 @@ public class LocationClient { boolean wifi_ok=false,gps_ok=false,lbs_ok=false; if (runtime.currentWifiInfo !=null )wifi_ok =true; if (runtime.getLocationInstance().getLocationStat() == ICLocation.LOCATION_STAT.LOCATION_FIXED) gps_ok=true; - lbs_ok=((runtime.getLocationInstance().getMNC()==null)?false:true); + lbs_ok=( runtime.getLocationInstance().isDataChanged()==false + ||(runtime.getLocationInstance().getMNC().equals("0") + && runtime.getLocationInstance().getMCC().equals("0") + && runtime.getLocationInstance().getGSMStationCID() ==0 + && runtime.getLocationInstance().getLAC()==0)) ?false:true; + Logger.i("getMNC "+runtime.getLocationInstance().getMNC()+" getMCC "+runtime.getLocationInstance().getMCC()+" getGSMStationCID " + runtime.getLocationInstance().getGSMStationCID()+ " getLAC "+runtime.getLocationInstance().getLAC()+" changed "+runtime.getLocationInstance().isDataChanged()); Logger.i("lbs_ok "+lbs_ok+" waitAndSendLocation wifi_ok " + wifi_ok+ " gps_ok "+gps_ok); - if (lbs_ok) { + if (lbs_ok ) { + Logger.i("offerQueue "+protocolAPIHelper.AP01(runtime)); ServiceUtil.offerQueue(protocolAPIHelper.genStringMessage("AP01", protocolAPIHelper.AP01(runtime))); } } @@ -776,10 +783,13 @@ public void updateCellInfo() { //循环发送queue 中的数据 StringMessage stringMessage = null; try { + Logger.i("Sending Thread Queue Take "); + StringMessage stringMessage1 = (StringMessage)LocationClient.queue.take(); try { if (runtime.getSignalStrength() + 110 < LocationClient.getMinSignalStrength(SimSignalUtil.getInstance((runtime.getContextProxy()).context).getNetworkType())) { + Logger.i("Skip Send for SignalStrengh "+(runtime.getSignalStrength() + 110 )+" < "+LocationClient.getMinSignalStrength(SimSignalUtil.getInstance((runtime.getContextProxy()).context).getNetworkType())); LocationClient.saveQueue(); stringMessage = stringMessage1; @@ -793,8 +803,8 @@ public void updateCellInfo() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("send="); stringBuilder.append(stringMessage.cmd()); - FileOutputUtil.fileOutput(context, "LocationInfo", stringBuilder.toString()); - + FileOutputUtil.fileOutput(context, "LocationInfo ", stringBuilder.toString()); + Logger.i(stringBuilder.toString()); connection.send(stringMessage); this.lock.lock(); @@ -803,19 +813,20 @@ public void updateCellInfo() { try { if (KeepAlive.isConnected) { //如果 服务器连接状态,等30秒 - this.condition.await(30000L, TimeUnit.MILLISECONDS); - } else if (stringMessage.all() != null && stringMessage.all()[0].equals("#@H10@#")) { - //如果 消息中有 ,等30秒 + Logger.i("KeepAlive.isConnected "+KeepAlive.isConnected+" delay 30000ms"); this.condition.await(30000L, TimeUnit.MILLISECONDS); } else { //如果服务器断开,等5秒重连 + Logger.i("KeepAlive.isConnected "+KeepAlive.isConnected+" delay 5000ms"); this.condition.await(5000L, TimeUnit.MILLISECONDS); } if (linkOK) { - if (stringMessage.all() != null && stringMessage.all()[0].equals("#@H43@#")) { + if (stringMessage.all() != null && stringMessage.all()[0].equals("AP01")) { this.isResent = false; + Logger.i("linkOK "+linkOK+ " AP01"); Deliver.releaseWakeLockForGetWifiList(); - } else if (stringMessage.all() != null && stringMessage.all()[0].equals("#@H42@#")) { + } else if (stringMessage.all() != null && stringMessage.all()[0].equals("AP02")) { + Logger.i("linkOK "+linkOK+" AP02"); Deliver.releaseWakeLockForGetWifiList(); } // if (LocationClient.queue.peek() == null) diff --git a/app/src/main/java/com/ic/protocol/bean/ICLocation.java b/app/src/main/java/com/ic/protocol/bean/ICLocation.java index 5836a7b6..2b75dd4f 100644 --- a/app/src/main/java/com/ic/protocol/bean/ICLocation.java +++ b/app/src/main/java/com/ic/protocol/bean/ICLocation.java @@ -90,14 +90,16 @@ public class ICLocation { // CID,Cell Identity,基站编号,是个16位的数据(范围是0到65535)。 - private String MCC; - private String MNC; - private int LAC; - private int CID; - public void setMCC(String mcc){ MCC=mcc;} - public void setMNC(String mnc){MNC = mnc;} - public void setLAC(int lac){LAC=lac;} - public void setCID(int cid) { CID=cid;} + private String MCC="0"; + private String MNC="0"; + private int LAC=0; + private int CID=0; + private boolean datachanged=false; + public void setMCC(String mcc){ MCC=mcc;datachanged=true;} + public void setMNC(String mnc){MNC = mnc;datachanged=true;} + public void setLAC(int lac){LAC=lac;datachanged=true;} + public void setCID(int cid) { CID=cid;datachanged=true;} + public boolean isDataChanged(){return datachanged;} public String getMCC(){ return MCC; } diff --git a/app/src/main/java/com/ic/protocol/service/Deliver.java b/app/src/main/java/com/ic/protocol/service/Deliver.java index 44ac2982..11800ef0 100644 --- a/app/src/main/java/com/ic/protocol/service/Deliver.java +++ b/app/src/main/java/com/ic/protocol/service/Deliver.java @@ -74,7 +74,7 @@ public class Deliver extends AbstractConnectionService { } public static PowerManager.WakeLock WakeLockForGetWifiList(Runtime paramRuntime) { - PowerManager.WakeLock wakeLock = ((PowerManager)(paramRuntime.getContextProxy()).context.getSystemService(Context.POWER_SERVICE)).newWakeLock(1, "waitForWifiListReply"); + PowerManager.WakeLock wakeLock = ((PowerManager)(paramRuntime.getContextProxy()).context.getSystemService(Context.POWER_SERVICE)).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "waitForWifiListReply"); wakeLock.acquire(120000L); return wakeLock; } @@ -93,7 +93,7 @@ public class Deliver extends AbstractConnectionService { } public PowerManager.WakeLock getWakeLock() { - PowerManager.WakeLock wakeLock = ((PowerManager)(this.mRuntime.getContextProxy()).context.getSystemService(Context.POWER_SERVICE)).newWakeLock(1, "ReceiveWakelockTag"); + PowerManager.WakeLock wakeLock = ((PowerManager)(this.mRuntime.getContextProxy()).context.getSystemService(Context.POWER_SERVICE)).newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "ReceiveWakelockTag"); wakeLock.acquire(40000L); return wakeLock; } diff --git a/app/src/main/java/com/ic/protocol/service/KeepAlive.java b/app/src/main/java/com/ic/protocol/service/KeepAlive.java index 5e65814a..e834f64f 100644 --- a/app/src/main/java/com/ic/protocol/service/KeepAlive.java +++ b/app/src/main/java/com/ic/protocol/service/KeepAlive.java @@ -258,7 +258,8 @@ public class KeepAlive extends AbstractConnectionService { Logger.i(stringBuilder.toString()); // if (!connectionError) { connectionError = false; - ServiceUtil.offerQueue(protocolAPIHelper.genStringMessage("heart",protocolAPIHelper.AP03(paramRuntime)), true); + paramConnection.send(protocolAPIHelper.genStringMessage("AP00",protocolAPIHelper.AP00(paramRuntime))); + paramConnection.send(protocolAPIHelper.genStringMessage("heart",protocolAPIHelper.AP03(paramRuntime))); // if (Deliver.haveSendH42) { // ServiceUtil.offerQueue(new StringMessage(protocolAPIHelper.AP03(paramRuntime))); // Deliver.haveSendH42 = false; @@ -283,8 +284,9 @@ public class KeepAlive extends AbstractConnectionService { Logger.i("onHeartAlarm"); // UpdateHeartBeatTimeout(); // if (this.reCycleTimes == 0 && this.currentReConnectInterval != 11){ - ServiceUtil.offerQueue(protocolAPIHelper.genStringMessage("heart",protocolAPIHelper.AP03(paramRuntime)), true); -// } + paramNettyConnection.send(protocolAPIHelper.genStringMessage("AP00",protocolAPIHelper.AP00(paramRuntime))); + paramNettyConnection.send(protocolAPIHelper.genStringMessage("heart",protocolAPIHelper.AP03(paramRuntime))); + // } } diff --git a/app/src/main/java/com/ic/protocol/service/protocolMainServer.java b/app/src/main/java/com/ic/protocol/service/protocolMainServer.java index 105020d3..8a4e92fe 100644 --- a/app/src/main/java/com/ic/protocol/service/protocolMainServer.java +++ b/app/src/main/java/com/ic/protocol/service/protocolMainServer.java @@ -437,8 +437,9 @@ public class protocolMainServer extends Service { } AlarmWakeUp.setAlarmWakeUpTime(); boolean screenon = ((PowerManager)getSystemService(POWER_SERVICE)).isScreenOn(); - if (!screenon) + if (!screenon) { send_at_to_update_lbs(); + } if (Util.isConnectWifi((this.runtime.getContextProxy()).context) && !screenon) { is_wifi_network_ok = true; Util.turnOffWifiForSleep((this.runtime.getContextProxy()).context, this.runtime); @@ -484,7 +485,7 @@ public class protocolMainServer extends Service { wakeUpFromSleep(); } is_allowed_in_sleep_mode = 1; - setWakeAlarm(); +// setWakeAlarm(); return Service.START_STICKY; } if (HEART_ALARM.equals(paramIntent.getAction())) { @@ -563,6 +564,7 @@ public class protocolMainServer extends Service { intent.putExtra("command", "AT+CREG=2"); intent.putExtra("arg2", ""); (this.runtime.getContextProxy()).context.sendBroadcast(intent); + Logger.i("send_at_to_update_lbs "); } //每一分钟设置一次 diff --git a/app/src/main/java/com/ic/protocol/utils/CellInfoUtil.java b/app/src/main/java/com/ic/protocol/utils/CellInfoUtil.java index c1d83741..b1019c3a 100644 --- a/app/src/main/java/com/ic/protocol/utils/CellInfoUtil.java +++ b/app/src/main/java/com/ic/protocol/utils/CellInfoUtil.java @@ -29,7 +29,8 @@ public class CellInfoUtil { public static boolean getCellInfoOver = false; private static String mCellInfo; - + + public static String getCellInfo(){return mCellInfo;} public static Handler mHandler = new Handler() { public void handleMessage(Message param1Message) { super.handleMessage(param1Message); diff --git a/app/src/main/java/com/ic/protocol/utils/NettyConnection.java b/app/src/main/java/com/ic/protocol/utils/NettyConnection.java index c2dea88c..8a2b0379 100644 --- a/app/src/main/java/com/ic/protocol/utils/NettyConnection.java +++ b/app/src/main/java/com/ic/protocol/utils/NettyConnection.java @@ -102,7 +102,7 @@ public class NettyConnection implements Connection ,RxSocket.SocketConnectionLis return; realtime_old = l; Logger.i("connect1 "+host+":"+port); -// disconnect(); + disconnect(); this.executorService.execute(new Runnable() { public void run() { NettyConnection.this.connectImpl(host, port); diff --git a/app/version_code.properties b/app/version_code.properties index 07f202d3..f7461f5e 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1 @@ -#Tue Jan 07 10:15:46 CST 2020 -VERSION_CODE=113 +VERSION_CODE=320 diff --git a/local.properties b/local.properties index 44f6d2d3..1b956e06 100644 --- a/local.properties +++ b/local.properties @@ -4,5 +4,5 @@ # Location of the SDK. This is only used by Gradle. # For customization when using a Version Control System, please read the # header note. -#Tue Jan 07 16:17:26 CST 2020 -sdk.dir=C\:\\Users\\incar\\AppData\\Local\\Android\\Sdk +#Wed Jan 08 01:09:59 CST 2020 +sdk.dir=C\:\\Users\\Admin\\AppData\\Local\\Android\\Sdk