Skip to content

Commit

Permalink
Fix for Issue #30
Browse files Browse the repository at this point in the history
Signed-off-by: Karel Goderis <karel.goderis@me.com> (github: kgoderis)
  • Loading branch information
kgoderis committed Nov 13, 2014
1 parent dd4d587 commit 4f2f79f
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,7 @@ public ZonePlayerHandler(Thing thing, UpnpIOService upnpIOService,
this.discoveryServiceRegistry = discoveryServiceRegistry;
this.discoveryServiceRegistry.addDiscoveryListener(this);
}
if (!service.isRegistered(this)) {
logger.debug("Setting status for thing '{}' to OFFLINE", getThing()
.getUID());
getThing().setStatus(ThingStatus.OFFLINE);
}

}

@Override
Expand All @@ -142,6 +138,12 @@ public void dispose() {
pollingJob.cancel(true);
pollingJob = null;
}

if (getThing().getStatus() == ThingStatus.ONLINE) {
logger.debug("Setting status for thing '{}' to OFFLINE", getThing()
.getUID());
getThing().setStatus(ThingStatus.OFFLINE);
}
}

@Override
Expand All @@ -155,6 +157,12 @@ public void initialize() {
} else {
logger.warn("Cannot initalize the zoneplayer. UDN not set.");
}

if (getThing().getStatus() == ThingStatus.OFFLINE) {
logger.debug("Setting status for thing '{}' to ONLINE", getThing()
.getUID());
getThing().setStatus(ThingStatus.ONLINE);
}
}

@Override
Expand Down

0 comments on commit 4f2f79f

Please sign in to comment.