working on ethersex stuff

This commit is contained in:
Lucas Pleß 2012-05-25 18:02:59 +02:00
parent 8c363fbf64
commit 892a7e6905
2 changed files with 17 additions and 0 deletions

View File

@ -5,13 +5,22 @@ import de.ctdo.bunti.model.BuntiEthersexDevice;
import de.ctdo.bunti.model.BuntiDevice; import de.ctdo.bunti.model.BuntiDevice;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener; import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import java.util.Map; import java.util.Map;
@Component
public class EthersexMixerImpl implements EthersexMixer, ApplicationListener<DeviceChangedEvent> { public class EthersexMixerImpl implements EthersexMixer, ApplicationListener<DeviceChangedEvent> {
private static final Logger LOGGER = LoggerFactory.getLogger(EthersexMixerImpl.class); private static final Logger LOGGER = LoggerFactory.getLogger(EthersexMixerImpl.class);
// private boolean hasDataChanged = true; // private boolean hasDataChanged = true;
ECMDSender sender;
@Autowired
public void setECMDSender(ECMDSender sender) {
this.sender = sender;
}
@Override @Override
public final boolean updateDevice(BuntiDevice device, Map<String, Object> options) { public final boolean updateDevice(BuntiDevice device, Map<String, Object> options) {
@ -19,6 +28,12 @@ public class EthersexMixerImpl implements EthersexMixer, ApplicationListener<De
return false; return false;
} }
BuntiEthersexDevice edev = (BuntiEthersexDevice) device;
// BuntiDMXDevice dmxDev = (BuntiDMXDevice) device; // BuntiDMXDevice dmxDev = (BuntiDMXDevice) device;
// //
// if (dmxDev.setValuesFromOptions(options)) { // if (dmxDev.setValuesFromOptions(options)) {

View File

@ -24,6 +24,8 @@ public class SimpleECMDSender implements ECMDSender {
try { try {
Socket client = new Socket(dest, ECMD_TCP_PORT); Socket client = new Socket(dest, ECMD_TCP_PORT);
client.setSoTimeout(2000);
DataOutputStream outToServer = new DataOutputStream(client.getOutputStream()); DataOutputStream outToServer = new DataOutputStream(client.getOutputStream());
BufferedReader inFromServer = new BufferedReader(new InputStreamReader(client.getInputStream())); BufferedReader inFromServer = new BufferedReader(new InputStreamReader(client.getInputStream()));