Skip to content

Commit

Permalink
[openwebnet] code style check
Browse files Browse the repository at this point in the history
Signed-off-by: Massimo Valla <[email protected]>
  • Loading branch information
mvalla committed Oct 16, 2023
1 parent 23263a3 commit 18b91ec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ private void discoverByActivation(BaseOpenMessage baseMsg) {
/**
* Register a device ThingHandler to this BridgHandler
*
* @param ownId the device OpenWebNet id
* @param ownId the device OpenWebNet id
* @param thingHandler the thing handler to be registered
*/
protected void registerDevice(String ownId, OpenWebNetThingHandler thingHandler) {
Expand Down Expand Up @@ -695,7 +695,7 @@ public void onReconnected() {
/**
* Return a ownId string (=WHO.WHERE) from the device Where address and handler
*
* @param where the Where address (to be normalized)
* @param where the Where address (to be normalized)
* @param handler the device handler
* @return the ownId String
*/
Expand All @@ -706,7 +706,7 @@ protected String ownIdFromDeviceWhere(Where where, OpenWebNetThingHandler handle
/**
* Returns a ownId string (=WHO.WHERE) from a Who and Where address
*
* @param who the Who
* @param who the Who
* @param where the Where address (to be normalized)
* @return the ownId String
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,20 @@ protected void add(int area, OpenWebNetThingHandler h) {
oneHandler = h;
}
logger.warn("/////////////////////// Added handler {} to Area {}", oId, area);
logger.warn(this.toString());
logger.warn("Map: {}", this.toString());
}

}

protected void remove(int area, OpenWebNetThingHandler h) {
if (hndlrsMap.containsKey(area)) {
Map<String, OpenWebNetThingHandler> areaHndlrs = hndlrsMap.get(Integer.valueOf(area));
if (areaHndlrs != null) {
boolean removed = areaHndlrs.remove(h.ownId, h);
if (removed && oneHandler == h) {
if (removed && oneHandler.equals(h)) {
oneHandler = getFirst();
}
logger.warn("/////////////////////// ^^^^^^^^^^^^ Removed handler {} from Area {}", h.ownId, area);
logger.warn(this.toString());
logger.warn("Map: {}", this.toString());
}
}
}
Expand Down Expand Up @@ -191,7 +190,6 @@ public String toString() {

public OpenWebNetLightingHandler(Thing thing) {
super(thing);

}

@Override
Expand Down Expand Up @@ -355,8 +353,7 @@ private void dimLightTo(int percent, Command command) {
lastBrightnessChangeSentTS = System.currentTimeMillis();
send(Lighting.requestDimTo(w.value(), newBrightnessWhat));
} catch (OWNException e) {
logger.warn("Exception while sending dimTo request for command {}: {}", command,
e.getMessage());
logger.warn("Exception while sending dimTo request for command {}: {}", command, e.getMessage());
}
}
} else {
Expand All @@ -381,7 +378,15 @@ protected void handleMultipleMessage(Lighting msg) {
if (w.isGeneral()) {
l = map.getAllHandlers();
} else if (w.getArea() > 0) {
l = map.getAreaHandlers(w.getArea());
// l = map.getAreaHandlers(w.getArea());

try {
send(Lighting.requestStatus(w.getArea() + ""));
} catch (OWNException e) {
// Auto-generated catch block
// e.printStackTrace();
}

}
if (l != null) {
for (OpenWebNetThingHandler hndlr : l) {
Expand Down Expand Up @@ -457,8 +462,7 @@ private synchronized void updateBrightness(Lighting msg) {
}
brightness = newBrightness;
} else {
logger.warn("updateBrightness() Cannot handle message {} for thing {}", msg,
getThing().getUID());
logger.warn("updateBrightness() Cannot handle message {} for thing {}", msg, getThing().getUID());
return;
}
}
Expand Down Expand Up @@ -520,8 +524,7 @@ private void updateOnOffState(Lighting msg) {
}
updateState(channelId, OnOffType.from(msg.isOn()));
} else {
logger.debug("updateOnOffState() Ignoring unsupported WHAT for thing {}. Frame={}",
getThing().getUID(),
logger.debug("updateOnOffState() Ignoring unsupported WHAT for thing {}. Frame={}", getThing().getUID(),
msg.getFrameValue());
return;
}
Expand Down Expand Up @@ -566,5 +569,4 @@ public void dispose() {
}
super.dispose();
}

}

0 comments on commit 18b91ec

Please sign in to comment.