use of com.digitaldan.jomnilinkII.OmniUnknownMessageTypeException in project openhab1-addons by openhab.
the class OmniLinkBinding method internalReceiveCommand.
/**
* @{inheritDoc
*/
@Override
protected void internalReceiveCommand(String itemName, Command command) {
// the code being executed when a command was sent on the openHAB
// event bus goes here. This method is only called if one of the
// BindingProviders provide a binding for the given 'itemName'.
logger.debug("internalReceiveCommand() is called!!! {} {} ", itemName, command);
if (omniWorker != null && omniWorker.isConnected()) {
for (OmniLinkBindingProvider provider : providers) {
OmniLinkBindingConfig config = provider.getOmniLinkBindingConfig(itemName);
Item item = provider.getItem(itemName);
List<OmniLinkControllerCommand> commands = OmniLinkCommandMapper.getCommand(item, config, command);
/*
* send each command we get back
*/
for (OmniLinkControllerCommand cmd : commands) {
try {
logger.debug("Sending command {}/{}/{}", new Object[] { cmd.getCommand(), cmd.getParameter1(), cmd.getParameter2() });
omniWorker.getOmniConnection().controllerCommand(cmd.getCommand(), cmd.getParameter1(), cmd.getParameter2());
// little hack to get audio updates faster.
if (config.getObjectType() == OmniLinkItemType.AUDIOZONE_KEY) {
audioUpdateLock.notifyAll();
}
} catch (IOException e) {
logger.error("Could not send command", e);
} catch (OmniNotConnectedException e) {
logger.error("Could not send command", e);
} catch (OmniInvalidResponseException e) {
logger.error("Could not send command", e);
} catch (OmniUnknownMessageTypeException e) {
logger.error("Could not send command", e);
}
}
}
} else {
logger.debug("Could not send message, connection not established {}", omniWorker == null);
}
// get the
}
Aggregations