forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[paradoxalarm] Limit maximum zones and partitions with new parameters…
… and more channels added to partition thing (openhab#6792) * Implementation of maxZones and maxPartitions parameters * Reworked creation of EvoCommunicator to use builder pattern * Added support for additional, non-mandatory parameters maxZones and maxPartitions which limit the maximum amount of zones and partitions that are used during refresh. * Changed Factory to create builder instead of communicator * Renamed classes to represent properly the new object creation design Signed-off-by: Konstantin Polihronov <polychronov@gmail.com>
- Loading branch information
Showing
15 changed files
with
460 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...in/java/org/openhab/binding/paradoxalarm/internal/communication/ICommunicatorBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* Copyright (c) 2010-2020 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.binding.paradoxalarm.internal.communication; | ||
|
||
import java.util.concurrent.ScheduledExecutorService; | ||
|
||
/** | ||
* The {@link ICommunicatorBuilder} is representing the functionality of communicator builders. | ||
* The idea is to ease initialization of communicators which can have lots of parameters. | ||
* | ||
* @author Konstantin Polihronov - Initial contribution | ||
*/ | ||
public interface ICommunicatorBuilder { | ||
ICommunicatorBuilder withMaxZones(Integer zones); | ||
|
||
ICommunicatorBuilder withMaxPartitions(Integer partitions); | ||
|
||
ICommunicatorBuilder withIp150Password(String ip150Password); | ||
|
||
ICommunicatorBuilder withPcPassword(String pcPassword); | ||
|
||
ICommunicatorBuilder withIpAddress(String ipAddress); | ||
|
||
ICommunicatorBuilder withTcpPort(Integer tcpPort); | ||
|
||
ICommunicatorBuilder withScheduler(ScheduledExecutorService scheduler); | ||
|
||
IParadoxCommunicator build(); | ||
} |
41 changes: 41 additions & 0 deletions
41
...n/java/org/openhab/binding/paradoxalarm/internal/communication/ParadoxBuilderFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* Copyright (c) 2010-2020 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.binding.paradoxalarm.internal.communication; | ||
|
||
import org.openhab.binding.paradoxalarm.internal.exceptions.ParadoxRuntimeException; | ||
import org.openhab.binding.paradoxalarm.internal.model.PanelType; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* The {@link ParadoxBuilderFactory} used to create the proper communicator builder objects for different panel | ||
* types. | ||
* | ||
* @author Konstantin Polihronov - Initial contribution | ||
*/ | ||
public class ParadoxBuilderFactory { | ||
|
||
private final Logger logger = LoggerFactory.getLogger(ParadoxBuilderFactory.class); | ||
|
||
public ICommunicatorBuilder createBuilder(PanelType panelType) { | ||
switch (panelType) { | ||
case EVO48: | ||
case EVO96: | ||
case EVO192: | ||
logger.debug("Creating new builder for Paradox {} system", panelType); | ||
return new EvoCommunicator.EvoCommunicatorBuilder(panelType); | ||
default: | ||
throw new ParadoxRuntimeException("Unsupported panel type: " + panelType); | ||
} | ||
} | ||
} |
Oops, something went wrong.