本文整理汇总了Java中com.serotonin.modbus4j.exception.ErrorResponseException类的典型用法代码示例。如果您正苦于以下问题:Java ErrorResponseException类的具体用法?Java ErrorResponseException怎么用?Java ErrorResponseException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ErrorResponseException类属于com.serotonin.modbus4j.exception包,在下文中一共展示了ErrorResponseException类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startSimulator
import com.serotonin.modbus4j.exception.ErrorResponseException; //导入依赖的package包/类
public boolean startSimulator() throws ModbusTransportException, ErrorResponseException, ModbusInitException
{
for (SlaveDevice sDevice : slaveDevices)
{
if(sDevice.getDeviceModbusProtocol().equals("TCP") &&
simSettings.getTCP_SLAVES().equals("ENABLE"))
{System.out.println("TCP_DeviceStarted");sDevice.startDevice();}
else if(sDevice.getDeviceModbusProtocol().equals("UDP") &&
simSettings.getUDP_SLAVES().equals("ENABLE"))
{System.out.println("UDP");sDevice.startDevice();}
else
{System.out.println(sDevice.getDeviceModbusProtocol() + " Protocol not allowed. Check your register files or simulator settings.");}
}
return true;
}
示例2: main
import com.serotonin.modbus4j.exception.ErrorResponseException; //导入依赖的package包/类
public static void main(String[] args) throws ModbusTransportException, ErrorResponseException, IOException, ModbusInitException
{
/*File settingsFile = new File("C:\\Users\\Cevat\\Google Drive\\cevat_private\\GitHub\\ModbusSlaveSimulator\\simulatorFiles\\slaveDevice-test.json");
SlaveDevice sd = new SlaveDevice(settingsFile.getAbsolutePath());
*/
File settingsFile = new File("C:\\Users\\Cevat\\Google Drive\\cevat_private\\GitHub\\ModbusSlaveSimulator\\simulatorFiles\\SimulatorSettings.json");
Simulator sim = new Simulator(settingsFile.getAbsolutePath());
if(sim.startSimulator())
{System.out.println("Simulation Started");}
}