Skip to content

Commit

Permalink
Fix a bug in the implementation of DiscoveryListener of the ZonePlaye…
Browse files Browse the repository at this point in the history
…rHandler

Note for other binding developers: DiscoveryListeners get called on the discovery of any Thing, e.g. there is no selectivity, and it is up to the DiscoveryListener implementor to check if the ThingUID is valid or not

Signed-off-by: Karel Goderis <[email protected]>
  • Loading branch information
kgoderis committed Mar 9, 2015
1 parent 491f7f2 commit fec6647
Showing 1 changed file with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,21 +165,25 @@ public void initialize() {

@Override
public void thingDiscovered(DiscoveryService source, DiscoveryResult result) {
if (getThing().getConfiguration().get(UDN)
.equals(result.getProperties().get(UDN))) {
logger.debug("Discovered UDN '{}' for thing '{}'", result
.getProperties().get(UDN), getThing().getUID());
getThing().setStatus(ThingStatus.ONLINE);
onSubscription();
onUpdate();
if(result.getThingUID().equals(this.getThing().getUID())) {
if (getThing().getConfiguration().get(UDN)
.equals(result.getProperties().get(UDN))) {
logger.debug("Discovered UDN '{}' for thing '{}'", result
.getProperties().get(UDN), getThing().getUID());
getThing().setStatus(ThingStatus.ONLINE);
onSubscription();
onUpdate();
}
}
}

@Override
public void thingRemoved(DiscoveryService source, ThingUID thingUID) {
logger.debug("Setting status for thing '{}' to OFFLINE", getThing()
.getUID());
getThing().setStatus(ThingStatus.OFFLINE);
if(thingUID.equals(this.getThing().getUID())) {
logger.debug("Setting status for thing '{}' to OFFLINE", getThing()
.getUID());
getThing().setStatus(ThingStatus.OFFLINE);
}
}

@Override
Expand Down Expand Up @@ -1210,7 +1214,7 @@ public void setPosition(String relTime) {
public void setPositionTrack(long tracknr) {
seek("TRACK_NR", Long.toString(tracknr));
}

public void setPositionTrack(String tracknr) {
seek("TRACK_NR", tracknr);
}
Expand Down

0 comments on commit fec6647

Please sign in to comment.