Product family: XBP24-ZB Function set: ZigBee Coordinator API Firmware version: 21A7
Hello, I am currently using Digi's XBee Java Library with API (AP=1) and it works properly. However, another node of my network is associated with an Arduino and I want to use 'Arduino Library for communicating with XBee in API mode' (https://github.com/andrewrapp/xbee-arduino). That Arduino Library requires API Escaped operating mode (API 2). It was not supposed to be a problem, since XBee Java Library supports API 2. Nevertheless, I got an error when trying to open the serial connection with the XBee.
package com.digi.xbee.example;
import com.digi.xbee.api.XBeeDevice;
import com.digi.xbee.api.exceptions.XBeeException;
public class MainApp {
/* Constants */
// TODO Replace with the port where your sender module is connected to.
private static final String PORT = "COM4";
// TODO Replace with the baud rate of your sender module.
private static final int BAUD_RATE = 9600;
private static final String DATA_TO_SEND = "Hello XBee World!";
public static void main(String[] args) {
XBeeDevice myDevice = new XBeeDevice(PORT, BAUD_RATE);
byte[] dataToSend = DATA_TO_SEND.getBytes();
try {
myDevice.open();
System.out.format("Sending broadcast data: '%s'", new String(dataToSend));
myDevice.sendBroadcastData(dataToSend);
System.out.println(" >> Success");
} catch (XBeeException e) {
System.out.println(" >> Error");
e.printStackTrace();
System.exit(1);
} finally {
myDevice.close();
}
}
}
Error com.digi.xbee.api.exceptions.TimeoutException: There was a timeout while executing the requested operation. at com.digi.xbee.api.AbstractXBeeDevice.sendXBeePacket(AbstractXBeeDevice.java:989) at com.digi.xbee.api.AbstractXBeeDevice.sendATCommand(AbstractXBeeDevice.java:806) at com.digi.xbee.api.AbstractXBeeDevice.sendParameter(AbstractXBeeDevice.java:1983) at com.digi.xbee.api.AbstractXBeeDevice.getParameter(AbstractXBeeDevice.java:1925) at com.digi.xbee.api.AbstractXBeeDevice.readDeviceInfo(AbstractXBeeDevice.java:365) at com.digi.xbee.api.XBeeDevice.open(XBeeDevice.java:219) at com.digi.xbee.example.MainApp.main(MainApp.java:20)
Is there any difference between API and API 2 when programming with this Java Library?