Listening to channel events from another system in duet

GarCollGarColl Junior MemberPosts: 9
Here comes my next problem with duet...
I have 2 masters and run a duet module on the first one. Now the duet device is also defined on the second master and channels are turnded on and off on both systems. While those turned on and off on the first master (where also the duet module runs) are triggered nicely in the duet module, the ones from the second master behave weirdly:
1. when i turn a channel on, i receive the on event
2. when i turn it on again, i receive the on event again
3. and when i turn it off i get no event
1 is the intended behaviour but 2 and 3 are not so much. 2 i could live with (maybe some synchronisation issues), but number 3 is kind of bad.
Here is my java code:
public class TestModule extends Utility implements IChannelListener{

	public TestModule() {
		super();
	}

	public TestModule(BundleContext bctxt, NetLinxDevice nd, Properties props) {
		super(bctxt, nd, props);
		initialiseDevice(props.getProperty("Duet-Device"));
	}
	
	private NetLinxDevice initialiseDevice(String deviceString){
		NetLinxDevice device = new NetLinxDevice(new DPS(deviceString), true);
		device.addChannelListener(this);
		device.initialize();
		device.notifyOnline();
		return device;
	}

	protected void doAddNetLinxDeviceListeners() {
	}

	protected boolean doNetLinxDeviceInitialization() {
		return false;
	}

	public boolean isDeviceOnLine() {
		return false;
	}

	public boolean isDataInitialized() {
		return false;
	}

	public void handleChannelEvent(Event event) {
		System.out.println("duet event "+event.getChannelID()+" "+event.type);
	}

}

Here is what i do in netlinx code of my second master to fire channel evens:
DATA_EVENT[vdvTest]
	{
	COMMAND:
		{
		STACK_VAR CHAR cStr[100];
		STACK_VAR INTEGER nChannel;
		cStr = DATA.TEXT;
		IF(FIND_STRING(cStr, "'ON-'", 1))
			{
			REMOVE_STRING(cStr, "'ON-'", 1);
			nChannel = ATOI(cStr);
			IF(nChannel > 0)
				{
				SEND_STRING 0:0:0, "'set ',ITOA(nChannel),' ON'";
				ON[dvDuet, nChannel];
				}
			}
		ELSE IF(FIND_STRING(cStr, "'OFF-'", 1))
			{
			REMOVE_STRING(cStr, "'OFF-'", 1);
			nChannel = ATOI(cStr);
			IF(nChannel > 0)
				{
				SEND_STRING 0:0:0, "'set ',ITOA(nChannel),' OFF'";
				OFF[dvDuet, nChannel];
				}
			}
		}
	}
I also attached the source if someone wanna take the time to set it up...

As AMX doesn't do any duet courses nor provides support for duet of any kind in my coutry, but i think particularly network related stuff can be programmed better with it, i also wondered if there is any further documetation out there that explains the technical part in a bit more detail. For instance i see the JavaRouter in telnet when i do show buffers. This one was once locking up and i have no clue where to start looking in my source.
Sign In or Register to comment.