Closed dotKokott closed 4 years ago
Update:
I looked up how the DataReader notifies these listeners (https://github.com/digidotcom/xbee-java/blob/master/library/src/main/java/com/digi/xbee/api/DataReader.java#L784) & when I copy that behaviour I can successfully retrieve the ReceivePacket:
@Override
public void packetReceived(XBeePacket xbp) {
if ((xbp instanceof XBeeAPIPacket)) {
XBeeAPIPacket apiPacket = (XBeeAPIPacket)xbp;
APIFrameType apiType = apiPacket.getFrameType();
if(apiType == APIFrameType.RECEIVE_PACKET) {
ReceivePacket packet = (ReceivePacket)apiPacket;
String msg = new String(packet.getRFData());
System.out.println(msg);
}
}
}
So I am not sure why it does not work by itself.
Nevermind. I just did not notice that my code was throwing an Exception inside of the received because the Exception was swallowed by the calling thread.
I am sending unicast data from one device to another (Hardware: XB8X).
I am using sendData(...) to send the data & the DataListener interface to receive it.
The DataListener is not getting called, however if I add a PacketListener I do get all the packets, including the successful Receive Packet.
Same behaviour when I use XCTU to send the Transmit Request.
Any idea how this could be? Thanks!