-[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":978,"versionName":"2110191611","enabled":true,"outputFile":"ICSer_V978_2110191611_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V978_2110191611_release.apk","properties":{}}]
\ No newline at end of file
+[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":979,"versionName":"2110201800","enabled":true,"outputFile":"ICSer_V979_2110201800_release.apk","fullName":"release","baseName":"release"},"path":"ICSer_V979_2110201800_release.apk","properties":{}}]
\ No newline at end of file
import java.util.ArrayList;\r
import java.util.Iterator;\r
\r
-public class voicePacket {\r
+public class VoicePacket {\r
\r
\r
- private static voicePacket gvoicePacket = null;\r
+ private static VoicePacket gvoicePacket = null;\r
\r
- public synchronized static voicePacket getInstance() {\r
+ public synchronized static VoicePacket getInstance() {\r
if (gvoicePacket == null)\r
- gvoicePacket = new voicePacket();\r
+ gvoicePacket = new VoicePacket();\r
return gvoicePacket;\r
}\r
\r
- private static voicePacket gvoicepacket_sent = null;\r
+ private static VoicePacket gvoicepacket_sent = null;\r
\r
- public synchronized static voicePacket getInstanceSent() {\r
- if (gvoicepacket_sent == null)\r
- gvoicepacket_sent = new voicePacket();\r
+ public synchronized static VoicePacket getInstanceSent() {\r
+ if (gvoicepacket_sent == null) {\r
+ gvoicepacket_sent = new VoicePacket();\r
+ }\r
return gvoicepacket_sent;\r
}\r
\r
import com.enqualcomm.support.bean.Runtime;
import com.enqualcomm.support.bean.StringMessage;
import com.enqualcomm.support.bean.VoiceContent;
-import com.enqualcomm.support.bean.voicePacket;
+import com.enqualcomm.support.bean.VoicePacket;
import com.enqualcomm.support.provider.ICDatabaseHelper;
import com.enqualcomm.support.provider.WeTalkMessageProvider;
import com.enqualcomm.support.service.base.AbstractConnectionService;
if (cmd.equals("SentVoicePacket")) {
//收到BP07 表示服务器收到一个voicePacket 分包成功,开始检查下一个包是否存在需要发送。
//收到SentVoicePacket 表示 有一个VoiceMessage要发送,需要从第0个包开始发送语音分包。
- voicePacket voicepacket = voicePacket.getInstanceSent();
+ VoicePacket voicepacket = VoicePacket.getInstanceSent();
+ ICLogger.d("voicepacket toString " + voicepacket.toString());
+ ICLogger.d("voicepacket.getCurrentIndexToSent() ==> " + voicepacket.getCurrentIndexToSent());
+ ICLogger.d("voicepacket.getPacketCount() ==> " + voicepacket.getPacketCount());
if (voicepacket.getCurrentIndexToSent() < voicepacket.getPacketCount()) {
ICLogger.i("voicepacket " + voicepacket.getName() + " filetype " + voicepacket.getFiletype() + " , datatype " + voicepacket.getDateType() + " " + voicepacket.getPacketTime() + " send " + (voicepacket.getCurrentIndexToSent() + 1) + "/" + voicepacket.getPacketCount());
if (mConnection instanceof NettyConnection) {
if (CoreService.getInstance().getConnection() != null)
CoreService.getInstance().getConnection().DeliverCMDMessageToSystem("SentVoicePacket", "");
}, recordtime * 1000);
- }catch (Exception e){
- ICLogger.e(e.getMessage(),e);
+ } catch (Exception e) {
+ ICLogger.e(e.getMessage(), e);
}
return true;
}
ICLogger.d("content --- > " + content);
//todo:还有类型也要查询出来
int type = query.getInt(query.getColumnIndex("type"));
+ ICLogger.d("type ==> " + type);
query.close();
if (type == ICDatabaseHelper.MessageType.VOICE) {
protocolAPIHelper.sendVoice(duration, remoteNum, content, lastPathSegment);
package com.enqualcomm.support.utils;\r
\r
-import com.enqualcomm.support.bean.voicePacket;\r
-\r
import java.io.File;\r
import java.io.FileInputStream;\r
import java.io.FileNotFoundException;\r
// 把voiceContent拆解成1024的分包
Util.parseToVoicePacketSent(voiceContent, 1024);
//trigger 分包发送
- if (CoreService.getInstance().getConnection() != null)
+ if (CoreService.getInstance().getConnection() != null) {
CoreService.getInstance().getConnection().DeliverCMDMessageToSystem("SentVoicePacket", "");
+ }
} else if (msgType.equals("pic")) {
//创建voiceConent并添加到数据
final VoiceContent voiceContent = VoiceContent.placeHolderOut(CONTACT_CATEGORY_GROUP, msgFrom, "0000", msgUrl, 2, 3);
Util.parseToVoicePacketSent(voiceContent, 1024);
//trigger 分包发送
if (CoreService.getInstance().getConnection() != null) {
-
//h88专用功能,拍照时检查体温心率
if (Util.getSystemProperties("persist.sys.do_check_condition", "false").equals("true")) {
//开启测温
import com.enqualcomm.support.CoreService;
import com.enqualcomm.support.bean.Runtime;
import com.enqualcomm.support.bean.VoiceContent;
-import com.enqualcomm.support.bean.voicePacket;
+import com.enqualcomm.support.bean.VoicePacket;
import com.enqualcomm.support.service.Deliver;
import com.ic.protocols.protocolAPIHelper;
sb.append("00").append(hexS.toLowerCase());
} else if (ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS) {
//全角半角字符
- int j = ((int) myBuffer[i] - 65248);
+ int j = ((int) myBuffer[i] - 65248);
String hexS = Integer.toHexString(j);
sb.append("00").append(hexS);
} else {
}
public static boolean parseToVoicePacketSent(VoiceContent voiceContent, int packetSize) {
-
- long filesize;
- File voicefile = new File(voiceContent.content);
- if (voicefile.exists()) {
- filesize = voicefile.length();
-
- int count = (int) (filesize / packetSize);
- if ((filesize % packetSize) > 0)
+ long fileSize;
+ File voiceFile = new File(voiceContent.content);
+ ICLogger.d("voiceFile ==> " + voiceFile);
+ if (voiceFile.exists()) {
+ fileSize = voiceFile.length();
+ int count = (int) (fileSize / packetSize);
+ if ((fileSize % packetSize) > 0) {
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);
- voicePacket.getInstanceSent().setSender(voiceContent.contactNumber);
+ }
+ 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);
+ VoicePacket.getInstanceSent().setSender(voiceContent.contactNumber);
try {
- FileInputStream fis = new FileInputStream(voicefile);
- byte[] audiobuf = new byte[packetSize];
+ FileInputStream fis = new FileInputStream(voiceFile);
+ byte[] audioBuf = new byte[packetSize];
for (int i = 0; i < count; i++) {
- int readbytes = fis.read(audiobuf, 0, packetSize);
- voicePacket.getInstanceSent().appendVoice(voiceContent.contactNumber, "", count, i, readbytes, audiobuf);
+ int readBytes = fis.read(audioBuf, 0, packetSize);
+ VoicePacket.getInstanceSent().appendVoice(voiceContent.contactNumber, "", count, i, readBytes, audioBuf);
}
fis.close();
- voicePacket.getInstanceSent().setCurrentIndexToSent(0);
- voicePacket.getInstanceSent().setPacketTime(TimeUtil.getSystemTime3());
+ VoicePacket.getInstanceSent().setCurrentIndexToSent(0);
+ VoicePacket.getInstanceSent().setPacketTime(TimeUtil.getSystemTime3());
if (voiceContent.filetype == 1) //* 1 语音—— 1.监听语音 * 2.SOS语音 * 3.扩展
{
int duration = Util.getDuration(voiceContent.content);
- voicePacket.getInstanceSent().setDurationHex(String.format("%04X", duration));
+ VoicePacket.getInstanceSent().setDurationHex(String.format("%04X", duration));
} else {
- voicePacket.getInstanceSent().setDurationHex("0000");
+ VoicePacket.getInstanceSent().setDurationHex("0000");
}
+ ICLogger.d("handle data okay ==> " + VoicePacket.getInstanceSent().toString());
return true;
} catch (Exception e) {
e.printStackTrace();
ICLogger.e(e.getMessage(), e);
}
-
}
return false;
}
protocolfzd_handler.sendPicture(remoteNum, imagePath, imageId);
break;
case Config.PROTOCOL_MQTT:
-
break;
case PROTOCOL_ANAN:
-
break;
case Config.PROTOCOL_S123:
-
+ protocols123_handler.sendPicture(remoteNum, imagePath, imageId);
break;
case Config.PROTOCOL_GATOR:
import android.media.AudioManager;
import android.net.Uri;
import android.os.Environment;
-import android.os.SystemProperties;
-import android.os.UserHandle;
import android.provider.Settings;
import android.support.v4.app.ActivityCompat;
import android.telephony.TelephonyManager;
import com.enqualcomm.support.bean.Runtime;
import com.enqualcomm.support.bean.StringMessage;
import com.enqualcomm.support.bean.VoiceContent;
-import com.enqualcomm.support.bean.voicePacket;
+import com.enqualcomm.support.bean.VoicePacket;
import com.enqualcomm.support.provider.ICAlarmProvider;
import com.enqualcomm.support.provider.ICDatabaseHelper;
import com.enqualcomm.support.provider.ICGlobalSettingsProvider;
packetIndex + "/" + packetCount + " " + (receiveSuccess == 1 ? "成功" : "失敗"));
if (receiveSuccess == 1) {
//如果服务器接收 语音成功,则设置下一个要发送的语音包Index,当index == packetCount的时候表示所有包发送完毕,停止继续发送
- voicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex);
+ VoicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex);
}
//发送消息,再次检查要发送的语音包,确认其发送完毕
connection.DeliverCMDMessageToSystem("SentVoicePacket", "SentVoicePacket");
ICLogger.d(stringBuffer.toString());
connection.send(AP28(Name, appendIndex, packetCount, currentId, 1));
- voicePacket.getInstance().appendVoice(Name,
+ VoicePacket.getInstance().appendVoice(Name,
appendIndex, packetCount, currentId, packetLen, packetData);
- ICLogger.d("================" + voicePacket.getInstance().toString());
- if (voicePacket.getInstance().isFinished()) {
+ ICLogger.d("================" + VoicePacket.getInstance().toString());
+ if (VoicePacket.getInstance().isFinished()) {
String dir = Environment.getExternalStorageDirectory() + "/Android/VoiceCache";
- String amrFilepath = Util.saveFile(voicePacket.getInstance().getVoicePacketBytes(), 0, voicePacket.getInstance().getVoicePacketLen(), new File(dir), "receive_" + voicePacket.getInstance().getPacketTime() + ".amr");
+ String amrFilepath = Util.saveFile(VoicePacket.getInstance().getVoicePacketBytes(), 0, VoicePacket.getInstance().getVoicePacketLen(), new File(dir), "receive_" + VoicePacket.getInstance().getPacketTime() + ".amr");
ICLogger.i("save Amr file to " + amrFilepath);
- voicePacket.getInstance().clearPacket();
+ VoicePacket.getInstance().clearPacket();
VoiceContent voiceContent = VoiceContent.placeHolderIn(Content.CONTACT_CATEGORY_GROUP, GROUP_ALL, amrFilepath);
import com.enqualcomm.support.bean.Runtime;
import com.enqualcomm.support.bean.StringMessage;
import com.enqualcomm.support.bean.VoiceContent;
-import com.enqualcomm.support.bean.voicePacket;
+import com.enqualcomm.support.bean.VoicePacket;
import com.enqualcomm.support.provider.ICAlarmProvider;
import com.enqualcomm.support.provider.ICDatabaseHelper;
import com.enqualcomm.support.service.HeartRateManager;
ICLogger.i("服务器在" + time + " 收到语音 " + packetIndex + "/" + packetCount + " " + (receiveSuccess == 1 ? "成功" : "失敗"));
if (receiveSuccess == 1) {
//如果服务器接收 语音成功,则设置下一个要发送的语音包Index,当index == packetCount的时候表示所有包发送完毕,停止继续发送
- voicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex);
+ VoicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex);
}
//发送消息,再次检查要发送的语音包,确认其发送完毕
connection.DeliverCMDMessageToSystem("SentVoicePacket", "SentVoicePacket");
log(stringBuffer.toString());
connection.send(AP28(Name, appendIndex, packetCount, currentId, 1));
- voicePacket.getInstance().appendVoice(Name, appendIndex, packetCount, currentId, packetLen, packetData);
- log("================" + voicePacket.getInstance().toString());
- if (voicePacket.getInstance().isFinished()) {
+ VoicePacket.getInstance().appendVoice(Name, appendIndex, packetCount, currentId, packetLen, packetData);
+ log("================" + VoicePacket.getInstance().toString());
+ if (VoicePacket.getInstance().isFinished()) {
String dir = Environment.getExternalStorageDirectory() + "/Android/VoiceCache";
- String amrFilepath = Util.saveFile(voicePacket.getInstance().getVoicePacketBytes(), 0, voicePacket.getInstance().getVoicePacketLen(), new File(dir), "receive_" + voicePacket.getInstance().getPacketTime() + ".amr");
+ String amrFilepath = Util.saveFile(VoicePacket.getInstance().getVoicePacketBytes(), 0, VoicePacket.getInstance().getVoicePacketLen(), new File(dir), "receive_" + VoicePacket.getInstance().getPacketTime() + ".amr");
ICLogger.i("save Amr file to " + amrFilepath);
- voicePacket.getInstance().clearPacket();
+ VoicePacket.getInstance().clearPacket();
VoiceContent voiceContent = VoiceContent.placeHolderIn(Content.CONTACT_CATEGORY_GROUP, GROUP_ALL, amrFilepath);
import com.enqualcomm.support.bean.Silent;
import com.enqualcomm.support.bean.StringMessage;
import com.enqualcomm.support.bean.VoiceContent;
-import com.enqualcomm.support.bean.voicePacket;
+import com.enqualcomm.support.bean.VoicePacket;
import com.enqualcomm.support.provider.ICAlarmProvider;
import com.enqualcomm.support.provider.ICDatabaseHelper;
import com.enqualcomm.support.provider.ICMembersProvider;
connection.send(BP12(ds, sourceNumb, count, index, time, true));
byte packetData[] = Util.subArray(bytes, cmdlist[0].length() + cmdlist[1].length() + cmdlist[2].length() + cmdlist[3].length() + cmdlist[4].length() + cmdlist[5].length() + 6, bytes.length - 1);
- voicePacket.getInstance().appendVoice(sourceNumb, time, count, index, ipackagelen, packetData);
- log("================" + voicePacket.getInstance().toString());
- if (voicePacket.getInstance().isFinished()) {
+ VoicePacket.getInstance().appendVoice(sourceNumb, time, count, index, ipackagelen, packetData);
+ log("================" + VoicePacket.getInstance().toString());
+ if (VoicePacket.getInstance().isFinished()) {
String dir = Environment.getExternalStorageDirectory() + "/Android/VoiceCache";
- String amrFilepath = Util.saveFile(voicePacket.getInstance().getVoicePacketBytes(), 0, voicePacket.getInstance().getVoicePacketLen(), new File(dir), "receive_" + voicePacket.getInstance().getPacketTime() + ".amr");
+ String amrFilepath = Util.saveFile(VoicePacket.getInstance().getVoicePacketBytes(), 0, VoicePacket.getInstance().getVoicePacketLen(), new File(dir), "receive_" + VoicePacket.getInstance().getPacketTime() + ".amr");
ICLogger.i("save Amr file to " + amrFilepath);
- voicePacket.getInstance().clearPacket();
+ VoicePacket.getInstance().clearPacket();
VoiceContent voiceContent = VoiceContent.placeHolderIn(Content.CONTACT_CATEGORY_GROUP, GROUP_ALL, amrFilepath);
final Uri uri2 = ds.getDbHelper().insertMessage(voiceContent);
//回复UI消息,表示已经接收到
ICLogger.i("服务器在" + time + " 收到 " + sender + " 语音 " + duration + " " + packetIndex + "/" + packetCount + " " + (receiveSuccess == 1 ? "成功" : (receiveSuccess == 0 ? "失敗" : "非亲情号")));
if (receiveSuccess == 1) {
//如果服务器接收 语音成功,则设置下一个要发送的语音包Index,当index == packetCount的时候表示所有包发送完毕,停止继续发送
- voicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex);
+ VoicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex);
//发送消息,再次检查要发送的语音包,确认其发送完毕
connection.DeliverCMDMessageToSystem("SentVoicePacket", "SentVoicePacket");
} else if (receiveSuccess == 0) {
import com.enqualcomm.support.bean.Runtime;
import com.enqualcomm.support.bean.StringMessage;
import com.enqualcomm.support.bean.VoiceContent;
-import com.enqualcomm.support.bean.voicePacket;
+import com.enqualcomm.support.bean.VoicePacket;
import com.enqualcomm.support.provider.ICAlarmProvider;
import com.enqualcomm.support.provider.ICDatabaseHelper;
import com.enqualcomm.support.service.HeartRateManager;
ICLogger.i("服务器在" + time + " 收到语音 " + packetIndex + "/" + packetCount + " " + (receiveSuccess == 1 ? "成功" : "失敗"));
if (receiveSuccess == 1) {
//如果服务器接收 语音成功,则设置下一个要发送的语音包Index,当index == packetCount的时候表示所有包发送完毕,停止继续发送
- voicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex);
+ VoicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex);
}
//发送消息,再次检查要发送的语音包,确认其发送完毕
connection.DeliverCMDMessageToSystem("SentVoicePacket", "SentVoicePacket");
log(stringBuffer.toString());
connection.send(AP28(Name, appendIndex, packetCount, currentId, 1));
- voicePacket.getInstance().appendVoice(Name, appendIndex, packetCount, currentId, packetLen, packetData);
- log("================" + voicePacket.getInstance().toString());
- if (voicePacket.getInstance().isFinished()) {
+ VoicePacket.getInstance().appendVoice(Name, appendIndex, packetCount, currentId, packetLen, packetData);
+ log("================" + VoicePacket.getInstance().toString());
+ if (VoicePacket.getInstance().isFinished()) {
String dir = Environment.getExternalStorageDirectory() + "/Android/VoiceCache";
- String amrFilepath = Util.saveFile(voicePacket.getInstance().getVoicePacketBytes(), 0, voicePacket.getInstance().getVoicePacketLen(), new File(dir), "receive_" + voicePacket.getInstance().getPacketTime() + ".amr");
+ String amrFilepath = Util.saveFile(VoicePacket.getInstance().getVoicePacketBytes(), 0, VoicePacket.getInstance().getVoicePacketLen(), new File(dir), "receive_" + VoicePacket.getInstance().getPacketTime() + ".amr");
ICLogger.i("save Amr file to " + amrFilepath);
- voicePacket.getInstance().clearPacket();
+ VoicePacket.getInstance().clearPacket();
VoiceContent voiceContent = VoiceContent.placeHolderIn(Content.CONTACT_CATEGORY_GROUP, GROUP_ALL, amrFilepath);
final Uri uri2 = runtime.getDbHelper().insertMessage(voiceContent);
//回复UI消息,表示已经接收到
ICLogger.i("服务器在收到 index " + time + ", 文件类型 " + ftype + ",内容类型 " + dtype + " " + packetIndex + "/" + packetCount + " " + (receiveSuccess == 1 ? "成功" : "失敗"));
if (receiveSuccess == 1) {
//如果服务器接收 语音成功,则设置下一个要发送的语音包Index,当index == packetCount的时候表示所有包发送完毕,停止继续发送
- voicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex);
+ VoicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex);
//voicePacket.getInstanceSent().setFileType(ftype,dtype);
}
//发送消息,再次检查要发送的语音包,确认其发送完毕
import com.enqualcomm.support.bean.Runtime;
import com.enqualcomm.support.bean.StringMessage;
import com.enqualcomm.support.bean.VoiceContent;
-import com.enqualcomm.support.bean.voicePacket;
+import com.enqualcomm.support.bean.VoicePacket;
import com.enqualcomm.support.provider.ICAlarmProvider;
import com.enqualcomm.support.provider.ICDatabaseHelper;
import com.enqualcomm.support.service.HeartRateManager;
ICLogger.i("服务器在" + time + " 收到语音 " + packetIndex + "/" + packetCount + " " + (receiveSuccess == 1 ? "成功" : "失敗"));
if (receiveSuccess == 1) {
//如果服务器接收 语音成功,则设置下一个要发送的语音包Index,当index == packetCount的时候表示所有包发送完毕,停止继续发送
- voicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex);
+ VoicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex);
}
//发送消息,再次检查要发送的语音包,确认其发送完毕
connection.DeliverCMDMessageToSystem("SentVoicePacket", "SentVoicePacket");
log(stringBuffer.toString());
connection.send(AP28(Name, appendIndex, packetCount, currentId, 1));
- voicePacket.getInstance().appendVoice(Name, appendIndex, packetCount, currentId, packetLen, packetData);
- log("================" + voicePacket.getInstance().toString());
- if (voicePacket.getInstance().isFinished()) {
+ VoicePacket.getInstance().appendVoice(Name, appendIndex, packetCount, currentId, packetLen, packetData);
+ log("================" + VoicePacket.getInstance().toString());
+ if (VoicePacket.getInstance().isFinished()) {
String dir = Environment.getExternalStorageDirectory() + "/Android/VoiceCache";
- String amrFilepath = Util.saveFile(voicePacket.getInstance().getVoicePacketBytes(), 0, voicePacket.getInstance().getVoicePacketLen(), new File(dir), "receive_" + voicePacket.getInstance().getPacketTime() + ".amr");
+ String amrFilepath = Util.saveFile(VoicePacket.getInstance().getVoicePacketBytes(), 0, VoicePacket.getInstance().getVoicePacketLen(), new File(dir), "receive_" + VoicePacket.getInstance().getPacketTime() + ".amr");
ICLogger.i("save Amr file to " + amrFilepath);
- voicePacket.getInstance().clearPacket();
+ VoicePacket.getInstance().clearPacket();
VoiceContent voiceContent = VoiceContent.placeHolderIn(Content.CONTACT_CATEGORY_GROUP, GROUP_ALL, amrFilepath);
import com.enqualcomm.support.bean.SleepInfo;
import com.enqualcomm.support.bean.StringMessage;
import com.enqualcomm.support.bean.VoiceContent;
-import com.enqualcomm.support.bean.voicePacket;
+import com.enqualcomm.support.bean.VoicePacket;
import com.enqualcomm.support.provider.ICAlarmProvider;
import com.enqualcomm.support.provider.ICDatabaseHelper;
import com.enqualcomm.support.provider.ICGlobalSettingsProvider;
import static com.enqualcomm.support.Constants.FROM_SERVER;
import static com.enqualcomm.support.LocationClient.LOCATION_MODE;
import static com.enqualcomm.support.bean.Contact.GROUP_ALL;
+import static com.enqualcomm.support.bean.Content.CONTACT_CATEGORY_GROUP;
import static java.lang.Math.abs;
/**
mConnection.send(stringMessage);
}
+ public void sendPicture(String remoteNum, String imagePath, String imageId) {
+ //发送图片
+ final VoiceContent voiceContent =
+ VoiceContent.placeHolderOut(CONTACT_CATEGORY_GROUP, remoteNum, "0000",
+ imagePath, 2, 3);
+ remoteNum = "s123";
+ ICLogger.d("remote number is ==> " + remoteNum);
+ voiceContent.contactNumber = remoteNum;
+ // 把voiceContent拆解成1024的分包
+ Util.parseToVoicePacketSent(voiceContent, 1024);
+ //trigger 分包发送
+ if (CoreService.getInstance().getConnection() != null) {
+ //开启发送图片
+ CoreService.getInstance().getConnection().DeliverCMDMessageToSystem("SentVoicePacket", "");
+ }
+ }
+
public enum CMD_TYPE {
/*终端发起*/
AP00,//登录包
APWF,
BPSM,//快捷回复指令
APSM,
+ BP39,//白名单的补充
+ AP39,
UNKNOWN_CMD,
}
cmdMap.put(CMD_TYPE.BPRP, "BPRP");
cmdMap.put(CMD_TYPE.APFF, "APFF");
cmdMap.put(CMD_TYPE.BPFF, "BPFF");
+ cmdMap.put(CMD_TYPE.BP39, "BP39");
/* 服务器发起*/
cmdMap.put(CMD_TYPE.BP45, "BP45");
cmdMap.put(CMD_TYPE.AP45, "AP45");
cmdMap.put(CMD_TYPE.APWF, "APWF");
cmdMap.put(CMD_TYPE.BPSM, "BPSM");
cmdMap.put(CMD_TYPE.APSM, "APSM");
+ cmdMap.put(CMD_TYPE.AP39, "AP39");
}
resolver.delete(Uri.parse(ICMembersProvider.MEMBERS), "type=? and group_type is null", new String[]{
ICDatabaseHelper.MemberType.WHITE_LIST + ""
});
- resolver.delete(Uri.parse(ICMembersProvider.MEMBERS), "type=? and (group_type=? or group_type is null)", new String[]{
+ resolver.delete(Uri.parse(ICMembersProvider.MEMBERS), "type=? and group_type=?", new String[]{
ICDatabaseHelper.MemberType.WHITE_LIST + "", "0"
});
//从记录上看,
ICLogger.i("服务器在" + time + " 收到语音 " + packetIndex + "/" + packetCount + " " + (receiveSuccess == 1 ? "成功" : "失敗"));
if (receiveSuccess == 1) {
//如果服务器接收 语音成功,则设置下一个要发送的语音包Index,当index == packetCount的时候表示所有包发送完毕,停止继续发送
- voicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex);
+ VoicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex);
}
//发送消息,再次检查要发送的语音包,确认其发送完毕
connection.DeliverCMDMessageToSystem("SentVoicePacket", "SentVoicePacket");
log(stringBuffer.toString());
connection.send(AP28(Name, appendIndex, packetCount, currentId, 1));
- voicePacket.getInstance().appendVoice(Name, appendIndex, packetCount, currentId, packetLen, packetData);
- log("================" + voicePacket.getInstance().toString());
- if (voicePacket.getInstance().isFinished()) {
+ VoicePacket.getInstance().appendVoice(Name, appendIndex, packetCount, currentId, packetLen, packetData);
+ log("================" + VoicePacket.getInstance().toString());
+ if (VoicePacket.getInstance().isFinished()) {
String dir = Environment.getExternalStorageDirectory() + "/Android/VoiceCache";
- String amrFilepath = Util.saveFile(voicePacket.getInstance().getVoicePacketBytes(), 0, voicePacket.getInstance().getVoicePacketLen(), new File(dir), "receive_" + voicePacket.getInstance().getPacketTime() + ".amr");
+ String amrFilepath = Util.saveFile(VoicePacket.getInstance().getVoicePacketBytes(), 0, VoicePacket.getInstance().getVoicePacketLen(), new File(dir), "receive_" + VoicePacket.getInstance().getPacketTime() + ".amr");
ICLogger.i("save Amr file to " + amrFilepath);
- voicePacket.getInstance().clearPacket();
+ VoicePacket.getInstance().clearPacket();
VoiceContent voiceContent = VoiceContent.placeHolderIn(Content.CONTACT_CATEGORY_GROUP, GROUP_ALL, amrFilepath);
final Uri uri2 = runtime.getDbHelper().insertMessage(voiceContent);
//回复UI消息,表示已经接收到
ICLogger.i("服务器在收到 index " + time + ", 文件类型 " + ftype + ",内容类型 " + dtype + " " + packetIndex + "/" + packetCount + " " + (receiveSuccess == 1 ? "成功" : "失敗"));
if (receiveSuccess == 1) {
//如果服务器接收 语音成功,则设置下一个要发送的语音包Index,当index == packetCount的时候表示所有包发送完毕,停止继续发送
- voicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex);
+ VoicePacket.getInstanceSent().setCurrentIndexToSent(packetIndex);
//voicePacket.getInstanceSent().setFileType(ftype,dtype);
}
//发送消息,再次检查要发送的语音包,确认其发送完毕
break;
case APFX:
break;
+ case BP39:
+ ICLogger.d("收到白名单扩展..");
+ handleBP39(cmd);
+ break;
}
return ret;
}
+ /**
+ * IWBP39,353456789012345,080835,1,
+ * D3590D54|135xxxxxxxxxx,
+ * D3590D54|135xxxxxxxxxx,
+ * D3590D54|135xxxxxxxxxx,
+ * D3590D54|135xxxxxxxxxx,
+ * D3590D54|135xxxxxxxxxx,
+ * D3590D54|135xxxxxxxxxx,
+ * D3590D54|135xxxxxxxxxx,
+ * D3590D54|135xxxxxxxxxx,
+ * D3590D54|135xxxxxxxxxx,
+ * D3590D54|135xxxxxxxxxx#
+ *
+ * @param cmd
+ */
+ private void handleBP39(String cmd) {
+ cmd = cmd.replace(CMDEND, "");
+ //对数据进行切割
+ String[] split = cmd.split(CMDSPLIT);
+ if (split.length == 14) {
+ String index = split[2];
+ String groupId = split[3];
+ StringBuilder sb = new StringBuilder();
+ sb.append(CMDHEADER);
+ sb.append(cmdMap.get(CMD_TYPE.AP39));
+ sb.append(CMDSPLIT);
+ sb.append(index);
+ sb.append(CMDSPLIT);
+ ICLogger.d("index==> " + index + " group id ==> " + groupId);
+ //删除数据库里的数据
+ mRuntime.getContextProxy().getResolver()
+ .delete(Uri.parse(ICMembersProvider.MEMBERS),
+ "type=? and group_type=?", new String[]{
+ ICDatabaseHelper.MemberType.WHITE_LIST + "", groupId
+ });
+ for (int i = 4; i < 14; i++) {
+ String item = split[i];
+ ICLogger.d("item ==> " + item);
+ //数据入库
+ sb.append(item);
+ if (i != split.length - 1) {
+ sb.append(CMDSPLIT);
+ } else {
+ sb.append(CMDEND);
+ }
+ if ("|".equals(item)) {
+ continue;
+ }
+ //数据入库
+ String[] tmp = item.split("\\|");
+ if (tmp.length == 2) {
+ String name = Util.decodeUnicode2Utf8(tmp[0]);
+ String phonem = tmp[1];
+ ICLogger.i("phnums[" + i + "]=" + item + ",split = " + tmp.length + " , name=" + name + ",-" + phonem);
+ //contactArray.add(new Contact(Contact.CATEGORY_CALL, name, phonem));
+ ContentValues contentValues = new ContentValues();
+ contentValues.put(ICDatabaseHelper.fType, ICDatabaseHelper.MemberType.WHITE_LIST);
+ contentValues.put(ICDatabaseHelper.fPhoneNum, phonem);
+ contentValues.put(ICDatabaseHelper.fUserName, name);
+ //这个是第0组
+ contentValues.put(ICDatabaseHelper.fGroup, groupId);
+ contentValues.put(ICDatabaseHelper.fCreateTime, System.currentTimeMillis());
+ contentValues.put(ICDatabaseHelper.fUpdateTime, System.currentTimeMillis());
+ //TODO:保存到fzd的联系人列表,类型为白名单
+ mRuntime.getContextProxy().getResolver()
+ .insert(Uri.parse(ICMembersProvider.MEMBERS), contentValues);
+ } else {
+ ICLogger.i("phnums[" + i + "]=" + item + ",split = " + tmp.length);
+ }
+ }
+ String responseText = sb.toString();
+ ICLogger.d("responseText ==> " + responseText);
+ mConnection.send(genStringMessage(cmdMap.get(CMD_TYPE.AP39), responseText));
+ } else {
+ ICLogger.d("parse error =14=> " + cmd);
+ }
+ }
+
/**
* 设置二维码
*
-#Tue Oct 19 16:11:41 CST 2021\r
-VERSION_CODE=978\r
+#Wed Oct 20 18:00:38 CST 2021\r
+VERSION_CODE=979\r