Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
60af1f8
Release candidate 1 of version 2.0
Mar 26, 2016
c944bbe
Release candidate 2 of version 2.0
Mar 28, 2016
c0d9e47
Release candidate 3 of version 2.0
Mar 28, 2016
45ba156
Release candidate 3 of version 2.0
Mar 28, 2016
10e98f3
Release candidate 4 of version 2.0
Mar 29, 2016
64767d4
Release version 2.0
Apr 6, 2016
8281fe7
Release version 2.1
May 13, 2016
fd953e4
Release version 2.1
May 13, 2016
9cedc2b
Release version 2.1.1
May 18, 2016
fb4755f
Re-release version 2.1.1
May 19, 2016
ec19c9f
Re-release version 2.1.2
Jun 5, 2016
c930305
Re-release version 2.1.3
Jul 1, 2016
69dbdb1
Re-release version 2.2.0
Jul 5, 2016
e286d03
Re-release version 2.2.1
Jul 19, 2016
441870e
Re-release version 2.2.2
Jul 22, 2016
6d0c77e
Re-release version 2.3.0
Sep 4, 2016
d36c042
Re-release version 2.3.1
Oct 10, 2016
0a8e198
Re-release version 2.3.2
Jan 22, 2017
99e6299
Re-release version 2.3.2
Jan 22, 2017
5de69d8
Re-release version 2.3.3
Apr 12, 2017
3c0ede2
Re-release version 2.3.4
Jun 7, 2017
e4a3802
Re-release version 2.3.6
Sep 11, 2017
06fcdb9
Release version 2.3.7
Oct 24, 2017
1197786
Release version 2.3.8
Jan 18, 2018
30a2390
Release version 2.3.9
Feb 2, 2018
82fc995
Release version 2.4.0
Mar 5, 2018
7ddaff0
Release version 2.4.1
Mar 18, 2018
1f7e4f9
Release version 2.4.2
Apr 20, 2018
f70a29f
Release version 2.5.0
Apr 23, 2018
b9e0e77
Set theme jekyll-theme-minimal
steveohara Aug 23, 2018
b77ed1c
Release version 2.5.1
Aug 23, 2018
6fd0ca9
Release version 2.5.2
Oct 22, 2018
fc6d63b
Release version 2.5.3
Dec 19, 2018
f82d40e
Release version 2.5.5
Jun 15, 2019
497454b
Release version 2.5.8
Nov 16, 2019
9d2a112
Release version 2.6.0
Feb 17, 2020
2a755ac
Release version 2.6.1
Feb 20, 2020
409d1e5
Release version 2.6.2
Mar 28, 2020
4500cb4
Release version 2.6.3
Mar 30, 2020
9c5c48b
Release version 2.6.3
Mar 30, 2020
5f63b4c
Release version 2.6.4
Mar 30, 2020
e132b24
Release version 2.6.5
Apr 8, 2020
8e7b094
Release version 2.7.0
Sep 5, 2020
928290f
Release version 3.0.0
Aug 20, 2021
1424886
Released version 3.1.1
Jan 27, 2022
c26ae5c
Released version 3.2.0
Sep 14, 2023
a1f7f65
Released version 3.2.1
Mar 11, 2024
209dda5
Released version 3.2.2
Dec 21, 2025
7d18308
Dropped the development branch - trunk development only from now on
Dec 22, 2025
6509527
ModbusSerialTransport.getInterFrameDelay returns wrong values if the …
Dec 22, 2025
cab9405
Merge tag 'v3.3.0' into release/v3.3.0
da-Kai Feb 13, 2026
71a02c9
snapshot version
da-Kai Feb 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Snapshot releases can be downloaded here
# Dependencies

* [jSerialComm](http://fazecast.github.io/jSerialComm/)
The serial comms is handled by JSerialComm that includs native implementations for most platforms.
The serial comms is handled by JSerialComm that includes native implementations for most platforms.
* [slf4j](https://www.slf4j.org/)
Logging facade to fit in with your application logging framework
* JRE 1.8 (JRE 1.6 for v2.70 and lower)
Expand Down
8 changes: 5 additions & 3 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ _(**NOT BACKWARDS COMPATIBLE**)_
* Add support for providing an optional java.net proxy for. (#151)
* Added support for testing serial comms on Mac/Linux

## Version 3.2.2-openems.1
* Add Deploy Workflow
* Forward 'disablePortConfiguration'-setting from jSerialComm
## Version 3.2.3
* Failed to read response! CRC Error in received frame #153 - thanks thomas-hutterer-tik. (#153)
* Expose disableRs485ModeControl from jSerialComm v2.11.4 thanks da-Kai (#160)

**_Note: - from 3.3.0 onwards, the release notes will be maintained in commit and GitHub releases._**
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-minimal
21 changes: 10 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<artifactId>j2mod</artifactId>
<name>j2mod</name>
<url>https://github.com/OpenEMS/j2mod</url>
<version>3.2.2-openems.2</version>
<version>3.3.0-openems.1-SNAPSHOT</version>
<description>A Modbus TCP/UDP/Serial Master and Slave implementation</description>

<packaging>bundle</packaging>
Expand All @@ -23,7 +23,7 @@
<name>Dieter Wimberger</name>
<email>wimpi@user.sourceforge.com</email>
<organization>SourceForge</organization>
<organizationUrl>http://jamod.sourceforge.net</organizationUrl>
<organizationUrl>https://jamod.sourceforge.net</organizationUrl>
<roles>
<role>architect</role>
<role>developer</role>
Expand All @@ -34,17 +34,17 @@
<name>John Charlton</name>
<email>jdcharlton@user.sourceforge.com</email>
<organization>SourceForge</organization>
<organizationUrl>http://jamod.sourceforge.net</organizationUrl>
<organizationUrl>https://jamod.sourceforge.net</organizationUrl>
<roles>
<role>developer</role>
</roles>
</developer>
<developer>
<id>jhaugh</id>
<name>Julie Haugh</name>
<email>http://www.ghgande.com</email>
<email>https://www.ghgande.com</email>
<organization>greenHouse Gas and Electric</organization>
<organizationUrl>http://www.ghgande.com</organizationUrl>
<organizationUrl>https://www.ghgande.com</organizationUrl>
<roles>
<role>developer</role>
</roles>
Expand All @@ -54,7 +54,7 @@
<name>Steve O'Hara</name>
<email>steve.ohara@4ng.co.uk</email>
<organization>4NG</organization>
<organizationUrl>http://www.4ng.co.uk</organizationUrl>
<organizationUrl>https://www.4ng.co.uk</organizationUrl>
<roles>
<role>developer</role>
</roles>
Expand All @@ -64,7 +64,7 @@
<licenses>
<license>
<name>The Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>

Expand All @@ -88,15 +88,14 @@

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<artifactId>slf4j-reload4j</artifactId>
<version>2.0.9</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.20.0</version>
<version>2.25.3</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -252,7 +251,7 @@
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.7.0</version>
<version>0.9.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/ghgande/j2mod/modbus/io/BytesOutputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ public void reset() {
count = 0;
}

/**
* Resets this <tt>BytesInputStream</tt> using the given
* byte[] as new input buffer.
*
* @param data a byte array with data to be read.
*/
public void reset(byte[] data) {
buf = data;
count = 0;
}

@Override
public void writeBoolean(boolean v) throws IOException {
dataOutputStream.writeBoolean(v);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ protected ModbusRequest readRequestIn(AbstractModbusListener listener) throws Mo
int[] crc = ModbusUtil.calculateCRC(inBuffer, 0, dlength); // does not include CRC
if (ModbusUtil.unsignedByteToInt(inBuffer[dlength]) != crc[0] || ModbusUtil.unsignedByteToInt(inBuffer[dlength + 1]) != crc[1]) {
if (logger.isDebugEnabled()) {
logger.debug("CRC should be {}, {}", Integer.toHexString(crc[0]), Integer.toHexString(crc[1]));
logger.debug("CRC should be {}, {} inBuffer={}", Integer.toHexString(crc[0]), Integer.toHexString(crc[1]),
ModbusUtil.toHex(inBuffer, 0, dlength + 2));
}

// Drain the input in case the frame was misread and more
Expand Down Expand Up @@ -380,6 +381,8 @@ protected ModbusRequest readRequestIn(AbstractModbusListener listener) throws Mo
logger.debug("Read message not meant for us: {}", ModbusUtil.toHex(byteInputOutputStream.getBuffer(), 0, byteInputOutputStream.size()));
}
}
// as the buffer might have been bumped due to more than 256 bytes input, we reset it to the original inBuffer
byteInputOutputStream.reset(inBuffer);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,8 @@ int getInterFrameDelay() {
return 1750;
}
else {
return Math.max(getCharInterval(Modbus.INTER_MESSAGE_GAP), Modbus.MINIMUM_TRANSMIT_DELAY);
long delay = Math.max(getCharIntervalMicro(Modbus.INTER_MESSAGE_GAP), Modbus.MINIMUM_TRANSMIT_DELAY * 1000L);
return delay > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) delay;
}
}

Expand All @@ -660,17 +661,6 @@ long getMaxCharDelay() {
* Used for message timings.
*
* @param chars Number of characters
* @return char interval in milliseconds
*/
int getCharInterval(double chars) {
return (int) (getCharIntervalMicro(chars) / 1000);
}

/**
* Calculates an interval based on a set number of characters.
* Used for message timings.
*
* @param chars Number of caracters
* @return microseconds
*/
long getCharIntervalMicro(double chars) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.ghgande.j2mod.modbus.msg.ReadFileRecordResponse.RecordResponse;
import com.ghgande.j2mod.modbus.net.AbstractModbusListener;
import com.ghgande.j2mod.modbus.procimg.*;
import com.ghgande.j2mod.modbus.procimg.Record;

import java.io.DataInput;
import java.io.DataOutput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import com.ghgande.j2mod.modbus.msg.WriteFileRecordResponse.RecordResponse;
import com.ghgande.j2mod.modbus.net.AbstractModbusListener;
import com.ghgande.j2mod.modbus.procimg.*;
import com.ghgande.j2mod.modbus.procimg.Record;

import java.io.DataInput;
import java.io.DataOutput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ public void setNetworkInterface(NetworkInterface networkInterface) {

/**
* Sets the <tt>Proxy</tt> that this socket uses. If null (the default), no proxy is used.
* @param proxy the proxy as <tt>Proxy</tt>.
*/
public void setProxy(Proxy proxy) {
if(socket != null && proxy != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ public static synchronized void close() {
/**
* Returns the running slave listening on the given port
*
* @param type Type of slave
* @param port Port to check for running slave
* @return Null or ModbusSlave
*/
Expand All @@ -207,6 +208,7 @@ public static synchronized ModbusSlave getSlave(ModbusSlaveType type, int port)
/**
* Returns the running slave listening on the given port
*
* @param type Type of slave
* @param port Port to check for running slave
* @return Null or ModbusSlave
*/
Expand Down
46 changes: 23 additions & 23 deletions src/main/java/com/ghgande/j2mod/modbus/util/SerialParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -395,29 +395,6 @@ public void setDatabits(String databits) {
}
}

/**
* Disables RS-485 control signals management.
* <p>
* <i>Please note that this is only effective on Linux.</i>
* <p>
* This function forces RS-485 mode to stay untouched,
* regardless of the current setting of RS-485 mode.
* <p>
* This function is necessary for Linux drivers that don't handle TIOCGRS485 properly.
*/
public void disableRs485Control() {
this.rs485DisableControl = true;
}

/**
* Returns whether RS-485 control signals management is disabled.
*
* @return true if RS-485 control signals management is disabled.
*/
public boolean isRs485ControlDisabled() {
return this.rs485DisableControl;
}

/**
* Returns the number of data bits as <tt>String</tt>.
*
Expand Down Expand Up @@ -924,6 +901,29 @@ public void setRs485DelayAfterTxMicroseconds(String microseconds) {
setRs485DelayAfterTxMicroseconds(Integer.parseInt(microseconds));
}

/**
* Disables RS-485 control signals management.
* <p>
* <i>Please note that this is only effective on Linux.</i>
* <p>
* This function forces RS-485 mode to stay untouched,
* regardless of the current setting of RS-485 mode.
* <p>
* This function is necessary for Linux drivers that don't handle TIOCGRS485 properly.
*/
public void disableRs485Control() {
this.rs485DisableControl = true;
}

/**
* Returns whether RS-485 control signals management is disabled.
*
* @return true if RS-485 control signals management is disabled.
*/
public boolean isRs485ControlDisabled() {
return this.rs485DisableControl;
}

@Override
public String toString() {
return "SerialParameters{" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.*;

/**
* Testing class for {@link ModbusTCPMaster#equals} &amp; {@link ModbusTCPMaster#hashCode} methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package com.ghgande.j2mod.modbus.cmd;

import com.ghgande.j2mod.modbus.Modbus;
import com.ghgande.j2mod.modbus.procimg.Record;
import com.ghgande.j2mod.modbus.procimg.*;
import com.ghgande.j2mod.modbus.slave.ModbusSlave;
import com.ghgande.j2mod.modbus.slave.ModbusSlaveFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import com.ghgande.j2mod.modbus.Modbus;
import com.ghgande.j2mod.modbus.procimg.*;
import com.ghgande.j2mod.modbus.procimg.Record;
import com.ghgande.j2mod.modbus.slave.ModbusSlave;
import com.ghgande.j2mod.modbus.slave.ModbusSlaveFactory;
import org.slf4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package com.ghgande.j2mod.modbus.utils;

import com.ghgande.j2mod.modbus.procimg.*;
import com.ghgande.j2mod.modbus.procimg.Record;
import com.ghgande.j2mod.modbus.slave.ModbusSlave;
import com.ghgande.j2mod.modbus.util.Observable;
import com.ghgande.j2mod.modbus.util.Observer;
Expand Down