if (valueSelector == RFXComValueSelector.SIGNAL_LEVEL) {
state = new DecimalType(signalLevel);
} else {
throw new RFXComException("Can't convert "
+ valueSelector + " to NumberItem");
}
} else if (valueSelector.getItemClass() == SwitchItem.class) {
if (valueSelector == RFXComValueSelector.COMMAND) {
switch (command) {
case OFF:
case GROUP_OFF:
state = OnOffType.OFF;
break;
case ON:
case GROUP_ON:
state = OnOffType.ON;
break;
default:
throw new RFXComException("Can't convert "
+ command + " to SwitchItem");
}
} else {
throw new RFXComException("Can't convert "
+ valueSelector + " to SwitchItem");
}
} else if (valueSelector.getItemClass() == ContactItem.class) {
if (valueSelector == RFXComValueSelector.CONTACT) {
switch (command) {
case OFF:
case GROUP_OFF:
state = OpenClosedType.CLOSED;
break;
case ON:
case GROUP_ON:
state = OpenClosedType.OPEN;
break;
default:
throw new RFXComException("Can't convert "
+ command + " to ContactItem");
}
} else {
throw new RFXComException("Can't convert "
+ valueSelector + " to ContactItem");
}
} else if (valueSelector.getItemClass() == StringItem.class) {
if (valueSelector == RFXComValueSelector.RAW_DATA) {
state = new StringType(
DatatypeConverter.printHexBinary(rawMessage));
} else {
throw new RFXComException("Can't convert "
+ valueSelector + " to StringItem");
}
} else {
throw new RFXComException("Can't convert " + valueSelector
+ " to " + valueSelector.getItemClass());
}
return state;