cleaned up and corrected setValuesFromOptions

This commit is contained in:
Lucas Pleß 2012-03-06 17:58:11 +01:00
parent 0f63e33da8
commit 41452fab63
1 changed files with 10 additions and 14 deletions

View File

@ -127,20 +127,16 @@ public abstract class BuntiDMXDevice extends BuntiDevice {
public final boolean setValuesFromOptions(Map<String, Object> options) { public final boolean setValuesFromOptions(Map<String, Object> options) {
for (Entry<String, Object> opt : options.entrySet()) { for (Entry<String, Object> opt : options.entrySet()) {
try {
DMXChannel channel = dmxChannels.getChannelByName(opt.getKey()); int value = Integer.parseInt(opt.getValue().toString());
if(channel != null) { if(!setChannelValueByName(opt.getKey(), value)) {
try { return false;
int value = Integer.parseInt(opt.getValue().toString()); }
} catch (Exception e) {
setChannelValueByName(channel.getName(), value); return false;
}
} catch (Exception e) { }
return false;
}
}
}
return true; return true;
} }