package Method;
|
import java.util.Vector;
|
import BaoWen.Dell_55AA07;
|
import BaoWen.Udp_Receive;
|
import BaoWen.Urt_7000_port;
|
import Frame.Tag_IFrame;
|
import PbuliClass.Shi_jian_cha_sss;
|
import PbuliClass.Systems;
|
import person.Person;
|
import person.person_Dell;
|
import tag.Tag;
|
import tag.Tag_Dell;
|
import tbDataModel_Dell.Dell_Ip;
|
import tbDataModel_Dell.ReadPeizhiMessage;
|
import tbDataModel_Dell.Read_Write_Anchor_Message;
|
|
/**¸ÃÀàÓÃÓÚ¿ØÖƱêÇ©Ïà¹Ø²ÎÊý*/
|
public class ControTag {
|
|
/**×Ô¶¯Ð޸ıêǩƵÂÊ*/
|
public static void auto_alert_taghz(String pinlv,String tagid) {
|
// int hz=getpinglvint(pinlv);
|
//byte[] byt=Read_Write_Anchor_Message.write_one_taghz(hz, tagid,(byte)0x06);
|
//Dell_Ip.alert_one_ip(byt,tagid,"×Ô¶¯Ð޸ıêǩƵÂÊ");
|
}
|
|
/**Ð޸ıêÇ©µÄƵÂÊ*/
|
public static int set_tag_hz(String pinlv,String tagid) {
|
Dell_55AA07.setNum(0);
|
Tag_IFrame.get_text_area().setText("");
|
Tag_Dell.alert_succ();
|
int succ=0;
|
int needhz=Integer.parseInt(pinlv);
|
int hz=getpinglvint(pinlv);
|
byte[] byt=Read_Write_Anchor_Message.write_one_taghz(hz, tagid,(byte)0x06);
|
//ÐèÒªÐ޸ĵıêÇ©
|
if(tagid.equals("ËùÓбêÇ©")) {
|
byt=Read_Write_Anchor_Message.write_taghz(hz, Tag_Dell.tagzu(),(byte)0x06);
|
Dell_Ip.alert_all_ip(byt,"ÐÞ¸ÄËùÓбêǩƵÂÊ");
|
person_Dell.alert_all_tag_hz(hz,needhz);
|
Tag_Dell.alert_all_tag_hz(pinlv);
|
}else {
|
Tag tag=Tag_Dell.get_tag(tagid);
|
if(tag!=null) {
|
if(pinlv.equals("0.1")) {
|
tag.setDoublehz(0.1);
|
}
|
tag.setTag_pinglv(pinlv);
|
Dell_Ip.alert_one_ip(byt,tagid,"Ð޸ıêǩƵÂÊ");
|
Person person=person_Dell.get_Person(tagid);
|
person.setHz(hz);
|
person.setTagneedhz(needhz);
|
}
|
}
|
return succ;
|
}
|
|
/**»ñÈ¡ÆÀÂʶÔÓ¦µÄºÁÃëÊý*/
|
public static int getpinglvint(String a) {
|
int hz=1000;
|
switch(a){
|
case "0.1" :
|
hz=1000;
|
break;
|
case "1" :
|
hz=1000;
|
break;
|
case "2" :
|
hz=500;
|
break;
|
case "5" :
|
hz=200;
|
break;
|
case "10" :
|
hz=100;
|
break;
|
case "20" :
|
hz=50;
|
break;
|
case "25" :
|
hz=40;
|
break;
|
case "50" :
|
hz=20;
|
break;
|
}
|
return hz;
|
}
|
|
|
|
/**¿ØÖƱêÇ©´úÂë
|
* @param int zhiÐèÒªÐ޸ĵÄÖµ
|
* @param String tagid ÐèÒªÐ޸ĵıêÇ©ID
|
* @param byte dizhiÐèÒªÐ޸ĵĵØÖ·
|
* @param String messageÐèÒª·µ»ØµÄÐÅÏ¢**/
|
|
public static int konghzitag(int zhi,String tagchoose,byte dizhi,String message,String datafrom) {
|
Dell_55AA07.setNum(0);
|
Tag_IFrame.get_text_area().setText("");
|
Tag_Dell.alert_succ();
|
int succ=0;
|
byte[] byt=Read_Write_Anchor_Message.write_one_taghz(zhi, tagchoose,dizhi);
|
if(Systems.isWifi()) {
|
wifi_urt_fengming(tagchoose,zhi);
|
}else {
|
//ÐèÒªÐ޸ĵıêÇ©
|
if(tagchoose.equals("ËùÓбêÇ©")) {
|
byt=Read_Write_Anchor_Message.write_taghz(zhi, Tag_Dell.tagzu(),dizhi);
|
Dell_Ip.alert_all_ip(byt,datafrom);
|
}else {
|
Dell_Ip.alert_one_ip(byt,tagchoose,datafrom);
|
}
|
if(message.length()>1) {
|
Tag_IFrame.get_text_area().setText(tagchoose+"ÒÑÍê³ÉÏ·¢ÐÞ¸Ä"+message+"Ö¸Áî...");
|
|
}
|
}
|
return succ;
|
}
|
|
/**±äµçվģʽÏ¿ØÖƱêÇ©·äÃù*/
|
public static void fengming_biandianzhan(int zhi,String tagid,String ip) {
|
byte[] byt=Read_Write_Anchor_Message.write_one_taghz(zhi, tagid,(byte)0x10);
|
Udp_Receive.biandianzout(byt,byt.length, ip);
|
}
|
|
/**ÖØÆôËùÓбêÇ©£¬ÔÚÈí¼þ¿ªÆôʱºò*/
|
public static void restore_all_tag() {
|
ControTag.konghzitag(1,"ËùÓбêÇ©",(byte)0x60,"","Èí¼þ¿ªÆôÖØÆô±êÇ©");
|
}
|
|
/**ÖØÆôij¸ö±êÇ©*/
|
public static void restore_tag(String tagid) {
|
byte[] byt=Read_Write_Anchor_Message.write_one_taghz(1, tagid,(byte)0x60);
|
Dell_Ip.alert_one_ip(byt,tagid,"ÖØÆô±êÇ©");
|
}
|
|
/**×Ö·û´®×ª16½øÖÆbyt[]*/
|
public static byte[] getbyt(String message) {
|
byte[] byt=ReadPeizhiMessage.toByteArray(message);
|
return byt;
|
}
|
|
/**¿ØÖÆÄ³¸ö±êÇ©ÏÔʾij¸öÎÄ×Ö*/
|
public static void oled_onetag(String zhi0,String tagid) {
|
int zhi=Integer.parseInt(zhi0);
|
byte[] byt=Read_Write_Anchor_Message.write_one_taghz(zhi, tagid,(byte)0x29);
|
if(tagid.equals("ËùÓбêÇ©")) {
|
byt=Read_Write_Anchor_Message.write_taghz(zhi, Tag_Dell.tagzu(),(byte)0x29);
|
Dell_Ip.alert_all_ip(byt,"¿ØÖÆÏÔʾÎÄ×Ö");
|
}else {
|
Dell_Ip.alert_one_ip(byt,tagid,"¿ØÖÆÏÔʾÎÄ×Ö");
|
}
|
}
|
|
|
/**δÌí¼ÓµÄ±êǩע²áµÄʱºòÐ޸IJÎÊý**/
|
public static void noinkonghzitag(int zhi,String tagchoose,byte dizhi,String ancrid) {
|
byte[] byt=Read_Write_Anchor_Message.write_one_taghz(zhi, tagchoose,dizhi);
|
Dell_Ip.noinalert_one_ip(byt,tagchoose,ancrid);
|
}
|
|
/**¿ØÖÆ´øWIFIÉ豸·äÃù
|
* 55 AA 03 06 02 46 01 01 AC ff*/
|
public static void wifi_urt_fengming(String tagid,int value) {
|
if(tagid.equals("ËùÓбêÇ©")) {
|
Vector<Person> vcp=person_Dell.getPerson_vector();
|
int size=vcp.size();
|
for(int i=0;i<size;i++) {
|
String tagid0=vcp.get(i).getP_tagid();
|
wifi_urt_one_fengming( tagid0,value);
|
}
|
|
}else {
|
wifi_urt_one_fengming( tagid,value);
|
}
|
}
|
|
/**¿ØÖÆÄ³¸ö±êÇ©·äÃù*/
|
public static void wifi_urt_one_fengming(String tagid,int value) {
|
Person person=person_Dell.get_Person(tagid);
|
String time=person.getXinhaotime();
|
if(time.length()<5) {
|
return;
|
}
|
int b= Shi_jian_cha_sss.get_time_cha_s(GetNowTime.now(),time);
|
if(b<10) {
|
String ip=person.getBaoliu8();
|
String port=person.getBaoliu9();
|
if(port.length()>2) {
|
String a0="0306024601";
|
String lenth=Integer.toHexString(value);
|
if(lenth.length()<2) {
|
lenth="0"+lenth;
|
}
|
String a1=a0+lenth;
|
String jiaoyan=jiaoyan(a1);
|
String mes="55AA"+a1+jiaoyan;
|
byte[] byt=ReadPeizhiMessage.toByteArray(mes);
|
int size=byt.length;
|
Urt_7000_port.udp_out(byt,size, ip, port,tagid,mes);
|
}
|
}
|
}
|
|
|
/**УÑé*/
|
public static String jiaoyan(String a) {
|
String[] hex=StringToHex.hex(a);
|
int size=hex.length;
|
int sum=0;
|
for(int i=0;i<size;i++) {
|
sum+=Integer.parseInt(hex[i],16);
|
}
|
String hex16=Integer.toHexString(~sum);//È¡·´×ªÎª16½øÖÆ×Ö·û´®
|
int lenth=hex16.length();//×Ö·û´®µÄ³¤¶È
|
String hh=hex16.substring(lenth-4, lenth-2);
|
String ens=hex16.substring(lenth-2, lenth)+hh;
|
return ens;
|
}
|
|
|
}
|