From: snickersun Date: Wed, 5 Aug 2020 14:10:05 +0000 (+0800) Subject: protocol_ic 添加 APTU图片和音频传输支持 X-Git-Url: http://git.snicker.com.cn/sitemap.xml?a=commitdiff_plain;h=a6e8a5fff38e2e94fcf04b550b9a434aa6bb72a1;p=protocol_srv.git protocol_ic 添加 APTU图片和音频传输支持 --- diff --git a/app/src/main/java/com/enqualcomm/support/Config.java b/app/src/main/java/com/enqualcomm/support/Config.java index 2dbddfaf..3f26e3b6 100644 --- a/app/src/main/java/com/enqualcomm/support/Config.java +++ b/app/src/main/java/com/enqualcomm/support/Config.java @@ -357,6 +357,7 @@ public class Config { noTempSensor=true; if (c43_branch_name.equals("l05")) { SOSNoNeedDial=true; + noPPGSensor=false; }else{ noPPGSensor=true; } diff --git a/app/src/main/java/com/enqualcomm/support/CoreService.java b/app/src/main/java/com/enqualcomm/support/CoreService.java index 9a2e5df6..9e8715b2 100644 --- a/app/src/main/java/com/enqualcomm/support/CoreService.java +++ b/app/src/main/java/com/enqualcomm/support/CoreService.java @@ -698,7 +698,6 @@ public class CoreService extends Service { ICLogger.i("SitCheck 平均每分钟活动数大于参考值,则重置 lastCheckSitTime 以及 lastSitCheckStepCount"); Runtime.lastSitCheckStepCount=runtime.getTotalStepCount(); Runtime.lastSitCheckTiimeyyyyMMddHHmmss=TimeUtil.getSystemTime3(); - } } }else{ diff --git a/app/src/main/java/com/enqualcomm/support/bean/voicePacket.java b/app/src/main/java/com/enqualcomm/support/bean/voicePacket.java index 210f009a..92add632 100644 --- a/app/src/main/java/com/enqualcomm/support/bean/voicePacket.java +++ b/app/src/main/java/com/enqualcomm/support/bean/voicePacket.java @@ -59,6 +59,14 @@ public class voicePacket { filetype=type; datatype=dtype; } + + + public int getFiletype(){ + return filetype; + } + public int getDateType(){ + return datatype; + } ArrayList packetArray =new ArrayList(); public class voicepacketItem{ int currentId; 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 82ffa6e7..587ec45d 100644 --- a/app/src/main/java/com/enqualcomm/support/service/Deliver.java +++ b/app/src/main/java/com/enqualcomm/support/service/Deliver.java @@ -340,16 +340,16 @@ public static void sendLocationMSG( String Msg){ //收到SentVoicePacket 表示 有一个VoiceMessage要发送,需要从第0个包开始发送语音分包。 voicePacket voicepacket = voicePacket.getInstanceSent(); if (voicepacket.getCurrentIndexToSent() < voicepacket.getPacketCount()) { - ICLogger.i("voicepacket " + voicepacket.getName() + " " + 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.getVoicePacketWithIndex(voicepacket.getCurrentIndexToSent()).getPacketData(),voicepacket.getFiletype(),voicepacket.getDateType()) ); } else { - ICLogger.i("voicepacket " + voicepacket.getName() + " " + 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())) { 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 b0d52f83..7b174a2a 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java +++ b/app/src/main/java/com/enqualcomm/support/utils/ProcessReceiver.java @@ -267,10 +267,14 @@ public class ProcessReceiver extends BroadcastReceiver { String msgUrl=paramIntent.getStringExtra(KEY_MESSAGE_URL); ICLogger.i("receive msg to send type="+msgType+", msg from = "+msgFrom+", msgUrl"+msgUrl); if (msgFrom==null) msgFrom="123"; + /** + * * 1 语音—— 1.监听语音 * 2.SOS语音 * 3.扩展 + * * 2 图片—— 1.签到图片 * 2.指令图片 * 3.设备图片 * 4.扩展 + */ if (msgType.equals("voice")) { //创建voiceConent并添加到数据 - final VoiceContent voiceContent = VoiceContent.placeHolderOut(CONTACT_CATEGORY_GROUP, msgFrom, msgUrl); + final VoiceContent voiceContent = VoiceContent.placeHolderOut(CONTACT_CATEGORY_GROUP, msgFrom, msgUrl,1,3); // 把voiceContent拆解成1024的分包 Util.parseToVoicePacketSent(voiceContent); @@ -279,7 +283,7 @@ public class ProcessReceiver extends BroadcastReceiver { CoreService.getInstance().getConnection().DeliverCMDMessageToSystem("SentVoicePacket", ""); }else if (msgType.equals("pic")){ //创建voiceConent并添加到数据 - final VoiceContent voiceContent = VoiceContent.placeHolderOut(CONTACT_CATEGORY_GROUP, msgFrom, msgUrl,2,1); + final VoiceContent voiceContent = VoiceContent.placeHolderOut(CONTACT_CATEGORY_GROUP, msgFrom, msgUrl,2,3); // 把voiceContent拆解成1024的分包 Util.parseToVoicePacketSent(voiceContent); 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 e655c517..b787f2e8 100644 --- a/app/src/main/java/com/enqualcomm/support/utils/Util.java +++ b/app/src/main/java/com/enqualcomm/support/utils/Util.java @@ -811,8 +811,9 @@ public class Util { int count= (int)(filesize/1024); if ((filesize%1024)>0) count++; - ICLogger.i("File "+voiceContent.content+", size "+filesize+", count "+count); + ICLogger.i("File "+voiceContent.content+", size "+filesize+", count "+count + " filetype "+voiceContent.filetype + ", datatype "+voiceContent.datatype); voicePacket.getInstanceSent().clearPacket(); + voicePacket.getInstanceSent().setFileType(voiceContent.filetype,voiceContent.datatype); try { FileInputStream fis = new FileInputStream(voicefile); byte[] audiobuf = new byte[1024]; diff --git a/app/src/main/java/com/ic/protocols/protocolAPIHelper.java b/app/src/main/java/com/ic/protocols/protocolAPIHelper.java index d964d006..14ad1879 100644 --- a/app/src/main/java/com/ic/protocols/protocolAPIHelper.java +++ b/app/src/main/java/com/ic/protocols/protocolAPIHelper.java @@ -229,7 +229,7 @@ public class protocolAPIHelper { return ret; } - public static byte[] getVoicePacketItem(String packetTime,int count,int index,int datalen,byte[] amrdata){ + public static byte[] getVoicePacketItem(String packetTime,int count,int index,int datalen,byte[] amrdata,int filetype,int datatype){ byte[] ret=null; if (is_protocol_not_Initialled()) return null; switch(Config.protocol_no) @@ -241,7 +241,7 @@ public class protocolAPIHelper { ret=protocol_beehome.AP07(packetTime,count,index,datalen,amrdata); break; case Config.PROTOCOL_IC: - ret=protocol_ic.APTU(packetTime,1,1,count,index,datalen,amrdata); + ret=protocol_ic.APTU(packetTime,filetype,datatype,count,index,datalen,amrdata); break; case Config.PROTOCOL_FZD: ret=null;//protocol_fzd.AP07(packetTime,count,index,datalen,amrdata);