XBee API Mode - IDataReceiveListener query


I’m fairly new to Zigbee and familiar enough with Java.

I have been playing around with a coordinator(connected to windows machine) and a router(connected to a beaglebone) and can send data between the two Zigbee devices independantly ie. send from coord-router and vice versa using seperate code.

However I want to implement a setup where the coord will send a message to the router, the router will receive this and reply back to the coord with a response.

I’m using the sample code in the API Docs (MainApp & MyDataReceiveListener) to do this however I cannot send data with the myDevice.sendData() method within MyDataReceiveListener as myDevice is declared int he MainApp(). Does anyone have any ideas how to go about this?

I know this is very basic in what I’m trying to do so apologies!


Issue resolved.

I had jumped the gun, rather than use the listener I should of used the polling example.

Application now running as expected.