Skip to content

Commit 06df4d7

Browse files
committed
Fixed a bug where slave simulator would not run on an address other than 1.
1 parent 8061e8c commit 06df4d7

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

nbproject/project.properties

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,18 @@ endorsed.classpath=
3535
excludes=
3636
file.reference.etherip.jar=/Users/matthew/Downloads/ModbusMechanic/lib/etherip.jar
3737
file.reference.etherip.jar-1=C:\\Users\\JAMESMA\\Downloads\\etherip-master\\etherip-master\\dist\\etherip.jar
38-
file.reference.jlibmodbus-1.2.9.7.jar=/Users/matthew/Downloads/ModbusMechanic/lib/jlibmodbus-1.2.9.7.jar
38+
file.reference.jlibmodbus-1.2.9.7.jar=C:\\Users\\JAMESMA\\Downloads\\ModbusMechanic.v2.2.1\\ModbusMechanic\\lib\\jlibmodbus-1.2.9.7.jar
3939
file.reference.jlibmodbus-1.2.9.7.jar-1=C:\\Users\\JAMESMA\\Downloads\\jlibmodbus-1.2.9.7.jar
4040
file.reference.jna-5.12.1.jar-1=C:\\Users\\JAMESMA\\Downloads\\ModbusMechanic.v2.2.1\\ModbusMechanic\\lib\\jna-5.12.1.jar
4141
file.reference.purejavacomm.jar=/Users/matthew/Downloads/purejavacomm.jar
4242
file.reference.purejavacomm.jar-1=C:\\Users\\JAMESMA\\Downloads\\ModbusMechanic.v2.2.1\\ModbusMechanic\\lib\\purejavacomm.jar
4343
includes=**
4444
jar.compress=false
4545
javac.classpath=\
46-
${file.reference.etherip.jar}:\
47-
${file.reference.jlibmodbus-1.2.9.7.jar}:\
4846
${file.reference.etherip.jar-1}:\
4947
${file.reference.purejavacomm.jar-1}:\
50-
${file.reference.jna-5.12.1.jar-1}
48+
${file.reference.jna-5.12.1.jar-1}:\
49+
${file.reference.jlibmodbus-1.2.9.7.jar}
5150
# Space-separated list of extra javac options
5251
javac.compilerargs=
5352
javac.deprecation=false

src/modbusmechanic/ModbusMechanic.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class ModbusMechanic {
4747
* @param args the command line arguments
4848
*/
4949
//version in numeric form major,minor,rev
50-
public static int[] versionArray = { 2,3,0 };
50+
public static int[] versionArray = { 2,4,0 };
5151
public static int RESPONSE_TYPE_ASCII = 1;
5252
public static int RESPONSE_TYPE_FLOAT = 2;
5353
public static int RESPONSE_TYPE_UINT16 = 3;
@@ -431,7 +431,7 @@ public static String byteToHex(byte[] buf)
431431
}
432432
return sb.toString();
433433
}
434-
public static void startSlaveSimulatorTCP(int port, java.util.ArrayList registerList)
434+
public static void startSlaveSimulatorTCP(int serverAddress, int port, java.util.ArrayList registerList)
435435
{
436436

437437
try
@@ -440,7 +440,7 @@ public static void startSlaveSimulatorTCP(int port, java.util.ArrayList register
440440
parameters.setHost(InetAddress.getLocalHost());
441441
parameters.setPort(port);
442442
slave = ModbusSlaveFactory.createModbusSlaveTCP(parameters);
443-
slave.setServerAddress(1);
443+
slave.setServerAddress(serverAddress);
444444
slave.setReadTimeout(30000);
445445
slave.setDataHolder(new SimulatorDataHolder(registerList));
446446
slave.listen();

src/modbusmechanic/PacketFrame.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,7 @@ private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI
15721572
SlaveSimulatorFrame theFrame = new SlaveSimulatorFrame(slaveId);
15731573
if (simulatorType == 0)
15741574
{
1575-
ModbusMechanic.startSlaveSimulatorTCP(502, theFrame.getRegisterList());
1575+
ModbusMechanic.startSlaveSimulatorTCP(slaveId, 502, theFrame.getRegisterList());
15761576
}
15771577
else
15781578
{

0 commit comments

Comments
 (0)