package baowen;
|
|
|
import index.JPanelMoudle.readParamsComp;
|
import index.JPanelMoudle.versionUpgradeComp;
|
|
import tools.ShowMessage;
|
import tools.Tools;
|
|
import java.math.BigInteger;
|
|
|
//标签心跳包
|
public class Dell_55AA34 {
|
static String[] hex;//字节数组
|
static String ip;
|
static int port;
|
|
//55AA3403240000
|
public static void dellrgs( String ip1,String infom, int port1) {
|
String jinDu="";//升级进度
|
ip = ip1;
|
port = port1;
|
hex = Tools.hex(infom);
|
if (hex.length>3) {
|
int datalenth1 = Tools.decodeHEX(hex[3]);//数据长度
|
datalenth1 = datalenth1 * 2 + 8;
|
int lenth = infom.length();
|
if (lenth == datalenth1) {
|
int i = decodeHEX(hex[4]);
|
String tagid="-----";
|
if (hex[3].equals("05")){
|
tagid = hex[6] + hex[5];
|
}
|
String anchorID = readParamsComp.getAnchorId_jf().getText();
|
if (tagid.equals(anchorID)||tagid.equals("-----")){
|
versionUpgradeComp.getUpdateAnchor_jf().setValue(i);
|
}
|
if (i==100||i==99){//设备升级进度达到100或者99时
|
ShowMessage.zidingyi("信标升级完成");
|
versionUpgradeComp.exitUpgradeXinBiao();
|
}
|
}
|
}
|
}
|
|
|
|
|
/**16进制转为10进制*/
|
public static int decodeHEX(String hexs){
|
BigInteger bigint=new BigInteger(hexs, 16);
|
int numb=bigint.intValue();
|
return numb;
|
|
}
|
|
|
|
}
|