*/
@Override
protected boolean internalReceiveChanneledCommand(String itemName,
Command command, Channel sChannel,String commandAsString) {
IRtransBindingProvider provider = findFirstMatchingBindingProvider(itemName);
String remoteName = null;
String irCommandName = null;
if(command != null && provider != null){
if(command instanceof DecimalType) {
remoteName = StringUtils.substringBefore(commandAsString, ",");
irCommandName = StringUtils.substringAfter(commandAsString,",");
IrCommand firstCommand = new IrCommand();
firstCommand.remote = remoteName;
firstCommand.command = irCommandName;
IrCommand secondCommand = new IrCommand();
secondCommand.remote = provider.getRemote(itemName,command);
secondCommand.command = provider.getIrCommand(itemName,command);
if(!firstCommand.matches(secondCommand)) {
remoteName = null;
irCommandName = null;
}
} else {
remoteName = provider.getRemote(itemName,command);
irCommandName = provider.getIrCommand(itemName,command);
}
}
if(remoteName != null && irCommandName != null) {
Leds led = provider.getLed(itemName,command);
IrCommand theCommand = new IrCommand();
theCommand.remote = remoteName;
theCommand.command = irCommandName;
// construct the string we need to send to the IRtrans device
String output = packIRDBCommand(led, theCommand);
ByteBuffer outputBuffer = ByteBuffer.allocate(output.getBytes().length);
ByteBuffer response = null;
try {
outputBuffer.put(output.getBytes("ASCII"));
response = writeBuffer(outputBuffer,sChannel,true,timeOut);
} catch (UnsupportedEncodingException e) {
logger.error("An exception occurred while encoding an infrared command: {}",e.getMessage());
}
if(response != null) {
String message = stripByteCount(response);
if(message != null) {
if(message.contains("RESULT OK")){
List<Class<? extends State>> stateTypeList = provider.getAcceptedDataTypes(itemName,command);
State newState = createStateFromString(stateTypeList,commandAsString);
if(newState != null) {
eventPublisher.postUpdate(itemName, newState);
} else {