Skip to content

Commit

Permalink
Merge pull request #101 from fransjacobs/84-add-hardware-support-for-…
Browse files Browse the repository at this point in the history
…esu-ecos

84 add hardware support for esu ecos
  • Loading branch information
fransjacobs authored Jan 7, 2025
2 parents b5e2aca + 934ef99 commit 9017ac0
Show file tree
Hide file tree
Showing 155 changed files with 9,796 additions and 1,372 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
![GitHub issues](https://img.shields.io/github/issues-raw/fransjacobs/model-railway)
![GitHub Release](https://img.shields.io/github/v/release/fransjacobs/model-railway)
***

## About the Project

JCS is a hobby project of me where I try to automate my Model Railway. Over the past years I have worked on and off on several aspects and modules of the software which are needed to drive automatically.
Expand Down Expand Up @@ -82,9 +83,11 @@ To debug or easly setup your feedback sensors
## Supported Hardware

- [DCC-EX](https://dcc-ex.com) can be connected either via serial port or network
- [Marklin CS-2](https://www.marklin.nl/producten/details/article/60215)
- [Marklin CS-2](https://www.marklin.nl/producten/details/article/60215) [Protocol Documentation](http://streaming.maerklin.de/public-media/cs2/cs2CAN-Protokoll-2_0.pdf)
- [Marklin CS-3](https://www.marklin.nl/producten/details/article/60216)
- [HSI-S88](https://www.ldt-infocenter.com/dokuwiki/doku.php?id=en:hsi-88-usb) or the [DIY version](https://mobatron.4lima.de/2020/05/s88-scanner-mit-arduino) for feedback
- [ESO EcoS](https://www.esu.eu/) [Protocol Documentation ESU](https://github.com/cbries/railessentials/blob/master/ecoslibNet48/Documentation/ecos_pc_interface3.pdf) [Community Version](https://github.com/TabalugaDrache/TCPEcos/files/13458970/Netzwerkspezifikation_2023.pdf)


## Current status

Expand Down
74 changes: 59 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>jcs</groupId>
<artifactId>jcs</artifactId>
<version>0.0.2</version>
<version>0.0.3-SNAPSHOT</version>
<packaging>jar</packaging>
<name>JCS</name>
<url>https://github.com/fransjacobs/model-railway</url>
Expand Down Expand Up @@ -42,7 +42,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.16.0</version>
<version>3.17.0</version>
</dependency>
<dependency>
<groupId>org.beryx</groupId>
Expand All @@ -57,17 +57,17 @@
<dependency>
<groupId>com.dieselpoint</groupId>
<artifactId>norm</artifactId>
<version>1.1</version>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>5.1.0</version>
<version>6.2.1</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
Expand All @@ -77,18 +77,18 @@
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-batik</artifactId>
<version>3.11.0</version>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik</artifactId>
<version>1.17</version>
<version>1.18</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-transcoder</artifactId>
<version>1.17</version>
<version>1.18</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down Expand Up @@ -135,12 +135,12 @@
<dependency>
<groupId>com.formdev</groupId>
<artifactId>flatlaf</artifactId>
<version>3.5.1</version>
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>org.httprpc</groupId>
<artifactId>sierra</artifactId>
<version>2.3</version>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>eu.hansolo</groupId>
Expand All @@ -157,14 +157,44 @@
<artifactId>jSerialComm</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>com.shinyhut</groupId>
<artifactId>vernacular</artifactId>
<version>1.14</version>
</dependency>
<dependency>
<groupId>net.straylightlabs</groupId>
<artifactId>hola</artifactId>
<version>0.2.3</version>
</dependency>
<dependency>
<groupId>org.netbeans.external</groupId>
<artifactId>AbsoluteLayout</artifactId>
<version>RELEASE220</version>
<version>RELEASE230</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.2.5</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
Expand All @@ -177,7 +207,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.7.1</version>
<version>3.8.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
Expand Down Expand Up @@ -252,7 +282,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.4.0</version>
<version>3.5.2</version>
<configuration>
<testFailureIgnore>false</testFailureIgnore>
<argLine>-Dfile.encoding=UTF-8</argLine>
Expand Down Expand Up @@ -298,6 +328,20 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>deploy</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.github.fvarrui</groupId>
<artifactId>javapackager</artifactId>
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/jcs/commandStation/AbstractController.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ public abstract class AbstractController implements GenericController {
protected final List<DisconnectionEventListener> disconnectionEventListeners;

protected ExecutorService executor;

protected int defaultSwitchTime;

protected boolean power;
protected boolean debug = false;
protected boolean virtual = false;

public AbstractController(CommandStationBean commandStationBean) {
this(System.getProperty("skip.commandStation.autoconnect", "true").equalsIgnoreCase("true"), commandStationBean);
Expand All @@ -56,6 +60,8 @@ public AbstractController(boolean autoConnect, CommandStationBean commandStation
this.commandStationBean = commandStation;

debug = System.getProperty("message.debug", "false").equalsIgnoreCase("true");
defaultSwitchTime = Integer.getInteger("default.switchtime", 250);

powerEventListeners = new LinkedList<>();
sensorEventListeners = new LinkedList<>();
accessoryEventListeners = new LinkedList<>();
Expand All @@ -66,6 +72,10 @@ public AbstractController(boolean autoConnect, CommandStationBean commandStation

disconnectionEventListeners = new LinkedList<>();

if (this.commandStationBean != null) {
this.virtual = commandStationBean.isVirtual();
}

executor = Executors.newCachedThreadPool();
}

Expand All @@ -79,6 +89,17 @@ public boolean isConnected() {
return connected;
}

@Override
public void setVirtual(boolean flag) {
this.virtual = flag;
Logger.debug("Switching Virtual Mode " + (flag ? "On" : "Off"));
}

@Override
public boolean isVirtual() {
return this.virtual;
}

@Override
public void addDisconnectionEventListener(DisconnectionEventListener listener) {
this.disconnectionEventListeners.add(listener);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/jcs/commandStation/AccessoryController.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public interface AccessoryController extends GenericController {

void switchAccessory(Integer address, AccessoryValue value, Integer switchTime);

void switchAccessory(String id, AccessoryBean.AccessoryValue value);

void addAccessoryEventListener(AccessoryEventListener listener);

void removeAccessoryEventListener(AccessoryEventListener listener);

List<AccessoryBean> getAccessories();

//List<AccessoryBean> getSwitches();

//List<AccessoryBean> getSignals();

}
4 changes: 3 additions & 1 deletion src/main/java/jcs/commandStation/FeedbackController.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.List;
import jcs.commandStation.events.SensorEvent;
import jcs.commandStation.events.SensorEventListener;
import jcs.entities.DeviceBean;
import jcs.commandStation.entities.DeviceBean;
import jcs.entities.FeedbackModuleBean;

public interface FeedbackController extends GenericController {
Expand All @@ -32,4 +32,6 @@ public interface FeedbackController extends GenericController {
List<FeedbackModuleBean> getFeedbackModules();

void fireSensorEventListeners(SensorEvent sensorEvent);

void simulateSensor(SensorEvent sensorEvent);
}
10 changes: 7 additions & 3 deletions src/main/java/jcs/commandStation/GenericController.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
import java.util.List;
import jcs.commandStation.events.DisconnectionEventListener;
import jcs.entities.CommandStationBean;
import jcs.entities.DeviceBean;
import jcs.entities.InfoBean;
import jcs.commandStation.entities.DeviceBean;
import jcs.commandStation.entities.InfoBean;

interface GenericController {
public interface GenericController {

CommandStationBean getCommandStationBean();

Expand All @@ -31,6 +31,10 @@ interface GenericController {

void disconnect();

void setVirtual(boolean flag);

boolean isVirtual();

void addDisconnectionEventListener(DisconnectionEventListener listener);

void removeDisconnectionEventListener(DisconnectionEventListener listener);
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/jcs/commandStation/JCSCommandStation.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import jcs.entities.AccessoryBean;
import jcs.entities.AccessoryBean.AccessoryValue;
import jcs.entities.CommandStationBean;
import jcs.entities.InfoBean;
import jcs.commandStation.entities.InfoBean;
import jcs.entities.LocomotiveBean;

/**
Expand All @@ -49,6 +49,10 @@ public interface JCSCommandStation {

void disconnect();

void setVirtual(boolean flag);

boolean isVirtual();

void addDisconnectionEventListener(DisconnectionEventListener listener);

void addPowerEventListener(PowerEventListener listener);
Expand Down
Loading

0 comments on commit 9017ac0

Please sign in to comment.