From: TrillGates Date: Mon, 23 Aug 2021 06:39:18 +0000 (+0800) Subject: adjust ap03 step count and calorie X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=1b817d5cbaa291f8ce12501be151e3fed22a05fb;p=icsupport.git adjust ap03 step count and calorie --- diff --git a/app/release/ICSer_V919_2108202041_release.apk b/app/release/ICSer_V920_2108211919_release.apk similarity index 78% rename from app/release/ICSer_V919_2108202041_release.apk rename to app/release/ICSer_V920_2108211919_release.apk index 266f7dc9..ad9434de 100644 Binary files a/app/release/ICSer_V919_2108202041_release.apk and b/app/release/ICSer_V920_2108211919_release.apk differ diff --git a/app/release/output.json b/app/release/output.json index 3bf6417a..baf81e67 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":919,"versionName":"2108202041","enabled":true,"outputFile":"ICSer_V919_2108202041_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V919_2108202041_release.apk","properties":{}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":920,"versionName":"2108211919","enabled":true,"outputFile":"ICSer_V920_2108211919_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V920_2108211919_release.apk","properties":{}}] \ No newline at end of file diff --git a/app/src/main/java/com/enqualcomm/support/GSensorListener.java b/app/src/main/java/com/enqualcomm/support/GSensorListener.java index a6692294..138cb201 100644 --- a/app/src/main/java/com/enqualcomm/support/GSensorListener.java +++ b/app/src/main/java/com/enqualcomm/support/GSensorListener.java @@ -1,14 +1,9 @@ package com.enqualcomm.support; -import android.os.Handler; -import android.os.Message; - -import com.ic.jni.ICJniUtils; import com.enqualcomm.support.bean.Runtime; - -import com.enqualcomm.support.utils.FileOutputUtil; import com.enqualcomm.support.utils.ICLogger; +import com.ic.jni.ICJniUtils; /** * 由于Gsensor用的硬件计步,只需要保证打开计步器即可 @@ -28,7 +23,7 @@ public class GSensorListener { } public void updateStepCount(){ - if(getStepCountOver==false) { + if(!getStepCountOver) { getStepCountOver = true; CURRENT_STEP = ICJniUtils.getStepCount(); StringBuilder stringBuilder1 = new StringBuilder(); diff --git a/app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java b/app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java index e16a270e..04689ade 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/BatteryUtil.java @@ -228,6 +228,7 @@ public class BatteryUtil { Deliver.sendLocationMSG(protocol_s123.APGJ(runtime)); //延时1秒钟 mHandler.postDelayed(() -> { + ICLogger.d("do power off..."); CoreService.DevliverStringMessage("poweroff"); }, 1000); } @@ -301,9 +302,8 @@ public class BatteryUtil { IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); Intent batteryStatus = context.registerReceiver(null, ifilter); -//你可以读到充电状态,如果在充电,可以读到是usb还是交流电 - -// 是否在充电 + //你可以读到充电状态,如果在充电,可以读到是usb还是交流电 + // 是否在充电 int status = batteryStatus.getIntExtra(EXTRA_STATUS, -1); boolean isCharging = (status == BATTERY_STATUS_CHARGING);//|| status == BatteryManager.BATTERY_STATUS_FULL; boolean isCharging2 = batteryStatus.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1) != 0; diff --git a/app/src/main/java/com/enqualcomm/support/utils/VibrateUtil.java b/app/src/main/java/com/enqualcomm/support/utils/VibrateUtil.java index 25fefa8b..cc03c305 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/VibrateUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/VibrateUtil.java @@ -36,10 +36,12 @@ public class VibrateUtil { public void vibrateOn(boolean on) { if (vibrator != null) { - if (on) - vibrator.vibrate(1000);//不循环 - else + if (on) { vibrator.cancel(); + vibrator.vibrate(1000);//不循环} + } else { + vibrator.cancel(); + } } } diff --git a/app/src/main/java/com/ic/protocols/protocol_s123.java b/app/src/main/java/com/ic/protocols/protocol_s123.java index e824dfc8..71df616a 100644 --- a/app/src/main/java/com/ic/protocols/protocol_s123.java +++ b/app/src/main/java/com/ic/protocols/protocol_s123.java @@ -310,6 +310,7 @@ public class protocol_s123 { APFX,//飞行模式开关 BPFX,//飞行模式开关 BP75,//闹钟, + AP75,//闹钟, BPPH,//拨号功能开关 APPH, BPSS,//短信命令 @@ -436,6 +437,7 @@ public class protocol_s123 { cmdMap.put(CMD_TYPE.BPTQ, "BPTQ"); cmdMap.put(CMD_TYPE.APAT, "APAT"); cmdMap.put(CMD_TYPE.BP75, "BP75"); + cmdMap.put(CMD_TYPE.AP75, "AP75"); cmdMap.put(CMD_TYPE.BPAT, "BPAT"); cmdMap.put(CMD_TYPE.APBT, "APBT"); cmdMap.put(CMD_TYPE.BPBT, "BPBT"); @@ -816,16 +818,38 @@ public class protocol_s123 { //5555: 计步步数,每次到达 9999 后重 0 开始计 (此处 9999 为示例,可以为2字节int 然后溢出归零) //30: 翻滚次数 //获取一下卡路里 + ds.getContextProxy().context.sendBroadcast(new Intent("com.ic.action.GET_PED_COUNT")); + //TODO:可能要稍等一下 ContentResolver resolver = ds.getContextProxy().getResolver(); Cursor query = resolver.query(Uri.parse(ICGlobalSettingsProvider.SETTINGS), new String[]{"s_value"}, "s_key=?", new String[]{"sport_calorie_value"}, null); String calorie = "0"; - if (query != null) { - if (query.moveToNext()) { - calorie = query.getString(0); + try { + if (query != null) { + if (query.moveToNext()) { + calorie = query.getString(0); + } + query.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + //只要步数可以直接获取 + //为了和卡路里统一,所以由同一库里获取 + int stepCount = 0; + try { + Cursor stepCountCursor = resolver.query(Uri.parse(ICGlobalSettingsProvider.SETTINGS), + new String[]{"s_value"}, "s_key=?", new String[]{"sport_step_count"}, null); + if (stepCountCursor != null) { + if (stepCountCursor.moveToNext()) { + stepCount = stepCountCursor.getInt(0); + } + stepCountCursor.close(); } - query.close(); + } catch (Exception e) { + e.printStackTrace(); } + return genStringMessage(cmdMap.get(CMD_TYPE.AP03), new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.AP03)) .append(CMDSPLIT) @@ -835,7 +859,8 @@ public class protocol_s123 { .append(ds.isPowerConnected() ? "1" : "0") .append(ds.getProtection()) .append(ds.getWorkModeStr()).append(CMDSPLIT) - .append(ds.getTotalStepCount()) + //.append(ds.getTotalStepCount()) + .append(stepCount) .append(CMDSPLIT) .append(SleepInfo.getInstance().getRollTimes(ds)) .append(CMDSPLIT).append(calorie) @@ -2036,7 +2061,13 @@ public class protocol_s123 { ICLogger.i("收到服务器指令:设置" + (type.equals("1") ? "心率周期 " : "血压周期 ") + cycle + "分钟"); try { //发送重置PPGCycle的广播,会在CoreServer里面执行 - CoreService.getInstance().setHeartRateDetectAlarm(Integer.parseInt(cycle)); + int cycleInt = Integer.parseInt(cycle); + //他们要求的:心率血压血氧体温上传数据时间间隔软件做限制,最低设置5分钟上传一次,最高不限制 + //bug号:1195 + if (cycleInt < 5) { + cycleInt = 5; + } + CoreService.getInstance().setHeartRateDetectAlarm(cycleInt); // Intent intent = new Intent(); // intent.putExtra("PPGTestCycle", Integer.parseInt(cycle)); // intent.setFlags(FLAG_INCLUDE_STOPPED_PACKAGES); @@ -2213,6 +2244,12 @@ public class protocol_s123 { String freqstr = list[3]; int freq = Integer.parseInt(freqstr); connection.send(APTE(index)); + //他们要要做限制,心率血压血氧体温上传数据时间间隔软件做限制 + //最低设置5分钟上传一次,最高不限制 + //bug号:1195 + if (freq < 5) { + freq = 5; + } ICLogger.i("收到服务器指令:测量体温 " + freq + "分钟一次。"); Config.setTemperatureTestCycle(runtime, freq * 60); CoreService.getInstance().setTempAlarm(true); @@ -4131,6 +4168,12 @@ public class protocol_s123 { // @559d6c3463d09192,,1234567,0 // @559d6c3463d09192,,1234567,0 // @559d6c3463d09192,,1234567,0 + String ap75Str = cmd.replace("BP75", "AP75"); + String responseMsg = + ap75Str.replace(mRuntime.IMEI() + ",", + "") + CMDEND; + ICLogger.d("responseMsg == > " + responseMsg); + mConnection.send(genStringMessage(cmdMap.get(CMD_TYPE.AP75), responseMsg)); try { String[] split = cmd.split(CMDSPLIT); int cmdLen = 0; diff --git a/app/version_code.properties b/app/version_code.properties index 08b5710f..e577167c 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Fri Aug 20 20:41:09 CST 2021 -VERSION_CODE=919 +#Sat Aug 21 19:19:58 CST 2021 +VERSION_CODE=920