[atlona] Make volume a whole number & remove StringUtils (#9631)
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>pull/9652/head
parent
572da80fd9
commit
14a4a50582
|
@ -17,7 +17,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.openhab.core.thing.ThingStatus;
|
||||
import org.openhab.core.thing.ThingStatusDetail;
|
||||
import org.openhab.core.types.State;
|
||||
|
@ -88,7 +87,7 @@ public class StatefulHandlerCallback implements AtlonaHandlerCallback {
|
|||
*/
|
||||
@Override
|
||||
public void stateChanged(String channelId, State state) {
|
||||
if (StringUtils.isEmpty(channelId)) {
|
||||
if (channelId == null || "".equals(channelId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -116,7 +115,7 @@ public class StatefulHandlerCallback implements AtlonaHandlerCallback {
|
|||
* @param channelId the channel id to remove state
|
||||
*/
|
||||
public void removeState(String channelId) {
|
||||
if (StringUtils.isEmpty(channelId)) {
|
||||
if (channelId == null || "".equals(channelId)) {
|
||||
return;
|
||||
}
|
||||
state.remove(channelId);
|
||||
|
|
|
@ -323,7 +323,7 @@ public class AtlonaPro3Handler extends AtlonaHandler<AtlonaPro3Capabilities> {
|
|||
break;
|
||||
case AtlonaPro3Constants.CHANNEL_VOLUME:
|
||||
if (command instanceof DecimalType) {
|
||||
final double level = ((DecimalType) command).doubleValue();
|
||||
final int level = ((DecimalType) command).intValue();
|
||||
atlonaHandler.setVolume(portNbr, level);
|
||||
} else {
|
||||
logger.debug("Received a VOLUME channel command with a non DecimalType: {}", command);
|
||||
|
|
|
@ -19,7 +19,6 @@ import java.util.concurrent.TimeUnit;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.openhab.binding.atlona.internal.AtlonaHandlerCallback;
|
||||
import org.openhab.binding.atlona.internal.net.SocketSession;
|
||||
import org.openhab.binding.atlona.internal.net.SocketSessionListener;
|
||||
|
@ -599,7 +598,7 @@ class AtlonaPro3PortocolHandler {
|
|||
* @param portNbr a greater than zero port number
|
||||
* @param level a volume level in decibels (must range from -79 to +15)
|
||||
*/
|
||||
void setVolume(int portNbr, double level) {
|
||||
void setVolume(int portNbr, int level) {
|
||||
if (portNbr <= 0) {
|
||||
throw new IllegalArgumentException("portNbr must be greater than 0");
|
||||
}
|
||||
|
@ -906,7 +905,7 @@ class AtlonaPro3PortocolHandler {
|
|||
int hdmiPortNbr = Integer.parseInt(m.group(1));
|
||||
|
||||
// could be "off" (if mirror off), "on"/"Out" (with 3rd group representing out)
|
||||
String oper = StringUtils.trimToEmpty(m.group(2)).toLowerCase();
|
||||
String oper = (m.group(2) == null ? "" : m.group(2).trim()).toLowerCase();
|
||||
|
||||
if (oper.equals("off")) {
|
||||
callback.stateChanged(AtlonaPro3Utilities.createChannelID(AtlonaPro3Constants.GROUP_MIRROR,
|
||||
|
|
Loading…
Reference in New Issue