|
|
@@ -3,29 +3,19 @@ package com.bonait.bnframework.common.modbus; |
|
|
|
import static com.bonait.bnframework.common.modbus.DataConvertLib.ByteToShort; |
|
|
|
import static com.bonait.bnframework.common.modbus.DataConvertLib.BytesToFloat; |
|
|
|
import static com.bonait.bnframework.common.modbus.DataConvertLib.BytesToInt; |
|
|
|
import static com.bonait.bnframework.common.modbus.DataConvertLib.GetAddress; |
|
|
|
import static com.bonait.bnframework.common.modbus.DataConvertLib.IntToShorts; |
|
|
|
|
|
|
|
import android.util.Log; |
|
|
|
|
|
|
|
import com.bonait.bnframework.HBL.NotifyPropVar; |
|
|
|
import com.bonait.bnframework.business.ConfigData; |
|
|
|
import com.bonait.bnframework.common.constant.ConfigName; |
|
|
|
import com.bonait.bnframework.common.helper.DataFormat; |
|
|
|
import com.bonait.bnframework.common.helper.I.IReadCallBack; |
|
|
|
import com.bonait.bnframework.common.helper.I.IRun; |
|
|
|
import com.bonait.bnframework.common.helper.I.IThread; |
|
|
|
import com.bonait.bnframework.common.helper.I.IWriteCallBack; |
|
|
|
import com.bonait.bnframework.common.helper.MessageLog; |
|
|
|
import com.bonait.bnframework.common.helper.ThreadManager; |
|
|
|
import com.bonait.bnframework.common.utils.ToastUtils; |
|
|
|
import com.licheedev.modbus4android.ModbusCallback; |
|
|
|
import com.licheedev.modbus4android.ModbusParam; |
|
|
|
import com.licheedev.modbus4android.ModbusRespException; |
|
|
|
import com.licheedev.modbus4android.ModbusWorker; |
|
|
|
import com.licheedev.modbus4android.param.SerialParam; |
|
|
|
import com.licheedev.modbus4android.param.TcpParam; |
|
|
|
import com.serotonin.modbus4j.ModbusFactory; |
|
|
|
import com.serotonin.modbus4j.exception.ModbusInitException; |
|
|
|
import com.serotonin.modbus4j.exception.ModbusTransportException; |
|
|
|
import com.serotonin.modbus4j.msg.ReadCoilsResponse; |
|
|
@@ -35,16 +25,8 @@ import java.io.IOException; |
|
|
|
import java.io.InputStreamReader; |
|
|
|
import java.io.LineNumberReader; |
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.LinkedList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
|
import java.util.concurrent.atomic.AtomicBoolean; |
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
|
|
|
|
import kotlin.UInt; |
|
|
|
import kotlin.UShort; |
|
|
|
|
|
|
|
public class ModbusMaster implements IRead,IWrite,IModbusMaster { |
|
|
|
//https://blog.csdn.net/zgkxzx/article/details/71630301 |
|
|
@@ -94,7 +76,7 @@ public class ModbusMaster implements IRead,IWrite,IModbusMaster { |
|
|
|
|
|
|
|
} |
|
|
|
public boolean IsConnected=false; |
|
|
|
private String TempIp; |
|
|
|
public String TempIp; |
|
|
|
private int TempPort; |
|
|
|
private String TempCom; |
|
|
|
private int TempBaudRate; |
|
|
|