From: snickersun Date: Wed, 5 Aug 2020 19:21:54 +0000 (+0800) Subject: release V476 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=11d96287c9f15ce50ce03e3300208d98b2eb630b;p=protocol_srv.git release V476 protocol_ic 添加 BP46 拍照 ,BPDH 聆听。 --- diff --git a/app/release/ICSer_V476_2008060319_release.apk b/app/release/ICSer_V476_2008060319_release.apk new file mode 100644 index 00000000..26497247 Binary files /dev/null and b/app/release/ICSer_V476_2008060319_release.apk differ diff --git a/app/src/main/java/com/enqualcomm/support/CoreService.java b/app/src/main/java/com/enqualcomm/support/CoreService.java index 9e8715b2..9cb2fd41 100644 --- a/app/src/main/java/com/enqualcomm/support/CoreService.java +++ b/app/src/main/java/com/enqualcomm/support/CoreService.java @@ -675,7 +675,9 @@ public class CoreService extends Service { public static void DevliverStringMessage(String cmd){ CoreService.getInstance().connection.DeliverCMDMessageToSystem(cmd,""); } - + public static void DevliverStringMessage(String cmd,String str){ + CoreService.getInstance().connection.DeliverCMDMessageToSystem(cmd,str); + } public void checkKeepSitting(){ String dateyyyyMMDDhhmmss=TimeUtil.getSystemTime3(); String sleepdate=TimeUtil.getCurrentSleepRecordDate(dateyyyyMMDDhhmmss); diff --git a/app/src/main/java/com/enqualcomm/support/MainActivity.java b/app/src/main/java/com/enqualcomm/support/MainActivity.java index 829e971c..115bf1a2 100644 --- a/app/src/main/java/com/enqualcomm/support/MainActivity.java +++ b/app/src/main/java/com/enqualcomm/support/MainActivity.java @@ -2,8 +2,13 @@ package com.enqualcomm.support; import android.content.ComponentName; import android.content.Intent; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Color; +import android.os.Environment; import android.os.Handler; import android.os.Message; +import android.os.StatFs; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; @@ -11,8 +16,14 @@ import android.widget.Button; import android.widget.TextView; import com.enqualcomm.support.utils.DeviceInfoUtil; +import com.enqualcomm.support.utils.ICLogger; +import com.enqualcomm.support.utils.ImageUtil; +import com.enqualcomm.support.utils.TimeUtil; import com.enqualcomm.support.utils.Util; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -72,6 +83,8 @@ public class MainActivity extends AppCompatActivity { }); + + // SimSignalUtil.send_at_to_onoff_simcard(CoreService.getInstance().runtime)); // tbtnblood.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @@ -100,7 +113,7 @@ public class MainActivity extends AppCompatActivity { TextView tv_version=(TextView)findViewById(R.id.textViewVersion); tv_version.setText(DeviceInfoUtil.getVersionCode(this)+"-"+DeviceInfoUtil.getVersionName(this)); - +// testpic(); } @Override @@ -136,6 +149,56 @@ public class MainActivity extends AppCompatActivity { showmessage=false; + } + + public void testpic(){ + + String str = null; + try { + if (Environment.getExternalStorageState().equals("mounted")) { +// if ((new StatFs(Environment.getExternalStorageDirectory().toString())).getAvailableBytes() < paramArrayOfByte.length) + + str = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath(); + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(str); + stringBuilder.append("/TakePhoto_080835"); + stringBuilder.append(".jpg"); + str = stringBuilder.toString(); + Bitmap bitmap2 =BitmapFactory.decodeFile(str); +// Bitmap bitmap2 = BitmapFactory.decodeByteArray(paramArrayOfByte, 0, paramArrayOfByte.length); +// Bitmap bitmap1 = bitmap2; + Bitmap bitmap3 = bitmap2; + if ((this.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,bitmap2, TimeUtil.getSystemTime(),24, Color.RED, 20, 20); + str = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath(); + stringBuilder = new StringBuilder(); + stringBuilder.append(str); + stringBuilder.append("/TakePhoto_0808352"); + stringBuilder.append(".jpg"); + str = stringBuilder.toString(); + File file = new File(str); + if (!file.exists()) + file.createNewFile(); + BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(file)); + bitmap3.compress(Bitmap.CompressFormat.JPEG, 100, bufferedOutputStream); + bufferedOutputStream.flush(); + bufferedOutputStream.close(); + + ICLogger.i("Take Photo and Save to "+str); + } + + } catch (Exception e) { + e.printStackTrace(); + + } + + } private View.OnClickListener clickListener = new View.OnClickListener() { 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 587ec45d..7de47051 100644 --- a/app/src/main/java/com/enqualcomm/support/service/Deliver.java +++ b/app/src/main/java/com/enqualcomm/support/service/Deliver.java @@ -19,6 +19,8 @@ import com.enqualcomm.support.Config; 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.TimeUtil; import com.ic.protocols.protocolAPIHelper; import com.enqualcomm.support.bean.Contact; import com.enqualcomm.support.bean.StringMessage; @@ -46,6 +48,7 @@ import static android.app.PendingIntent.FLAG_UPDATE_CURRENT; import static com.enqualcomm.support.Constants.ACTION_WAKEUP_ALARM; import static com.enqualcomm.support.Constants.DIALOG_ACTION; import static com.enqualcomm.support.bean.Contact.CATEGORY_GROUP; +import static com.enqualcomm.support.bean.Content.CONTACT_CATEGORY_GROUP; /** * 负责发送除了login,心跳之外的所有指令 @@ -340,19 +343,33 @@ public static void sendLocationMSG( String Msg){ //收到SentVoicePacket 表示 有一个VoiceMessage要发送,需要从第0个包开始发送语音分包。 voicePacket voicepacket = voicePacket.getInstanceSent(); if (voicepacket.getCurrentIndexToSent() < voicepacket.getPacketCount()) { - ICLogger.i("voicepacket " + voicepacket.getName() +" filetype "+voicepacket.getFiletype()+ " , datatype "+ voicepacket.getDateType() + voicepacket.getPacketTime() + " send " + (voicepacket.getCurrentIndexToSent() + 1) + "/" + voicepacket.getPacketCount()); + ICLogger.i("voicepacket " + voicepacket.getName() + " filetype " + voicepacket.getFiletype() + " , datatype " + voicepacket.getDateType() + voicepacket.getPacketTime() + " send " + (voicepacket.getCurrentIndexToSent() + 1) + "/" + voicepacket.getPacketCount()); ((NettyConnection) mConnection).sendMsg( protocolAPIHelper.getVoicePacketItem(voicepacket.getPacketTime(), voicepacket.getPacketCount(), (voicepacket.getCurrentIndexToSent() + 1), voicepacket.getVoicePacketWithIndex(voicepacket.getCurrentIndexToSent()).getPacketLen(), - voicepacket.getVoicePacketWithIndex(voicepacket.getCurrentIndexToSent()).getPacketData(),voicepacket.getFiletype(),voicepacket.getDateType()) + voicepacket.getVoicePacketWithIndex(voicepacket.getCurrentIndexToSent()).getPacketData(), voicepacket.getFiletype(), voicepacket.getDateType()) ); } else { - ICLogger.i("voicepacket " + voicepacket.getName() +" filetype "+voicepacket.getFiletype()+ " , datatype "+ voicepacket.getDateType()+ " " + voicepacket.getPacketTime() + " sent Done!"); + ICLogger.i("voicepacket " + voicepacket.getName() + " filetype " + voicepacket.getFiletype() + " , datatype " + voicepacket.getDateType() + " " + voicepacket.getPacketTime() + " sent Done!"); } return true; - } else if ("poweroffCheckSim".equals(paramStringMessage.cmd())) { + } else if ("PhotoRemoteTaken".equals(paramStringMessage.cmd())) { + //接收到拍照完毕命令,发送照片 + + String msgUrl=paramStringMessage.isFromCache(); + ICLogger.i("receive taken photo to send "+msgUrl); + //创建voiceConent并添加到数据 + final VoiceContent voiceContent = VoiceContent.placeHolderOut(CONTACT_CATEGORY_GROUP, "123", msgUrl,2,2); + + // 把voiceContent拆解成1024的分包 + Util.parseToVoicePacketSent(voiceContent); + //trigger 分包发送 + if (CoreService.getInstance().getConnection()!=null) + CoreService.getInstance().getConnection().DeliverCMDMessageToSystem("SentVoicePacket", ""); + return true; + } else if ("poweroffCheckSim".equals(paramStringMessage.cmd())) { paramRuntime.setShutdown(true); if (SimSignalUtil.hasSimCard(paramRuntime.getContextProxy().context)) @@ -464,8 +481,31 @@ public static void sendLocationMSG( String Msg){ context.sendBroadcast(intent); } }); + return true; + }else if ("StartMonitor".equals(paramStringMessage.cmd())) { + + String recordfilepath=Util.getRecordfilePath(mRuntime, TimeUtil.getSystemTime3()); + AudioService.getInstance().startRecord(recordfilepath); + int recordtime=Integer.parseInt(paramStringMessage.isFromCache()); + Observable.timer(recordtime, TimeUnit.SECONDS).subscribe(new Action1() { + public void call(Long param1Long) { + + AudioService.getInstance().stopRecord(); + ICLogger.i("Monitor Record to send "+recordfilepath); + //创建voiceConent并添加到数据 + final VoiceContent voiceContent = VoiceContent.placeHolderOut(CONTACT_CATEGORY_GROUP, "123", recordfilepath,1,1); + + // 把voiceContent拆解成1024的分包 + Util.parseToVoicePacketSent(voiceContent); + //trigger 分包发送 + if (CoreService.getInstance().getConnection()!=null) + CoreService.getInstance().getConnection().DeliverCMDMessageToSystem("SentVoicePacket", ""); + + } + }); + return true; + } - } return false; 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 ae29a78a..a35c56a0 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/CameraUtil.java +++ b/app/src/main/java/com/enqualcomm/support/utils/CameraUtil.java @@ -4,6 +4,7 @@ import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.graphics.Color; import android.graphics.Matrix; import android.graphics.SurfaceTexture; import android.hardware.Camera; @@ -13,6 +14,8 @@ import android.os.StatFs; import android.view.SurfaceView; import android.view.WindowManager; +import com.enqualcomm.support.CoreService; + import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; @@ -31,11 +34,15 @@ public class CameraUtil implements SurfaceTexture.OnFrameAvailableListener { if (CameraUtil.this.mPs.getPictureFormat() == 256) { String str = CameraUtil.this.savePicture(param1ArrayOfByte); if (str != null) { - Intent intent = new Intent(CameraUtil.this.context, com.enqualcomm.support.CoreService.class); - intent.setAction(ACTION_REMOTE_CAMERA); - intent.putExtra("filepath", str); - intent.putExtra("number", CameraUtil.this.mNumber); - CameraUtil.this.context.startService(intent); +// Intent intent = new Intent(CameraUtil.this.context, com.enqualcomm.support.CoreService.class); +//// intent.setAction(ACTION_REMOTE_CAMERA); +//// intent.putExtra("filepath", str); +//// intent.putExtra("number", CameraUtil.this.mNumber); +//// CameraUtil.this.context.startService(intent); + + if (CoreService.getInstance()!=null){ + CoreService.getInstance().DevliverStringMessage("PhotoRemoteTaken",str); + } } else { ICLogger.i("空间不足,保存失败"); } @@ -104,21 +111,26 @@ public class CameraUtil implements SurfaceTexture.OnFrameAvailableListener { str = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(str); - stringBuilder.append("/RemoteCamera.jpg"); + stringBuilder.append("/TakePhoto_"); + stringBuilder.append(this.mNumber); + stringBuilder.append(".jpg"); str = stringBuilder.toString(); Bitmap bitmap2 = BitmapFactory.decodeByteArray(paramArrayOfByte, 0, paramArrayOfByte.length); - Bitmap bitmap1 = bitmap2; +// Bitmap bitmap1 = bitmap2; + 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); - } +// 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); + } + bitmap3 = ImageUtil.drawTextToLeftTop(this.context,bitmap2,TimeUtil.getSystemTime(),30, Color.RED ,25,25); File file = new File(str); if (!file.exists()) file.createNewFile(); BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(file)); - bitmap1.compress(Bitmap.CompressFormat.JPEG, 100, bufferedOutputStream); + bitmap3.compress(Bitmap.CompressFormat.JPEG, 100, bufferedOutputStream); bufferedOutputStream.flush(); bufferedOutputStream.close(); diff --git a/app/src/main/java/com/enqualcomm/support/utils/ICAudioManager.java b/app/src/main/java/com/enqualcomm/support/utils/ICAudioManager.java index 280f12bb..93ba0131 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/ICAudioManager.java +++ b/app/src/main/java/com/enqualcomm/support/utils/ICAudioManager.java @@ -14,9 +14,12 @@ public class ICAudioManager { AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); ICLogger.i("======setVolumnMute"); // saved_volumn = audioManager.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL); - audioManager.setMasterMute(true); - audioManager.setStreamMute(AudioManager.STREAM_VOICE_CALL,true); - audioManager.setSpeakerphoneOn(false); + if (audioManager != null) { + audioManager.setMasterMute(true); + + audioManager.setStreamMute(AudioManager.STREAM_VOICE_CALL, true); + audioManager.setSpeakerphoneOn(false); + } // SimSignalUtil.SetRingMode(context, AudioManager.RINGER_MODE_SILENT, false); // CloseSpeaker(context);// @@ -25,9 +28,12 @@ public class ICAudioManager { public static void restoreVolumn(Context context) { ICLogger.i("======restoreVolumn "+saved_volumn); AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); - audioManager.setMasterMute(false); - audioManager.setStreamMute(AudioManager.STREAM_VOICE_CALL,false); - audioManager.setSpeakerphoneOn(true); + if (audioManager != null) { + audioManager.setMasterMute(false); + + audioManager.setStreamMute(AudioManager.STREAM_VOICE_CALL, false); + audioManager.setSpeakerphoneOn(true); + } // changeToSpeaker(context); // SimSignalUtil.SetRingMode(context, AudioManager.RINGER_MODE_NORMAL, true); 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 7b174a2a..e1aa44a0 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java +++ b/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java @@ -307,9 +307,27 @@ public class ProcessReceiver extends BroadcastReceiver { },2000L); return; }else if (ACTION_REMOTE_CAMERA.equals(str)) { - String str1; - str1 = paramIntent.getStringExtra("key_remote_number"); - (new CameraUtil(paramContext)).getPictur(str1); + if (paramIntent.hasExtra("remote_number")){ + //接收拍照命令,执行拍照 + String str1 = paramIntent.getStringExtra("remote_number"); + (new CameraUtil(paramContext)).getPictur(str1); + }else{ + //接收到拍照完毕命令,发送照片 + String msgFrom=paramIntent.getStringExtra("number"); + String msgUrl=paramIntent.getStringExtra("filepath"); + ICLogger.i("receive taken photo to send "+msgUrl); + //创建voiceConent并添加到数据 + final VoiceContent voiceContent = VoiceContent.placeHolderOut(CONTACT_CATEGORY_GROUP, msgFrom, msgUrl,2,2); + + // 把voiceContent拆解成1024的分包 + Util.parseToVoicePacketSent(voiceContent); + //trigger 分包发送 + if (CoreService.getInstance().getConnection()!=null) + CoreService.getInstance().getConnection().DeliverCMDMessageToSystem("SentVoicePacket", ""); + + } + + return; }else if (DIALOG_ACTION.equals(str)) { diff --git a/app/src/main/java/com/enqualcomm/support/utils/Util.java b/app/src/main/java/com/enqualcomm/support/utils/Util.java index b787f2e8..3874da7a 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/Util.java +++ b/app/src/main/java/com/enqualcomm/support/utils/Util.java @@ -462,6 +462,13 @@ public class Util { public static boolean LogfileExist(Runtime runtime,String logfilename){ return new File(getLogfilePath(runtime,logfilename)).exists(); } + public static String getRecordfilePath(Runtime runtime,String recordfilename){ + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(recordfilename); + stringBuilder.append(".amr"); + File file = new File(runtime.getCacheDir(), stringBuilder.toString()); + return file.getAbsolutePath(); + } public static String getLogfilePath(Runtime runtime,String logfilename){ StringBuilder stringBuilder = new StringBuilder(); 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 03a55f3e..43d5998e 100644 --- a/app/src/main/java/com/ic/protocols/protocol_ic.java +++ b/app/src/main/java/com/ic/protocols/protocol_ic.java @@ -1,6 +1,7 @@ package com.ic.protocols; import android.content.ComponentName; +import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Environment; @@ -16,6 +17,7 @@ import com.enqualcomm.support.bean.StringMessage; import com.enqualcomm.support.bean.VoiceContent; import com.enqualcomm.support.bean.voicePacket; import com.enqualcomm.support.service.HeartRateManager; +import com.enqualcomm.support.utils.CameraUtil; import com.enqualcomm.support.utils.Connection; import com.enqualcomm.support.utils.ICLogger; import com.enqualcomm.support.utils.NettyConnection; @@ -26,8 +28,13 @@ import com.enqualcomm.support.utils.Util; import java.io.File; import java.util.ArrayList; import java.util.HashMap; +import java.util.concurrent.TimeUnit; + +import rx.Observable; +import rx.functions.Action1; import static com.enqualcomm.support.Constants.ACTION_HEATR_RATE_START; +import static com.enqualcomm.support.Constants.ACTION_REMOTE_CAMERA; import static com.enqualcomm.support.LocationClient.LOCATION_MODE; import static com.enqualcomm.support.bean.Contact.GROUP_ALL; import static java.lang.Math.abs; @@ -119,12 +126,18 @@ public class protocol_ic { BPHP, APDE,//进出围栏通知 BPDE, - APDF,//体温阀值设置 - BPDF, + APDG,//体温阀值设置 + BPDG, APTU,//上传语音图片 BPTU, APSL,//上传睡眠数据 BPSL, + AP46,//立即拍照 + BP46, + APDH,//聆听 + BPDH, + AP99,//监听电话 + BP99, UNKNOWN_CMD, } @@ -154,6 +167,7 @@ public class protocol_ic { cmdMap.put(CMD_TYPE.BPHT, "BPHT"); cmdMap.put(CMD_TYPE.APTM, "APTM"); cmdMap.put(CMD_TYPE.BPTM, "BPTM"); + /* 服务器发起*/ cmdMap.put(CMD_TYPE.AP12, "AP12"); cmdMap.put(CMD_TYPE.BP12, "BP12"); cmdMap.put(CMD_TYPE.AP14, "AP14"); @@ -208,12 +222,19 @@ public class protocol_ic { cmdMap.put(CMD_TYPE.BPHP, "BPHP"); cmdMap.put(CMD_TYPE.APDE, "APDE"); cmdMap.put(CMD_TYPE.BPDE, "BPDE"); - cmdMap.put(CMD_TYPE.APDF, "APDF"); - cmdMap.put(CMD_TYPE.BPDF, "BPDF"); + cmdMap.put(CMD_TYPE.APDG, "APDG"); + cmdMap.put(CMD_TYPE.BPDG, "BPDG"); cmdMap.put(CMD_TYPE.APTU, "APTU"); cmdMap.put(CMD_TYPE.BPTU, "BPTU"); cmdMap.put(CMD_TYPE.APSL, "APSL"); cmdMap.put(CMD_TYPE.BPSL, "BPSL"); + cmdMap.put(CMD_TYPE.AP46, "AP46"); + cmdMap.put(CMD_TYPE.BP46, "BP46"); + cmdMap.put(CMD_TYPE.APDH, "APDH"); + cmdMap.put(CMD_TYPE.BPDH, "BPDH"); + cmdMap.put(CMD_TYPE.AP99, "AP99"); + cmdMap.put(CMD_TYPE.BP99, "BP99"); + } @@ -1892,19 +1913,19 @@ public class protocol_ic { } - public static String APDF(String id){ - return new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.APDF)) + public static String APDG(String id){ + return new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.APDG)) .append(CMDSPLIT).append(id) .append(CMDEND).toString(); } - public void handleBPDF(NettyConnection connection,String cmd,Runtime runtime){ + public void handleBPDG(NettyConnection connection,String cmd,Runtime runtime){ /** * 示例: - * IWBPDF,353456789012345,1,30.0,37.3 # + * IWBPDG,353456789012345,1,30.0,37.3 # * 说明: * IW:标识符 - * BPDF: 命令字符 + * BPDG: 命令字符 * 353456789012345:设备IMEI或者ID * 080835 :指令流水号 * 1:开关 1开, 0 关 @@ -1919,14 +1940,14 @@ public class protocol_ic { String switch_on=list[2]; String min_temp=list[3]; String max_temp=list[4]; - connection.send(genStringMessage("APDF",APDF(index))); + connection.send(genStringMessage("APDG",APDG(index))); if ( Integer.parseInt(switch_on) == 1) { - ICLogger.i("Handle BPDF index " + index + ", 体温报警阈值开 min="+min_temp+",max="+max_temp); + ICLogger.i("Handle BPDG index " + index + ", 体温报警阈值开 min="+min_temp+",max="+max_temp); }else { - ICLogger.i("Handle BPDF index " + index + ", 体温报警阈值关 "); + ICLogger.i("Handle BPDG index " + index + ", 体温报警阈值关 "); } }else{ - ICLogger.i("BPDF format error!"); + ICLogger.i("BPDG format error!"); } } @@ -2015,6 +2036,7 @@ public class protocol_ic { if (receiveSuccess == 1){ //如果服务器接收 语音成功,则设置下一个要发送的语音包Index,当index == packetCount的时候表示所有包发送完毕,停止继续发送 voicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex); + //voicePacket.getInstanceSent().setFileType(ftype,dtype); } //发送消息,再次检查要发送的语音包,确认其发送完毕 connection.DeliverCMDMessageToSystem("SentVoicePacket","SentBPFilePacket"); @@ -2024,8 +2046,6 @@ public class protocol_ic { } } - - public static String APSL(String date,int deepsleep,int lightsleep,int score){ /*** * 示例: @@ -2055,6 +2075,109 @@ public class protocol_ic { return sb; } + public static String AP46(String id,String cmd) + { + return new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.AP46)) + .append(CMDSPLIT).append(id) + .append(CMDSPLIT).append(cmd) + .append(CMDEND).toString(); + } + + public void handleBP46(String cmd , NettyConnection connection,Runtime runtime) { +/*** + * IWBP46,353456789012345,080835,1,[参数]# + * 说明: + * IW:标识符 + * BP46 : 命令字符 + * 353456789012345:IMEI号,设备唯一ID + * 080835 :指令流水号 + * 1: 表示立即拍照 + * [参数]: 此为可选项。根据不同类型设备扩展 + * #:结尾标识符 + * 设备响应: IWAP46,080835,1# + * 080835:指令流水号 + * 1 成功 0失败 + * # 结尾标识符 + */ + String[] cmdlist=cmd.split(CMDSPLIT); + if (cmdlist.length==5){ + String imei=cmdlist[1]; + String id=cmdlist[2]; + String cdd=cmdlist[3]; + String tmp=cmdlist[4]; + + connection.send(genStringMessage("AP46",AP46(id,cdd))); + + if (cdd.equals("1")) { + //delay 启动 + Context context = mRuntime.getContextProxy().context.getApplicationContext(); +// Intent intent = new Intent(context, com.enqualcomm.support.CoreService.class); +// intent.setAction(ACTION_REMOTE_CAMERA); +// intent.putExtra("remote_number", id); +// context.startService(intent); +// runtime.getContextProxy().context.sendBroadcast(intent); + (new CameraUtil(context)).getPictur(id); + } + }else{ + ICLogger.i(" BP46 Format error!"); + } + + } + + + public static String APDH(String id,String cmd) + { + return new StringBuffer(CMDHEADER).append(cmdMap.get(CMD_TYPE.APDH)) + .append(CMDSPLIT).append(id) + .append(CMDSPLIT).append(cmd) + .append(CMDEND).toString(); + } + + + public void handleBPDH( NettyConnection connection,Runtime runtime,String cmd) { + /*** + * IWBPDH,353456789012345,080835,1,[参数]# + * 说明: + * IW:标识符 + * BPDH : 命令字符 + * 353456789012345:IMEI号,设备唯一ID + * 080835 :指令流水号 + * 1: 表示立即聆听 可扩展 + * [参数]: 此为可选项。录音时间 为空默认15秒 + * #:结尾标识符 + * 设备响应: IWAPDH,080835,1# + * 080835:指令流水号 + * 1 成功 0失败 + * # 结尾标识符 + */ + + String[] cmdlist=cmd.split(CMDSPLIT); + if (cmdlist.length==5){ + String imei=cmdlist[1]; + String id=cmdlist[2]; + String cdd=cmdlist[3]; + String tmp=cmdlist[4]; + + tmp=tmp.replace(CMDEND,"").trim(); + + if (tmp.isEmpty()) tmp="15"; + connection.send(genStringMessage("APDH",APDH(id,cdd))); + + if (cdd.equals("1")) { + //delay 启动 + Context context = mRuntime.getContextProxy().context.getApplicationContext(); + CoreService.getInstance().DevliverStringMessage("StartMonitor",tmp); + } + }else{ + ICLogger.i(" BPDH Format error!"); + } + } + + + + + + public boolean handleCmd(CMD_TYPE type, String cmd) { @@ -2121,10 +2244,10 @@ public class protocol_ic { mConnection.DeliverCMDMessageToSystem("StartLocate",cmd);//通知下面线程状态变化 break; -// case BP05: //L02服务器不适用 -// //查询服务器语音 返回信息 -// API.handleBP05(cmd); -// break; + case BP46: //立即拍照 + ICLogger.i("立即拍照!"); + handleBP46(cmd,mConnection,mRuntime); + break; case BP12: //收到设置SOS号码 @@ -2243,15 +2366,20 @@ public class protocol_ic { ICLogger.i("收到服务器 图片语音 消息 BPTU"); // mConnection.DeliverCMDMessageToSystem("APTU", "");//通知下面线程状态变化 break; - case BPDF: - handleBPDF(mConnection,cmd,mRuntime); + case BPDG: + handleBPDG(mConnection,cmd,mRuntime); ICLogger.i(" 收到 体温阈值设置!"); - mConnection.DeliverCMDMessageToSystem("APDF",cmd);//通知下面线程状态变化 + mConnection.DeliverCMDMessageToSystem("APDG",cmd);//通知下面线程状态变化 break; case BPSL: ICLogger.i("睡眠数据上传完毕!"); mConnection.DeliverCMDMessageToSystem("APSL",cmd);//通知下面线程状态变化 break; + + case BPDH: + ICLogger.i("聆听"); + handleBPDH(mConnection,mRuntime,cmd); + break; } return ret; diff --git a/app/version_code.properties b/app/version_code.properties index 4a3083e0..f7f253b8 100644 --- a/app/version_code.properties +++ b/app/version_code.properties @@ -1,2 +1,2 @@ -#Tue Aug 04 21:16:19 CST 2020 -VERSION_CODE=475 +#Thu Aug 06 03:19:06 CST 2020 +VERSION_CODE=476 diff --git a/local.properties b/local.properties index aad8a511..06d18e6a 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. -#Thu Jul 30 18:51:06 CST 2020 -sdk.dir=C\:\\Users\\incar\\AppData\\Local\\Android\\Sdk +#Wed Aug 05 23:43:00 CST 2020 +sdk.dir=D\:\\Android\\Sdk