Fix equalsIgnoreCase issue (#11141)
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
This commit is contained in:
parent
be17654767
commit
5ce27e3407
@ -40,7 +40,7 @@ Some notes:
|
|||||||
|
|
||||||
* The binding should work on all Epson projectors that support the ESC/VP21 protocol, however not all binding channels will be useable on all projectors.
|
* The binding should work on all Epson projectors that support the ESC/VP21 protocol, however not all binding channels will be useable on all projectors.
|
||||||
* The _source_ channel includes a dropdown with the most common source inputs.
|
* The _source_ channel includes a dropdown with the most common source inputs.
|
||||||
* If your projector has a source input that is not in the dropdown, the two digit hex code to access that input will be displayed by the _source_ channel when that input is selected by the remote control.
|
* If your projector has a source input that is not in the dropdown, the two character hex code to access that input will be displayed by the _source_ channel when that input is selected by the remote control.
|
||||||
* By using the sitemap mapping or a rule to send the input's code back to the _source_ channel, any source on the projector can be accessed by the binding.
|
* By using the sitemap mapping or a rule to send the input's code back to the _source_ channel, any source on the projector can be accessed by the binding.
|
||||||
* The following channels _aspectratio_, _colormode_, _luminance_, _gamma_ and _background_ are pre-populated with a full set of options but not every option will be useable on all projectors.
|
* The following channels _aspectratio_, _colormode_, _luminance_, _gamma_ and _background_ are pre-populated with a full set of options but not every option will be useable on all projectors.
|
||||||
* If your projector has an option in one of the above mentioned channels that is not recognized by the binding, the channel will display 'UNKNOWN' if that un-recognized option is selected by the remote control.
|
* If your projector has an option in one of the above mentioned channels that is not recognized by the binding, the channel will display 'UNKNOWN' if that un-recognized option is selected by the remote control.
|
||||||
|
|||||||
@ -12,8 +12,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.openhab.binding.epsonprojector.internal;
|
package org.openhab.binding.epsonprojector.internal;
|
||||||
|
|
||||||
import java.io.InvalidClassException;
|
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.openhab.core.items.Item;
|
import org.openhab.core.items.Item;
|
||||||
import org.openhab.core.library.items.DimmerItem;
|
import org.openhab.core.library.items.DimmerItem;
|
||||||
@ -29,34 +27,34 @@ import org.openhab.core.library.items.SwitchItem;
|
|||||||
*/
|
*/
|
||||||
@NonNullByDefault
|
@NonNullByDefault
|
||||||
public enum EpsonProjectorCommandType {
|
public enum EpsonProjectorCommandType {
|
||||||
POWER("Power", SwitchItem.class),
|
POWER("power", SwitchItem.class),
|
||||||
POWER_STATE("PowerState", StringItem.class),
|
POWER_STATE("powerstate", StringItem.class),
|
||||||
LAMP_TIME("LampTime", NumberItem.class),
|
LAMP_TIME("lamptime", NumberItem.class),
|
||||||
KEY_CODE("KeyCode", StringItem.class),
|
KEY_CODE("keycode", StringItem.class),
|
||||||
VKEYSTONE("VerticalKeystone", NumberItem.class),
|
VKEYSTONE("verticalkeystone", NumberItem.class),
|
||||||
HKEYSTONE("HorizontalKeystone", NumberItem.class),
|
HKEYSTONE("horizontalkeystone", NumberItem.class),
|
||||||
AKEYSTONE("AutoKeystone", SwitchItem.class),
|
AKEYSTONE("autokeystone", SwitchItem.class),
|
||||||
FREEZE("Freeze", SwitchItem.class),
|
FREEZE("freeze", SwitchItem.class),
|
||||||
ASPECT_RATIO("AspectRatio", StringItem.class),
|
ASPECT_RATIO("aspectratio", StringItem.class),
|
||||||
LUMINANCE("Luminance", StringItem.class),
|
LUMINANCE("luminance", StringItem.class),
|
||||||
SOURCE("Source", StringItem.class),
|
SOURCE("source", StringItem.class),
|
||||||
BRIGHTNESS("Brightness", NumberItem.class),
|
BRIGHTNESS("brightness", NumberItem.class),
|
||||||
CONTRAST("Contrast", NumberItem.class),
|
CONTRAST("contrast", NumberItem.class),
|
||||||
DENSITY("Density", NumberItem.class),
|
DENSITY("density", NumberItem.class),
|
||||||
TINT("Tint", NumberItem.class),
|
TINT("tint", NumberItem.class),
|
||||||
COLOR_TEMP("ColorTemperature", NumberItem.class),
|
COLOR_TEMP("colortemperature", NumberItem.class),
|
||||||
FLESH_TEMP("FleshTemperature", NumberItem.class),
|
FLESH_TEMP("fleshtemperature", NumberItem.class),
|
||||||
COLOR_MODE("ColorMode", StringItem.class),
|
COLOR_MODE("colormode", StringItem.class),
|
||||||
HPOSITION("HorizontalPosition", NumberItem.class),
|
HPOSITION("horizontalposition", NumberItem.class),
|
||||||
VPOSITION("VerticalPosition", NumberItem.class),
|
VPOSITION("verticalposition", NumberItem.class),
|
||||||
GAMMA("Gamma", StringItem.class),
|
GAMMA("gamma", StringItem.class),
|
||||||
VOLUME("Volume", DimmerItem.class),
|
VOLUME("volume", DimmerItem.class),
|
||||||
MUTE("Mute", SwitchItem.class),
|
MUTE("mute", SwitchItem.class),
|
||||||
HREVERSE("HorizontalReverse", SwitchItem.class),
|
HREVERSE("horizontalreverse", SwitchItem.class),
|
||||||
VREVERSE("VerticalReverse", SwitchItem.class),
|
VREVERSE("verticalreverse", SwitchItem.class),
|
||||||
BACKGROUND("Background", StringItem.class),
|
BACKGROUND("background", StringItem.class),
|
||||||
ERR_CODE("ErrCode", NumberItem.class),
|
ERR_CODE("errcode", NumberItem.class),
|
||||||
ERR_MESSAGE("ErrMessage", StringItem.class),;
|
ERR_MESSAGE("errmessage", StringItem.class),;
|
||||||
|
|
||||||
private final String text;
|
private final String text;
|
||||||
private Class<? extends Item> itemClass;
|
private Class<? extends Item> itemClass;
|
||||||
@ -75,48 +73,22 @@ public enum EpsonProjectorCommandType {
|
|||||||
return itemClass;
|
return itemClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Procedure to validate command type string.
|
|
||||||
*
|
|
||||||
* @param commandTypeText
|
|
||||||
* command string e.g. RawData, Command, Brightness
|
|
||||||
* @return true if item is valid.
|
|
||||||
* @throws IllegalArgumentException
|
|
||||||
* Not valid command type.
|
|
||||||
* @throws InvalidClassException
|
|
||||||
* Not valid class for command type.
|
|
||||||
*/
|
|
||||||
public static boolean validateBinding(String commandTypeText, Class<? extends Item> itemClass)
|
|
||||||
throws IllegalArgumentException, InvalidClassException {
|
|
||||||
for (EpsonProjectorCommandType c : EpsonProjectorCommandType.values()) {
|
|
||||||
if (c.text.equalsIgnoreCase(commandTypeText)) {
|
|
||||||
if (c.getItemClass().equals(itemClass)) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
throw new InvalidClassException("Not valid class for command type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new IllegalArgumentException("Not valid command type");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Procedure to convert command type string to command type class.
|
* Procedure to convert command type string to command type class.
|
||||||
*
|
*
|
||||||
* @param commandTypeText
|
* @param commandTypeText
|
||||||
* command string e.g. RawData, Command, Brightness
|
* command string e.g. RawData, Command, Brightness
|
||||||
* @return corresponding command type.
|
* @return corresponding command type.
|
||||||
* @throws InvalidClassException
|
* @throws IllegalArgumentException
|
||||||
* Not valid class for command type.
|
* No valid class for command type.
|
||||||
*/
|
*/
|
||||||
public static EpsonProjectorCommandType getCommandType(String commandTypeText) throws IllegalArgumentException {
|
public static EpsonProjectorCommandType getCommandType(String commandTypeText) throws IllegalArgumentException {
|
||||||
for (EpsonProjectorCommandType c : EpsonProjectorCommandType.values()) {
|
for (EpsonProjectorCommandType c : EpsonProjectorCommandType.values()) {
|
||||||
if (c.text.equalsIgnoreCase(commandTypeText)) {
|
if (c.text.equals(commandTypeText)) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new IllegalArgumentException("Not valid command type");
|
throw new IllegalArgumentException("Not valid command type: " + commandTypeText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -170,7 +170,7 @@ public class EpsonProjectorHandler extends BaseThingHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
logger.warn("Unknown channel {}", channel.getUID().getId());
|
logger.warn("Unknown channel {}, exception: {}", channel.getUID().getId(), e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user