if (provider.isInBinding(itemName) == false) {
logger.debug(
"Received command (item='{}', state='{}', class='{}')",
new Object[] { itemName, command.toString(),
command.getClass().toString() });
RFXComSerialConnector connector = RFXComConnection
.getCommunicator();
if (connector == null) {
logger.warn("RFXCom controller is not initialized!");
return;
}
String id = provider.getId(itemName);
PacketType packetType = provider.getPacketType(itemName);
Object subType = provider.getSubType(itemName);
RFXComValueSelector valueSelector = provider
.getValueSelector(itemName);
try {
RFXComMessageInterface obj = RFXComMessageFactory.getMessageInterface(packetType);
obj.convertFromState(valueSelector, id, subType, command, getNextSeqNumber());
byte[] data = obj.decodeMessage();
logger.debug("Transmitting data: {}",
DatatypeConverter.printHexBinary(data));
setResponseMessage(null);
connector.sendMessage(data);
} catch (RFXComException e) {
e.printStackTrace();
} catch (IOException e) {
logger.error("Message sending to RFXCOM controller failed.", e);