From: SnickerSun Date: Sun, 3 Oct 2021 10:28:32 +0000 (+0800) Subject: protocolV2 V966 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=41efffb1adc5448041cec362bda56a9c09ed4eed;p=icsupport.git protocolV2 V966 体温检测增加2秒钟测量结果延时上传,过滤掉无用的重复上传数据。 --- diff --git a/app/release/ICSer_V965_2109291733_release.apk b/app/release/ICSer_V966_2110031826_release.apk similarity index 78% rename from app/release/ICSer_V965_2109291733_release.apk rename to app/release/ICSer_V966_2110031826_release.apk index 8452f639..327ceaee 100644 Binary files a/app/release/ICSer_V965_2109291733_release.apk and b/app/release/ICSer_V966_2110031826_release.apk differ diff --git a/app/release/output.json b/app/release/output.json index d1448fc2..3cf56cb2 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":965,"versionName":"2109291733","enabled":true,"outputFile":"ICSer_V965_2109291733_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V965_2109291733_release.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":966,"versionName":"2110031826","enabled":true,"outputFile":"ICSer_V966_2110031826_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V966_2110031826_release.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/java/com/enqualcomm/support/Config.java b/app/src/main/java/com/enqualcomm/support/Config.java index 380b305b..8af9d913 100644 --- a/app/src/main/java/com/enqualcomm/support/Config.java +++ b/app/src/main/java/com/enqualcomm/support/Config.java @@ -63,6 +63,8 @@ public class Config { public static String DefaultWiFiPWD = "87654321"; public static String DefaultWiFiEncryptType = "psk"; + public static final int TemperatureTestResultSendTimeOut = 2; // 温度测试结果发送超时2秒 ,两秒内更新不发送,超过两秒不更新才发送 + public static final int GPSLocationTimeoutInSeconds = 50; public static final int WiFiLocationTimeoutInSeconds = 12; diff --git a/app/src/main/java/com/enqualcomm/support/Constants.java b/app/src/main/java/com/enqualcomm/support/Constants.java index 3a835792..ff6634e7 100644 --- a/app/src/main/java/com/enqualcomm/support/Constants.java +++ b/app/src/main/java/com/enqualcomm/support/Constants.java @@ -103,7 +103,7 @@ public interface Constants { String ACTION_CHECK_SERVER_RESPONSE = "com.enqualcomm.support.ACTION_CHECK_SERVER_RESPONSE"; String ACTION_RETRY_SERVER_CONNECT = "com.enqualcomm.support.ACTION_RETRY_SERVER_CONNECT"; String ACTION_CHECK_LOCATION_RESULT = "com.enqualcomm.support.ACTION_CHECK_LOCATION_RESULT"; - + String ACTION_TEMP_RESULT_SEND_TIMEOUT = "com.enqualcomm.support.ACTION_TEMP_RESULT_SEND_TIMEOUT"; String ACTION_MESSAGE_SENT = "com.ic.action.message_sent"; String ACTION_MESSAGE_RECEIVED = "com.ic.action.message_received"; diff --git a/app/src/main/java/com/enqualcomm/support/CoreService.java b/app/src/main/java/com/enqualcomm/support/CoreService.java index b9541627..b39577d7 100644 --- a/app/src/main/java/com/enqualcomm/support/CoreService.java +++ b/app/src/main/java/com/enqualcomm/support/CoreService.java @@ -1488,6 +1488,8 @@ public class CoreService extends Service { Util.shutdown(); } }, 1000); + }else if (Constants.ACTION_TEMP_RESULT_SEND_TIMEOUT.equals(paramIntent.getAction())){ + TemperatureUtil.getInstance().sendTempResult(); } this.invokeHandlerServiceChain.processUserRequest(paramIntent, this.connection, this.runtime); diff --git a/app/src/main/java/com/enqualcomm/support/bean/ICLocation.java b/app/src/main/java/com/enqualcomm/support/bean/ICLocation.java index b77cf970..78127c13 100644 --- a/app/src/main/java/com/enqualcomm/support/bean/ICLocation.java +++ b/app/src/main/java/com/enqualcomm/support/bean/ICLocation.java @@ -84,6 +84,7 @@ public class ICLocation { LOCATION_GPS_TIEMOUT, LOCATION_WIFI_FAILED, LOCATION_CLOSED, + LOCATION_UNKNOWN, } @@ -283,25 +284,46 @@ public class ICLocation { private int rxlevel = 0; private boolean datachanged = false; + private String lastMCC="0"; + private String lastMNC = "0"; + private int lastLAC = 0; + private int lastCID = 0; + + public void save_last_MCC_MNC_LAC_CID(){ + lastMCC=MCC; + lastMNC=MNC; + lastLAC=LAC; + lastCID=CID; + datachanged = false; + } public void setMCC(String mcc) { - MCC = mcc; - datachanged = true; + if (!mcc.equals(lastMCC)) { + MCC = mcc; + datachanged = true; + } } public void setMNC(String mnc) { - ICLogger.d("MNC==> " + mnc); - MNC = mnc; - datachanged = true; + if(!mnc.equals(lastMNC)) { + ICLogger.d("MNC==> " + mnc); + MNC = mnc; + datachanged = true; + } } public void setLAC(int lac) { - LAC = lac; - datachanged = true; + if(lac!=lastLAC) { + ICLogger.d("LAC==> " + lac); + LAC = lac; + datachanged = true; + } } public void setCID(int cid) { - CID = cid; - datachanged = true; + if(cid!=lastCID) { + CID = cid; + datachanged = true; + } } public void setRxlevel(int level) { diff --git a/app/src/main/java/com/enqualcomm/support/service/AudioService.java b/app/src/main/java/com/enqualcomm/support/service/AudioService.java index ee11e51d..0a5cacfa 100644 --- a/app/src/main/java/com/enqualcomm/support/service/AudioService.java +++ b/app/src/main/java/com/enqualcomm/support/service/AudioService.java @@ -120,18 +120,19 @@ public class AudioService implements MediaPlayer.OnErrorListener, MediaPlayer.On public void startRecord(String FileName) { - if (mRecorder == null) - mRecorder = new MediaRecorder(); - mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); - mRecorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB); - mRecorder.setOutputFile(FileName); - mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); try { + if (mRecorder == null) + mRecorder = new MediaRecorder(); + mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); + mRecorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB); + mRecorder.setOutputFile(FileName); + mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); + mRecorder.prepare(); + mRecorder.start(); } catch (IOException e) { ICLogger.e("prepare() failed"); } - mRecorder.start(); } public void stopRecord() { diff --git a/app/src/main/java/com/enqualcomm/support/utils/CellInfoUtil.java b/app/src/main/java/com/enqualcomm/support/utils/CellInfoUtil.java index e725ef8b..6c5cb8df 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/CellInfoUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/CellInfoUtil.java @@ -110,7 +110,7 @@ public class CellInfoUtil { try { CellLocation celllocation = tm.getCellLocation(); if (celllocation == null) { - ICLogger.i("cellLocation = null"); + ICLogger.i("no signal, cellLocation = null"); return 1; } else { if (celllocation instanceof GsmCellLocation) { @@ -162,6 +162,7 @@ public class CellInfoUtil { * CID,Cell Identity,基站编号。 * BSSS,Base station signal strength,基站信号强度。 */ + runtime.getLocationInstance().save_last_MCC_MNC_LAC_CID(); int maxstationCount = 0; String mccmnc; if (Build.VERSION.SDK_INT > 23) { 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 748fb16f..00af4455 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/TemperatureUtil.java @@ -22,6 +22,7 @@ import com.enqualcomm.support.provider.ICGlobalSettingsProvider; import com.enqualcomm.support.provider.ICNotificationProvider; import com.enqualcomm.support.provider.WarningItemProvider; import com.enqualcomm.support.service.Deliver; +import com.ic.jni.ICJniUtils; import com.ic.protocols.protocolAPIHelper; import com.ic.work.ITempSensorCallback; import com.ic.work.ITempSensorService; @@ -74,6 +75,15 @@ public class TemperatureUtil { } }; + private static Temperature CurrentTemperature=null; + public void trigger_timer_send(Context context){ + ICLogger.d("trigger_timer_send "+Config.TemperatureTestResultSendTimeOut+" "+Constants.ACTION_TEMP_RESULT_SEND_TIMEOUT); + AlarmHelper.setRealTimeAlarmInSeconds(context,Config.TemperatureTestResultSendTimeOut,Constants.ACTION_TEMP_RESULT_SEND_TIMEOUT); + } + public void sendTempResult(){ + //处理结果 + handleTemperature(CurrentTemperature); + } private final ITempSensorCallback.Stub mRemoteCallback = new ITempSensorCallback.Stub() { @Override @@ -84,8 +94,10 @@ public class TemperatureUtil { @Override public void onTemperatureGet(Temperature temperature) { ICLogger.d("on temperature test end..." + temperature); - //处理结果 - handleTemperature(temperature); + CurrentTemperature=temperature; + if (CoreService.getInstance()!=null){ + trigger_timer_send( CoreService.getInstance().getApplicationContext()); + } } @Override diff --git a/app/version_code.properties b/app/version_code.properties index b4a9c900..f8884e0b 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Wed Sep 29 17:33:51 CST 2021 -VERSION_CODE=965 +#Sun Oct 03 18:26:30 CST 2021 +VERSION_CODE=966