package com.dev.electlock;
|
import gnu.io.SerialPort;
|
import gnu.io.UnsupportedCommOperationException;
|
|
import java.io.File;
|
import java.io.FileInputStream;
|
import java.io.IOException;
|
import java.nio.ByteBuffer;
|
import java.nio.ByteOrder;
|
import java.util.Date;
|
|
import javax.swing.JOptionPane;
|
import javax.swing.JTextArea;
|
|
import org.apache.logging.log4j.Logger;
|
|
import sp_comm.CommSerialPort;
|
import sp_comm.Comm_Socket;
|
import main.page_debug_inf;
|
|
import com.Com;
|
import com.ComFn;
|
import com.Crc16;
|
import com.PlaySound;
|
import com.dev.bts.data.FBS9100_ComBase;
|
import com.dev.bts.data.FBS9100_DFU;
|
import com.dev.electlock.data.ElectLock_ComBase;
|
import com.dev.electlock.data.ElectLock_State;
|
import com.dev.fbs9600_mon.SPCommMon;
|
import com.dev.modbus.MyModBusRtu;
|
import com.dev.simpower.dev.Power_ACData;
|
import com.dev.simpower.dev.Power_AlmParam;
|
import com.dev.simpower.dev.Power_AlmState;
|
import com.dev.simpower.dev.Power_ComBase;
|
import com.dev.simpower.dev.Power_LIBMSData;
|
import com.dev.simpower.dev.Power_ModelData;
|
import com.dev.simpower.dev.Power_Param;
|
import com.dev.simpower.dev.Power_RoadState;
|
import com.dev.simpower.dev.Power_TimeControl;
|
|
public class SPCommElectLock implements Runnable/*, SerialPortEventListener*/ {
|
|
public static final byte MODBUS_TYPE_YC = 0x01;
|
public static final byte MODBUS_TYPE_STD = 0x02;
|
|
public static final short CMD_TYPE_READ = 0x03;
|
|
public static final short CMD_TYPE_WRITE_YC = 0x05;
|
public static final short CMD_TYPE_WRITE_STD = 0x06;
|
public static final short CMD_TYPE_WRITE_MULTY = 0x10;
|
|
public static final int DEV_PARAM_DATA_STATE_NULL = 0;
|
public static final int DEV_PARAM_DATA_STATE_QUERY = 1;
|
public static final int DEV_PARAM_DATA_STATE_UPDATE = 2;
|
|
public static final int CommBautrate_Update = 115200;
|
|
private ByteBuffer dt_databuffer = ByteBuffer.allocate(0); //Ò£¿ØÒ£µ÷Êý¾Ý
|
private short dt_user_cmd = Power_ComBase.CMD_NULL;
|
private int dt_user_cmd_regaddr = 0; //Óû§¿ØÖÆÊ±µÄ¼Ä´æÆ÷µØÖ·
|
|
/*********************************************************************/
|
|
public short m_CMD_TYPE_WRITE = CMD_TYPE_WRITE_YC;
|
private byte m_MODBUS_TYPE = MODBUS_TYPE_YC;
|
|
private boolean CommThreadRunning = false;
|
public boolean AutoStartResTestEn = false;
|
public Date AutoStartResTestTime = new Date();
|
public Date AutoSaveResDataTime = new Date();
|
public boolean AutoSaveResDataEn = false;
|
public int AutoSaveResDataCount = 0;
|
public String AutoSaveDataFileName = "";
|
|
private ByteBuffer CommRxBuffer = ByteBuffer.allocate(1500);
|
private ByteBuffer CommTxBuffer = ByteBuffer.allocate(1048);
|
|
public int comm_tx_cnt = 0;
|
public int comm_rx_cnt = 0;
|
|
private int comm_bautrate = 9600;
|
public int dt_target_addr = 0;
|
public int m_ZDHJ_REG_CNT = 1;
|
public int ZDHJ_BattCount = -1;
|
//--------------------------------------------------------//
|
public int dev_param_data_state = 0;
|
public int dev_param_addr = 0;
|
public int dev_param_curr_range = 0;
|
public double dev_param_FloatCurrLev = 0;
|
public double dev_param_float_curr_lev = 0;
|
public double dev_param_wenbo_curr_lev = 0;
|
public int dev_param_auto_restest_interval = 0;
|
public int dev_param_res_test_type = 0;
|
public int dev_param_ResDisTestMethod = 0;
|
public int dev_param_Batt_StdCap = 0;
|
public double dev_param_res_dis_slope = 0;
|
public double dev_param_res_wenbo_slope = 0;
|
public int dev_param_monnum_setmode = 0;
|
public int dev_param_devid = 0;
|
public double[] dev_param_resparam_d = new double[4];
|
public double[] dev_param_resparam_s = new double[4];
|
//--------------------------------------------------------//
|
public int dev_stat_version = 0;
|
public int dev_stat_state = 0;
|
public double GroupVol = 0;
|
public double BattCurr = 0;
|
public int BattState = 0;
|
public int BattCurrDir = 0;
|
public double AvgWenBoCurr = 0;
|
public double PeakWenBoCurr = 0;
|
public int SpiCommErrCount = 0; //SPIͨÐÅ´íÎó¼ÆÊý
|
public int ResTestCount = 0; //ÄÚ×è²âÊÔ´ÎÊý
|
public int CurentResTestMode = 0; //µ±Ç°ÄÚ×è²âÊÔ·½·¨
|
public int BianhaoErrNum = 0; //±àºÅ´íÎóµ¥ÌåºÅ
|
public double ExTemp = 0; //ÍⲿζÈ
|
//--------------------------------------------------------//
|
public short mAddrSettedNow = 0;
|
|
private short dt_cmd = CMD_TYPE_READ;
|
public int dt_cmd_ack = Power_ComBase.CMD_NULL;
|
public MyModBusRtu rtu_rt;
|
|
public MyModBusRtu rtu_rx;
|
|
public Date dt_cmd_ack_time = new Date();
|
private short dt_cmd_regaddr = 0;
|
private short dt_cmd_regcnt = 0;
|
private short[] dt_cmd_regdata = null;
|
|
private int dt_cmd_cnt = 0;
|
|
private page_debug_inf dt_debug_inf;
|
private int m_COMM_PORT_TYPE = 0;
|
private CommSerialPort m_SP_Comm = null;
|
private Comm_Socket m_SocketComm = null;
|
private Logger m_Log = null;
|
|
private int read_libms_index = 0; //¶ÁÈ¡ï®µç³Ø°üË÷Òý
|
private int read_model_index = 0; //¶ÁÈ¡µçÔ´Ä£¿éË÷Òý
|
|
public Power_ACData m_AcData;
|
public ElectLock_State m_ElectLock_State;
|
public Power_LIBMSData[] m_LibmsDatas;
|
public Power_ModelData[] m_ModelDatas;
|
public Power_AlmState m_AlmState;
|
|
public Power_Param m_ParamFromDev; //É豸¶ÁÈ¡µÄ²ÎÊý
|
public Power_TimeControl m_TimeControlFromDev; //É豸¶ÁÈ¡µÄ²ÎÊý
|
public Power_RoadState m_RoadStateFromDev; //É豸¶ÁÈ¡µÄ²ÎÊý
|
|
public Power_AlmParam m_AlmParamFromDev; //É豸¶ÁÈ¡µÄ¸æ¾¯²ÎÊý
|
|
public String op_result = ""; //¿ØÖÆ·µ»Ø½á¹û
|
|
public String op_result_sysparam = ""; //ϵͳ²ÎÊý½á¹û×Ö·û´®
|
public String op_result_powerparam = ""; //µçÔ´½á¹û×Ö·û´®
|
public String op_result_almaram = ""; //µçÔ´¸æ¾¯½á¹û×Ö·û´®
|
public String op_result_jiaozhun = ""; //µçԴУ׼½á¹û×Ö·û´®
|
|
|
public short dt_user_cmd_ack = Power_ComBase.CMD_NULL; //²Ù×÷·µ»Ø½á¹û,ÓÃÓÚ½çÃæÅжÏgeng'xin
|
|
private boolean dt_dfu_en = false; //Ô¶³ÌÉý¼¶±êʶ
|
private boolean dt_change_commBautrate = false;
|
|
|
private JTextArea dt_show_msg; //Éý¼¶Îı¾ÐÅÏ¢Óò
|
|
private String dt_dfuFileName; //Éý¼¶ÎļþÃû³Æ
|
|
public SPCommElectLock(int addr_t, int bitrate, page_debug_inf debug, Logger log) {
|
dt_target_addr = addr_t & 0x00FF;
|
comm_bautrate = bitrate;
|
dt_debug_inf = debug;
|
m_Log = log;
|
rtu_rx = new MyModBusRtu();
|
|
m_RoadStateFromDev = new Power_RoadState();
|
m_TimeControlFromDev = new Power_TimeControl();
|
m_ParamFromDev = new Power_Param();
|
m_AcData = new Power_ACData();
|
m_AlmState = new Power_AlmState();
|
|
m_ElectLock_State = new ElectLock_State();
|
|
m_LibmsDatas = new Power_LIBMSData[Power_ComBase.LIBMSDATA_MAX_COUNT];
|
for(int i =0;i<m_LibmsDatas.length;i++) {
|
m_LibmsDatas[i] = new Power_LIBMSData();
|
}
|
|
m_ModelDatas = new Power_ModelData[Power_ComBase.LIMODEL_MAX_COUNT];
|
for(int i =0;i<m_LibmsDatas.length;i++) {
|
m_ModelDatas[i] = new Power_ModelData();
|
}
|
}
|
|
public void setCommBautrate(int bt_rate) {
|
if(SPCommMon.COMM_PORT_TYPE_Serial != m_COMM_PORT_TYPE) {
|
return;
|
}
|
|
try {
|
comm_bautrate = bt_rate;
|
m_SP_Comm.serialPort.setSerialPortParams(comm_bautrate, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
|
} catch (UnsupportedCommOperationException e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
}
|
|
//³õʼ»¯´®¿Ú
|
public boolean OpenCommPort(int comm_port_type, String comm_name_or_ip, int bitrate_or_comm_port) {
|
boolean res = false;
|
m_COMM_PORT_TYPE = comm_port_type;
|
if(SPCommMon.COMM_PORT_TYPE_Serial == m_COMM_PORT_TYPE) {
|
m_SP_Comm = new CommSerialPort(bitrate_or_comm_port, m_Log);
|
res = m_SP_Comm.OpenCommPort(comm_name_or_ip);
|
} else {
|
m_SocketComm = new Comm_Socket(comm_name_or_ip, bitrate_or_comm_port);
|
res = true;
|
}
|
|
if(true == res) {
|
CommTxBuffer.order(ByteOrder.BIG_ENDIAN);
|
CommRxBuffer.order(ByteOrder.BIG_ENDIAN);
|
comm_tx_cnt = 0;
|
comm_rx_cnt = 0;
|
CommThreadRunning = true;
|
}
|
|
return res;
|
}
|
|
private void makeCommTxData() {
|
CommTxBuffer.clear();
|
|
rtu_rt = new MyModBusRtu();
|
ByteBuffer dt_data = ByteBuffer.allocate(0);
|
|
rtu_rt.addr = dt_target_addr;
|
if(dt_user_cmd == Power_ComBase.CMD_NULL) {
|
//Ëæ»ú¶ÁȡʵʱÊý¾Ý
|
|
if(++dt_cmd_cnt > 1000) {
|
dt_cmd_cnt = 0;
|
}
|
rtu_rt.Cmd = MyModBusRtu.CMD_TYPE_READ_INPUT;
|
rtu_rt.reg_addr = ElectLock_ComBase.LOCK_REAL_ADDR;
|
rtu_rt.reg_count = ElectLock_State.Reg_Count_Real;
|
|
if(dt_cmd_cnt%5 == 1) {
|
rtu_rt.reg_addr = ElectLock_ComBase.LOCK_IDCard1_ADDR;
|
rtu_rt.reg_count = ElectLock_State.Reg_Count_Card;
|
}else if(dt_cmd_cnt%5 == 2) {
|
rtu_rt.reg_addr = ElectLock_ComBase.LOCK_IDCard2_ADDR;
|
rtu_rt.reg_count = ElectLock_State.Reg_Count_Card;
|
}
|
|
} else {
|
//Êý¾Ý
|
dt_data = dt_databuffer;
|
//Ò£µ÷Ò£¿ØÊý¾Ý
|
rtu_rt.Cmd = dt_user_cmd;
|
dt_user_cmd = Power_ComBase.CMD_NULL;
|
|
rtu_rt.reg_addr = dt_user_cmd_regaddr;
|
if(dt_data.capacity() > 0) {
|
rtu_rt.reg_count = dt_data.capacity()/2;
|
}else {
|
System.out.println("rtu_rt.reg_addr:" + rtu_rt.reg_addr + " Ϊ´«ÈëÉèÖõÄÊýÖµ");
|
//rtu_rt.reg_count = Power_Param.REG_Count;
|
|
}
|
}
|
|
makeRTData(rtu_rt,dt_data);
|
}
|
|
public void makeRTData(MyModBusRtu rtu,ByteBuffer bf) {
|
CommTxBuffer.position(0);
|
|
CommTxBuffer.put((byte)rtu.addr);
|
CommTxBuffer.put((byte)rtu.Cmd);
|
CommTxBuffer.putShort((short)rtu.reg_addr);
|
|
if(rtu.Cmd == MyModBusRtu.CMD_TYPE_READ || rtu.Cmd == MyModBusRtu.CMD_TYPE_READ_INPUT) {
|
//¶ÁÈ¡
|
CommTxBuffer.putShort((short)rtu.reg_count);
|
|
} else if(
|
rtu.Cmd == MyModBusRtu.CMD_TYPE_WRITE_STD
|
|| rtu.Cmd == MyModBusRtu.CMD_TYPE_WRITE_YC
|
|| rtu.Cmd == MyModBusRtu.CMD_TYPE_WRITE_SysUpdate
|
|| rtu.Cmd == MyModBusRtu.CMD_TYPE_Read_UpdateFile
|
) {
|
//µ¥µãдÈë
|
CommTxBuffer.put(bf);
|
} else if(rtu.Cmd == MyModBusRtu.CMD_TYPE_WRITE_MULTY) {
|
//¶àµãдÈë
|
CommTxBuffer.putShort((short)rtu.reg_count);
|
CommTxBuffer.put((byte)bf.capacity());
|
CommTxBuffer.put(bf);
|
}
|
|
int crc = Crc16.CalCRC16(CommTxBuffer, CommTxBuffer.position()) & 0xFFFF;
|
CommTxBuffer.putShort((short) crc);
|
CommTxBuffer.flip();
|
|
//System.out.println("·¢ËÍÊý¾Ý³¤¶È£º" + CommTxBuffer.remaining());
|
|
}
|
|
public void tr_Msg(ByteBuffer bbf_tx, ByteBuffer bbf_rx, boolean showdat) {
|
if(++comm_tx_cnt > 32500) {
|
comm_tx_cnt = 0;
|
}
|
if(SPCommMon.COMM_PORT_TYPE_Serial == m_COMM_PORT_TYPE) {
|
m_SP_Comm.SP_Comm(bbf_tx, bbf_rx, CommSerialPort.mutycomm_Type_Samd09, dt_debug_inf, showdat);
|
} else {
|
m_SocketComm.SocketComm(bbf_tx, bbf_rx, dt_debug_inf, showdat);
|
}
|
}
|
|
public void CloseCommPort() {
|
CommThreadRunning = false;
|
}
|
|
public void setCommCmd(short cmd, int cmd_reg_addr, short[] reg_data, int reg_len) {
|
if(dt_cmd_regaddr > 0) {
|
return;
|
}
|
|
dt_cmd = cmd;
|
dt_cmd_regaddr = (short) cmd_reg_addr;
|
dt_cmd_regdata = reg_data;
|
dt_cmd_regcnt = (short) reg_len;
|
}
|
|
public void setCommCmd(short cmd, int cmd_user_reg_addr, ByteBuffer bf) {
|
if(dt_cmd_regaddr > 0) {
|
return;
|
}
|
|
dt_user_cmd = cmd; //ÃüÁî
|
dt_user_cmd_regaddr = (short) cmd_user_reg_addr; //¼Ä´æÆ÷µØÖ·
|
|
dt_databuffer = bf; //Ò£¿Ø»òÒ£µ÷Êý¾Ý
|
}
|
|
|
public void setCommCmdAck(int ack_t) {
|
dt_cmd_ack = ack_t;
|
dt_cmd_ack_time = new Date();
|
//System.out.println(Com.get_DTF(dt_cmd_ack_time, Com.DTF_YMDhms) + ", " + dev_param_data_state);
|
String wav_f = "6133.wav";
|
if(ack_t%2 == 0) {
|
wav_f = "4577.wav";
|
}
|
if(ack_t > 0) {
|
new PlaySound(wav_f);
|
}
|
}
|
|
private boolean processRxData(ByteBuffer bbf_rx) {
|
rtu_rx.clear();
|
boolean isSuccess = false;
|
if(rtu_rx.putByteBuffer(bbf_rx)) {
|
|
if(MyModBusRtu.CMD_TYPE_READ == rtu_rx.Cmd) {
|
|
// if(Power_ComBase.PWD_ACData_RegAddr_Start == rtu_rt.reg_addr) {
|
// //¶ÁÈ¡¼«¼ò»¯µçÔ´Ò£²âÊý¾Ý
|
// if(m_AcData.putByteBuffer(bbf_rx)) {
|
// isSuccess = true;
|
// }
|
// }else if(Power_ComBase.PWD_LIBMSData_RegAddr_Start1 <= rtu_rt.reg_addr && rtu_rt.reg_addr <= Power_ComBase.PWD_LIBMSData_RegAddr_Start4) {
|
// //ï®µç³Ø°üÊý¾Ý
|
// if(m_LibmsDatas[read_libms_index].putByteBuffer(bbf_rx)) {
|
//
|
// //System.out.println("ï®µç³Ø°ü£º"+(read_libms_index+1)+"¶ÁÈ¡³É¹¦");
|
// read_libms_index ++;
|
// if(read_libms_index >= Power_ComBase.LIBMSDATA_MAX_COUNT) {
|
// read_libms_index = 0;
|
// }
|
// isSuccess = true;
|
// }
|
// }else if(Power_ComBase.PWD_ModelData_RegAddr_Start1 <= rtu_rt.reg_addr && rtu_rt.reg_addr <= Power_ComBase.PWD_ModelData_RegAddr_Start4) {
|
// //µçÔ´Ä£¿éÊý¾Ý
|
// if(m_ModelDatas[read_model_index].putByteBuffer(bbf_rx)) {
|
//
|
// //System.out.println("µçÔ´Ä£¿é£º"+(read_model_index+1)+"¶ÁÈ¡³É¹¦");
|
// read_model_index ++;
|
// if(read_model_index >= Power_ComBase.LIMODEL_MAX_COUNT) {
|
// read_model_index = 0;
|
// }
|
// isSuccess = true;
|
// }
|
// }else if(Power_ComBase.PWD_ModelAlm_RegAddr_Start == rtu_rt.reg_addr) {
|
// if(m_AlmState.putByteBuffer(bbf_rx)) {
|
// isSuccess = true;
|
// }
|
// }else if(Power_ComBase.PWD_SysParam_RegAddr_Start == rtu_rt.reg_addr) {
|
// if(m_ParamFromDev.putByteBuffer(bbf_rx)) {
|
// dt_user_cmd_ack = Power_ComBase.PWD_SysParam_Read_ACK;
|
// op_result_sysparam = "¶ÁÈ¡µçԴϵͳ²ÎÊý³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// isSuccess = true;
|
// }
|
// }else if(Power_ComBase.PWD_PowerParam_RegAddr_Start == rtu_rt.reg_addr) {
|
// //System.out.println("999");
|
// if(m_ParamFromDev.putPowerByteBuffer(bbf_rx)) {
|
// dt_user_cmd_ack = Power_ComBase.PWD_PwdParam_Read_ACK;
|
// op_result_powerparam = "¶ÁÈ¡µçÔ´²ÎÊý³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// isSuccess = true;
|
// }
|
// }else if(Power_ComBase.PWD_AlmParam_RegAddr_Start == rtu_rt.reg_addr) {
|
// m_AlmParamFromDev = new Power_AlmParam();
|
// if(m_AlmParamFromDev.putByteBuffer(bbf_rx)) {
|
// dt_user_cmd_ack = Power_ComBase.PWD_AlmParam_Read_ACK;
|
// op_result_almaram = "¶ÁÈ¡µçÔ´¸æ¾¯²ÎÊý³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// isSuccess = true;
|
// }
|
// }else if(Power_ComBase.PWD_SchoolTime_RegAddr_Start == rtu_rt.reg_addr) {
|
// if(m_ParamFromDev.putTimeByteBuffer(bbf_rx)) {
|
// dt_user_cmd_ack = Power_ComBase.PWD_SchoolTime_Read_ACK;
|
// op_result_jiaozhun = "¶ÁÈ¡É豸ʱ¼ä³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// isSuccess = true;
|
// }
|
// }else if(Power_ComBase.PWD_Load1Time_RegAddr_Start == rtu_rt.reg_addr) {
|
// if(m_TimeControlFromDev.putByteBuffer1(bbf_rx)) {
|
// dt_user_cmd_ack = Power_ComBase.PWD_Load1Time_Read_ACK;
|
// op_result_jiaozhun = "¶ÁÈ¡1-6··Öʱ²ÎÊý³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// isSuccess = true;
|
// }
|
// }else if(Power_ComBase.PWD_Load7Time_RegAddr_Start == rtu_rt.reg_addr) {
|
// if(m_TimeControlFromDev.putByteBuffer2(bbf_rx)) {
|
// dt_user_cmd_ack = Power_ComBase.PWD_Load2Time_Read_ACK;
|
// op_result_jiaozhun = "¶ÁÈ¡7-12··Öʱ²ÎÊý³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// isSuccess = true;
|
// }
|
// }else if(Power_ComBase.PWD_LoadControl_RegAddr_Start == rtu_rt.reg_addr) {
|
// if(m_RoadStateFromDev.putByteBuffer(bbf_rx)) {
|
// //System.err.println("¶ÁÈ¡·Ö·1~12·Ö·״̬³É¹¦" + m_RoadStateFromDev);
|
// isSuccess = true;
|
// }
|
// }
|
|
|
|
}else if(MyModBusRtu.CMD_TYPE_READ_INPUT == rtu_rx.Cmd){
|
if(ElectLock_ComBase.LOCK_REAL_ADDR == rtu_rt.reg_addr) {
|
//¶ÁȡʵʱÊý¾Ý
|
if(m_ElectLock_State.putByteBuffer(bbf_rx)) {
|
isSuccess = true;
|
}
|
}else if(ElectLock_ComBase.LOCK_IDCard1_ADDR == rtu_rt.reg_addr) {
|
if(m_ElectLock_State.putCardByteBuffer(bbf_rx, 0)) {
|
isSuccess = true;
|
}
|
}else if(ElectLock_ComBase.LOCK_IDCard2_ADDR == rtu_rt.reg_addr) {
|
if(m_ElectLock_State.putCardByteBuffer(bbf_rx, 50)) {
|
isSuccess = true;
|
}
|
}
|
}else if(MyModBusRtu.CMD_TYPE_WRITE_YC == rtu_rx.Cmd){
|
if(ElectLock_ComBase.LOCK_CLEAR_AUTH_ADDR == rtu_rx.reg_addr) {
|
//Çå¿ÕËùÓÐÊÚȨ¿¨
|
if(ElectLock_ComBase.Control_Value == rtu_rx.result) {
|
isSuccess = true;
|
op_result = "Çå¿ÕËùÓÐÊÚȨ¿¨³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}else {
|
op_result = "Çå¿ÕËùÓÐÊÚȨ¿¨Ê§°Ü" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}
|
}else if(ElectLock_ComBase.LOCK_REMOTE_OPEN_ADDR == rtu_rx.reg_addr) {
|
//Ô¶³Ì¿ªËø
|
if(ElectLock_ComBase.Control_Value == rtu_rx.result) {
|
isSuccess = true;
|
op_result = "Ô¶³Ì¿ªËø³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}else {
|
op_result = "Ô¶³Ì¿ªËøÊ§°Ü" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}
|
}else if(ElectLock_ComBase.LOCK_RESTART_ADDR == rtu_rx.reg_addr) {
|
//Ô¶³ÌÖØÆô
|
if(ElectLock_ComBase.Control_Value == rtu_rx.result) {
|
isSuccess = true;
|
op_result = "Ô¶³ÌÖØÆô³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}else {
|
op_result = "Ô¶³ÌÖØÆôʧ°Ü" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}
|
}
|
}else if(MyModBusRtu.CMD_TYPE_WRITE_STD == rtu_rx.Cmd) {
|
if(ElectLock_ComBase.LOCK_SET_ADDR_ADDR == rtu_rx.reg_addr) {
|
if(rtu_rx.result > 0) {
|
isSuccess = true;
|
op_result = "ÉèÖÃËø¾ßµØÖ·³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}else {
|
op_result = "ÉèÖÃËø¾ßµØÖ·Ê§°Ü" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}
|
}else if(ElectLock_ComBase.LOCK_Add_ID_AUTH_ADDR == rtu_rx.reg_addr) {
|
if(rtu_rx.result > 0) {
|
isSuccess = true;
|
op_result = "ÉèÖÃËø¾ßµØÖ·³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}else {
|
op_result = "ÉèÖÃËø¾ßµØÖ·Ê§°Ü" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}
|
}else if(ElectLock_ComBase.LOCK_SET_Model_ADDR == rtu_rx.reg_addr) {
|
if(rtu_rx.result >= 0) {
|
isSuccess = true;
|
op_result = "ÉèÖÃËø¾ß¹¤×÷ģʽ³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}else {
|
op_result = "ÉèÖÃËø¾ß¹¤×÷ģʽʧ°Ü" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}
|
}else if(ElectLock_ComBase.LOCK_SET_Bluetooth_ADDR == rtu_rx.reg_addr) {
|
if(rtu_rx.result == 1) {
|
isSuccess = true;
|
op_result = "Ëø¾ß¿ªÆôÀ¶ÑÀ³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}else if(rtu_rx.result == 0) {
|
isSuccess = true;
|
op_result = "Ëø¾ß¹Ø±ÕÀ¶ÑÀ³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}else {
|
op_result = "Ëø¾ßÉèÖÃÀ¶ÑÀʧ°Ü" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}
|
}
|
|
// if(Power_ComBase.PWD_DoorControl_RegAddr_Start == rtu_rx.reg_addr) {
|
// //ÃÅ´Å¿ØÖÆ
|
// if(Power_ComBase.CMD_Fail != rtu_rx.result) {
|
// op_result_sysparam = "¿ØÖÆÃÅ´Å´ò¿ª³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// }else {
|
// op_result_sysparam = "¿ØÖÆÃŴŹرճɹ¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// }
|
// isSuccess = true;
|
// }else if(Power_ComBase.PWD_LoadControl_RegAddr_Start <= rtu_rx.reg_addr && rtu_rx.reg_addr < Power_ComBase.PWD_BackControl_RegAddr_Start) {
|
// //·Ö·1~12¿ØÖÆ
|
// int idx = rtu_rx.reg_addr - Power_ComBase.PWD_LoadControl_RegAddr_Start +1;
|
// if(Power_ComBase.CMD_Fail != rtu_rx.result) {
|
// op_result_sysparam = "¿ØÖÆ·Ö·" + idx + "´ò¿ª³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// }else {
|
// op_result_sysparam = "¿ØÖÆ·Ö·" + idx + "¹Ø±Õ³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// }
|
// isSuccess = true;
|
// }else if(Power_ComBase.PWD_BackControl_RegAddr_Start <= rtu_rx.reg_addr && rtu_rx.reg_addr < Power_ComBase.PWD_DoorControl_RegAddr_Start) {
|
// //·Ö·1~12±¸µç¿ØÖÆ
|
// int idx = rtu_rx.reg_addr - Power_ComBase.PWD_BackControl_RegAddr_Start +1;
|
// if(Power_ComBase.CMD_Fail != rtu_rx.result) {
|
// op_result_sysparam = "¿ØÖÆ·Ö·" + idx + "±¸µç¿ØÖÆ´ò¿ª³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// }else {
|
// op_result_sysparam = "¿ØÖÆ·Ö·" + idx + "±¸µç¿ØÖƹرÕʧ°Ü" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// }
|
// isSuccess = true;
|
// }
|
|
|
}else if(MyModBusRtu.CMD_TYPE_WRITE_MULTY == rtu_rx.Cmd) {
|
if(ElectLock_ComBase.LOCK_Add_ID_AUTH_ADDR == rtu_rx.reg_addr) {
|
//Ìí¼ÓÊÚȨID¿¨
|
if(ElectLock_ComBase.RegCount_Double == rtu_rx.result) {
|
isSuccess = true;
|
op_result = "Ìí¼ÓÊÚȨ¿¨ID³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}else {
|
op_result = "Ìí¼ÓÊÚȨ¿¨IDʧ°Ü" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}
|
}else if(ElectLock_ComBase.LOCK_Clear_ID_AUTH_ADDR == rtu_rx.reg_addr) {
|
//È¡ÏûÊÚȨID¿¨
|
if(ElectLock_ComBase.RegCount_Double == rtu_rx.result) {
|
isSuccess = true;
|
op_result = "ÒÆ³ýÊÚȨ¿¨ID³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}else {
|
op_result = "ÒÆ³ýÊÚȨ¿¨IDʧ°Ü" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
}
|
}
|
|
// if(Power_ComBase.PWD_PowerParam_RegAddr_Start == rtu_rx.reg_addr) {
|
// //ÉèÖõçÔ´²ÎÊý
|
// if(rtu_rx.result == Power_Param.REG_Count_Power) {
|
// op_result_powerparam = "ÉèÖõçÔ´²ÎÊý³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// isSuccess = true;
|
// }else {
|
// op_result_powerparam = "ÉèÖõçÔ´²ÎÊýʧ°Ü" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// }
|
// }else if(Power_ComBase.PWD_AlmParam_RegAddr_Start == rtu_rx.reg_addr) {
|
// //ÉèÖõçÔ´¸æ¾¯²ÎÊý
|
// if(rtu_rx.result == Power_AlmParam.REG_Count) {
|
// op_result_almaram = "ÉèÖõçÔ´¸æ¾¯²ÎÊý³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// isSuccess = true;
|
// }else {
|
// op_result_almaram = "ÉèÖõçÔ´¸æ¾¯²ÎÊýʧ°Ü" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// }
|
// }else if(Power_ComBase.PWD_SysParam_RegAddr_Start == rtu_rx.reg_addr) {
|
// //ÉèÖõçԴϵͳ²ÎÊý
|
// if(rtu_rx.result == Power_Param.REG_Count) {
|
// op_result_sysparam = "ÉèÖõçԴϵͳ²ÎÊý³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// isSuccess = true;
|
// }else {
|
// op_result_sysparam = "ÉèÖõçԴϵͳ²ÎÊýʧ°Ü" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// }
|
// }else if(Power_ComBase.PWD_SchoolTime_RegAddr_Start == rtu_rx.reg_addr) {
|
// //ÉèÖõçԴУʱ
|
// if(rtu_rx.result == Power_Param.REG_Count_Time) {
|
// op_result_jiaozhun = "ÉèÖõçԴУʱ³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// isSuccess = true;
|
// }else {
|
// op_result_jiaozhun = "ÉèÖõçԴУʱʧ°Ü" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// }
|
// }else if(Power_ComBase.PWD_Load1Time_RegAddr_Start == rtu_rx.reg_addr) {
|
// //ÉèÖ÷Ö·1-6·Öʱ¿ØÖÆ
|
// if(rtu_rx.result == Power_TimeControl.REG_Count) {
|
// op_result_jiaozhun = "ÉèÖ÷Ö·1-6·Öʱ²ÎÊý³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// isSuccess = true;
|
// }else {
|
// op_result_jiaozhun = "ÉèÖ÷Ö·1-6·Öʱ²ÎÊýʧ°Ü" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// }
|
// }else if(Power_ComBase.PWD_Load7Time_RegAddr_Start == rtu_rx.reg_addr) {
|
// //ÉèÖ÷Ö·7-12·Öʱ¿ØÖÆ
|
// if(rtu_rx.result == Power_TimeControl.REG_Count) {
|
// op_result_jiaozhun = "ÉèÖ÷Ö·7-12·Öʱ²ÎÊý³É¹¦" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// isSuccess = true;
|
// }else {
|
// op_result_jiaozhun = "ÉèÖ÷Ö·7-12·Öʱ²ÎÊýʧ°Ü" + Com.get_DTF(new Date(), Com.DTF_YMDhms);
|
// }
|
// }
|
} else if(MyModBusRtu.CMD_TYPE_WRITE_SysUpdate == rtu_rx.Cmd) {
|
if(Power_ComBase.PWD_SysReStart_RegAddr_Start == rtu_rx.reg_addr) {
|
//Ô¶³ÌÖØÆôÉ豸
|
if(rtu_rx.result == 0xBBBB) {
|
//É豸Զ³ÌÖØÆô³É¹¦
|
dt_user_cmd_ack = Power_ComBase.PWD_SysRestart_Success_ACK;
|
isSuccess = true;
|
}else {
|
//É豸Զ³ÌÖØÆôʧ°Ü
|
dt_user_cmd_ack = Power_ComBase.PWD_SysRestart_Fail_ACK;
|
}
|
}else if(Power_ComBase.PWD_TransUpdateFile_RegAddr_Start == rtu_rx.reg_addr) {
|
if(rtu_rx.result != 0) {
|
isSuccess = true;
|
}
|
}else if(Power_ComBase.PWD_StartUpdate_RegAddr_Start == rtu_rx.reg_addr) {
|
if(rtu_rx.result == (0xEEEE)) {
|
isSuccess = true;
|
System.out.println("Çл»É豸²¨ÌØÂʳɹ¦....");
|
}else if(rtu_rx.result != 0) {
|
isSuccess = true;
|
appendUppdateInfo("System Update Success ... " + Com.get_DTF(new Date(), Com.DTF_YMDhms) + "\n");
|
}else {
|
appendUppdateInfo("System Update Fail ... " + Com.get_DTF(new Date(), Com.DTF_YMDhms) + "\n");
|
}
|
}
|
} else if(MyModBusRtu.CMD_TYPE_Read_UpdateFile == rtu_rx.Cmd) {
|
if(Power_ComBase.PWD_TransUpdateFile_RegAddr_Start == rtu_rt.reg_addr) {
|
if(bbf_rx.remaining() > 2) {
|
isSuccess = true;
|
}else {
|
System.err.println("·µ»ØÊý¾Ý³¤¶È²»×ã");
|
}
|
}
|
}
|
}
|
if(bbf_rx.limit() > 0 && isSuccess) {
|
if(++comm_rx_cnt > 32500) {
|
comm_rx_cnt = 0;
|
}
|
}
|
return isSuccess;
|
}
|
|
public void setAutoStartRestTest(String filename, int type, boolean en) {
|
AutoSaveDataFileName = filename;
|
AutoStartResTestEn = en;
|
AutoSaveResDataCount = 0;
|
}
|
|
private void closeSPCommPort() {
|
if(SPCommMon.COMM_PORT_TYPE_Serial == m_COMM_PORT_TYPE) {
|
m_SP_Comm.serialPort.close();
|
} else {
|
m_SocketComm.socketClose();
|
}
|
}
|
|
public void run() {
|
while(true == CommThreadRunning) {
|
try {
|
Thread.sleep(200);
|
if(dt_dfu_en == false) {
|
if(dt_change_commBautrate) {
|
//Éý¼¶¹ý³ÌÖÐʧ°Ü,»Ö¸´Ê±Çл»Á¬½ÓʱµÄ²¨ÌØÂÊ
|
//setCommBautrate(comm_bautrate);
|
dt_change_commBautrate = false;
|
}
|
|
makeCommTxData();
|
tr_Msg(CommTxBuffer, CommRxBuffer, true);
|
processRxData(CommRxBuffer);
|
|
} else {
|
//--------------------------- BOOTLOADER_CMD_WRITE-----------------------------//
|
|
dt_show_msg.append("---------------------------------------------------\n");
|
String dfu_text_inf = "Power System Update Start." + Com.get_DTF(new Date(), Com.DTF_YMDhms) + "\n";
|
appendUppdateInfo(dfu_text_inf);
|
|
if(!dt_change_commBautrate) {
|
appendUppdateInfo("¿ªÊ¼ÉèÖÃËø¾ß´®¿Ú²¨ÌØÂÊΪ " + CommBautrate_Update +"\n");
|
for(int k = 0;k<3;k++) {
|
|
dt_user_cmd = MyModBusRtu.CMD_TYPE_WRITE_SysUpdate;
|
dt_user_cmd_regaddr = Power_ComBase.PWD_StartUpdate_RegAddr_Start;
|
dt_databuffer = electlock_util.createSysUpdateControlByteBuffer(0xEEEE);
|
|
makeCommTxData();
|
tr_Msg(CommTxBuffer, CommRxBuffer, true);
|
|
if(true == processRxData(CommRxBuffer)) {
|
if(rtu_rx.result == 0xEEEE) {
|
appendUppdateInfo("ÉèÖÃËø¾ß´®¿Ú²¨ÌØÂÊΪ " + CommBautrate_Update + "³É¹¦£¡\n");
|
dt_change_commBautrate = true;
|
break;
|
}
|
} else {
|
//Çл»²¨ÌØÂÊʧ°Ü
|
Thread.sleep(500);
|
}
|
}
|
}
|
if(!dt_change_commBautrate) {
|
appendUppdateInfo("Çл»Ëø¾ß²¨ÌØÂÊʧ°Ü,SystemUpdate Fial !!!\n");
|
dt_dfu_en = false;
|
continue;
|
}
|
|
try {
|
appendUppdateInfo("ÉèÖÃÁ¬½Ó´®¿ÚµÄ²¨ÌØÂÊΪ " + CommBautrate_Update + "\n");
|
setCommBautrate(CommBautrate_Update);
|
Thread.sleep(6000);
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
|
boolean prog_ok = false;
|
FileInputStream fis = null;
|
try {
|
File f = new File(dt_dfuFileName);
|
long file_len = f.length();
|
byte[] buf_to_flash = new byte[Power_ComBase.DFU_BUF_LEN];
|
|
Thread.sleep(100);
|
fis = new FileInputStream(f);
|
int dfu_datablock_num = 1;
|
int percent = 0;
|
while(true)
|
{
|
//====================================//
|
if((false == dt_dfu_en) || (false == CommThreadRunning)) {
|
dfu_text_inf = "DFU Manual Stop . . .\n";
|
appendUppdateInfo(dfu_text_inf);
|
break;
|
}
|
//====================================//
|
for(int n=0; n<buf_to_flash.length; n++) {
|
buf_to_flash[n] = (byte) 0xFF;
|
}
|
//====================================//
|
int data_len_towrite = fis.read(buf_to_flash);
|
if(data_len_towrite > 0) {
|
Thread.sleep(1);
|
for(int cnt_t=0; cnt_t<3; cnt_t++) {
|
|
//¹¹Ôì·¢ËÍÊý¾Ý
|
makeSendFileData(buf_to_flash,dfu_datablock_num);
|
dt_user_cmd = MyModBusRtu.CMD_TYPE_WRITE_SysUpdate;
|
dt_user_cmd_regaddr = Power_ComBase.PWD_TransUpdateFile_RegAddr_Start;
|
|
makeCommTxData();
|
tr_Msg(CommTxBuffer, CommRxBuffer, true);
|
|
if(true == processRxData(CommRxBuffer)) {
|
if(rtu_rx.result == dfu_datablock_num) {
|
prog_ok = true;
|
break;
|
}
|
} else {
|
prog_ok = false;
|
Thread.sleep(500);
|
}
|
}
|
if(false == prog_ok) {
|
dfu_text_inf = "DFU Write Error!\n";
|
appendUppdateInfo(dfu_text_inf);
|
break;
|
} else {
|
dfu_datablock_num += 1;
|
}
|
|
int tran_len_t = dfu_datablock_num*FBS9100_DFU.DFU_BUF_LEN;
|
if(percent < (tran_len_t*100)/file_len) {
|
percent = (int) ((tran_len_t*100)/file_len);
|
if(percent > 100) {
|
percent = 100;
|
}
|
appendUppdateInfo(String.format("DFU Write: %d%% Done.\n", percent));
|
}
|
} else {
|
dfu_text_inf = "DFU Write: 100% Done!\n";
|
appendUppdateInfo(dfu_text_inf);
|
//System.out.println(dfu_text_inf);
|
break;
|
}
|
}
|
} catch (IOException | InterruptedException e1) {
|
e1.printStackTrace();
|
} finally {
|
try {
|
fis.close();
|
} catch (IOException e1) {
|
e1.printStackTrace();
|
}
|
}
|
|
if((true == prog_ok) && (true == dt_dfu_en) && (true == CommThreadRunning)) {
|
boolean check_ok = false;
|
FileInputStream fis_ck = null;
|
try {
|
File f_ck = new File(dt_dfuFileName);
|
long file_len_ck = f_ck.length();
|
byte[] buf_check = new byte[Power_ComBase.DFU_BUF_LEN];
|
|
Thread.sleep(100);
|
fis_ck = new FileInputStream(f_ck);
|
int check_datablock_num = 1;
|
int percent = 0;
|
while(true)
|
{
|
//====================================//
|
if((false == dt_dfu_en) || (false == CommThreadRunning)) {
|
dfu_text_inf = "DFU Check Manual Stop . . .\n";
|
appendUppdateInfo(dfu_text_inf);
|
break;
|
}
|
//====================================//
|
for(int n=0; n<buf_check.length; n++) {
|
buf_check[n] = (byte) 0xFF;
|
}
|
//====================================//
|
int len_buf_check = fis_ck.read(buf_check);
|
if(len_buf_check > 0) {
|
Thread.sleep(1);
|
for(int cnt_t=0; cnt_t<3; cnt_t++) {
|
|
//¹¹Ôì·¢ËÍÊý¾Ý
|
dt_databuffer = electlock_util.createSysUpdateControlByteBuffer(check_datablock_num);
|
dt_user_cmd = MyModBusRtu.CMD_TYPE_Read_UpdateFile;
|
dt_user_cmd_regaddr = Power_ComBase.PWD_TransUpdateFile_RegAddr_Start;
|
|
makeCommTxData();
|
tr_Msg(CommTxBuffer, CommRxBuffer, true);
|
if(true == processRxData(CommRxBuffer)) {
|
if(rtu_rx.result == check_datablock_num) {
|
if(true == checkDfuReadAckBuf(CommRxBuffer, buf_check)) {
|
check_ok = true;
|
} else {
|
check_ok = false;
|
Thread.sleep(500);
|
}
|
if(true == check_ok) {
|
break;
|
}
|
}
|
}
|
}
|
if(false == check_ok) {
|
dfu_text_inf = "DFU File Check Error!\n ";
|
appendUppdateInfo(dfu_text_inf);
|
break;
|
} else {
|
check_datablock_num += 1;
|
}
|
|
int tran_len_t = check_datablock_num*FBS9100_DFU.DFU_BUF_LEN;
|
if(percent < (tran_len_t*100)/file_len_ck) {
|
percent = (int) ((tran_len_t*100)/file_len_ck);
|
if(percent > 100) {
|
percent = 100;
|
}
|
appendUppdateInfo(String.format("DFU File Check: %d%% Done.\n", percent));
|
}
|
} else {
|
dfu_text_inf = "DFU File Check: 100% Done!\n";
|
appendUppdateInfo(dfu_text_inf);
|
|
setCommCmd(MyModBusRtu.CMD_TYPE_WRITE_SysUpdate, Power_ComBase.PWD_StartUpdate_RegAddr_Start, electlock_util.createSysUpdateControlByteBuffer(0xDFDF));
|
//setCommCmd(FBS9100_ComBase.CMD_SystemUpdate, ByteBuffer.allocate(0));
|
break;
|
}
|
}
|
} catch (IOException | InterruptedException e1) {
|
e1.printStackTrace();
|
} finally {
|
try {
|
fis_ck.close();
|
} catch (IOException e1) {
|
e1.printStackTrace();
|
}
|
}
|
}
|
//---------------------------------------------------------------------------------//
|
dt_dfu_en = false;
|
//---------------------------------------------------------------------------------//
|
}
|
} catch (InterruptedException e) {
|
e.printStackTrace();
|
CloseCommPort();
|
JOptionPane.showMessageDialog(null, "ZDHJ CommPort ´®¿ÚÒì³£: " + e.getMessage());
|
}
|
}
|
/******************************************/
|
closeSPCommPort();
|
/******************************************/
|
dt_debug_inf.addDebugInf(Com.get_DTF(new Date(), Com.DTF_YMDhms_S)
|
+ " ZDHJ CommPort is quit,"
|
+ " COMM_PORT_TYPE: " + m_COMM_PORT_TYPE + "\n");
|
/******************************************/
|
}
|
|
|
public void makeSendFileData(byte[] data,int block_num) {
|
dt_databuffer = ByteBuffer.allocate(data.length + 2);
|
dt_databuffer.order(ByteOrder.BIG_ENDIAN);
|
dt_databuffer.putShort(FBS9100_ComBase.changeIntToShort(block_num));
|
dt_databuffer.put(data);
|
dt_databuffer.flip();
|
}
|
|
public void setCommCmd_DFU(boolean dfu_en, String dfu_file, JTextArea show_area) {
|
dt_dfu_en = dfu_en;
|
dt_show_msg = show_area;
|
|
dt_dfuFileName = dfu_file;
|
}
|
|
|
public boolean checkDfuReadAckBuf(ByteBuffer bf,byte[] data) {
|
boolean check_ok = false;
|
if(data.length <= bf.remaining()) {
|
check_ok = true;
|
for(int k = 0 ;k< data.length;k++) {
|
if(data[k] != bf.get()) {
|
System.err.println("УÑé×Ö½Ú£º" + k + "ʧ°Ü");
|
check_ok = false;
|
break;
|
}
|
}
|
}else {
|
//System.err.println("bf£º"+ComFn.bytesToHexString(bf.array(), bf.array().length));
|
//System.err.println("data£º"+ComFn.bytesToHexString(data, data.length));
|
//System.err.println("data.length£º" + data.length + "\tbf.remaining():"+bf.remaining());
|
}
|
return check_ok;
|
}
|
|
public void appendUppdateInfo(String msg) {
|
StringBuffer buffer = new StringBuffer(dt_show_msg.getText());
|
dt_show_msg.setText(msg);
|
dt_show_msg.append(buffer.toString());
|
}
|
}
|