public class protocolAPIHelper {
- private static protocol_jiai protocoljiai_handler=null;
- private static protocol_beehome protocolbeehome_handler=null;
- private static protocol_ic protocolic_handler=null;
- private static protocol_fzd protocolfzd_handler=null;
- private static protocol_mqtt protocolmqtt_handler=null;
+ private static protocol_jiai protocoljiai_handler = null;
+ private static protocol_beehome protocolbeehome_handler = null;
+ private static protocol_ic protocolic_handler = null;
+ private static protocol_fzd protocolfzd_handler = null;
+ private static protocol_mqtt protocolmqtt_handler = null;
public protocolAPIHelper(Connection connect, Runtime runtime) {
- ICLogger.i("init Protocol "+Config.getProtocolNumber());
- if (protocolbeehome_handler==null)
- protocolbeehome_handler=new protocol_beehome(connect,runtime);
- if (protocoljiai_handler==null)
- protocoljiai_handler=new protocol_jiai(connect,runtime);
- if (protocolic_handler==null)
- protocolic_handler=new protocol_ic(connect,runtime);
- if (protocolfzd_handler==null)
- protocolfzd_handler=new protocol_fzd(connect,runtime);
- if (protocolmqtt_handler==null)
- protocolmqtt_handler=new protocol_mqtt(connect,runtime);
+ ICLogger.i("init Protocol " + Config.getProtocolNumber());
+ if (protocolbeehome_handler == null)
+ protocolbeehome_handler = new protocol_beehome(connect, runtime);
+ if (protocoljiai_handler == null)
+ protocoljiai_handler = new protocol_jiai(connect, runtime);
+ if (protocolic_handler == null)
+ protocolic_handler = new protocol_ic(connect, runtime);
+ if (protocolfzd_handler == null)
+ protocolfzd_handler = new protocol_fzd(connect, runtime);
+ if (protocolmqtt_handler == null)
+ protocolmqtt_handler = new protocol_mqtt(connect, runtime);
}
- private static boolean is_protocol_not_Initialled(){
- return (protocolbeehome_handler==null || protocoljiai_handler == null || protocolic_handler==null|| protocolfzd_handler==null ||protocolmqtt_handler==null);
+ private static boolean is_protocol_not_Initialled() {
+ return (protocolbeehome_handler == null || protocoljiai_handler == null || protocolic_handler == null || protocolfzd_handler == null || protocolmqtt_handler == null);
}
+
/*
返回true 表示 cmd 全部解析成功
返回false表示 cmd至少有一条解析失败,失败的数据归入buffer,下一次识别接着使用
字符串通过#号进行识别。
每个字符串如果发现 #,却又没有Header,“IW”则会被丢弃
*/
- public boolean parserCmd(String cmd_type,byte[] bytes) {
+ public boolean parserCmd(String cmd_type, byte[] bytes) {
//只要服务器收到消息,就认为服务器是联通的,保存联通的时间
- Runtime.lastLinkReceiveStamp=System.currentTimeMillis();
+ Runtime.lastLinkReceiveStamp = System.currentTimeMillis();
if (is_protocol_not_Initialled()) return false;
- switch(Config.protocol_no)
- {
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
protocoljiai_handler.parserCmd(bytes);
break;
protocolfzd_handler.parserCmd(bytes);
break;
case Config.PROTOCOL_MQTT:
- protocolmqtt_handler.parserCmd(cmd_type,bytes);
+ protocolmqtt_handler.parserCmd(cmd_type, bytes);
break;
}
return true;
}
- public static StringMessage genStringMessage(String cmdName, byte[] rawdata){
- StringMessage sm=new StringMessage(new String[]{cmdName,new String(rawdata) });
- sm.setDate(TimeUtil.getSystemDateYYMMDD(),TimeUtil.getSystemTimeHHmmss());
+
+ public static StringMessage genStringMessage(String cmdName, byte[] rawdata) {
+ StringMessage sm = new StringMessage(new String[]{cmdName, new String(rawdata)});
+ sm.setDate(TimeUtil.getSystemDateYYMMDD(), TimeUtil.getSystemTimeHHmmss());
return sm;
}
- public static StringMessage genStringMessage(String cmdName, String msg){
- StringMessage sm=new StringMessage(new String[]{cmdName,msg});
+
+ public static StringMessage genStringMessage(String cmdName, String msg) {
+ StringMessage sm = new StringMessage(new String[]{cmdName, msg});
sm.refresh(msg);
- sm.setDate(TimeUtil.getSystemDateYYMMDD(),TimeUtil.getSystemTimeHHmmss());
+ sm.setDate(TimeUtil.getSystemDateYYMMDD(), TimeUtil.getSystemTimeHHmmss());
return sm;
}
* @param msg
* @return
*/
- public static String isCmdStr(StringMessage msg){
- if(msg==null)
+ public static String isCmdStr(StringMessage msg) {
+ if (msg == null)
ICLogger.i("isCmdStr StringMessage is null");
if (is_protocol_not_Initialled()) {
ICLogger.i("isCmdStr is_protocol_not_Initialled ");
return "";
}
- String ret="";
- switch(Config.protocol_no)
- {
+ String ret = "";
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=protocol_jiai.isCmdStr(msg.isFromCache());
+ ret = protocol_jiai.isCmdStr(msg.isFromCache());
break;
case Config.PROTOCOL_BEEHOME:
- ret=protocol_beehome.isCmdStr(msg.isFromCache());
+ ret = protocol_beehome.isCmdStr(msg.isFromCache());
break;
case Config.PROTOCOL_IC:
- ret=protocol_ic.isCmdStr(msg.isFromCache());
+ ret = protocol_ic.isCmdStr(msg.isFromCache());
break;
case Config.PROTOCOL_FZD:
- ret=protocol_fzd.isCmdStr(msg.isFromCache());
+ ret = protocol_fzd.isCmdStr(msg.isFromCache());
break;
case Config.PROTOCOL_MQTT:
- ret=protocol_mqtt.isCmdStr(msg);
+ ret = protocol_mqtt.isCmdStr(msg);
break;
}
return ret;
}
- public static StringMessage getBindingMSG(Runtime runtime){
+
+ public static StringMessage getBindingMSG(Runtime runtime) {
if (is_protocol_not_Initialled()) return null;
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_BEEHOME:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_IC:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_FZD:
- ret=protocol_fzd.PING();
+ ret = protocol_fzd.PING();
break;
case Config.PROTOCOL_MQTT:
- ret=protocol_mqtt.LGZONE(runtime);
+ ret = protocol_mqtt.LGZONE(runtime);
break;
}
return ret;
}
- public static StringMessage getSyncTimeMSG(Runtime runtime){
+
+ public static StringMessage getSyncTimeMSG(Runtime runtime) {
if (is_protocol_not_Initialled()) return null;
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_BEEHOME:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_IC:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_FZD:
- ret=protocol_fzd.LGZONE(runtime);
+ ret = protocol_fzd.LGZONE(runtime);
break;
case Config.PROTOCOL_MQTT:
- ret=null;
+ ret = null;
break;
}
return ret;
}
- public static StringMessage getTemperatureMSG(double temp_adusted,double body_temp,double tempout,Runtime runtime){
+ public static StringMessage getTemperatureMSG(double temp_adusted, double body_temp, double tempout, Runtime runtime) {
if (is_protocol_not_Initialled()) return null;
- if (runtime==null){
- if (CoreService.getInstance()!=null)
- runtime=CoreService.getInstance().getRuntime();
- else
- {
+ if (runtime == null) {
+ if (CoreService.getInstance() != null)
+ runtime = CoreService.getInstance().getRuntime();
+ else {
ICLogger.i("Runtime == null !");
return null;
}
}
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=protocol_jiai.AP50(runtime);
+ ret = protocol_jiai.AP50(runtime);
break;
case Config.PROTOCOL_BEEHOME:
- ret=protocol_beehome.APTP(temp_adusted,body_temp);
+ ret = protocol_beehome.APTP(temp_adusted, body_temp);
break;
case Config.PROTOCOL_IC:
- ret=protocol_ic.APTP(temp_adusted,body_temp,tempout);
+ ret = protocol_ic.APTP(temp_adusted, body_temp, tempout);
break;
case Config.PROTOCOL_FZD:
- ret=protocol_fzd.temp(body_temp);
+ ret = protocol_fzd.temp(body_temp);
break;
case Config.PROTOCOL_MQTT:
- ret=protocol_mqtt.temp(body_temp,runtime);;
+ ret = protocol_mqtt.temp(body_temp, runtime);
+ ;
break;
}
return ret;
}
- public static StringMessage getChargingMSG(int charging){
+ public static StringMessage getChargingMSG(int charging) {
if (is_protocol_not_Initialled()) return null;
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
break;
case Config.PROTOCOL_BEEHOME:
break;
case Config.PROTOCOL_IC:
- if(Config.custom_name.equals("VitracK"))
- ret=protocol_ic.APCH(charging);
+ if (Config.custom_name.equals("VitracK"))
+ ret = protocol_ic.APCH(charging);
break;
case Config.PROTOCOL_FZD:
break;
return ret;
}
- public static StringMessage getWarningMSG(Runtime runtime){
+ public static StringMessage getWarningMSG(Runtime runtime) {
if (is_protocol_not_Initialled()) return null;
- StringMessage ret=null;
+ StringMessage ret = null;
runtime.dumpDevStatus();
- switch(Config.protocol_no)
- {
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=protocol_jiai.AP10(runtime);
+ ret = protocol_jiai.AP10(runtime);
break;
case Config.PROTOCOL_BEEHOME:
- ret=protocol_beehome.AP10(runtime);
+ ret = protocol_beehome.AP10(runtime);
break;
case Config.PROTOCOL_IC:
- ret=protocol_ic.AP10(runtime);
+ ret = protocol_ic.AP10(runtime);
break;
case Config.PROTOCOL_FZD:
- ret=protocol_fzd.AL(runtime);
+ ret = protocol_fzd.AL(runtime);
break;
case Config.PROTOCOL_MQTT:
- ret=protocol_mqtt.AL(runtime);
+ ret = protocol_mqtt.AL(runtime);
break;
}
return ret;
}
- public static StringMessage getLoginMSG(Runtime runtime){
+ public static StringMessage getLoginMSG(Runtime runtime) {
if (is_protocol_not_Initialled()) return null;
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=protocol_jiai.AP00(runtime);
+ ret = protocol_jiai.AP00(runtime);
break;
case Config.PROTOCOL_BEEHOME:
- ret=protocol_beehome.AP00(runtime);
+ ret = protocol_beehome.AP00(runtime);
break;
case Config.PROTOCOL_IC:
- ret=protocol_ic.AP00(runtime);
+ ret = protocol_ic.AP00(runtime);
break;
case Config.PROTOCOL_FZD:
- ret=protocol_fzd.LK();
+ ret = protocol_fzd.LK();
break;
case Config.PROTOCOL_MQTT:
- ret=protocol_mqtt.BREQ(runtime);
+ ret = protocol_mqtt.BREQ(runtime);
break;
}
return ret;
}
- public static StringMessage getHeartbeatMSG(Runtime runtime){
+ public static StringMessage getHeartbeatMSG(Runtime runtime) {
if (is_protocol_not_Initialled()) return null;
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=protocol_jiai.AP03(runtime);
+ ret = protocol_jiai.AP03(runtime);
break;
case Config.PROTOCOL_BEEHOME:
- ret=protocol_beehome.AP03(runtime);
+ ret = protocol_beehome.AP03(runtime);
break;
case Config.PROTOCOL_IC:
- ret=protocol_ic.AP03(runtime);
+ ret = protocol_ic.AP03(runtime);
break;
case Config.PROTOCOL_FZD:
- ret=protocol_fzd.KA(runtime);
+ ret = protocol_fzd.KA(runtime);
break;
case Config.PROTOCOL_MQTT:
- ret=protocol_mqtt.KA(runtime);
+ ret = protocol_mqtt.KA(runtime);
break;
}
return ret;
}
- public static StringMessage getGPSLocationMSG(Runtime runtime){
+ public static StringMessage getGPSLocationMSG(Runtime runtime) {
if (is_protocol_not_Initialled()) return null;
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=protocol_jiai.AP01(runtime);
+ ret = protocol_jiai.AP01(runtime);
break;
case Config.PROTOCOL_BEEHOME:
- ret=protocol_beehome.AP01(runtime);
+ ret = protocol_beehome.AP01(runtime);
break;
case Config.PROTOCOL_IC:
- ret=protocol_ic.AP01(runtime);
+ ret = protocol_ic.AP01(runtime);
break;
case Config.PROTOCOL_FZD:
- ret=protocol_fzd.UD(runtime);
+ ret = protocol_fzd.UD(runtime);
break;
case Config.PROTOCOL_MQTT:
- ret=protocol_mqtt.UD(runtime);
+ ret = protocol_mqtt.UD(runtime);
break;
}
return ret;
}
- public static StringMessage getLBSLocationMSG(Runtime runtime){
+
+
+ public static StringMessage getLBSLocationMSG(Runtime runtime) {
if (is_protocol_not_Initialled()) return null;
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=protocol_jiai.AP02(runtime);
+ ret = protocol_jiai.AP02(runtime);
break;
case Config.PROTOCOL_BEEHOME:
- ret=protocol_beehome.AP02(runtime);
+ ret = protocol_beehome.AP02(runtime);
break;
case Config.PROTOCOL_IC:
- ret=protocol_ic.AP02(runtime);
+ ret = protocol_ic.AP02(runtime);
break;
case Config.PROTOCOL_FZD:
- ret=protocol_fzd.UD(runtime);
+ ret = protocol_fzd.UD(runtime);
break;
case Config.PROTOCOL_MQTT:
- ret=protocol_mqtt.UD(runtime);
+ ret = protocol_mqtt.UD(runtime);
break;
}
return ret;
}
- public static byte[] getVoicePacketItem(String packetTime,int count,int index,int datalen,byte[] amrdata,int filetype,int datatype){
- byte[] ret=null;
+ 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)
- {
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=protocol_jiai.AP07(packetTime,count,index,datalen,amrdata);
+ ret = protocol_jiai.AP07(packetTime, count, index, datalen, amrdata);
break;
case Config.PROTOCOL_BEEHOME:
- ret=protocol_beehome.AP07(packetTime,count,index,datalen,amrdata);
+ ret = protocol_beehome.AP07(packetTime, count, index, datalen, amrdata);
break;
case Config.PROTOCOL_IC:
/***
* * 1 语音—— 1.监听语音 * 2.SOS语音 * 3.扩展
* * 2 图片—— 1.签到图片 * 2.指令图片 * 3.设备图片 * 4.扩展
*/
- if(filetype==1 && datatype==3){
+ if (filetype == 1 && datatype == 3) {
//对讲用的类型
- ret=protocol_ic.AP07(packetTime,count,index,datalen,amrdata);
- }else {
+ ret = protocol_ic.AP07(packetTime, count, index, datalen, amrdata);
+ } else {
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);
+ ret = null;//protocol_fzd.AP07(packetTime,count,index,datalen,amrdata);
break;
case Config.PROTOCOL_MQTT:
- ret=null;//protocol_fzd.AP07(packetTime,count,index,datalen,amrdata);
+ ret = null;//protocol_fzd.AP07(packetTime,count,index,datalen,amrdata);
break;
}
return ret;
}
- public static StringMessage getPPG_ECG_MSG(Runtime runtime){
+
+ public static StringMessage getPPG_ECG_MSG(Runtime runtime) {
if (is_protocol_not_Initialled()) return null;
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
//ret=protocol_jiai.APHP(runtime);
- ret=protocol_jiai.APHT(runtime);
+ ret = protocol_jiai.APHT(runtime);
break;
case Config.PROTOCOL_BEEHOME:
- ret=protocol_beehome.APHP(runtime);
+ ret = protocol_beehome.APHP(runtime);
break;
case Config.PROTOCOL_IC:
ret = protocol_ic.APHP(runtime);
break;
case Config.PROTOCOL_FZD:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_MQTT:
- ret=null;
+ ret = null;
break;
}
return ret;
}
- public static StringMessage getPPG_ECG_MSG(int ppg,int bph,int bpl){
+
+ public static StringMessage getPPG_ECG_MSG(int ppg, int bph, int bpl) {
if (is_protocol_not_Initialled()) return null;
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=protocol_jiai.APHT(ppg,bph,bpl);
+ ret = protocol_jiai.APHT(ppg, bph, bpl);
break;
case Config.PROTOCOL_BEEHOME:
- ret=protocol_beehome.APHT(ppg,bph,bpl);
+ ret = protocol_beehome.APHT(ppg, bph, bpl);
break;
case Config.PROTOCOL_IC:
- ret=protocol_ic.APHT(ppg,bph,bpl);
+ ret = protocol_ic.APHT(ppg, bph, bpl);
break;
case Config.PROTOCOL_FZD:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_MQTT:
- ret=null;
+ ret = null;
break;
}
return ret;
}
- public static StringMessage getBlood_MSG(int pbh, int pbl,Runtime runtime){
+ public static StringMessage getBlood_MSG(int pbh, int pbl, Runtime runtime) {
if (is_protocol_not_Initialled()) return null;
- if (runtime==null){
- if (CoreService.getInstance()!=null)
- runtime=CoreService.getInstance().getRuntime();
- else
- {
+ if (runtime == null) {
+ if (CoreService.getInstance() != null)
+ runtime = CoreService.getInstance().getRuntime();
+ else {
ICLogger.i("Runtime == null !");
return null;
}
}
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_BEEHOME:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_IC:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_FZD:
- ret=protocol_fzd.blood(pbl,pbh);
+ ret = protocol_fzd.blood(pbl, pbh);
break;
case Config.PROTOCOL_MQTT:
- ret=protocol_mqtt.blood(pbl,pbh,runtime);
+ ret = protocol_mqtt.blood(pbl, pbh, runtime);
break;
}
return ret;
}
- public static StringMessage getOxygen_MSG(int ox,Runtime runtime){
+ public static StringMessage getOxygen_MSG(int ox, Runtime runtime) {
if (is_protocol_not_Initialled()) return null;
- if (runtime==null){
- if (CoreService.getInstance()!=null)
- runtime=CoreService.getInstance().getRuntime();
- else
- {
+ if (runtime == null) {
+ if (CoreService.getInstance() != null)
+ runtime = CoreService.getInstance().getRuntime();
+ else {
ICLogger.i("Runtime == null !");
return null;
}
}
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_BEEHOME:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_IC:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_FZD:
- ret=protocol_fzd.oxygen(ox);
+ ret = protocol_fzd.oxygen(ox);
break;
case Config.PROTOCOL_MQTT:
- ret=protocol_mqtt.oxygen(ox,runtime);
+ ret = protocol_mqtt.oxygen(ox, runtime);
break;
}
return ret;
}
- public static StringMessage getPPG_MSG(int ppg,Runtime runtime){
+
+ public static StringMessage getPPG_MSG(int ppg, Runtime runtime) {
if (is_protocol_not_Initialled()) return null;
- if (runtime==null){
- if (CoreService.getInstance()!=null)
- runtime=CoreService.getInstance().getRuntime();
- else
- {
+ if (runtime == null) {
+ if (CoreService.getInstance() != null)
+ runtime = CoreService.getInstance().getRuntime();
+ else {
ICLogger.i("Runtime == null !");
return null;
}
}
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_BEEHOME:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_IC:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_FZD:
- ret=protocol_fzd.heart(ppg);
+ ret = protocol_fzd.heart(ppg);
break;
case Config.PROTOCOL_MQTT:
- ret=protocol_mqtt.heart(ppg,runtime);
+ ret = protocol_mqtt.heart(ppg, runtime);
break;
}
return ret;
}
- public static StringMessage getPPG_ECG_MSG(int ppg,int bph,int bpl,int spo2,Runtime runtime){
+
+ public static StringMessage getPPG_ECG_MSG(int ppg, int bph, int bpl, int spo2, Runtime runtime) {
if (is_protocol_not_Initialled()) return null;
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- // ret=protocol_jiai.APHP(ppg,bph,bpl,spo2);
- ret=protocol_jiai.APHT(ppg,bph,bpl);
+ // ret=protocol_jiai.APHP(ppg,bph,bpl,spo2);
+ ret = protocol_jiai.APHT(ppg, bph, bpl);
break;
case Config.PROTOCOL_BEEHOME:
- ret=protocol_beehome.APHP(ppg,bph,bpl,spo2);
+ ret = protocol_beehome.APHP(ppg, bph, bpl, spo2);
break;
case Config.PROTOCOL_IC:
ret = protocol_ic.APHP(ppg, bph, bpl, spo2);
break;
case Config.PROTOCOL_FZD:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_MQTT:
- ret=null;
+ ret = null;
break;
}
return ret;
}
- public static StringMessage getWeatherMSG(Runtime runtime){
+
+ public static StringMessage getWeatherMSG(Runtime runtime) {
if (is_protocol_not_Initialled()) return null;
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=protocol_jiai.APWT();
+ ret = protocol_jiai.APWT();
break;
case Config.PROTOCOL_BEEHOME:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_IC:
ret = protocol_ic.APTQ(runtime);
break;
case Config.PROTOCOL_FZD:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_MQTT:
- ret=null;
+ ret = null;
break;
}
return ret;
}
- public static String getDefaultServerIP(){
+ public static String getDefaultServerIP() {
- String ret="";
- switch(Config.protocol_no)
- {
+ String ret = "";
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=protocol_jiai.defaultServerIP;
+ ret = protocol_jiai.defaultServerIP;
break;
case Config.PROTOCOL_BEEHOME:
- ret=protocol_beehome.defaultServerIP;
+ ret = protocol_beehome.defaultServerIP;
break;
case Config.PROTOCOL_IC:
- ret=protocol_ic.defaultServerIP;
+ ret = protocol_ic.defaultServerIP;
break;
case Config.PROTOCOL_FZD:
- ret=protocol_fzd.defaultServerIP;
+ ret = protocol_fzd.defaultServerIP;
break;
case Config.PROTOCOL_MQTT:
- ret=protocol_mqtt.defaultServerIP;
+ ret = protocol_mqtt.defaultServerIP;
break;
}
return ret;
}
- public static int getDefaultServerPort(){
- int ret=8090;
- switch(Config.protocol_no)
- {
+ public static int getDefaultServerPort() {
+
+ int ret = 8090;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=protocol_jiai.defaultServerPort;
+ ret = protocol_jiai.defaultServerPort;
break;
case Config.PROTOCOL_BEEHOME:
- ret=protocol_beehome.defaultServerPort;
+ ret = protocol_beehome.defaultServerPort;
break;
case Config.PROTOCOL_IC:
- ret=protocol_ic.defaultServerPort;
+ ret = protocol_ic.defaultServerPort;
break;
case Config.PROTOCOL_FZD:
- ret=protocol_fzd.defaultServerPort;
+ ret = protocol_fzd.defaultServerPort;
break;
case Config.PROTOCOL_MQTT:
- ret=protocol_mqtt.defaultServerPort;
+ ret = protocol_mqtt.defaultServerPort;
break;
}
return ret;
}
- public static StringMessage getSleepMSG(SleepInfo sr,Runtime runtime){
+
+ public static StringMessage getSleepMSG(SleepInfo sr, Runtime runtime) {
if (is_protocol_not_Initialled()) return null;
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_BEEHOME:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_IC:
- if(Config.getProtocolServerHost(runtime.getContextProxy().context).equals(protocol_jiai.defaultServerIP))
- {
- ret=null;
- }else {
+ if (Config.getProtocolServerHost(runtime.getContextProxy().context).equals(protocol_jiai.defaultServerIP)) {
+ ret = null;
+ } else {
ret = protocol_ic.APSL(sr.getCurrentDate(), sr.getDeepsleep_minutes(), sr.getLightsleep_minutes(), sr.getScore());
}
break;
case Config.PROTOCOL_FZD:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_MQTT:
- ret=null;
+ ret = null;
break;
}
return ret;
}
- public static StringMessage getPushTxtReadFlagToSrvMSG(Runtime runtime ){
+ public static StringMessage getPushTxtReadFlagToSrvMSG(Runtime runtime) {
if (is_protocol_not_Initialled()) return null;
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=protocoljiai_handler.AP94();
+ ret = protocoljiai_handler.AP94();
break;
case Config.PROTOCOL_BEEHOME:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_IC:
- if(Config.getProtocolServerHost(runtime.getContextProxy().context).equals(protocol_jiai.defaultServerIP))
- {
- ret=protocolic_handler.AP94();;
- }else {
+ if (Config.getProtocolServerHost(runtime.getContextProxy().context).equals(protocol_jiai.defaultServerIP)) {
+ ret = protocolic_handler.AP94();
+ ;
+ } else {
ret = null;
}
break;
case Config.PROTOCOL_FZD:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_MQTT:
- ret=null;
+ ret = null;
break;
}
return ret;
}
- public static StringMessage getPRACTICE(){
+ public static StringMessage getPRACTICE() {
if (is_protocol_not_Initialled()) return null;
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_BEEHOME:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_IC:
ret = null;
break;
case Config.PROTOCOL_FZD:
- ret=protocol_fzd.PRACTICE(Runtime.healthInfo);
+ ret = protocol_fzd.PRACTICE(Runtime.healthInfo);
break;
case Config.PROTOCOL_MQTT:
- ret=null;
+ ret = null;
break;
}
return ret;
}
- public static StringMessage getBLEScanResult(Runtime runtime){
+ public static StringMessage getBLEScanResult(Runtime runtime) {
if (is_protocol_not_Initialled()) return null;
- StringMessage ret=null;
- switch(Config.protocol_no)
- {
+ StringMessage ret = null;
+ switch (Config.protocol_no) {
case Config.PROTOCOL_JIAI:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_BEEHOME:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_IC:
ret = protocol_ic.APBR(runtime);
break;
case Config.PROTOCOL_FZD:
- ret=null;
+ ret = null;
break;
case Config.PROTOCOL_MQTT:
- ret=null;
+ ret = null;
break;
}
return ret;
import android.content.ComponentName;
import android.content.Intent;
+import android.text.TextUtils;
import com.enqualcomm.support.Config;
import com.enqualcomm.support.CoreService;
private static final String CMDEND = "]";
private static final String CMDHEADERSPLIT = "*";
private static final String CMDSPLIT = ",";
- private static final boolean doEncryption=Util.getSystemProperties("persist.sys.encrypt_fzd","true").equals("true");
+ private static final boolean doEncryption = Util.getSystemProperties("persist.sys.encrypt_fzd", "true").equals("true");
public static final String defaultServerIP = "api.xcloudtech.com";
public static final int defaultServerPort = 9000;
blood,//血压上传
heart,//心率上传
PRACTICE,//自由锻炼数据上传
+ BRREG,//获取佰锐的ID
+ MEMBERS,//获取联系人列表
+ RTALK,//视频通话佰锐:对方拒接音视频聊天(服务器下发指令)
+ CALLING,//有人向你发起音视频聊天(服务器下发)
+ RCALLING,//拒绝对方的发起的通话请求
+ TALK,//向对方发起音视频聊天
UNKNOWN_CMD,
}
private static HashMap<CMD_TYPE, String> cmdMap = null;
static {
- cmdMap = new HashMap<CMD_TYPE, String>();
+ cmdMap = new HashMap<>();
cmdMap.put(CMD_TYPE.LK, "LK");
+ cmdMap.put(CMD_TYPE.MEMBERS, "MEMBERS");
+ cmdMap.put(CMD_TYPE.RTALK, "RTALK");
+ cmdMap.put(CMD_TYPE.RCALLING, "RCALLING");
+ cmdMap.put(CMD_TYPE.TALK, "TALK");
+ cmdMap.put(CMD_TYPE.CALLING, "CALLING");
cmdMap.put(CMD_TYPE.PING, "PING");
cmdMap.put(CMD_TYPE.KA, "KA");
cmdMap.put(CMD_TYPE.UD, "UD");
cmdMap.put(CMD_TYPE.blood, "blood");
cmdMap.put(CMD_TYPE.heart, "heart");
cmdMap.put(CMD_TYPE.PRACTICE, "PRACTICE");
+ cmdMap.put(CMD_TYPE.BRREG, "BRREG");
+
}
private Connection mConnection = null;
private StringBuffer cmdbuf = new StringBuffer();
-// /*
-// 输入的字符串,如果有完整命令,返回 true
-// 否则返回 false
-// */
-// public boolean isCmdStr(String msg) {
-// /***
-// * IC*334588000000156*LEN*FALLDOWN
-// */
-// String cmd;
-// int index=msg.indexOf(CMDSPLIT);
-// if (index > 0){
-// cmd = msg.substring(0,index);
-// }else{
-// cmd = msg;
-// }
-// if (regexUtil.isFZDCMD(cmd) ) {
-// return true;
-// }
-// return false;
-// }
private void log(String msg) {
ICLogger.log(TAG, msg);
StringBuilder sb = new StringBuilder();
int len = CMD.length();
String header = genHeader(len, CMD);
- if(doEncryption) {
- String keyheader = keyheader(CMD, len);
- sb.append(CMDHEADER).append(keyheader).append(header).append(CMDEND);
- }else{
+ if (doEncryption) {
+ String keyheader = keyheader(CMD, len);
+ sb.append(CMDHEADER).append(keyheader).append(header).append(CMDEND);
+ } else {
sb.append(CMDHEADER).append(header).append(CMDEND);
}
return genStringMessage(CMD, sb.toString());
String data_buf = CMD + CMDSPLIT + data;
int data_buf_len = data_buf.length();
String header = genHeader(data_buf_len, CMD);
- if(doEncryption) {
- String keyheader = keyheader(CMD, data_buf_len);//计算header md5值
- sb.append(CMDHEADER).append(keyheader).append(header).append(CMDSPLIT).append(data).append(CMDEND);
- }else{
+ if (doEncryption) {
+ String keyheader = keyheader(CMD, data_buf_len);//计算header md5值
+ sb.append(CMDHEADER).append(keyheader).append(header).append(CMDSPLIT).append(data).append(CMDEND);
+ } else {
sb.append(CMDHEADER).append(header).append(CMDSPLIT).append(data).append(CMDEND);
}
return genStringMessage(CMD, sb.toString());
if (datetime != null) {
ICLogger.i("===" + timezone + " " + TimeUtil.getDefaultTimeZone());
- TimeUtil.setTimeZone(runtime.getContextProxy().context,timezone);
+ TimeUtil.setTimeZone(runtime.getContextProxy().context, timezone);
ICLogger.i("===" + TimeUtil.getDefaultTimeZone());
- TimeUtil.setSysDateTime(runtime.getContextProxy().context, datetime, timezone,false);
+ TimeUtil.setSysDateTime(runtime.getContextProxy().context, datetime, timezone, false);
ICLogger.i("===" + TimeUtil.getDefaultTimeZone());
}
// Set Datetime 20200505112734
}
+ public static StringMessage MEMBERS() {
+ return genFZDCMD(cmdMap.get(CMD_TYPE.MEMBERS));
+ }
+
+
+ public static StringMessage BRREG() {
+ return genFZDCMD(cmdMap.get(CMD_TYPE.BRREG));
+ }
+
+
public static StringMessage PHL() {
return genFZDCMD(cmdMap.get(CMD_TYPE.PHL));
}
ICLogger.i(i / 2 + " 姓名 " + name + ", 电话 " + phonem);
contactArray.add(new Contact(Contact.CATEGORY_CALL, name, phonem));
}
-// contactArray.add(new Contact(Contact.CATEGORY_GROUP,"All","666"));
-// contactArray.add(new Contact(Contact.CATEGORY_PARTNER,"PARTNER","666"));
-// contactArray.add(new Contact(Contact.CATEGORY_CARE,"CARE","666"));
-// contactArray.add(new Contact(Contact.CATEGORY_VOLTE,"VOLTE","666"));
-
runtime.getDbHelper().saveContacts(contactArray, false, false, true, false, false, false);
} else {
ICLogger.i("没有电话本!执行清除操作!");
ICLogger.i("handleCmd " + type.name() + " strLen=" + data.length());
if (Config.LOG_TOFILE) ICLogger.logToFile("APILog", " recv " + cmd + " " + data);
switch (type) {
+ case MEMBERS:
+ ICLogger.i("收到群成员数据 ==> " + data);
+ //处理一下数据
+ handleMEMBERS(mRuntime, data);
+ break;
+ case RTALK:
+ //拒绝通话请求,当我们通过TALK向对方发起通话请求的时候,如果对方拒绝,则会收到此指令
+ //此指令由平台发送。
+ ICLogger.i("收到对方拒绝音视频通话的指令 == > " + data);
+ handleRTalk(mConnection, mRuntime, data);
+ break;
+ case TALK:
+ //0 表示可正常通话,-1 表示余额不足,不能通话,1 表示对方不在线或未登陆成功
+ ICLogger.i("收到向对方请求音视频通话的结果 ==> " + data);
+ handlerTalkRequestResult(mRuntime, data);
+ break;
+ case CALLING:
+ //有音视频聊天请求,此指令由平台发送,也就是被动通知
+ ICLogger.i("收到平台发送的音视频聊天请求 == > " + data);
+ handleCallRequest(mConnection, mRuntime, data);
+ break;
+ case RCALLING:
+ ICLogger.i("服务器收到了我拒绝音视频通话的消息");
+ break;
case LK: //登录包
ICLogger.i("服务器收到登录包LK");
mConnection.DeliverCMDMessageToSystem("login", cmd);//通知下面线程状态变化
handleCR(mConnection);
mConnection.DeliverCMDMessageToSystem("StartLocate", cmd);//通知下面线程状态变化
break;
-
-// case BP07:
-// //收到发送的语音包
-// handleBP07(cmd,mConnection);
-// break;
-// case BP10:
-// //报警包
-// mConnection.DeliverCMDMessageToSystem("AP10",cmd);//通知下面线程状态变化
-// break;
-//
-// case BPTM:
-// //校时命令
-// handleBPTM(cmd);
-// ICLogger.i("服务器收到校时命令APTM");
-// mConnection.DeliverCMDMessageToSystem("APTM",cmd);//通知下面线程状态变化
-// break;
-// case BP85://设置闹钟
-// handleBP85(cmd,mConnection,mRuntime);
-// ICLogger.i("收到服务器设置闹钟命令BP85");
-// mConnection.DeliverCMDMessageToSystem("AP85",cmd);//通知下面线程状态变化
-// break;
case UPLOAD:
//设置工作模式
handleUPLOAD(mConnection, mRuntime, cmd, data);
mConnection.DeliverCMDMessageToSystem("setWorkMod", cmd);//通知下面线程状态变化
-//
-// break;
-// case BP34:
-// //设置工作模式
-// handleBP34(mConnection,mRuntime,cmd);
-// mConnection.DeliverCMDMessageToSystem("setWorkMod",cmd);//通知下面线程状态变化
-// break;
-//
-//// case BP05: //L02服务器不适用
-//// //查询服务器语音 返回信息
-//// API.handleBP05(cmd);
-//// break;
-//
case SOS:
//收到设置SOS号码
handleSOS(mConnection, mRuntime, cmd, data);
ICLogger.i("收到服务器设置白名单号码命令PHL");
handlePHL(mConnection, mRuntime, cmd, data);
break;
-// case BP15:
-// handleBP15(cmd,mConnection,mRuntime);
-// ICLogger.i("收到服务器设置定位命令BP15");
-// break;
-// case BP17:
-// //收到恢复出厂设置
-// handleBP17(mConnection,cmd);
-// ICLogger.i("收到服务器恢复出厂设置命令BP17");
-// mConnection.DeliverCMDMessageToSystem("FactoryReset",cmd);//通知下面线程状态变化
-// break;
-//
-// case BP18:
-// //收到重启
-// handleBP18(mConnection,cmd);
-// ICLogger.i("收到服务器重启命令BP18");
-// mConnection.DeliverCMDMessageToSystem("Reboot",cmd);//通知下面线程状态变化
-// break;
-//
case POWEROFF:
//收到关机
handlePOWEROFF(mConnection);
ICLogger.i("收到服务器关机命令BP31");
mConnection.DeliverCMDMessageToSystem("poweroff", cmd);//通知下面线程状态变化
break;
-// case BP40:
-// //服务器推送文本
-// handleBP40(mConnection,mRuntime,cmd);
-// ICLogger.i("收到服务器推送文本消息");
-// mConnection.DeliverCMDMessageToSystem("showTxt",cmd);//通知下面线程状态变化
-// break;
-//
case hrtstart:
handleHrtstart(mConnection);
ICLogger.i("收到服务器心率检测命令");
break;
case blood:
ICLogger.i("服务器收到上传的血压");
- mConnection.DeliverCMDMessageToSystem("blood", cmd);//通知下面线程状态变化,用Deliver发送的话必须发,表示服务器响应了
+ //通知下面线程状态变化,用Deliver发送的话必须发,表示服务器响应了
+ mConnection.DeliverCMDMessageToSystem("blood", cmd);
break;
case oxygen:
ICLogger.i("服务器收到上传的血氧");
- mConnection.DeliverCMDMessageToSystem("oxygen", cmd);//通知下面线程状态变化,用Deliver发送的话必须发,表示服务器响应了
+ //通知下面线程状态变化,用Deliver发送的话必须发,表示服务器响应了
+ mConnection.DeliverCMDMessageToSystem("oxygen", cmd);
break;
case temp:
ICLogger.i("服务器收到上传的体温");
- mConnection.DeliverCMDMessageToSystem("temp", cmd);//通知下面线程状态变化,用Deliver发送的话必须发,表示服务器响应了
+ //通知下面线程状态变化,用Deliver发送的话必须发,表示服务器响应了
+ mConnection.DeliverCMDMessageToSystem("temp", cmd);
break;
case heart:
ICLogger.i("服务器收到上传的心率heart");
- mConnection.DeliverCMDMessageToSystem("heart", cmd);//通知下面线程状态变化,用Deliver发送的话必须发,表示服务器响应了
+ //通知下面线程状态变化,用Deliver发送的话必须发,表示服务器响应了
+ mConnection.DeliverCMDMessageToSystem("heart", cmd);
break;
case LGZONE:
ICLogger.i("收到服务器时间 LGZONE " + data);
handleFIND(mConnection);
mConnection.DeliverCMDMessageToSystem("findDev", cmd);//通知下面线程状态变化
break;
-// case BP89:
-// //心率/血压阀值
-// handleBP89(cmd,mConnection);
-// mConnection.DeliverCMDMessageToSystem("AP89",cmd);//通知下面线程状态变化
-// break;
-//
-// case BPTE: //设置测试体温
-// handleBPTE(cmd,mConnection,mRuntime);
-// mConnection.DeliverCMDMessageToSystem("APTE",cmd);//通知下面线程状态变化
-// break;
-//
-// case BPTP:
-// handleBPTP();
-// mConnection.DeliverCMDMessageToSystem("APTP",cmd);//通知下面线程状态变化
-// break;
-// case BPHP:
-// handleBPHP();
-// mConnection.DeliverCMDMessageToSystem("IWAPHP",cmd);//通知下面线程状态变化
-// break;
-// case BPX1://设置 心率血压血氧修正值
-// handleBPX1(cmd,mConnection,mRuntime);
-// ICLogger.i("收到服务器设置 心率血压血氧修正值BPX1");
-// mConnection.DeliverCMDMessageToSystem("APX1",cmd);//通知下面线程状态变化
-// break;
-//
-// case BPS4: //提醒设置(时间段) 主要为久坐设置提醒时长。
-// handleBPS4(cmd,mConnection,mRuntime);
-// ICLogger.i("收到 提醒设置(时间段)");
-// mConnection.DeliverCMDMessageToSystem("APS4",cmd);//通知下面线程状态变化
-// break;
-// case BPDE:
-// handleBPDE(mConnection,cmd,mRuntime);
-// ICLogger.i(" 收到 进出围栏通知!");
-// mConnection.DeliverCMDMessageToSystem("APDE",cmd);//通知下面线程状态变化
-// break;
-//
-// case BPTU:
-// handleBPTU(cmd, mConnection);
-// ICLogger.i("收到服务器 图片语音 消息 BPTU");
-// // mConnection.DeliverCMDMessageToSystem("APTU", "");//通知下面线程状态变化
-// break;
-// case BPDF:
-// handleBPDF(mConnection,cmd,mRuntime);
-// ICLogger.i(" 收到 体温阈值设置!");
-// mConnection.DeliverCMDMessageToSystem("APDF",cmd);//通知下面线程状态变化
-// break;
-
}
-
return ret;
}
+ /**
+ * 有通话请求
+ * 注:终端一旦收到该请求,则需要确保音视频 sdk 处于连接状态的,如果未登陆,要登陆后回复服 务端,
+ * [XT*YYYYYYYYYYYYYYY*LEN*CALLING,呼叫者 id,会议 id(没有则留空,但位置保留),音频还是视 频(0 为音频,1 为视频)]
+ * 实例: [XT*334588000000156*0007*CALLING,d3e2f759f9d5af3858f3530b,,0]
+ * 终端回复: [XT*设备 ID*LEN*CALLING,音视频状态] 音视频状态,为 0 表示正常可通讯状态否则填上用音视频返回的状态码,
+ * 比如 200,如果未获取到 返回状态码,则填 1。 [XT*334588000000156*0009*CALLING,0]
+ *
+ * @param mConnection
+ * @param mRuntime
+ * @param data
+ */
+ private void handleCallRequest(Connection mConnection, Runtime mRuntime, String data) {
+ //TODO:
+ //需要回复平台结果
+ }
+
+ /**
+ * 对方拒绝音视频通话
+ * 注:终端一旦收到该请求,则表示对方拒接音视频聊天, [XT*YYYYYYYYYYYYYYY*LEN*RTALK,拒接者 id,会议 id,音频还是视频(0 为音频,1 为视频)]
+ * 实例: [XT*334588000000156*0007*RTALK,d3e2f759f9d5af3858f3530b,会议 id,0]
+ * 终端回复: [XT*设备 ID*LEN*RTALK]
+ * 实例:[XT*334588000000156*0009*RTALK]
+ *
+ * @param mConnection
+ * @param mRuntime
+ * @param data
+ */
+ private void handleRTalk(Connection mConnection, Runtime mRuntime, String data) {
+ //TODO:
+
+ //终端回复: [XT*设备 ID*LEN*RTALK]
+ mConnection.send(genFZDCMD(cmdMap.get(CMD_TYPE.RTALK)));
+ }
+
+
+ /**
+ * 向对方发起音视频通话
+ *
+ * @param type 通话类型 1 表示语音通话,2 表示视频通话
+ * @param remoteAccount 对方账号
+ * @return
+ */
+ public static StringMessage TALK(String type, String remoteAccount) {
+ //准备数据
+ StringBuilder sb = new StringBuilder();
+ sb.append(type);
+ sb.append(",");
+ sb.append(remoteAccount);
+ String data = sb.toString();
+ ICLogger.d("request talk == > " + data);
+ return genFZDCMD(cmdMap.get(CMD_TYPE.MEMBERS), data);
+ }
+
+
+ /**
+ * 拒绝与对方音视频通话
+ * <p>
+ * 注:终端一旦收到该请求,则需要确保音视频 sdk 处于连接状态的,如果未登陆,要登陆后回复服 务端,
+ * [XT*YYYYYYYYYYYYYYY*LEN*RCALLING,呼叫者 id,会议 id(没有则留空,但位置保留),音频还是视 频(0 为音频,1 为视频)]
+ * 实例: [XT*334588000000156*0007*RCALLING,d3e2f759f9d5af3858f3530b,,0]
+ * 终端回复: [XT*设备 ID*LEN*RCALLING]
+ * 实例:[XT*334588000000156*0009*RCALLING]
+ *
+ * @return
+ */
+ public static StringMessage RCALLING(String remoteUserId, String type) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(remoteUserId);
+ sb.append(",,");
+ sb.append(type);
+ String data = sb.toString();
+ ICLogger.i("reject call data == > " + data);
+ return genFZDCMD(cmdMap.get(CMD_TYPE.RCALLING), data);
+ }
+
+ /**
+ * 当向对方发起通话请求的时候,结果会从此方法回来。
+ * <p>
+ * 0 表示可正常通话,-1 表示余额不足,不能通话,1 表示对方不在线或未登陆成功
+ *
+ * @param mRuntime
+ * @param data
+ */
+ private void handlerTalkRequestResult(Runtime mRuntime, String data) {
+ ICLogger.d("handlerTalkRequestResult == > " + data);
+
+ }
+
+ /**
+ * 处理联系人列表
+ * 文档说明:
+ * 获取群成员列表 (佰锐的账号是整型) [XT*YYYYYYYYYYYYYYY*LEN*MEMBERS] 实例:[XT*334588000000156*0007*MEMBERS]
+ * 平台回复:[XT*设备 ID*LEN*MEMBERS,账号 1,昵称 1,电话 1,账号 2,昵称 2,电话 2.....]
+ * 实例: [XT*334588000000156*003F*MEMBERS,d3e2f759f9d5af3858f3530,爸爸,13662313580,妈妈,555]
+ * 以上数据部分使用 Unicode 编码,最终上面示例传到服务端将是:
+ * [XT*334588000000156*00E4*MEMBERS,005B00530047002A003900340030003300300039003400310032
+ * 0032002A0030003000330046002A004D0045004D0042004500520053002C0064003300650032006600370
+ * 0350039006600390064003500610066003300380035003800660033003500330030002C72387238002C00
+ * 310033003600360032003300310033003500380030002C59885988002C003500350035005D]
+ * 如果没有群成员列表,则返回空,如[XT*334588000000156*00E4*MEMBERS,]
+ * 如果群成员没有电话,那么电话字段留空,比如上面示例中爸爸没有电话,那么则示例如下:
+ * [XT*334588000000156*003F*MEMBERS,d3e2f759f9d5af3858f3530b,爸爸,,妈妈,555]
+ *
+ * @param mRuntime
+ * @param data
+ */
+ private void handleMEMBERS(Runtime mRuntime, String data) {
+ //判断一下大小,有可能是没有数据的
+ if (!TextUtils.isEmpty(data)) {
+ ICLogger.d("members data == > " + data);
+ String s = Util.decodeUnicode2Utf8(data);
+ ICLogger.d("members result == > " + s);
+ }
+ }
+
public boolean handleCmd(CMD_TYPE type, String cmd, byte[] bytes) {