moved address configuration in seperate file

This commit is contained in:
Lucas Pleß 2012-03-07 00:41:24 +01:00
parent e5fb13bdcf
commit 40bf50c0f2
3 changed files with 18 additions and 3 deletions

View File

@ -19,7 +19,7 @@ import java.util.Map;
public class DMXMixerImpl implements DMXMixer, ApplicationListener<DeviceChangedEvent> {
private static final Logger LOGGER = LoggerFactory.getLogger(DMXMixerImpl.class);
private static final String ARTNET_DEVICE_ADDRESS = "192.168.0.90";
private String artNetDeviceAddress;
private final Map<Integer, Integer> dmxMap = Collections.synchronizedMap(new HashMap<Integer, Integer>());
private SimpleArtNetSender artNetSender;
@ -30,6 +30,9 @@ public class DMXMixerImpl implements DMXMixer, ApplicationListener<DeviceChanged
this.artNetSender = artNetSender;
}
public void setArtNetDeviceAddress(String artNetDeviceAddress) {
this.artNetDeviceAddress = artNetDeviceAddress;
}
public final void initDMXData() {
for (int i = 0; i <= DMX.DMX_CHANNELS_MAX; i++) {
@ -45,7 +48,7 @@ public class DMXMixerImpl implements DMXMixer, ApplicationListener<DeviceChanged
}
if (hasDataChanged) {
artNetSender.sendDMXData(dmxMap, ARTNET_DEVICE_ADDRESS);
artNetSender.sendDMXData(dmxMap, artNetDeviceAddress);
hasDataChanged = false;
}
@ -87,4 +90,5 @@ public class DMXMixerImpl implements DMXMixer, ApplicationListener<DeviceChanged
}
}
}

View File

@ -0,0 +1 @@
artnet.deviceAddress=192.168.0.90

View File

@ -8,7 +8,12 @@
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<context:component-scan base-package="de.ctdo" />
<context:component-scan base-package="de.ctdo" />
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:bunti.properties"/>
</bean>
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
@ -19,4 +24,9 @@
<task:executor id="myExecutor" pool-size="3-10" queue-capacity="50" />-->
<task:scheduler id="myScheduler" pool-size="3"/>
<bean class="de.ctdo.bunti.dmx.DMXMixerImpl">
<property name="artNetDeviceAddress" value="${artnet.deviceAddress}"/>
</bean>
</beans>