mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[touchwand] Add port configuration to websocket (#13440)
* add port configuration to websocket Signed-off-by: Roie Geron <roie.geron@gmail.com>
This commit is contained in:
parent
517fe44b36
commit
58168c205f
@ -85,7 +85,7 @@ public class TouchWandBridgeHandler extends BaseBridgeHandler implements TouchWa
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
synchronized (this) {
|
||||
if (isRunning) {
|
||||
TouchWandWebSockets localSockets = touchWandWebSockets = new TouchWandWebSockets(host,
|
||||
TouchWandWebSockets localSockets = touchWandWebSockets = new TouchWandWebSockets(host, port,
|
||||
scheduler);
|
||||
localSockets.registerListener(this);
|
||||
localSockets.connect();
|
||||
|
@ -59,6 +59,7 @@ public class TouchWandWebSockets {
|
||||
|
||||
private WebSocketClient client;
|
||||
private String controllerAddress;
|
||||
private int port;
|
||||
private TouchWandSocket touchWandSocket;
|
||||
private boolean isShutDown = false;
|
||||
private CopyOnWriteArraySet<TouchWandUnitStatusUpdateListener> listeners = new CopyOnWriteArraySet<>();
|
||||
@ -67,17 +68,18 @@ public class TouchWandWebSockets {
|
||||
|
||||
private ScheduledExecutorService scheduler;
|
||||
|
||||
public TouchWandWebSockets(String ipAddress, ScheduledExecutorService scheduler) {
|
||||
public TouchWandWebSockets(String ipAddress, int port, ScheduledExecutorService scheduler) {
|
||||
client = new WebSocketClient();
|
||||
touchWandSocket = new TouchWandSocket();
|
||||
this.controllerAddress = ipAddress;
|
||||
this.port = port;
|
||||
this.scheduler = scheduler;
|
||||
socketReconnect = null;
|
||||
}
|
||||
|
||||
public void connect() {
|
||||
try {
|
||||
uri = new URI("ws://" + controllerAddress + WS_ENDPOINT_TOUCHWAND);
|
||||
uri = new URI("ws://" + controllerAddress + ":" + String.valueOf(port) + WS_ENDPOINT_TOUCHWAND);
|
||||
} catch (URISyntaxException e) {
|
||||
logger.warn("URI not valid {} message {}", uri, e.getMessage());
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user