package udptcp;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import java.util.Vector;
|
/**
|
* ´¦ÀíÔʼ±¨ÎÄ
|
*/
|
public class DellHexBaowen implements Runnable {
|
static int sleeptime = 1;
|
static Thread t;
|
static Vector<HexBaowen> allReceivedHexMessages = new Vector<HexBaowen>();
|
static int a = 0;
|
public static void intsert(String ip, String hex, String time, int port,int timestamp) {
|
HexBaowen HexBaowen = new HexBaowen();
|
HexBaowen.setHex(hex);
|
HexBaowen.setIp(ip);
|
HexBaowen.setAddtime(time);
|
HexBaowen.setTimestamp(timestamp);
|
HexBaowen.setPort(port);
|
allReceivedHexMessages.add(HexBaowen);
|
}
|
|
|
/**
|
* ´¦ÀíÔʼ±¨ÎÄ
|
*/
|
public void dellhex() {
|
int size = allReceivedHexMessages.size();
|
if (size == 0) {
|
sleeptime = 50;
|
return;
|
}
|
if (size > 100000) {//Èç¹ûÊý¾Ý´óÓÚ10ÍòÌõûÓд¦ÀíÔòÇå¿Õ
|
allReceivedHexMessages.removeAllElements();
|
} else {
|
sleeptime = 0;
|
HexBaowen HexBaowen0 = allReceivedHexMessages.get(0);
|
String ip = HexBaowen0.getIp();
|
int port = HexBaowen0.getPort();
|
String hex = HexBaowen0.getHex();
|
String time = HexBaowen0.getAddtime();
|
int timestamp = HexBaowen0.getTimestamp();
|
int lenth = hex.length();
|
try {
|
dellhex2(ip, port, hex, time, timestamp, lenth);//´¦ÀíÔʼÊý¾Ý
|
|
} catch (Exception e) {
|
logger.info("errorData:"+hex);
|
e.printStackTrace();
|
}
|
allReceivedHexMessages.remove(HexBaowen0);//ɾ³ý´¦Àí¹ýµÄ±¨ÎÄ
|
}
|
}
|
|
|
/**
|
* Æô¶¯Ï̵߳ķ½·¨
|
*/
|
public void startThread() {
|
t = new Thread(this);
|
t.start();
|
}
|
|
public void run() {
|
while (true) {
|
try {
|
dellhex();
|
Thread.sleep(sleeptime);//ÐÝÃßʱ¼ä
|
} catch (InterruptedException e) {
|
e.printStackTrace();
|
}
|
}
|
}
|
|
|
public static Vector<HexBaowen> get allReceivedHexMessages() {
|
return allReceivedHexMessages;
|
}
|
|
/**
|
* yang2023.07.08
|
*/
|
public static void dellhex2(String ip, int port, String hex, String time, int timestamp, int lenth) {
|
Have_Yuanshi_Do.Dell_yuanshi(ip, hex, time);
|
//// if (AnchorSet.isReadpeizhi()) {//Èç¹ûÉ豸´¦ÓÚ¶ÁÈ¡ÅäÖÃģʽ}
|
// else if (hex.startsWith("55AA02") && lenth == 32) {
|
// Dell_55AA02.dellrgs(hex, ip, port);
|
// } else
|
if (hex != null) {
|
if (hex.startsWith("55AA01") && lenth == 42) {//Èç¹ûÊǺϷ¨µÄ55AA01Êý¾Ý
|
Dell_55AA01.dell_55AA01(ip, hex, time, timestamp, port);
|
HexBaowenShow.ok("2", "55AA01", hex, ip, LanguageTools.getTranslation(CLYSBW));//±¨ÎÄÏÔʾ
|
//Èç¹ûÊǺϷ¨µÄ²â¾àÊý¾Ý
|
} else if (hex.startsWith("55AA0C")) {
|
Dell_HexBaowen_55AA0C.intsert(ip, hex, time, port,"0");
|
} else if (hex.startsWith("55AA12")) {
|
Dell_HexBaowen_55AA0C.intsert(ip, hex, time, port,"0");
|
}else if (hex.startsWith("55AA22")) {
|
Dell_HexBaowen_55AA0C.intsert(ip, hex, time, port,"0");
|
}else if (hex.startsWith("55AA24")) {
|
Dell_HexBaowen_55AA0C.intsert(ip, hex, time, port,"0");
|
}else if (hex.startsWith("55AA23")) {
|
Dell_HexBaowen_55AA0C.intsert(ip, hex, time, port,"0");
|
}else if (hex.startsWith("55AA0A")) {
|
Dell_HexBaowen_55AA0C.intsert(ip, hex, time, port,"0");
|
} else if (hex.startsWith("55AA1A") ) {
|
Dell_HexBaowen_55AA0C.intsert(ip, hex, time, port,"0");
|
} else if (hex.startsWith("55AA20") ) {
|
Dell_HexBaowen_55AA0C.intsert(ip, hex, time, port,"0");
|
}else if (hex.startsWith("55AACC") ) {
|
Dell_HexBaowen_55AA0C.intsert(ip, hex, time, port,"0");
|
}else if (hex.startsWith("55AACD") ) {
|
Dell_HexBaowen_55AA0C.intsert(ip, hex, time, port,"0");
|
}else if (hex.startsWith("55AACF") ) {
|
Dell_HexBaowen_55AA0C.intsert(ip, hex, time, port,"0");
|
}else if (hex.startsWith("55AA07")) {
|
//Ð޸ķµ»ØÐÅÏ¢
|
Dell_55AA07.dell(ip, hex.toString());
|
HexBaowenShow.ok("2", "55AA07", hex, ip, LanguageTools.getTranslation(CLYSBW));
|
//»ùÕ¾ÊÕµ½ÅúÁ¿Ð޸ıêÇ©ÐÅÏ¢55AA09080B0C00000000D7FFio
|
} else if (hex.startsWith("55AA09") ) {
|
HexBaowenShow.ok("2", "55AA09", hex, ip, LanguageTools.getTranslation(CLYSBW));
|
//»ùÕ¾·µ»Ø×´Ì¬Öµ55AA100E18980100000000000000000030
|
} else if (hex.startsWith("55AA10") ) {
|
//µ÷Óô¦Àí×¢²áÐÅÏ¢µÄ·½·¨
|
Dell_55AA10.dell(hex);
|
HexBaowenShow.ok("2", "55AA10", hex, ip, LanguageTools.getTranslation(CLYSBW));
|
|
} else if (hex.startsWith("55AA0E")) {
|
HexBaowenShow.ok("2", "55AA0E", hex, ip, LanguageTools.getTranslation(CLYSBW));
|
Dell_55AA0E.dell(hex);
|
}else if (hex.startsWith("55AA02")) {
|
Dell_55AA02.dellrgs(hex, ip, port);
|
|
} else if (hex.startsWith("55AA31")) {
|
Dell_55AA31.dellrgs(hex, ip, port);
|
//»ùÕ¾ÐÄÌø°ü
|
}else if (hex.startsWith("55AA32")) {
|
Dell_55AA32.dellrgs(hex, ip, port);
|
//´¦ÀíÉý¼¶½ø¶È
|
}else if (hex.startsWith("55AA34")) {
|
Dell_55AA34.dellrgs(hex, ip, port);
|
//´¦Àí×¢²á±¨ÎÄ
|
}else if (hex.startsWith("55AA03")) {
|
HexBaowenShow.ok("2", "55AA03", hex, ip, LanguageTools.getTranslation(CLYSBW));
|
Dell_55AA03.dell(ip, hex,port);
|
//Èç¹ûÊÇÐÄÌø°ü
|
}else if (hex.startsWith("55AA39")) {
|
HexBaowenShow.ok("2", "55AA39", hex, ip, LanguageTools.getTranslation(CLYSBW));
|
Dell_55AA39.dell(ip, hex,port);
|
//Èç¹ûÊÇÐÄÌø°ü
|
} else if (hex.startsWith("55AA14")) {
|
HexBaowenShow.ok("2", "55AA14", hex, ip, LanguageTools.getTranslation(CLYSBW));
|
Dell_55AA14.dell_14(ip, time, hex, timestamp, port);
|
|
}else {
|
Dell_uanshi_byt.intsert(ip, hex, time, timestamp, port);
|
}
|
}
|
}
|
|
|
public static Logger getLogger() {
|
return logger;
|
}
|
}
|