use of com.github.paolodenti.jsapp.core.command.base.SappCommand in project openhab1-addons by openhab.
the class SappCentralExecuter method executeSapp7CCommand.
/**
* runs 7C command
*/
public int executeSapp7CCommand(String ip, int port, int address) throws SappException {
synchronized (this) {
SappCommand sappCommand = new Sapp7CCommand(address);
sappCommand.run(ip, port);
if (!sappCommand.isResponseOk()) {
throw new SappException("command execution failed");
}
return sappCommand.getResponse().getDataAsWord();
}
}
use of com.github.paolodenti.jsapp.core.command.base.SappCommand in project openhab1-addons by openhab.
the class SappCentralExecuter method executeSapp74Command.
/**
* runs 74 command
*/
public int executeSapp74Command(String ip, int port, byte address) throws SappException {
synchronized (this) {
SappCommand sappCommand = new Sapp74Command(address);
sappCommand.run(ip, port);
if (!sappCommand.isResponseOk()) {
throw new SappException("command execution failed");
}
return sappCommand.getResponse().getDataAsWord();
}
}
use of com.github.paolodenti.jsapp.core.command.base.SappCommand in project openhab1-addons by openhab.
the class SappCentralExecuter method executeSapp7DCommand.
/**
* runs 7D command
*/
public void executeSapp7DCommand(String ip, int port, int address, int value) throws SappException {
synchronized (this) {
SappCommand sappCommand = new Sapp7DCommand(address, value);
sappCommand.run(ip, port);
if (!sappCommand.isResponseOk()) {
throw new SappException("command execution failed");
}
}
}
use of com.github.paolodenti.jsapp.core.command.base.SappCommand in project openhab1-addons by openhab.
the class SappCentralExecuter method executeSapp75Command.
/**
* runs 75 command
*/
public int executeSapp75Command(String ip, int port, byte address) throws SappException {
synchronized (this) {
SappCommand sappCommand = new Sapp75Command(address);
sappCommand.run(ip, port);
if (!sappCommand.isResponseOk()) {
throw new SappException("command execution failed");
}
return sappCommand.getResponse().getDataAsWord();
}
}
use of com.github.paolodenti.jsapp.core.command.base.SappCommand in project openhab1-addons by openhab.
the class SappCentralExecuter method executePollingSappCommands.
/**
* runs polling on virtuals, inputs, outputs
*/
public PollingResult executePollingSappCommands(String ip, int port) throws SappException {
synchronized (this) {
PollingResult pollingResult = new PollingResult();
SappConnection sappConnection = null;
try {
sappConnection = new SappConnection(ip, port);
sappConnection.openConnection();
SappCommand sappCommand;
sappCommand = new Sapp80Command();
sappCommand.run(sappConnection);
if (!sappCommand.isResponseOk()) {
throw new SappException("Sapp80Command command execution failed");
}
pollingResult.changedOutputs = sappCommand.getResponse().getDataAsByteWordMap();
sappCommand = new Sapp81Command();
sappCommand.run(sappConnection);
if (!sappCommand.isResponseOk()) {
throw new SappException("Sapp81Command command execution failed");
}
pollingResult.changedInputs = sappCommand.getResponse().getDataAsByteWordMap();
sappCommand = new Sapp82Command();
sappCommand.run(sappConnection);
if (!sappCommand.isResponseOk()) {
throw new SappException("Sapp82Command command execution failed");
}
pollingResult.changedVirtuals = sappCommand.getResponse().getDataAsWordWordMap();
return pollingResult;
} catch (IOException e) {
throw new SappException(e.getMessage());
} finally {
if (sappConnection != null) {
sappConnection.closeConnection();
}
}
}
}
Aggregations