Skip to content

Commit

Permalink
DSC Alarm: Fix Premature Setting of Partition Arm Mode Item (openhab#…
Browse files Browse the repository at this point in the history
…4416)

The binding would prematurely set the item PARTITION_ARM_MODE when
issuing a partition arm command.  This would sometimes show that the
partition was armed when it actually wasn't.  This fixes that situation
by only setting the item when a verification message is received from
the alarm system.
  • Loading branch information
RSStephens authored and teichsta committed May 31, 2016
1 parent fe40dd9 commit 64733d4
Show file tree
Hide file tree
Showing 12 changed files with 436 additions and 525 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public class DSCAlarmBindingConfig implements BindingConfig {
* @param zoneId the ZoneId of the item
* @param itemType the DSC Alarm Item Type.
*/
public DSCAlarmBindingConfig(DSCAlarmDeviceType dscAlarmDeviceType, int partitionId, int zoneId,
DSCAlarmItemType dscAlarmItemType) {
public DSCAlarmBindingConfig(DSCAlarmDeviceType dscAlarmDeviceType, int partitionId, int zoneId, DSCAlarmItemType dscAlarmItemType) {
this.dscAlarmDeviceType = dscAlarmDeviceType;
this.partitionId = partitionId;
this.zoneId = zoneId;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ public void validateItemType(Item item, String bindingConfig) throws BindingConf
* {@inheritDoc}
*/
@Override
public void processBindingConfiguration(String context, Item item, String bindingConfig)
throws BindingConfigParseException {
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException {

String[] sections = bindingConfig.split(":");

Expand Down Expand Up @@ -104,13 +103,11 @@ public void processBindingConfiguration(String context, Item item, String bindin
}

if (dscAlarmItemType == null) {
logger.error("processBindingConfiguration(): {}: DSC Alarm Item Type is NULL! Item Not Added!",
item.getName());
logger.error("processBindingConfiguration(): {}: DSC Alarm Item Type is NULL! Item Not Added!", item.getName());
return;
}

DSCAlarmBindingConfig config = new DSCAlarmBindingConfig(dscAlarmDeviceType, partitionId, zoneId,
dscAlarmItemType);
DSCAlarmBindingConfig config = new DSCAlarmBindingConfig(dscAlarmDeviceType, partitionId, zoneId, dscAlarmItemType);
addBindingConfig(item, config);

super.processBindingConfiguration(context, item, bindingConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ public void setSysMessage(String sysMessage) {
* @param eventPublisher
* @param event
*/
public synchronized void updateDeviceItem(Item item, DSCAlarmBindingConfig config, EventPublisher eventPublisher,
DSCAlarmEvent event) {
public synchronized void updateDeviceItem(Item item, DSCAlarmBindingConfig config, EventPublisher eventPublisher, DSCAlarmEvent event) {
logger.debug("updateDeviceItem(): Item Name: {}", item.getName());

if (config != null) {
Expand Down Expand Up @@ -181,8 +180,7 @@ public synchronized void updateDeviceItem(Item item, DSCAlarmBindingConfig confi
* @param state
* @param description
*/
public synchronized void updateDeviceProperties(Item item, DSCAlarmBindingConfig config, int state,
String description) {
public synchronized void updateDeviceProperties(Item item, DSCAlarmBindingConfig config, int state, String description) {
logger.debug("updateDeviceProperties(): Item Name: {}", item.getName());

if (config != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
* @since 1.6.0
*/
public enum DSCAlarmConnectorType {
SERIAL,
TCP;
SERIAL,
TCP;
}
Loading

0 comments on commit 64733d4

Please sign in to comment.