Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S-Bus transport protocol. Derived from Modbus protocol #4025

Open
wants to merge 48 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
d3edb02
S-Bus transport protocol. Derived from Modbus protocol
Jan 7, 2024
af5ad18
add sbus module to the list of bundles
Jan 7, 2024
21fe586
cleanup classpath and project files
Jan 7, 2024
1202a03
fix unit tests
Jan 13, 2024
fc6a680
fix formatting issues
Jan 13, 2024
1c8a36c
fix sat-plugin issues
Jan 13, 2024
d6fc1c2
Fix build number reporting at startup (#3991)
kaikreuzer Jan 2, 2024
1b6976f
New translations addons.properties (Italian) (#3979)
openhab-bot Jan 2, 2024
06e8ee4
Refactor ThingHandlerService to an OSGi component prototype (#3957)
J-N-K Jan 2, 2024
b30517f
Use isEmpty instead of 0 comparisons (#3999)
wborn Jan 2, 2024
8c96f38
Remove redundant array creation for calling varargs methods (#3997)
wborn Jan 2, 2024
306f1af
Remove redundant modifiers (#4000)
wborn Jan 2, 2024
85fba42
fix empty rule condition (#3993)
mherwege Jan 2, 2024
cad8cfb
Replace or remove assert statements (#3994)
wborn Jan 2, 2024
43212b8
Fix assertEquals order (#3995)
wborn Jan 2, 2024
5932f44
Use diamond operator (#4001)
wborn Jan 3, 2024
76da465
Fix `SerialPort.getFlowControlMode()` infinite recursion (#4007)
wborn Jan 3, 2024
7bebd52
Simplify assertions (#3996)
wborn Jan 3, 2024
ef5393a
Use static inner classes (#4002)
wborn Jan 3, 2024
608abf2
Fix `String.format` argument mismatches (#4008)
wborn Jan 3, 2024
fee7c6b
Remove unnecessary semicolons (#4009)
wborn Jan 3, 2024
e9089d8
Iterate using Map entries (#4003)
wborn Jan 3, 2024
6aa01a3
Simplify adding elements to Collections (#4006)
wborn Jan 3, 2024
32c5a18
Use protected modifier with constructor of abstract classes (#4010)
wborn Jan 3, 2024
d277fe1
Update license headers to 2024 (#4011)
wborn Jan 3, 2024
e78155b
Fix openhab-core-auth-oauth2client feature installation (#4012)
wborn Jan 3, 2024
2b2085b
Fix JavaDoc issues (#4004)
wborn Jan 3, 2024
1529e7b
IpAddonFinder: Skip installed addons (#4013)
holgerfriedrich Jan 4, 2024
758f5d8
Upgrade to JmDNS 3.5.9 (#4015)
kaikreuzer Jan 4, 2024
da0eb70
Fix JavaDoc build (#4018)
wborn Jan 5, 2024
6a280c9
Fix CurrencyUnit (#4016)
J-N-K Jan 5, 2024
8034416
[Audio] Add piped audio stream and fix raw PCM streams format (#3960)
GiviMAD Jan 7, 2024
de8c61a
Refactor java.util.Date usages to java.time.Instant (#4026)
jlaur Jan 7, 2024
1c11bd1
UsbSerialDiscovery service based on Windows registry (#3934)
andrewfg Jan 11, 2024
b88dfe4
[discovery] Fix `Instant` serialization/deserialization regression (#…
jlaur Jan 12, 2024
cbef713
Fix wrong class name logged in LocaleServiceImpl (#4034)
wborn Jan 12, 2024
1360107
Improve ThreadPoolManagerTest stability (#4035)
wborn Jan 12, 2024
e9925e3
Upgrade Jollyday to 0.23.2 (#4033)
wborn Jan 14, 2024
1111939
Fix NPE in UpnpIOServiceImpl (#4038)
J-N-K Jan 14, 2024
ec3efa2
Improve marketplace add-on handling (#4019)
J-N-K Jan 14, 2024
739ffef
Fix logging in ChannelCommandDescriptionProvider (#4040)
J-N-K Jan 15, 2024
89817bd
Fix config parsing and version handling in RemoteAddonServices (#4043)
J-N-K Jan 15, 2024
71fd2b4
Improve RemoteAddonService and fix test (#4049)
J-N-K Jan 17, 2024
5c34a7b
Merge branch 'main' of https://github.com/openhab/openhab-core into f…
Jan 20, 2024
404f24a
fix spotless issues
Jan 20, 2024
fed04c1
fix build problems
Jan 20, 2024
cdf8bae
fix build problems
Jan 20, 2024
ae378d9
two forgoten but important lines, for transfering subnetId to the mod…
Jan 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,4 +1,6 @@
target/
**/.classpath
**/.project
src-gen/
xtend-gen/
bin/
Expand Down
6 changes: 6 additions & 0 deletions bom/openhab-core/pom.xml
Expand Up @@ -148,6 +148,12 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.io.transport.sbus</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.io.transport.serial</artifactId>
Expand Down
20 changes: 20 additions & 0 deletions bundles/org.openhab.core.io.transport.sbus/NOTICE
@@ -0,0 +1,20 @@
This content is produced and maintained by the openHAB project.

* Project home: https://www.openhab.org

== Declared Project Licenses

This program and the accompanying materials are made available under the terms
of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/.

== Source Code

https://github.com/openhab/openhab-core

== Third-party Content

jsoup
* License: MIT License
* Project: https://jsoup.org/
* Source: https://github.com/jhy/jsoup
10 changes: 10 additions & 0 deletions bundles/org.openhab.core.io.transport.sbus/bnd.bnd
@@ -0,0 +1,10 @@
Bundle-SymbolicName: ${project.artifactId}
Automatic-Module-Name: ${def;bsn}
Import-Package: \
org.eclipse.jdt.annotation.*;resolution:=optional,\
org.openhab.*;version=!,\
!net.sf.cglib.proxy,\
gnu.io;version="[3.12,6)",\
*
-sources: false
-contract: *
71 changes: 71 additions & 0 deletions bundles/org.openhab.core.io.transport.sbus/pom.xml
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.reactor.bundles</artifactId>
<version>4.2.0-SNAPSHOT</version>
</parent>

<artifactId>org.openhab.core.io.transport.sbus</artifactId>

<name>openHAB Core :: Bundles :: S-Bus Transport</name>

<dependencies>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.config.core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.test</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.8.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ro.ciprianpascu</groupId>
<artifactId>j2sbus</artifactId>
<version>1.3.7.OH</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>embed-dependencies</id>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeScope>runtime</includeScope>
<includeTypes>jar</includeTypes>
<excludeGroupIds>commons-pool2,org.openhab.core.bundles</excludeGroupIds>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<excludeTransitive>true</excludeTransitive>
<type>jar</type>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
@@ -0,0 +1,65 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.io.transport.sbus;

import java.util.Objects;

import org.eclipse.jdt.annotation.NonNullByDefault;

/**
* Encapsulates result of modbus read operations
*
* @author Nagy Attila Gabor - Initial contribution
*/
@NonNullByDefault
public class AsyncModbusFailure<R> {
private final R request;

private final Exception cause;

public AsyncModbusFailure(R request, Exception cause) {
Objects.requireNonNull(request, "Request must not be null!");
Objects.requireNonNull(cause, "Cause must not be null!");
this.request = request;
this.cause = cause;
}

/**
* Get request matching this response
*
* @return request object
*/
public R getRequest() {
return request;
}

/**
* Get cause of error
*
* @return exception representing error
*/
public Exception getCause() {
return cause;
}

@Override
public String toString() {
StringBuilder builder = new StringBuilder("AsyncModbusReadResult(");
builder.append("request = ");
builder.append(request);
builder.append(", error = ");
builder.append(cause);
builder.append(")");
return builder.toString();
}
}
@@ -0,0 +1,93 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.io.transport.sbus;

import java.util.Objects;
import java.util.Optional;

import org.eclipse.jdt.annotation.NonNullByDefault;

/**
* Encapsulates result of modbus read operations
*
* @author Sami Salonen - Initial contribution
*/
@NonNullByDefault
public class AsyncModbusReadResult {

private final ModbusReadRequestBlueprint request;

private final Optional<BitArray> bits;

private final Optional<ModbusRegisterArray> registers;

public AsyncModbusReadResult(ModbusReadRequestBlueprint request, ModbusRegisterArray registers) {
Objects.requireNonNull(request, "Request must not be null!");
Objects.requireNonNull(registers, "Registers must not be null!");
this.request = request;
this.registers = Optional.of(registers);
this.bits = Optional.empty();
}

public AsyncModbusReadResult(ModbusReadRequestBlueprint request, BitArray bits) {
Objects.requireNonNull(request, "Request must not be null!");
Objects.requireNonNull(bits, "Bits must not be null!");
this.request = request;
this.registers = Optional.empty();
this.bits = Optional.of(bits);
}

/**
* Get request matching this response
*
* @return request object
*/
public ModbusReadRequestBlueprint getRequest() {
return request;
}

/**
* Get "coil" or "discrete input" bit data in the case of no errors
*
* @return bit data
*/
public Optional<BitArray> getBits() {
return bits;
}

/**
* Get "input register" or "holding register" data in the case of no errors
*
* @return register data
*/
public Optional<ModbusRegisterArray> getRegisters() {
return registers;
}

@Override
public String toString() {
StringBuilder builder = new StringBuilder("AsyncModbusReadResult(");
builder.append("request = ");
builder.append(request);
bits.ifPresent(bits -> {
builder.append(", bits = ");
builder.append(bits);
});
registers.ifPresent(registers -> {
builder.append(", registers = ");
builder.append(registers);
});
builder.append(")");
return builder.toString();
}
}
@@ -0,0 +1,66 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.core.io.transport.sbus;

import java.util.Objects;

import org.eclipse.jdt.annotation.NonNullByDefault;

/**
* Encapsulates result of modbus write operations
*
* @author Sami Salonen - Initial contribution
*/
@NonNullByDefault
public class AsyncModbusWriteResult {

private final ModbusWriteRequestBlueprint request;

private final ModbusResponse response;

public AsyncModbusWriteResult(ModbusWriteRequestBlueprint request, ModbusResponse response) {
Objects.requireNonNull(request, "Request must not be null!");
Objects.requireNonNull(response, "Response must not be null!");
this.request = request;
this.response = response;
}

/**
* Get request matching this response
*
* @return request object
*/
public ModbusWriteRequestBlueprint getRequest() {
return request;
}

/**
* Get response
*
* @return response
*/
public ModbusResponse getResponse() {
return response;
}

@Override
public String toString() {
StringBuilder builder = new StringBuilder("AsyncModbusWriteResult(");
builder.append("request = ");
builder.append(request);
builder.append(", response = ");
builder.append(response);
builder.append(")");
return builder.toString();
}
}