NXI - 'GET' Send Commands
joelw
Posts: 175
I'm seeing some problems getting string responses from NXI ports in Duet.
If I define "dummy" event handlers in NetLinx, the Duet code will receive string events from NXI ports. I am aware that once Duet claims a NetLinx device, the NetLinx code no longer has affect.
If I don't define "dummy" event handlers in NetLinx, the Duet code will never receive a string event from NXI port.
Send Commands that return a string with an Axlink touch panel work fine. No "dummy" event handler required in NetLinx.
How can I make this work without the dummy NetLinx events?
If I define "dummy" event handlers in NetLinx, the Duet code will receive string events from NXI ports. I am aware that once Duet claims a NetLinx device, the NetLinx code no longer has affect.
If I don't define "dummy" event handlers in NetLinx, the Duet code will never receive a string event from NXI port.
Send Commands that return a string with an Axlink touch panel work fine. No "dummy" event handler required in NetLinx.
private NetLinxDevice dvIR = null; // bundle constructor dvIR = new NetLinxDevice(new DPS("5001:8:0"),false); // not a virtual port... dvIR.initialize(); protected void doAddNetLinxDeviceListeners() { if(dvIR != null) { dvIR.addDataListener(new DataHandler()); } } // else where in code send command is called dvIR.sendCommand("GET MODE"); public class DataHandler implements IDataListener { public void handleDataEvent(Event evt) { switch(evt.type) { ... case Event.E_STRING: { String msg = new String((byte[]) evt.dataValue); System.out.println("E_STRING [" + msg + "]"); break; } ... } } }
How can I make this work without the dummy NetLinx events?
0
Comments
NetLinx Studio v2.5 Build 2.5.0.163
Cafe Version 1.8.85 Build Number: 85
Platform Version 1.9.194 Build Number: 194
Runtime Version 1.9.194 Build Number: 194
NXI v1.00.22
NXC-ME260/64 v3.21.354