From: snickersun Date: Mon, 19 Oct 2020 15:23:35 +0000 (+0800) Subject: release V664 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=20c52e5fe92b10c7ea5aac766cababbe04a8ce30;p=protocol_srv.git release V664 1、protocol_ic AP03添加 充电提示(用预留位表示) 2、修复protocol_jiai BP93 解码问题 3、拍照添加 persist.sys.camera_cap_mirror persist.sys.camera_capsize persist.sys.camera_orientation persist.sys.capture_quality 来控制照片方向,是否镜像等参数 4、拍照后 通过 persist.sys.do_check_condition判断是否执行 心率,体温检测。 5、优化关机事件,放宽限定条件。 6、添加 照片watermark时间格式 persist.sys.needWaterMark 7、runtime中添加 getMsAfterLastPowerPlugin getMsAfterLastPowerPlugout 函数,暂时未启用,用于判断充电经过了多久。 --- diff --git a/app/app.iml b/app/app.iml index 497b2ac8..d1100d69 100644 --- a/app/app.iml +++ b/app/app.iml @@ -29,14 +29,14 @@ - - + + - + diff --git a/app/release/ICSer_V661_2010161805_release.apk b/app/release/ICSer_V664_2010192321_release.apk similarity index 78% rename from app/release/ICSer_V661_2010161805_release.apk rename to app/release/ICSer_V664_2010192321_release.apk index 65a6a8b6..ad509c60 100644 Binary files a/app/release/ICSer_V661_2010161805_release.apk and b/app/release/ICSer_V664_2010192321_release.apk differ diff --git a/app/release/output.json b/app/release/output.json index 53821ec3..0c0f357d 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"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 +[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":664,"versionName":"2010192321","enabled":true,"outputFile":"ICSer_V664_2010192321_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V664_2010192321_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 ff64e09b..35fdd1c2 100644 --- a/app/src/main/java/com/enqualcomm/support/Config.java +++ b/app/src/main/java/com/enqualcomm/support/Config.java @@ -81,6 +81,7 @@ public class Config { return json; } + public final static boolean isL03Tracker=getIsL03tracker(); public final static boolean upload_logs_via_ftp=false; final static String KeyProtocolServerIP="ProtocolServerIP"; @@ -729,6 +730,12 @@ public class Config { } return en; } - + public static boolean needWaterMark(){ + String customname=getSystemProperties("persist.sys.needWaterMark","true"); + if(customname.trim().equals("true")){ + return true; + }else + return false; + } } diff --git a/app/src/main/java/com/enqualcomm/support/LocationClient.java b/app/src/main/java/com/enqualcomm/support/LocationClient.java index 2757e71f..31cdb689 100644 --- a/app/src/main/java/com/enqualcomm/support/LocationClient.java +++ b/app/src/main/java/com/enqualcomm/support/LocationClient.java @@ -804,8 +804,6 @@ public void updateCellInfo() { * else return false */ private boolean checkNoMoveTimeout(){ - - noMove=runtime.getLastStepCount() == runtime.getTotalStepCount(); runtime.updateFZDDevStatusMoving(!noMove); //设置当前运动状态 ICLogger.i(" checkNoMoveTimeout last_noMove "+last_noMove+" noMove "+noMove); @@ -1027,31 +1025,6 @@ public void updateCellInfo() { })).start(); } - private void sendBatteryNotification() { - if (runtime.getHaveBatteryChange() && !runtime.getBatterychanging() && !this.batteryNotification) { -// connection.send(API.H05(runtime, "2")); - ICLogger.i("sendBatteryNotification LevelChanged "); - this.batteryNotification = true; - } - if (runtime.getBatteryLow() && !runtime.getBatterychanging() && !this.batteryLowNotification) { -// connection.send(API.H05(runtime, "1")); - ICLogger.i("sendBatteryNotification Low Battery "); - - if (runtime.getBatteryLow()) { - runtime.setAlarmType(Runtime.AlarmType.ALARM_LOWBATTERY); - //trigger AP10 报警低电 -// connection.send(protocolAPIHelper.getWarningMSG(runtime)); - ICLogger.i("triggerSOSLocationProcess "); - LocationClient.getInstance().triggerSOSLocationProcess(); - } - - this.batteryLowNotification = true; - } - if (runtime.getBatterychanging()) { - this.batteryNotification = false; - this.batteryLowNotification = false; - } - } // 飞行模式 1 开启 0 关闭 public void setAirMode(int paramInt) { boolean isAirModeOn = this.mSignalUtil.IsAirModeOn(); diff --git a/app/src/main/java/com/enqualcomm/support/bean/Runtime.java b/app/src/main/java/com/enqualcomm/support/bean/Runtime.java index 554addd2..ea064749 100644 --- a/app/src/main/java/com/enqualcomm/support/bean/Runtime.java +++ b/app/src/main/java/com/enqualcomm/support/bean/Runtime.java @@ -491,9 +491,30 @@ public class Runtime { private boolean PowerConnected=false; + private long msPowerConnectionStatusChangedTime=0; public void setPowerConnected(boolean connected){ - PowerConnected=connected; + if (PowerConnected!=connected){ + msPowerConnectionStatusChangedTime=System.currentTimeMillis(); + PowerConnected=connected; + } + } + + //获取上次开始充电到现在的时间 ms + public long getMsAfterLastPowerPlugin(){ + if (PowerConnected){ + return (System.currentTimeMillis()-msPowerConnectionStatusChangedTime); + }else + return 0; } + + //获取上次停止充电到现在的时间 ms + public long getMsAfterLastPowerPlugout(){ + if (!PowerConnected){ + return (System.currentTimeMillis()-msPowerConnectionStatusChangedTime); + }else + return 0; + } + public boolean isPowerConnected(){ return PowerConnected; } 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 e97f9d78..8142dbda 100644 --- a/app/src/main/java/com/enqualcomm/support/service/Deliver.java +++ b/app/src/main/java/com/enqualcomm/support/service/Deliver.java @@ -20,6 +20,7 @@ import com.enqualcomm.support.Constants; import com.enqualcomm.support.CoreService; import com.enqualcomm.support.R; import com.enqualcomm.support.bean.VoiceContent; +import com.enqualcomm.support.utils.TemperatureUtil; import com.enqualcomm.support.utils.TimeUtil; import com.ic.protocols.protocolAPIHelper; import com.enqualcomm.support.bean.Contact; @@ -385,8 +386,23 @@ public class Deliver extends AbstractConnectionService { // 把voiceContent拆解成1024的分包 Util.parseToVoicePacketSent(voiceContent); //trigger 分包发送 - if (CoreService.getInstance().getConnection()!=null) + if (CoreService.getInstance().getConnection()!=null) { + + + if(Util.getSystemProperties("persist.sys.do_check_condition","false").equals("true")) { + //开启测温 + TemperatureUtil.DoTempTest(); + + try { + Thread.sleep(5000); + } catch (Exception e) { + } + //开启测量PPG + HeartRateManager.triggerPPGtest(); + } + CoreService.getInstance().getConnection().DeliverCMDMessageToSystem("SentVoicePacket", ""); + } return true; } else if ("poweroffCheckSim".equals(paramStringMessage.cmd())) { paramRuntime.setShutdown(true); diff --git a/app/src/main/java/com/enqualcomm/support/service/KeepAlive.java b/app/src/main/java/com/enqualcomm/support/service/KeepAlive.java index abd8488d..1ad197fa 100644 --- a/app/src/main/java/com/enqualcomm/support/service/KeepAlive.java +++ b/app/src/main/java/com/enqualcomm/support/service/KeepAlive.java @@ -406,20 +406,14 @@ public class KeepAlive extends AbstractConnectionService { public void onReceive(Context param1Context, Intent param1Intent) { boolean bool = param1Intent.getBooleanExtra("reboot", false); ICLogger.i("Shutdown Received! reboot="+bool); - if (KeepAlive.this.mRuntime.getBatteryLow() && !KeepAlive.this.mRuntime.getBatterychanging() && !bool && !KeepAlive.this.mRuntime.isShutdown()){ - /*电量低,没有充电,且不是服务器让关闭的*/ -// if (KeepAlive.this.mRuntime.getBatteryLow()){ -// KeepAlive.this.mRuntime.setAlarmType(Runtime.AlarmType.ALARM_LOWBATTERY); + if (!bool && !KeepAlive.this.mRuntime.isShutdown()){ + /*电量低,不是重启,且不是服务器让关闭的*/ KeepAlive.this.mRuntime.setAlarmType(Runtime.AlarmType.ALARM_POWER_OFF); - ICLogger.i("triggerSOSLocationProcess "); + ICLogger.i("triggerSOSLocationProcess "); LocationClient.getInstance().triggerSOSLocationProcess(); // Deliver.sendLocationMSG(protocolAPIHelper.getWarningMSG(KeepAlive.this.mRuntime)); - ICLogger.i("Shutdown Received! send AP10 !"); -// } - } - } } } diff --git a/app/src/main/java/com/enqualcomm/support/utils/CameraUtil.java b/app/src/main/java/com/enqualcomm/support/utils/CameraUtil.java index fd5dd1fc..f53fd02f 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/CameraUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/CameraUtil.java @@ -11,9 +11,11 @@ import android.hardware.Camera; import android.media.ToneGenerator; import android.os.Environment; import android.os.StatFs; +import android.text.TextUtils; import android.view.SurfaceView; import android.view.WindowManager; +import com.enqualcomm.support.Config; import com.enqualcomm.support.CoreService; import java.io.BufferedOutputStream; @@ -28,7 +30,7 @@ public class CameraUtil implements SurfaceTexture.OnFrameAvailableListener { private Camera.PictureCallback jpegCallback = new Camera.PictureCallback() { public void onPictureTaken(byte[] param1ArrayOfByte, Camera param1Camera) { StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("format="); + stringBuilder.append("camera format="); stringBuilder.append(CameraUtil.this.mPs.getPictureFormat()); ICLogger.i(stringBuilder.toString()); if (CameraUtil.this.mPs.getPictureFormat() == 256) { @@ -44,7 +46,7 @@ public class CameraUtil implements SurfaceTexture.OnFrameAvailableListener { CoreService.getInstance().DevliverStringMessage("PhotoRemoteTaken",str); } } else { - ICLogger.i("空间不足,保存失败"); + ICLogger.i("camera 空间不足,保存失败"); } } CameraUtil.this.releaseCamera(); @@ -56,11 +58,12 @@ public class CameraUtil implements SurfaceTexture.OnFrameAvailableListener { String mNumber; private int mOrientation; - + private int custom_camera_orientation=0; + private int custom_camera_mirror=0; private Camera.Parameters mPs; private Camera.ShutterCallback shutterCallback = new Camera.ShutterCallback() { - public void onShutter() { ICLogger.i("shutterCallback"); } + public void onShutter() { ICLogger.i("camera shutterCallback"); } }; private SurfaceTexture surfaceTexture; @@ -117,17 +120,43 @@ public class CameraUtil implements SurfaceTexture.OnFrameAvailableListener { stringBuilder.append(this.mNumber); stringBuilder.append(".jpg"); str = stringBuilder.toString(); - Bitmap bitmap2 = BitmapFactory.decodeByteArray(paramArrayOfByte, 0, paramArrayOfByte.length); -// Bitmap bitmap1 = bitmap2; + Bitmap bitmap1 = BitmapFactory.decodeByteArray(paramArrayOfByte, 0, paramArrayOfByte.length); + Bitmap bitmap2 = bitmap1; + + +// if ((this.context.getResources().getConfiguration()).orientation == 1) { + custom_camera_mirror = Util.getSystemPropertiesInt("persist.sys.camera_cap_mirror",0); + Matrix matrix = new Matrix(); + matrix.reset(); + switch(custom_camera_orientation) + { + case 90: + case 270: + matrix.postRotate(custom_camera_orientation); + if(custom_camera_mirror==-1) + matrix.postScale(-1, 1); + else if(custom_camera_mirror==-2) + matrix.postScale(1,-1); + + bitmap2 = Bitmap.createBitmap(bitmap1, 0, 0, bitmap1.getWidth(), bitmap1.getHeight(), matrix, true); + break; + case 0: + case 180: + if(custom_camera_mirror<0) { + if (custom_camera_mirror == -1) + matrix.postScale(-1, 1); + else if (custom_camera_mirror == -2) + matrix.postScale(1, -1); + bitmap2 = Bitmap.createBitmap(bitmap1, 0, 0, bitmap1.getWidth(), bitmap1.getHeight(), matrix, true); + } + default: + break; + } + Bitmap bitmap3 = bitmap2; - if ((this.context.getResources().getConfiguration()).orientation == 1) { -// Matrix matrix = new Matrix(); -// matrix.reset(); - // matrix.postRotate(this.mOrientation); - // bitmap1 = Bitmap.createBitmap(bitmap2, 0, 0, bitmap2.getWidth(), bitmap2.getHeight(), matrix, true); -// bitmap3 = ImageUtil.drawTextToLeftTop(this.context,bitmap2,TimeUtil.getSystemTime(),40,0xFF4000 ,25,-100); + if(Config.needWaterMark()) { + bitmap3 = ImageUtil.drawTextToLeftTop(this.context, bitmap2, TimeUtil.getSystemTimeForCameraMark(), 50, Color.RED, 25, 25); } - bitmap3 = ImageUtil.drawTextToLeftTop(this.context,bitmap2,TimeUtil.getSystemTime(),50, Color.RED ,25,25); File file = new File(str); if (!file.exists()) file.createNewFile(); @@ -136,7 +165,7 @@ public class CameraUtil implements SurfaceTexture.OnFrameAvailableListener { bufferedOutputStream.flush(); bufferedOutputStream.close(); - ICLogger.i("Take Photo and Save to "+str); + ICLogger.i("camera Take Photo and Save to "+str); } return str; } catch (Exception e) { @@ -148,11 +177,27 @@ public class CameraUtil implements SurfaceTexture.OnFrameAvailableListener { private void takePicture(Context paramContext) { if (this.mCamera != null) { SurfaceView surfaceView = new SurfaceView(paramContext); + int width=640; + int height=480; try { this.mCamera.setPreviewDisplay(surfaceView.getHolder()); this.mPs = this.mCamera.getParameters(); - this.mPs.setPictureSize(640, 480); - ICLogger.i("CameraUtil---setCameraDisplayOrientation"); + String picsize=Util.getSystemProperties("persist.sys.camera_capsize","640x480"); + + if (!picsize.trim().isEmpty() ){ + String sizes[]= picsize.toLowerCase().split("x"); + if(sizes.length==2){ + try{ + int tmpw=Integer.parseInt(sizes[0]); + int tmph=Integer.parseInt(sizes[1]); + width=tmpw; + height=tmph; + }catch (Exception e){} + } + } + + ICLogger.i("CameraUtil---setCamera capture size "+ width+"x"+height ); + this.mPs.setPictureSize(width, height); setCameraDisplayOrientation(paramContext, 0, this.mCamera); this.mCamera.setParameters(this.mPs); ICLogger.i("CameraUtil---startPreview"); @@ -184,10 +229,12 @@ public class CameraUtil implements SurfaceTexture.OnFrameAvailableListener { public int getDisplayRotation(Context paramContext) { int i = ((WindowManager)paramContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getRotation(); + StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("getDisplayRotation rotation="); + stringBuilder.append("camera getDisplayRotation rotation="); stringBuilder.append(i); ICLogger.i(stringBuilder.toString()); + switch (i) { default: return 0; @@ -209,17 +256,29 @@ public class CameraUtil implements SurfaceTexture.OnFrameAvailableListener { this.mNumber = paramString; } - public void onFrameAvailable(SurfaceTexture paramSurfaceTexture) { ICLogger.i("onFrameAvailable"); } + public void onFrameAvailable(SurfaceTexture paramSurfaceTexture) { ICLogger.i("camera onFrameAvailable"); } public void setCameraDisplayOrientation(Context paramContext, int paramInt, Camera paramCamera) { Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); Camera.getCameraInfo(paramInt, cameraInfo); paramInt = getDisplayRotation(paramContext); + custom_camera_orientation=Util.getSystemPropertiesInt("persist.sys.camera_orientation",0); + ICLogger.i("camera getDisplayRotation1 "+paramInt+" cameraInfo.orientation "+cameraInfo.orientation+ " custom_camera_orientation "+custom_camera_orientation); + + if (cameraInfo.facing == 1) { + paramInt = (360 - (custom_camera_orientation + paramInt) % 360) % 360; + } else { + paramInt = (custom_camera_orientation - paramInt + 360) % 360; + } + /* if (cameraInfo.facing == 1) { paramInt = (360 - (cameraInfo.orientation + paramInt) % 360) % 360; } else { paramInt = (cameraInfo.orientation - paramInt + 360) % 360; - } + }*/ + + ICLogger.i("camera final display orientation "+paramInt); + paramCamera.setDisplayOrientation(paramInt); this.mOrientation = paramInt; } diff --git a/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java b/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java index e1060e09..162197a6 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java +++ b/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java @@ -289,8 +289,22 @@ public class ProcessReceiver extends BroadcastReceiver { // 把voiceContent拆解成1024的分包 Util.parseToVoicePacketSent(voiceContent); //trigger 分包发送 - if (CoreService.getInstance().getConnection()!=null) + if (CoreService.getInstance().getConnection()!=null) { + + if(Util.getSystemProperties("persist.sys.do_check_condition","false").equals("true")) { + //开启测温 + TemperatureUtil.DoTempTest(); + + try { + Thread.sleep(5000); + } catch (Exception e) { + } + //开启测量PPG + HeartRateManager.triggerPPGtest(); + } + //开启发送图片 CoreService.getInstance().getConnection().DeliverCMDMessageToSystem("SentVoicePacket", ""); + } } }else if (ACTION_SHUTDOWN.equals(str)) { @@ -325,11 +339,26 @@ public class ProcessReceiver extends BroadcastReceiver { //创建voiceConent并添加到数据 final VoiceContent voiceContent = VoiceContent.placeHolderOut(CONTACT_CATEGORY_GROUP, msgFrom, msgUrl,2,2); + // 把voiceContent拆解成1024的分包 Util.parseToVoicePacketSent(voiceContent); //trigger 分包发送 - if (CoreService.getInstance().getConnection()!=null) + if (CoreService.getInstance().getConnection()!=null) { + + if(Util.getSystemProperties("persist.sys.do_check_condition","false").equals("true")) { + //开启测温 + TemperatureUtil.DoTempTest(); + + try { + Thread.sleep(5000); + } catch (Exception e) { + } + //开启测量PPG + HeartRateManager.triggerPPGtest(); + } + //开启发送照片 CoreService.getInstance().getConnection().DeliverCMDMessageToSystem("SentVoicePacket", ""); + } } diff --git a/app/src/main/java/com/enqualcomm/support/utils/TimeUtil.java b/app/src/main/java/com/enqualcomm/support/utils/TimeUtil.java index ea0d71f6..d5be6434 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/TimeUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/TimeUtil.java @@ -22,6 +22,8 @@ public class TimeUtil { public static String getLocalTime2(long paramLong) { return (new SimpleDateFormat("MMddHHmmss")).format(new Date(paramLong)); } + public static String getSystemTimeForCameraMark() { return (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(new Date(System.currentTimeMillis())); } + public static String getSystemTime() { return getSystemTime(System.currentTimeMillis()); } //此处不能随意改动,影响闹铃设置 diff --git a/app/src/main/java/com/ic/protocols/protocol_ic.java b/app/src/main/java/com/ic/protocols/protocol_ic.java index 677e3571..ca72bdb7 100644 --- a/app/src/main/java/com/ic/protocols/protocol_ic.java +++ b/app/src/main/java/com/ic/protocols/protocol_ic.java @@ -454,7 +454,7 @@ public class protocol_ic { //5555: 计步步数,每次到达 9999 后重 0 开始计 (此处 9999 为示例,可以为2字节int 然后溢出归零) //30: 翻滚次数 return genStringMessage(cmdMap.get(CMD_TYPE.AP03),new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.AP03)).append(CMDSPLIT).append(String.format("%03d",abs(ds.getSignalStrength()))) - .append(ds.getGPSLocationStarNums()).append(ds.getBattery()).append("0") + .append(ds.getGPSLocationStarNums()).append(ds.getBattery()).append(ds.isPowerConnected()?"1":"0") .append(ds.getProtection()).append(ds.getWorkModeStr()).append(CMDSPLIT) .append(ds.getTotalStepCount()).append(CMDSPLIT).append(ds.getRolltimes()).append(CMDEND).toString()); } diff --git a/app/src/main/java/com/ic/protocols/protocol_jiai.java b/app/src/main/java/com/ic/protocols/protocol_jiai.java index 483a813f..688cc741 100644 --- a/app/src/main/java/com/ic/protocols/protocol_jiai.java +++ b/app/src/main/java/com/ic/protocols/protocol_jiai.java @@ -1658,7 +1658,7 @@ public static StringMessage AP50(Runtime ds){ String play_time=cmdlist[5]; String vib_time=cmdlist[6]; ICLogger.i("收到服务器文本 "+txtmsg+" 序号 "+msg_index_no+" , 播放 "+play_time+" 次,震动 "+vib_time+" 次!"); - txtmsg=Util.UrlGB2312ToUTF8(txtmsg); + txtmsg=Util.decodeUnicode2Utf8(txtmsg); StringMessage msg=AP93(cmdindex); //设定当前工作模式及循环频率 connection.send(msg); diff --git a/app/version_code.properties b/app/version_code.properties index 5f4591c6..efdcf2d1 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Fri Oct 16 18:05:48 CST 2020 -VERSION_CODE=661 +#Mon Oct 19 23:21:23 CST 2020 +VERSION_CODE=664